~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/session.h

  • Committer: Brian Aker
  • Date: 2009-02-05 10:38:55 UTC
  • Revision ID: brian@tangent.org-20090205103855-wajzccrbu7zbvmh4
Reworked some classes out of session.h
Also updated ignore file.

Show diffs side-by-side

added added

removed removed

Lines of Context:
34
34
#include <drizzled/sql_error.h>
35
35
#include <drizzled/query_arena.h>
36
36
#include <drizzled/file_exchange.h>
 
37
#include <drizzled/select_result_interceptor.h>
37
38
#include <string>
38
39
#include <bitset>
39
40
 
1440
1441
 
1441
1442
class JOIN;
1442
1443
 
1443
 
class select_result :public Sql_alloc {
1444
 
protected:
1445
 
  Session *session;
1446
 
  SELECT_LEX_UNIT *unit;
1447
 
public:
1448
 
  select_result();
1449
 
  virtual ~select_result() {};
1450
 
  virtual int prepare(List<Item> &,
1451
 
                      SELECT_LEX_UNIT *u)
1452
 
  {
1453
 
    unit= u;
1454
 
    return 0;
1455
 
  }
1456
 
  /*
1457
 
    Because of peculiarities of prepared statements protocol
1458
 
    we need to know number of columns in the result set (if
1459
 
    there is a result set) apart from sending columns metadata.
1460
 
  */
1461
 
  virtual uint32_t field_count(List<Item> &fields) const
1462
 
  { return fields.elements; }
1463
 
  virtual bool send_fields(List<Item> &list, uint32_t flags)=0;
1464
 
  virtual bool send_data(List<Item> &items)=0;
1465
 
  virtual bool initialize_tables (JOIN *)
1466
 
  { return 0; }
1467
 
  virtual void send_error(uint32_t errcode,const char *err);
1468
 
  virtual bool send_eof()=0;
1469
 
  virtual void abort() {}
1470
 
  /*
1471
 
    Cleanup instance of this class for next execution of a prepared
1472
 
    statement/stored procedure.
1473
 
  */
1474
 
  virtual void cleanup();
1475
 
  void set_session(Session *session_arg) { session= session_arg; }
1476
 
  void begin_dataset() {}
1477
 
};
1478
 
 
1479
 
 
1480
 
/*
1481
 
  Base class for select_result descendands which intercept and
1482
 
  transform result set rows. As the rows are not sent to the client,
1483
 
  sending of result set metadata should be suppressed as well.
1484
 
*/
1485
 
 
1486
 
class select_result_interceptor: public select_result
1487
 
{
1488
 
public:
1489
 
  select_result_interceptor() {}              /* Remove gcc warning */
1490
 
  uint32_t field_count(List<Item> &) const
1491
 
  { return 0; }
1492
 
  bool send_fields(List<Item> &,
1493
 
                   uint32_t)
1494
 
  { return false; }
1495
 
};
1496
 
 
1497
 
 
1498
 
class select_send :public select_result {
1499
 
  /**
1500
 
    True if we have sent result set metadata to the client.
1501
 
    In this case the client always expects us to end the result
1502
 
    set with an eof or error packet
1503
 
  */
1504
 
  bool is_result_set_started;
1505
 
public:
1506
 
  select_send() :is_result_set_started(false) {}
1507
 
  bool send_fields(List<Item> &list, uint32_t flags);
1508
 
  bool send_data(List<Item> &items);
1509
 
  bool send_eof();
1510
 
  void abort();
1511
 
  virtual void cleanup();
1512
 
};
1513
 
 
1514
1444
 
1515
1445
class select_to_file :public select_result_interceptor {
1516
1446
protected: