~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to libdrizzle/client.c

  • Committer: Brian Aker
  • Date: 2008-07-15 08:57:01 UTC
  • Revision ID: brian@tangent.org-20080715085701-h7i77in02mqsg2sv
Commit cleanup of export types.

Show diffs side-by-side

added added

removed removed

Lines of Context:
320
320
  or packet is an error message
321
321
*****************************************************************************/
322
322
 
323
 
ulong
324
 
cli_safe_read(MYSQL *mysql)
 
323
uint32_t cli_safe_read(MYSQL *mysql)
325
324
{
326
325
  NET *net= &mysql->net;
327
326
  ulong len=0;
403
402
  }
404
403
}
405
404
 
406
 
my_bool
 
405
bool
407
406
cli_advanced_command(MYSQL *mysql, enum enum_server_command command,
408
 
                     const uchar *header, ulong header_length,
409
 
                     const uchar *arg, ulong arg_length, my_bool skip_check)
 
407
                     const unsigned char *header, uint32_t header_length,
 
408
                     const unsigned char *arg, uint32_t arg_length, bool skip_check)
410
409
{
411
410
  NET *net= &mysql->net;
412
411
  my_bool result= 1;
780
779
  else the lengths are calculated from the offset between pointers.
781
780
**************************************************************************/
782
781
 
783
 
static void cli_fetch_lengths(ulong *to, MYSQL_ROW column,
784
 
                              unsigned int field_count)
 
782
static void cli_fetch_lengths(uint32_t *to, MYSQL_ROW column, uint32_t field_count)
785
783
786
 
  ulong *prev_length;
 
784
  uint32_t *prev_length;
787
785
  char *start=0;
788
786
  MYSQL_ROW end;
789
787
 
812
810
{
813
811
  MYSQL_ROWS    *row;
814
812
  MYSQL_FIELD   *field,*result;
815
 
  ulong lengths[9];                             /* Max of fields */
 
813
  uint32_t lengths[9];                          /* Max of fields */
816
814
  DBUG_ENTER("unpack_fields");
817
815
 
818
816
  field= result= (MYSQL_FIELD*) alloc_root(alloc,
1016
1014
*/
1017
1015
 
1018
1016
 
1019
 
static int
1020
 
read_one_row(MYSQL *mysql,uint fields,MYSQL_ROW row, ulong *lengths)
 
1017
static int32_t
 
1018
read_one_row(MYSQL *mysql, uint32_t fields, MYSQL_ROW row, uint32_t *lengths)
1021
1019
{
1022
1020
  uint field;
1023
1021
  ulong pkt_len,len;
1134
1132
 
1135
1133
#define strdup_if_not_null(A) (A) == 0 ? 0 : my_strdup((A),MYF(MY_WME))
1136
1134
 
1137
 
my_bool STDCALL
1138
 
mysql_ssl_set(MYSQL *mysql __attribute__((unused)) ,
1139
 
              const char *key __attribute__((unused)),
1140
 
              const char *cert __attribute__((unused)),
1141
 
              const char *ca __attribute__((unused)),
1142
 
              const char *capath __attribute__((unused)),
1143
 
              const char *cipher __attribute__((unused)))
1144
 
{
1145
 
  DBUG_ENTER("mysql_ssl_set");
1146
 
  DBUG_RETURN(0);
1147
 
}
1148
 
 
1149
 
 
1150
 
/*
1151
 
  Free strings in the SSL structure and clear 'use_ssl' flag.
1152
 
  NB! Errors are not reported until you do mysql_real_connect.
1153
 
*/
1154
 
 
1155
 
/*
1156
 
  Return the SSL cipher (if any) used for current
1157
 
  connection to the server.
1158
 
 
1159
 
  SYNOPSYS
1160
 
    mysql_get_ssl_cipher()
1161
 
      mysql pointer to the mysql connection
1162
 
 
1163
 
*/
1164
 
 
1165
 
const char * STDCALL
1166
 
mysql_get_ssl_cipher(MYSQL *mysql __attribute__((unused)))
1167
 
{
1168
 
  DBUG_ENTER("mysql_get_ssl_cipher");
1169
 
  DBUG_RETURN(NULL);
1170
 
}
1171
 
 
1172
 
 
1173
 
/*
1174
 
  Check the server's (subject) Common Name against the
1175
 
  hostname we connected to
1176
 
 
1177
 
  SYNOPSIS
1178
 
  ssl_verify_server_cert()
1179
 
    vio              pointer to a SSL connected vio
1180
 
    server_hostname  name of the server that we connected to
1181
 
 
1182
 
  RETURN VALUES
1183
 
   0 Success
1184
 
   1 Failed to validate server
1185
 
 
1186
 
 */
1187
 
 
1188
 
 
1189
1135
/*
1190
1136
  Note that the mysql argument must be initialized with mysql_init()
1191
1137
  before calling mysql_real_connect !
1192
1138
*/
1193
1139
 
1194
 
static my_bool cli_read_query_result(MYSQL *mysql);
 
1140
static bool cli_read_query_result(MYSQL *mysql);
1195
1141
static MYSQL_RES *cli_use_result(MYSQL *mysql);
1196
1142
 
1197
1143
static MYSQL_METHODS client_methods=
1286
1232
MYSQL * STDCALL
1287
1233
CLI_MYSQL_REAL_CONNECT(MYSQL *mysql,const char *host, const char *user,
1288
1234
                       const char *passwd, const char *db,
1289
 
                       uint port, const char *unix_socket,ulong client_flag)
 
1235
                       uint32_t port, const char *unix_socket, uint32_t client_flag)
1290
1236
{
1291
1237
  char          buff[NAME_LEN+USERNAME_LENGTH+100];
1292
1238
  char          *end,*host_info=NULL;
1293
 
  ulong         pkt_length;
 
1239
  uint32_t         pkt_length;
1294
1240
  NET           *net= &mysql->net;
1295
1241
  struct        sockaddr_un UNIXaddr;
1296
1242
  init_sigpipe_variables
1973
1919
}
1974
1920
 
1975
1921
 
1976
 
static my_bool cli_read_query_result(MYSQL *mysql)
 
1922
static bool cli_read_query_result(MYSQL *mysql)
1977
1923
{
1978
1924
  uchar *pos;
1979
1925
  ulong field_count;
2051
1997
  finish processing it.
2052
1998
*/
2053
1999
 
2054
 
int STDCALL
2055
 
mysql_send_query(MYSQL* mysql, const char* query, ulong length)
 
2000
int32_t STDCALL
 
2001
mysql_send_query(MYSQL* mysql, const char* query, uint32_t length)
2056
2002
{
2057
2003
  DBUG_ENTER("mysql_send_query");
2058
2004
  DBUG_RETURN(simple_command(mysql, COM_QUERY, (uchar*) query, length, 1));
2059
2005
}
2060
2006
 
2061
2007
 
2062
 
int STDCALL
2063
 
mysql_real_query(MYSQL *mysql, const char *query, ulong length)
 
2008
int32_t STDCALL
 
2009
mysql_real_query(MYSQL *mysql, const char *query, uint32_t length)
2064
2010
{
2065
2011
  DBUG_ENTER("mysql_real_query");
2066
 
  DBUG_PRINT("enter",("handle: 0x%lx", (long) mysql));
 
2012
  DBUG_PRINT("enter",("handle: 0x%lx", (int32_t) mysql));
2067
2013
  DBUG_PRINT("query",("Query = '%-.4096s'",query));
2068
2014
 
2069
2015
  if (mysql_send_query(mysql,query,length))
2099
2045
    DBUG_RETURN(0);
2100
2046
  }
2101
2047
  result->methods= mysql->methods;
2102
 
  result->eof=1;                                /* Marker for buffered */
2103
 
  result->lengths=(ulong*) (result+1);
 
2048
  result->eof= 1;                               /* Marker for buffered */
 
2049
  result->lengths= (uint32_t*) (result+1);
2104
2050
  if (!(result->data=
2105
2051
        (*mysql->methods->read_rows)(mysql,mysql->fields,mysql->field_count)))
2106
2052
  {
2147
2093
                                      sizeof(ulong)*mysql->field_count,
2148
2094
                                      MYF(MY_WME | MY_ZEROFILL))))
2149
2095
    DBUG_RETURN(0);
2150
 
  result->lengths=(ulong*) (result+1);
 
2096
  result->lengths=(uint32_t*) (result+1);
2151
2097
  result->methods= mysql->methods;
2152
2098
  if (!(result->row=(MYSQL_ROW)
2153
2099
        my_malloc(sizeof(result->row[0])*(mysql->field_count+1), MYF(MY_WME))))
2228
2174
  else the lengths are calculated from the offset between pointers.
2229
2175
**************************************************************************/
2230
2176
 
2231
 
ulong * STDCALL
 
2177
uint32_t * STDCALL
2232
2178
mysql_fetch_lengths(MYSQL_RES *res)
2233
2179
{
2234
2180
  MYSQL_ROW column;
2373
2319
   Signed number > 323000
2374
2320
*/
2375
2321
 
2376
 
ulong STDCALL
 
2322
uint32_t STDCALL
2377
2323
mysql_get_server_version(MYSQL *mysql)
2378
2324
{
2379
2325
  uint major, minor, version;