~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/sql_parse.cc

  • Committer: Brian Aker
  • Date: 2009-02-08 12:39:10 UTC
  • mfrom: (840.1.21 devel)
  • Revision ID: brian@tangent.org-20090208123910-gaodow8xvkw9ed4l
Merging Monty's work

Show diffs side-by-side

added added

removed removed

Lines of Context:
347
347
    the client, the connection is closed or "net_wait_timeout"
348
348
    number of seconds has passed
349
349
  */
350
 
  my_net_set_read_timeout(net, session->variables.net_wait_timeout);
 
350
  drizzleclient_net_set_read_timeout(net, session->variables.net_wait_timeout);
351
351
 
352
352
  /*
353
353
    XXX: this code is here only to clear possible errors of init_connect.
358
358
 
359
359
  net_new_transaction(net);
360
360
 
361
 
  packet_length= my_net_read(net);
 
361
  packet_length= drizzleclient_net_read(net);
362
362
  if (packet_length == packet_error)
363
363
  {
364
364
    /* Check if we can continue without closing the connection */
367
367
    /* This assert is killing me - and tracking down why the error isn't
368
368
     * set here is a waste since the protocol lib is being replaced. */ 
369
369
    //assert(session->is_error());
370
 
    net_end_statement(session);
 
370
    drizzleclient_net_end_statement(session);
371
371
 
372
372
    if (net->error != 3)
373
373
    {
383
383
  packet= (char*) net->read_pos;
384
384
  /*
385
385
    'packet_length' contains length of data, as it was stored in packet
386
 
    header. In case of malformed header, my_net_read returns zero.
387
 
    If packet_length is not zero, my_net_read ensures that the returned
 
386
    header. In case of malformed header, drizzleclient_net_read returns zero.
 
387
    If packet_length is not zero, drizzleclient_net_read ensures that the returned
388
388
    number of bytes was actually read from network.
389
 
    There is also an extra safety measure in my_net_read:
 
389
    There is also an extra safety measure in drizzleclient_net_read:
390
390
    it sets packet[packet_length]= 0, but only for non-zero packets.
391
391
  */
392
392
  if (packet_length == 0)                       /* safety */
395
395
    packet[0]= (unsigned char) COM_SLEEP;
396
396
    packet_length= 1;
397
397
  }
398
 
  /* Do not rely on my_net_read, extra safety against programming errors. */
 
398
  /* Do not rely on drizzleclient_net_read, extra safety against programming errors. */
399
399
  packet[packet_length]= '\0';                  /* safety */
400
400
 
401
401
  command= (enum enum_server_command) (unsigned char) packet[0];
404
404
    command= COM_END;                           // Wrong command
405
405
 
406
406
  /* Restore read timeout value */
407
 
  my_net_set_read_timeout(net, session->variables.net_read_timeout);
 
407
  drizzleclient_net_set_read_timeout(net, session->variables.net_read_timeout);
408
408
 
409
409
  assert(packet_length);
410
410
  return_value= dispatch_command(command, session, packet+1, (uint32_t) (packet_length-1));
557
557
 
558
558
    /* Clear variables that are allocated */
559
559
    session->user_connect= 0;
560
 
    res= check_user(session, passwd, passwd_len, db, false);
 
560
    res= check_user(session, passwd, passwd_len, db);
561
561
 
562
562
    if (res)
563
563
    {
591
591
    {
592
592
      char *beginning_of_next_stmt= (char*) end_of_stmt;
593
593
 
594
 
      net_end_statement(session);
 
594
      drizzleclient_net_end_statement(session);
595
595
      /*
596
596
        Multiple queries exits, execute them individually
597
597
      */
757
757
    session->mysys_var->abort= 0;
758
758
  }
759
759
 
760
 
  net_end_statement(session);
 
760
  drizzleclient_net_end_statement(session);
761
761
 
762
762
  session->set_proc_info("closing tables");
763
763
  /* Free tables */