~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/sql_insert.cc

  • Committer: Brian Aker
  • Date: 2008-08-18 04:35:40 UTC
  • mfrom: (342 codestyle)
  • mto: This revision was merged to the branch mainline in revision 352.
  • Revision ID: brian@tangent.org-20080818043540-numg7vydi7b0bzcd
Mering Monty's work

Show diffs side-by-side

added added

removed removed

Lines of Context:
61
61
    -1          Error
62
62
*/
63
63
 
64
 
static int check_insert_fields(THD *thd, TableList *table_list,
 
64
static int check_insert_fields(THD *thd, TABLE_LIST *table_list,
65
65
                               List<Item> &fields, List<Item> &values,
66
66
                               bool check_unique,
67
67
                               table_map *map __attribute__((unused)))
157
157
    -1          Error
158
158
*/
159
159
 
160
 
static int check_update_fields(THD *thd, TableList *insert_table_list,
 
160
static int check_update_fields(THD *thd, TABLE_LIST *insert_table_list,
161
161
                               List<Item> &update_fields,
162
162
                               table_map *map __attribute__((unused)))
163
163
{
224
224
  end of dispatch_command().
225
225
*/
226
226
 
227
 
bool mysql_insert(THD *thd,TableList *table_list,
 
227
bool mysql_insert(THD *thd,TABLE_LIST *table_list,
228
228
                  List<Item> &fields,
229
229
                  List<List_item> &values_list,
230
230
                  List<Item> &update_fields,
581
581
     true  ERROR
582
582
*/
583
583
 
584
 
static bool mysql_prepare_insert_check_table(THD *thd, TableList *table_list,
 
584
static bool mysql_prepare_insert_check_table(THD *thd, TABLE_LIST *table_list,
585
585
                                             List<Item> &fields __attribute__((unused)),
586
586
                                             bool select_insert)
587
587
{
636
636
    true  error
637
637
*/
638
638
 
639
 
bool mysql_prepare_insert(THD *thd, TableList *table_list,
 
639
bool mysql_prepare_insert(THD *thd, TABLE_LIST *table_list,
640
640
                          Table *table, List<Item> &fields, List_item *values,
641
641
                          List<Item> &update_fields, List<Item> &update_values,
642
642
                          enum_duplicates duplic,
736
736
 
737
737
  if (!select_insert)
738
738
  {
739
 
    TableList *duplicate;
 
739
    TABLE_LIST *duplicate;
740
740
    if ((duplicate= unique_table(thd, table_list, table_list->next_global, 1)))
741
741
    {
742
742
      update_non_unique_table_error(table_list, "INSERT", duplicate);
902
902
        info->touched++;
903
903
        if ((table->file->ha_table_flags() & HA_PARTIAL_COLUMN_READ &&
904
904
             !bitmap_is_subset(table->write_set, table->read_set)) ||
905
 
            table->compare_record())
 
905
            compare_record(table))
906
906
        {
907
907
          if ((error=table->file->ha_update_row(table->record[1],
908
908
                                                table->record[0])) &&
1035
1035
******************************************************************************/
1036
1036
 
1037
1037
int check_that_all_fields_are_given_values(THD *thd, Table *entry,
1038
 
                                           TableList *table_list)
 
1038
                                           TABLE_LIST *table_list)
1039
1039
{
1040
1040
  int err= 0;
1041
1041
  MY_BITMAP *write_set= entry->write_set;
1124
1124
}
1125
1125
 
1126
1126
 
1127
 
select_insert::select_insert(TableList *table_list_par, Table *table_par,
 
1127
select_insert::select_insert(TABLE_LIST *table_list_par, Table *table_par,
1128
1128
                             List<Item> *fields_par,
1129
1129
                             List<Item> *update_fields,
1130
1130
                             List<Item> *update_values,
1527
1527
      thd          in     Thread object
1528
1528
      create_info  in     Create information (like MAX_ROWS, ENGINE or
1529
1529
                          temporary table flag)
1530
 
      create_table in     Pointer to TableList object providing database
 
1530
      create_table in     Pointer to TABLE_LIST object providing database
1531
1531
                          and name for table to be created or to be open
1532
1532
      alter_info   in/out Initial list of columns and indexes for the table
1533
1533
                          to be created
1561
1561
*/
1562
1562
 
1563
1563
static Table *create_table_from_items(THD *thd, HA_CREATE_INFO *create_info,
1564
 
                                      TableList *create_table,
 
1564
                                      TABLE_LIST *create_table,
1565
1565
                                      Alter_info *alter_info,
1566
1566
                                      List<Item> *items,
1567
1567
                                      DRIZZLE_LOCK **lock,
1680
1680
      }
1681
1681
      else
1682
1682
      {
1683
 
        if (!(table= open_table(thd, create_table, (bool*) 0,
 
1683
        if (!(table= open_table(thd, create_table, thd->mem_root, (bool*) 0,
1684
1684
                                DRIZZLE_OPEN_TEMPORARY_ONLY)) &&
1685
1685
            !create_info->table_existed)
1686
1686
        {
1745
1745
   */
1746
1746
  class MY_HOOKS : public TABLEOP_HOOKS {
1747
1747
  public:
1748
 
    MY_HOOKS(select_create *x, TableList *create_table,
1749
 
             TableList *select_tables)
 
1748
    MY_HOOKS(select_create *x, TABLE_LIST *create_table,
 
1749
             TABLE_LIST *select_tables)
1750
1750
      : ptr(x), all_tables(*create_table)
1751
1751
      {
1752
1752
        all_tables.next_global= select_tables;
1770
1770
    }
1771
1771
 
1772
1772
    select_create *ptr;
1773
 
    TableList all_tables;
 
1773
    TABLE_LIST all_tables;
1774
1774
  };
1775
1775
 
1776
1776
  MY_HOOKS hooks(this, create_table, select_tables);
1866
1866
  char buf[2048];
1867
1867
  String query(buf, sizeof(buf), system_charset_info);
1868
1868
  int result;
1869
 
  TableList tmp_table_list;
 
1869
  TABLE_LIST tmp_table_list;
1870
1870
 
1871
1871
  memset(&tmp_table_list, 0, sizeof(tmp_table_list));
1872
1872
  tmp_table_list.table = *tables;