~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to libdrizzle-1.0/drizzle.cc

  • Committer: Brian Aker
  • Date: 2011-11-30 17:23:18 UTC
  • mto: This revision was merged to the branch mainline in revision 2466.
  • Revision ID: brian@tangent.org-20111130172318-3lfw8f73h0uycpda
Fix compiling issues for 1.0, and cleanup header files.

Show diffs side-by-side

added added

removed removed

Lines of Context:
101
101
 
102
102
  if (drizzle == NULL)
103
103
  {
104
 
    drizzle= malloc(sizeof(drizzle_st));
 
104
    drizzle= new (std::nothrow) drizzle_st;
105
105
    if (drizzle == NULL)
106
106
      return NULL;
107
107
 
145
145
  if (drizzle == NULL)
146
146
    return NULL;
147
147
 
148
 
  drizzle->options|= (from->options & (drizzle_options_t)~DRIZZLE_ALLOCATED);
 
148
  drizzle->options|= (from->options & int(~DRIZZLE_ALLOCATED));
149
149
 
150
150
  for (con= from->con_list; con != NULL; con= con->next)
151
151
  {
207
207
 
208
208
drizzle_options_t drizzle_options(const drizzle_st *drizzle)
209
209
{
210
 
  return drizzle->options;
 
210
  return drizzle_options_t(drizzle->options);
211
211
}
212
212
 
213
213
void drizzle_set_options(drizzle_st *drizzle, drizzle_options_t options)
280
280
{
281
281
  if (con == NULL)
282
282
  {
283
 
    con= malloc(sizeof(drizzle_con_st));
 
283
    con= new (std::nothrow) drizzle_con_st;
284
284
    if (con == NULL)
285
285
    {
286
286
      if (drizzle != NULL)
307
307
  con->revents= 0;
308
308
  con->capabilities= DRIZZLE_CAPABILITIES_NONE;
309
309
  con->charset= 0;
310
 
  con->command= 0;
 
310
  con->command= drizzle_command_t();
311
311
  con->options|= DRIZZLE_CON_MYSQL;
312
312
  con->socket_type= DRIZZLE_CON_SOCKET_TCP;
313
313
  con->status= DRIZZLE_CON_STATUS_NONE;
356
356
    return NULL;
357
357
 
358
358
  /* Clear "operational" options such as IO status. */
359
 
  con->options|= (from->options & (drizzle_con_options_t)~(
 
359
  con->options|= (from->options & int(~(
360
360
                  DRIZZLE_CON_ALLOCATED|DRIZZLE_CON_READY|
361
361
                  DRIZZLE_CON_NO_RESULT_READ|DRIZZLE_CON_IO_READY|
362
 
                  DRIZZLE_CON_LISTEN));
 
362
                  DRIZZLE_CON_LISTEN)));
363
363
  con->backlog= from->backlog;
364
364
  strcpy(con->db, from->db);
365
365
  strcpy(con->password, from->password);
512
512
  {
513
513
    if (con->options & DRIZZLE_CON_IO_READY)
514
514
    {
515
 
      con->options&= (drizzle_con_options_t)~DRIZZLE_CON_IO_READY;
 
515
      con->options&= int(~DRIZZLE_CON_IO_READY);
516
516
      return con;
517
517
    }
518
518
  }
532
532
    if ((con->options & (DRIZZLE_CON_IO_READY | DRIZZLE_CON_LISTEN)) ==
533
533
        (DRIZZLE_CON_IO_READY | DRIZZLE_CON_LISTEN))
534
534
    {
535
 
      con->options&= (drizzle_con_options_t)~DRIZZLE_CON_IO_READY;
 
535
      con->options&= int(~DRIZZLE_CON_IO_READY);
536
536
      return con;
537
537
    }
538
538
  }
595
595
 
596
596
  drizzle_con_set_tcp(con, host, port);
597
597
  drizzle_con_set_backlog(con, backlog);
598
 
  drizzle_con_add_options(con, DRIZZLE_CON_LISTEN | options);
 
598
  drizzle_con_add_options(con, drizzle_con_options_t(DRIZZLE_CON_LISTEN | int(options)));
599
599
 
600
600
  return con;
601
601
}
611
611
 
612
612
  drizzle_con_set_uds(con, uds);
613
613
  drizzle_con_set_backlog(con, backlog);
614
 
  drizzle_con_add_options(con, DRIZZLE_CON_LISTEN | options);
 
614
  drizzle_con_add_options(con, drizzle_con_options_t(DRIZZLE_CON_LISTEN | int(options)));
615
615
 
616
616
  return con;
617
617
}
677
677
{
678
678
  size_t size;
679
679
  int written;
680
 
  char *ptr;
681
680
  char log_buffer[DRIZZLE_MAX_ERROR_SIZE];
682
681
  va_list args;
683
682
 
684
683
  size= strlen(function);
685
 
  ptr= memcpy(log_buffer, function, size);
 
684
  char *ptr= (char *)memcpy(log_buffer, function, size);
686
685
  ptr+= size;
687
686
  ptr[0]= ':';
688
687
  size++;