~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/sql_update.cc

  • Committer: Brian Aker
  • Date: 2008-08-18 20:57:01 UTC
  • mto: This revision was merged to the branch mainline in revision 352.
  • Revision ID: brian@tangent.org-20080818205701-rzeyd4qw4xj7wx7l
Refactoring of class Table

Show diffs side-by-side

added added

removed removed

Lines of Context:
158
158
    fields              fields for update
159
159
    values              values of fields for update
160
160
    conds               WHERE clause expression
161
 
    order_num           number of elemen in ORDER BY clause
162
 
    order               ORDER BY clause list
 
161
    order_num           number of elemen in order_st BY clause
 
162
    order               order_st BY clause list
163
163
    limit               limit clause
164
164
    handle_duplicates   how to handle duplicates
165
165
 
175
175
                 List<Item> &fields,
176
176
                 List<Item> &values,
177
177
                 COND *conds,
178
 
                 uint order_num, ORDER *order,
 
178
                 uint order_num, order_st *order,
179
179
                 ha_rows limit,
180
180
                 enum enum_duplicates handle_duplicates __attribute__((unused)),
181
181
                 bool ignore)
352
352
    if (order && (need_sort || used_key_is_modified))
353
353
    {
354
354
      /*
355
 
        Doing an ORDER BY;  Let filesort find and sort the rows we are going
 
355
        Doing an order_st BY;  Let filesort find and sort the rows we are going
356
356
        to update
357
357
        NOTE: filesort will call table->prepare_for_position()
358
358
      */
748
748
    thd                 - thread handler
749
749
    table_list          - global/local table list
750
750
    conds               - conditions
751
 
    order_num           - number of ORDER BY list entries
752
 
    order               - ORDER BY clause list
 
751
    order_num           - number of order_st BY list entries
 
752
    order               - order_st BY clause list
753
753
 
754
754
  RETURN VALUE
755
755
    false OK
756
756
    true  error
757
757
*/
758
758
bool mysql_prepare_update(THD *thd, TABLE_LIST *table_list,
759
 
                         Item **conds, uint order_num, ORDER *order)
 
759
                         Item **conds, uint order_num, order_st *order)
760
760
{
761
761
  List<Item> all_fields;
762
762
  SELECT_LEX *select_lex= &thd->lex->select_lex;
765
765
    Statement-based replication of UPDATE ... LIMIT is not safe as order of
766
766
    rows is not defined, so in mixed mode we go to row-based.
767
767
 
768
 
    Note that we may consider a statement as safe if ORDER BY primary_key
 
768
    Note that we may consider a statement as safe if order_st BY primary_key
769
769
    is present. However it may confuse users to see very similiar statements
770
770
    replicated differently.
771
771
  */
1011
1011
  res= mysql_select(thd, &select_lex->ref_pointer_array,
1012
1012
                      table_list, select_lex->with_wild,
1013
1013
                      total_list,
1014
 
                      conds, 0, (ORDER *) NULL, (ORDER *)NULL, (Item *) NULL,
1015
 
                      (ORDER *)NULL,
 
1014
                      conds, 0, (order_st *) NULL, (order_st *)NULL, (Item *) NULL,
 
1015
                      (order_st *)NULL,
1016
1016
                      options | SELECT_NO_JOIN_CACHE | SELECT_NO_UNLOCK |
1017
1017
                      OPTION_SETUP_TABLES_DONE,
1018
1018
                      result, unit, select_lex);
1238
1238
    Table *table=table_ref->table;
1239
1239
    uint cnt= table_ref->shared;
1240
1240
    List<Item> temp_fields;
1241
 
    ORDER     group;
 
1241
    order_st     group;
1242
1242
    TMP_TABLE_PARAM *tmp_param;
1243
1243
 
1244
1244
    table->mark_columns_needed_for_update();
1303
1303
    if (!(tmp_tables[cnt]=create_tmp_table(thd,
1304
1304
                                           tmp_param,
1305
1305
                                           temp_fields,
1306
 
                                           (ORDER*) &group, 0, 0,
 
1306
                                           (order_st*) &group, 0, 0,
1307
1307
                                           TMP_TABLE_ALL_COLUMNS,
1308
1308
                                           HA_POS_ERROR,
1309
1309
                                           (char *) "")))