~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to plugin/mysql_protocol/mysql_protocol.cc

  • Committer: Lee Bieber
  • Date: 2011-03-16 16:39:32 UTC
  • mfrom: (2239.1.11 includes)
  • mto: This revision was merged to the branch mainline in revision 2240.
  • Revision ID: kalebral@gmail.com-20110316163932-ckt3uulj4pimqs8b
Merge Olaf - refactor includes

Show diffs side-by-side

added added

removed removed

Lines of Context:
34
34
#include "options.h"
35
35
#include <drizzled/identifier.h>
36
36
#include <drizzled/plugin/function.h>
 
37
#include <drizzled/diagnostics_area.h>
37
38
#include <libdrizzle/constants.h>
38
39
 
39
40
#define PROTOCOL_VERSION 10
201
202
  }
202
203
  else
203
204
  {
204
 
    sendError(session->main_da.sql_errno(), session->main_da.message());
 
205
    sendError(session->main_da().sql_errno(), session->main_da().message());
205
206
    counters->failedConnections.increment();
206
207
    return false;
207
208
  }
236
237
 
237
238
    if(net.last_errno== ER_NET_PACKET_TOO_LARGE)
238
239
      my_error(ER_NET_PACKET_TOO_LARGE, MYF(0));
239
 
    if (session->main_da.status() == Diagnostics_area::DA_ERROR)
240
 
      sendError(session->main_da.sql_errno(), session->main_da.message());
 
240
    if (session->main_da().status() == Diagnostics_area::DA_ERROR)
 
241
      sendError(session->main_da().sql_errno(), session->main_da().message());
241
242
    else
242
243
      sendOK();
243
244
 
342
343
  }
343
344
 
344
345
  buff[0]=0;                    // No fields
345
 
  if (session->main_da.status() == Diagnostics_area::DA_OK)
 
346
  if (session->main_da().status() == Diagnostics_area::DA_OK)
346
347
  {
347
 
    if (client_capabilities & CLIENT_FOUND_ROWS && session->main_da.found_rows())
348
 
      pos=storeLength(buff+1,session->main_da.found_rows());
 
348
    if (client_capabilities & CLIENT_FOUND_ROWS && session->main_da().found_rows())
 
349
      pos=storeLength(buff+1,session->main_da().found_rows());
349
350
    else
350
 
      pos=storeLength(buff+1,session->main_da.affected_rows());
351
 
    pos=storeLength(pos, session->main_da.last_insert_id());
352
 
    int2store(pos, session->main_da.server_status());
 
351
      pos=storeLength(buff+1,session->main_da().affected_rows());
 
352
    pos=storeLength(pos, session->main_da().last_insert_id());
 
353
    int2store(pos, session->main_da().server_status());
353
354
    pos+=2;
354
 
    tmp= min(session->main_da.total_warn_count(), (uint32_t)65535);
355
 
    message= session->main_da.message();
 
355
    tmp= min(session->main_da().total_warn_count(), (uint32_t)65535);
 
356
    message= session->main_da().message();
356
357
  }
357
358
  else
358
359
  {
367
368
  int2store(pos, tmp);
368
369
  pos+= 2;
369
370
 
370
 
  session->main_da.can_overwrite_status= true;
 
371
  session->main_da().can_overwrite_status= true;
371
372
 
372
373
  if (message && message[0])
373
374
  {
379
380
  drizzleclient_net_write(&net, buff, (size_t) (pos-buff));
380
381
  drizzleclient_net_flush(&net);
381
382
 
382
 
  session->main_da.can_overwrite_status= false;
 
383
  session->main_da().can_overwrite_status= false;
383
384
}
384
385
 
385
386
/**
402
403
  /* Set to true if no active vio, to work well in case of --init-file */
403
404
  if (net.vio != 0)
404
405
  {
405
 
    session->main_da.can_overwrite_status= true;
406
 
    writeEOFPacket(session->main_da.server_status(),
407
 
                   session->main_da.total_warn_count());
 
406
    session->main_da().can_overwrite_status= true;
 
407
    writeEOFPacket(session->main_da().server_status(),
 
408
                   session->main_da().total_warn_count());
408
409
    drizzleclient_net_flush(&net);
409
 
    session->main_da.can_overwrite_status= false;
 
410
    session->main_da().can_overwrite_status= false;
410
411
  }
411
412
  packet.shrink(buffer_length.get());
412
413
}
427
428
    It's one case when we can push an error even though there
428
429
    is an OK or EOF already.
429
430
  */
430
 
  session->main_da.can_overwrite_status= true;
 
431
  session->main_da().can_overwrite_status= true;
431
432
 
432
433
  /* Abort multi-result sets */
433
434
  session->server_status&= ~SERVER_MORE_RESULTS_EXISTS;
463
464
 
464
465
  drizzleclient_net_flush(&net);
465
466
 
466
 
  session->main_da.can_overwrite_status= false;
 
467
  session->main_da().can_overwrite_status= false;
467
468
}
468
469
 
469
470
/**