~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to libmysql/client.c

  • Committer: Brian Aker
  • Date: 2008-07-02 20:56:30 UTC
  • Revision ID: brian@tangent.org-20080702205630-go36gbsrq1zbjyvg
Second pass on removing PS from client library

Show diffs side-by-side

added added

removed removed

Lines of Context:
1600
1600
  cli_use_result,                              /* use_result */
1601
1601
  cli_fetch_lengths,                           /* fetch_lengths */
1602
1602
  cli_flush_use_result,                         /* flush_use_result */
1603
 
  NULL,                            /* list_fields */
1604
 
  NULL,                        /* unbuffered_fetch */
1605
 
  NULL,                         /* read_statistics */
 
1603
#ifndef MYSQL_SERVER
 
1604
  cli_list_fields,                            /* list_fields */
 
1605
  cli_unbuffered_fetch,                        /* unbuffered_fetch */
 
1606
  cli_read_statistics,                         /* read_statistics */
1606
1607
  cli_read_query_result,                       /* next_result */
1607
 
  NULL,                 /* read_change_user_result */
 
1608
  cli_read_change_user_result,                 /* read_change_user_result */
 
1609
#endif
1608
1610
};
1609
1611
 
1610
1612
C_MODE_START
2418
2420
  my_free(mysql->user,MYF(MY_ALLOW_ZERO_PTR));
2419
2421
  my_free(mysql->passwd,MYF(MY_ALLOW_ZERO_PTR));
2420
2422
  my_free(mysql->db,MYF(MY_ALLOW_ZERO_PTR));
2421
 
#if defined(EMBEDDED_LIBRARY) || MYSQL_VERSION_ID >= 50100
2422
2423
  my_free(mysql->info_buffer,MYF(MY_ALLOW_ZERO_PTR));
2423
2424
  mysql->info_buffer= 0;
2424
 
#endif
 
2425
 
2425
2426
  /* Clear pointers for better safety */
2426
2427
  mysql->host_info= mysql->user= mysql->passwd= mysql->db= 0;
2427
2428
}
2428
2429
 
2429
2430
 
2430
 
/*
2431
 
  Clear connection pointer of every statement: this is necessary
2432
 
  to give error on attempt to use a prepared statement of closed
2433
 
  connection.
2434
 
 
2435
 
  SYNOPSYS
2436
 
    mysql_detach_stmt_list()
2437
 
      stmt_list  pointer to mysql->stmts
2438
 
      func_name  name of calling function
2439
 
 
2440
 
  NOTE
2441
 
    There is similar code in mysql_reconnect(), so changes here
2442
 
    should also be reflected there.
2443
 
*/
2444
 
 
2445
 
void mysql_detach_stmt_list(LIST **stmt_list __attribute__((unused)),
2446
 
                            const char *func_name __attribute__((unused)))
2447
 
{
2448
 
#ifdef MYSQL_CLIENT
2449
 
  /* Reset connection handle in all prepared statements. */
2450
 
  LIST *element= *stmt_list;
2451
 
  char buff[MYSQL_ERRMSG_SIZE];
2452
 
  DBUG_ENTER("mysql_detach_stmt_list");
2453
 
 
2454
 
  my_snprintf(buff, sizeof(buff)-1, ER(CR_STMT_CLOSED), func_name);
2455
 
  for (; element; element= element->next)
2456
 
  {
2457
 
    MYSQL_STMT *stmt= (MYSQL_STMT *) element->data;
2458
 
    set_stmt_error(stmt, CR_STMT_CLOSED, unknown_sqlstate, buff);
2459
 
    stmt->mysql= 0;
2460
 
    /* No need to call list_delete for statement here */
2461
 
  }
2462
 
  *stmt_list= 0;
2463
 
  DBUG_VOID_RETURN;
2464
 
#endif /* MYSQL_CLIENT */
2465
 
}
2466
 
 
2467
 
 
2468
2431
void STDCALL mysql_close(MYSQL *mysql)
2469
2432
{
2470
2433
  DBUG_ENTER("mysql_close");
2481
2444
    }
2482
2445
    mysql_close_free_options(mysql);
2483
2446
    mysql_close_free(mysql);
2484
 
    mysql_detach_stmt_list(&mysql->stmts, "mysql_close");
2485
2447
    if (mysql->free_me)
2486
2448
      my_free((uchar*) mysql,MYF(0));
2487
2449
  }