~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/sql_insert.cc

  • Committer: Brian Aker
  • Date: 2008-08-16 22:34:15 UTC
  • mto: This revision was merged to the branch mainline in revision 346.
  • Revision ID: brian@tangent.org-20080816223415-n24esdpfcqi4pwpy
Refactor around classes. TABLE_LIST has been factored out of table.h

Show diffs side-by-side

added added

removed removed

Lines of Context:
66
66
                               bool check_unique,
67
67
                               table_map *map __attribute__((unused)))
68
68
{
69
 
  TABLE *table= table_list->table;
 
69
  Table *table= table_list->table;
70
70
 
71
71
  if (fields.elements == 0 && values.elements != 0)
72
72
  {
161
161
                               List<Item> &update_fields,
162
162
                               table_map *map __attribute__((unused)))
163
163
{
164
 
  TABLE *table= insert_table_list->table;
 
164
  Table *table= insert_table_list->table;
165
165
  bool timestamp_mark= false;
166
166
 
167
167
  if (table->timestamp_field)
240
240
  ulong counter = 1;
241
241
  uint64_t id;
242
242
  COPY_INFO info;
243
 
  TABLE *table= 0;
 
243
  Table *table= 0;
244
244
  List_iterator_fast<List_item> its(values_list);
245
245
  List_item *values;
246
246
  Name_resolution_context *context;
435
435
  {
436
436
    /*
437
437
      Do not do this release if this is a delayed insert, it would steal
438
 
      auto_inc values from the delayed_insert thread as they share TABLE.
 
438
      auto_inc values from the delayed_insert thread as they share Table.
439
439
    */
440
440
    table->file->ha_release_auto_increment();
441
441
    if (table->file->ha_end_bulk_insert() && !error)
637
637
*/
638
638
 
639
639
bool mysql_prepare_insert(THD *thd, TABLE_LIST *table_list,
640
 
                          TABLE *table, List<Item> &fields, List_item *values,
 
640
                          Table *table, List<Item> &fields, List_item *values,
641
641
                          List<Item> &update_fields, List<Item> &update_values,
642
642
                          enum_duplicates duplic,
643
643
                          COND **where __attribute__((unused)),
752
752
 
753
753
        /* Check if there is more uniq keys after field */
754
754
 
755
 
static int last_uniq_key(TABLE *table,uint keynr)
 
755
static int last_uniq_key(Table *table,uint keynr)
756
756
{
757
757
  while (++keynr < table->s->keys)
758
758
    if (table->key_info[keynr].flags & HA_NOSAME)
788
788
*/
789
789
 
790
790
 
791
 
int write_record(THD *thd, TABLE *table,COPY_INFO *info)
 
791
int write_record(THD *thd, Table *table,COPY_INFO *info)
792
792
{
793
793
  int error;
794
794
  char *key=0;
1034
1034
  Check that all fields with arn't null_fields are used
1035
1035
******************************************************************************/
1036
1036
 
1037
 
int check_that_all_fields_are_given_values(THD *thd, TABLE *entry,
 
1037
int check_that_all_fields_are_given_values(THD *thd, Table *entry,
1038
1038
                                           TABLE_LIST *table_list)
1039
1039
{
1040
1040
  int err= 0;
1132
1132
}
1133
1133
 
1134
1134
 
1135
 
select_insert::select_insert(TABLE_LIST *table_list_par, TABLE *table_par,
 
1135
select_insert::select_insert(TABLE_LIST *table_list_par, Table *table_par,
1136
1136
                             List<Item> *fields_par,
1137
1137
                             List<Item> *update_fields,
1138
1138
                             List<Item> *update_values,
1527
1527
***************************************************************************/
1528
1528
 
1529
1529
/*
1530
 
  Create table from lists of fields and items (or just return TABLE
 
1530
  Create table from lists of fields and items (or just return Table
1531
1531
  object for pre-opened existing table).
1532
1532
 
1533
1533
  SYNOPSIS
1553
1553
    This function behaves differently for base and temporary tables:
1554
1554
    - For base table we assume that either table exists and was pre-opened
1555
1555
      and locked at open_and_lock_tables() stage (and in this case we just
1556
 
      emit error or warning and return pre-opened TABLE object) or special
 
1556
      emit error or warning and return pre-opened Table object) or special
1557
1557
      placeholder was put in table cache that guarantees that this table
1558
1558
      won't be created or opened until the placeholder will be removed
1559
1559
      (so there is an exclusive lock on this table).
1564
1564
    SELECT it should be changed before it can be used in other contexts.
1565
1565
 
1566
1566
  RETURN VALUES
1567
 
    non-zero  Pointer to TABLE object for table created or opened
 
1567
    non-zero  Pointer to Table object for table created or opened
1568
1568
    0         Error
1569
1569
*/
1570
1570
 
1571
 
static TABLE *create_table_from_items(THD *thd, HA_CREATE_INFO *create_info,
 
1571
static Table *create_table_from_items(THD *thd, HA_CREATE_INFO *create_info,
1572
1572
                                      TABLE_LIST *create_table,
1573
1573
                                      Alter_info *alter_info,
1574
1574
                                      List<Item> *items,
1575
1575
                                      DRIZZLE_LOCK **lock,
1576
1576
                                      TABLEOP_HOOKS *hooks)
1577
1577
{
1578
 
  TABLE tmp_table;              // Used during 'Create_field()'
 
1578
  Table tmp_table;              // Used during 'Create_field()'
1579
1579
  TABLE_SHARE share;
1580
 
  TABLE *table= 0;
 
1580
  Table *table= 0;
1581
1581
  uint select_field_count= items->elements;
1582
1582
  /* Add selected items to field list */
1583
1583
  List_iterator_fast<Item> it(*items);
1651
1651
    binlog when a HEAP table is opened for the first time since startup, must
1652
1652
    not be written: 1) it would be wrong (imagine we're in CREATE SELECT: we
1653
1653
    don't want to delete from it) 2) it would be written before the CREATE
1654
 
    TABLE, which is a wrong order. So we keep binary logging disabled when we
 
1654
    Table, which is a wrong order. So we keep binary logging disabled when we
1655
1655
    open_table().
1656
1656
  */
1657
1657
  {
1761
1761
      }
1762
1762
 
1763
1763
  private:
1764
 
    virtual int do_postlock(TABLE **tables, uint count)
 
1764
    virtual int do_postlock(Table **tables, uint count)
1765
1765
    {
1766
1766
      THD *thd= const_cast<THD*>(ptr->get_thd());
1767
1767
      if (int error= decide_logging_format(thd, &all_tables))
1768
1768
        return error;
1769
1769
 
1770
 
      TABLE const *const table = *tables;
 
1770
      Table const *const table = *tables;
1771
1771
      if (thd->current_stmt_binlog_row_based  &&
1772
1772
          !table->s->tmp_table &&
1773
1773
          !ptr->get_create_info()->table_existed)
1849
1849
}
1850
1850
 
1851
1851
void
1852
 
select_create::binlog_show_create_table(TABLE **tables, uint count)
 
1852
select_create::binlog_show_create_table(Table **tables, uint count)
1853
1853
{
1854
1854
  /*
1855
1855
    Note 1: In RBR mode, we generate a CREATE TABLE statement for the