~drizzle-developers/ubuntu/natty/drizzle/natty

« back to all changes in this revision

Viewing changes to drizzled/sql_update.cc

  • Committer: Monty Taylor
  • Date: 2010-03-03 19:27:30 UTC
  • mto: (1308.1.2 trunk)
  • mto: This revision was merged to the branch mainline in revision 1278.
  • Revision ID: mordred@inaugust.com-20100303192730-o2o3nmp0lzhuatbe
Tags: upstream-2010.03.1317
ImportĀ upstreamĀ versionĀ 2010.03.1317

Show diffs side-by-side

added added

removed removed

Lines of Context:
33
33
#include <list>
34
34
 
35
35
using namespace std;
36
 
using namespace drizzled;
 
36
 
 
37
namespace drizzled
 
38
{
37
39
 
38
40
/**
39
41
  Re-read record if more columns are needed for error message.
110
112
    fields              fields for update
111
113
    values              values of fields for update
112
114
    conds               WHERE clause expression
113
 
    order_num           number of elemen in order_st BY clause
 
115
    order_num           number of elemen in ORDER BY clause
114
116
    order               order_st BY clause list
115
117
    limit               limit clause
116
118
    handle_duplicates   how to handle duplicates
143
145
  List<Item> all_fields;
144
146
  Session::killed_state killed_status= Session::NOT_KILLED;
145
147
 
146
 
  DRIZZLE_UPDATE_START(session->query);
 
148
  DRIZZLE_UPDATE_START(session->query.c_str());
147
149
  if (session->openTablesLock(table_list))
148
150
  {
149
151
    DRIZZLE_UPDATE_DONE(1, 0, 0);
290
292
      SORT_FIELD  *sortorder;
291
293
      ha_rows examined_rows;
292
294
 
293
 
      table->sort.io_cache = new IO_CACHE;
294
 
      memset(table->sort.io_cache, 0, sizeof(IO_CACHE));
 
295
      table->sort.io_cache = new internal::IO_CACHE;
 
296
      memset(table->sort.io_cache, 0, sizeof(internal::IO_CACHE));
295
297
 
296
298
      if (!(sortorder=make_unireg_sortorder(order, &length, NULL)) ||
297
299
          (table->sort.found_records= filesort(session, table, sortorder, length,
316
318
        update these in a separate loop based on the pointer.
317
319
      */
318
320
 
319
 
      IO_CACHE tempfile;
 
321
      internal::IO_CACHE tempfile;
320
322
      if (open_cached_file(&tempfile, drizzle_tmpdir,TEMP_PREFIX,
321
323
                           DISK_BUFFER_SIZE, MYF(MY_WME)))
322
324
        goto err;
388
390
        select= new optimizer::SqlSelect;
389
391
        select->head=table;
390
392
      }
391
 
      if (reinit_io_cache(&tempfile,READ_CACHE,0L,0,0))
 
393
      if (reinit_io_cache(&tempfile,internal::READ_CACHE,0L,0,0))
392
394
        error=1;
393
395
      // Read row ptrs from this cursor
394
396
      memcpy(select->file, &tempfile, sizeof(tempfile));
509
511
  table->cursor->try_semi_consistent_read(0);
510
512
 
511
513
  if (!transactional_table && updated > 0)
512
 
    session->transaction.stmt.modified_non_trans_table= true;
 
514
    session->transaction.stmt.markModifiedNonTransData();
513
515
 
514
516
  end_read_record(&info);
515
517
  delete select;
525
527
    Sometimes we want to binlog even if we updated no rows, in case user used
526
528
    it to be sure master and slave are in same state.
527
529
  */
528
 
  if ((error < 0) || session->transaction.stmt.modified_non_trans_table)
 
530
  if ((error < 0) || session->transaction.stmt.hasModifiedNonTransData())
529
531
  {
530
 
    if (session->transaction.stmt.modified_non_trans_table)
531
 
      session->transaction.all.modified_non_trans_table= true;
 
532
    if (session->transaction.stmt.hasModifiedNonTransData())
 
533
      session->transaction.all.markModifiedNonTransData();
532
534
  }
533
 
  assert(transactional_table || !updated || session->transaction.stmt.modified_non_trans_table);
 
535
  assert(transactional_table || !updated || session->transaction.stmt.hasModifiedNonTransData());
534
536
  free_underlaid_joins(session, select_lex);
535
537
 
536
538
  /* If LAST_INSERT_ID(X) was used, report X */
578
580
    session                     - thread handler
579
581
    table_list          - global/local table list
580
582
    conds               - conditions
581
 
    order_num           - number of order_st BY list entries
582
 
    order               - order_st BY clause list
 
583
    order_num           - number of ORDER BY list entries
 
584
    order               - ORDER BY clause list
583
585
 
584
586
  RETURN VALUE
585
587
    false OK
616
618
 
617
619
  return false;
618
620
}
 
621
 
 
622
} /* namespace drizzled */