~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/session.h

  • Committer: Brian Aker
  • Date: 2009-02-08 01:43:00 UTC
  • Revision ID: brian@tangent.org-20090208014300-gbidmdxbws95b223
More class creation.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1462
1462
class JOIN;
1463
1463
 
1464
1464
 
1465
 
class select_to_file :public select_result_interceptor {
1466
 
protected:
1467
 
  file_exchange *exchange;
1468
 
  File file;
1469
 
  IO_CACHE cache;
1470
 
  ha_rows row_count;
1471
 
  char path[FN_REFLEN];
1472
 
 
1473
 
public:
1474
 
  select_to_file(file_exchange *ex) :exchange(ex), file(-1),row_count(0L)
1475
 
  { path[0]=0; }
1476
 
  ~select_to_file();
1477
 
  void send_error(uint32_t errcode,const char *err);
1478
 
  bool send_eof();
1479
 
  void cleanup();
1480
 
};
1481
 
 
1482
 
 
1483
1465
#define ESCAPE_CHARS "ntrb0ZN" // keep synchronous with READ_INFO::unescape
1484
1466
 
1485
 
 
1486
 
/*
1487
 
 List of all possible characters of a numeric value text representation.
1488
 
*/
1489
 
#define NUMERIC_CHARS ".0123456789e+-"
1490
 
 
1491
 
 
1492
 
class select_export :public select_to_file {
1493
 
  uint32_t field_term_length;
1494
 
  int field_sep_char,escape_char,line_sep_char;
1495
 
  int field_term_char; // first char of FIELDS TERMINATED BY or MAX_INT
1496
 
  /*
1497
 
    The is_ambiguous_field_sep field is true if a value of the field_sep_char
1498
 
    field is one of the 'n', 't', 'r' etc characters
1499
 
    (see the READ_INFO::unescape method and the ESCAPE_CHARS constant value).
1500
 
  */
1501
 
  bool is_ambiguous_field_sep;
1502
 
  /*
1503
 
     The is_ambiguous_field_term is true if field_sep_char contains the first
1504
 
     char of the FIELDS TERMINATED BY (ENCLOSED BY is empty), and items can
1505
 
     contain this character.
1506
 
  */
1507
 
  bool is_ambiguous_field_term;
1508
 
  /*
1509
 
    The is_unsafe_field_sep field is true if a value of the field_sep_char
1510
 
    field is one of the '0'..'9', '+', '-', '.' and 'e' characters
1511
 
    (see the NUMERIC_CHARS constant value).
1512
 
  */
1513
 
  bool is_unsafe_field_sep;
1514
 
  bool fixed_row_size;
1515
 
public:
1516
 
  select_export(file_exchange *ex) :select_to_file(ex) {}
1517
 
  ~select_export();
1518
 
  int prepare(List<Item> &list, Select_Lex_Unit *u);
1519
 
  bool send_data(List<Item> &items);
1520
 
};
1521
 
 
1522
 
 
1523
 
class select_dump :public select_to_file {
1524
 
public:
1525
 
  select_dump(file_exchange *ex) :select_to_file(ex) {}
1526
 
  int prepare(List<Item> &list, Select_Lex_Unit *u);
1527
 
  bool send_data(List<Item> &items);
1528
 
};
1529
 
 
1530
 
 
1531
 
class select_insert :public select_result_interceptor {
1532
 
 public:
1533
 
  TableList *table_list;
1534
 
  Table *table;
1535
 
  List<Item> *fields;
1536
 
  uint64_t autoinc_value_of_last_inserted_row; // autogenerated or not
1537
 
  COPY_INFO info;
1538
 
  bool insert_into_view;
1539
 
  select_insert(TableList *table_list_par,
1540
 
                Table *table_par, List<Item> *fields_par,
1541
 
                List<Item> *update_fields, List<Item> *update_values,
1542
 
                enum_duplicates duplic, bool ignore);
1543
 
  ~select_insert();
1544
 
  int prepare(List<Item> &list, Select_Lex_Unit *u);
1545
 
  virtual int prepare2(void);
1546
 
  bool send_data(List<Item> &items);
1547
 
  virtual void store_values(List<Item> &values);
1548
 
  virtual bool can_rollback_data() { return 0; }
1549
 
  void send_error(uint32_t errcode,const char *err);
1550
 
  bool send_eof();
1551
 
  void abort();
1552
 
  /* not implemented: select_insert is never re-used in prepared statements */
1553
 
  void cleanup();
1554
 
};
1555
 
 
1556
 
 
1557
 
class select_create: public select_insert {
1558
 
  order_st *group;
1559
 
  TableList *create_table;
1560
 
  HA_CREATE_INFO *create_info;
1561
 
  TableList *select_tables;
1562
 
  Alter_info *alter_info;
1563
 
  Field **field;
1564
 
  /* lock data for tmp table */
1565
 
  DRIZZLE_LOCK *m_lock;
1566
 
  /* m_lock or session->extra_lock */
1567
 
  DRIZZLE_LOCK **m_plock;
1568
 
public:
1569
 
  select_create (TableList *table_arg,
1570
 
                 HA_CREATE_INFO *create_info_par,
1571
 
                 Alter_info *alter_info_arg,
1572
 
                 List<Item> &select_fields,enum_duplicates duplic, bool ignore,
1573
 
                 TableList *select_tables_arg)
1574
 
    :select_insert (NULL, NULL, &select_fields, 0, 0, duplic, ignore),
1575
 
    create_table(table_arg),
1576
 
    create_info(create_info_par),
1577
 
    select_tables(select_tables_arg),
1578
 
    alter_info(alter_info_arg),
1579
 
    m_plock(NULL)
1580
 
    {}
1581
 
  int prepare(List<Item> &list, Select_Lex_Unit *u);
1582
 
 
1583
 
  void store_values(List<Item> &values);
1584
 
  void send_error(uint32_t errcode,const char *err);
1585
 
  bool send_eof();
1586
 
  void abort();
1587
 
  virtual bool can_rollback_data() { return 1; }
1588
 
 
1589
 
  // Needed for access from local class MY_HOOKS in prepare(), since session is proteted.
1590
 
  const Session *get_session(void) { return session; }
1591
 
  const HA_CREATE_INFO *get_create_info() { return create_info; };
1592
 
  int prepare2(void) { return 0; }
1593
 
};
 
1467
#include <drizzled/select_to_file.h>
 
1468
 
 
1469
#include <drizzled/select_export.h>
 
1470
 
 
1471
#include <drizzled/select_dump.h>
 
1472
 
 
1473
#include <drizzled/select_insert.h>
 
1474
 
 
1475
#include <drizzled/select_create.h>
 
1476
 
 
1477
 
1594
1478
 
1595
1479
#include <storage/myisam/myisam.h>
1596
1480