~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/sql_delete.cc

merged with up to date trunk

Show diffs side-by-side

added added

removed removed

Lines of Context:
43
43
  end of dispatch_command().
44
44
*/
45
45
 
46
 
bool mysql_delete(Session *session, TableList *table_list, COND *conds,
 
46
bool delete_query(Session *session, TableList *table_list, COND *conds,
47
47
                  SQL_LIST *order, ha_rows limit, uint64_t,
48
48
                  bool reset_auto_increment)
49
49
{
71
71
  session->set_proc_info("init");
72
72
  table->map=1;
73
73
 
74
 
  if (mysql_prepare_delete(session, table_list, &conds))
 
74
  if (prepare_delete(session, table_list, &conds))
75
75
  {
76
76
    DRIZZLE_DELETE_DONE(1, 0);
77
77
    return true;
345
345
  Prepare items in DELETE statement
346
346
 
347
347
  SYNOPSIS
348
 
    mysql_prepare_delete()
 
348
    prepare_delete()
349
349
    session                     - thread handler
350
350
    table_list          - global/local table list
351
351
    conds               - conditions
354
354
    false OK
355
355
    true  error
356
356
*/
357
 
int mysql_prepare_delete(Session *session, TableList *table_list, Item **conds)
 
357
int prepare_delete(Session *session, TableList *table_list, Item **conds)
358
358
{
359
359
  Select_Lex *select_lex= &session->lex->select_lex;
360
360
 
393
393
  This will work even if the .ISM and .ISD tables are destroyed
394
394
*/
395
395
 
396
 
bool mysql_truncate(Session& session, TableList *table_list)
 
396
bool truncate(Session& session, TableList *table_list)
397
397
{
398
398
  bool error;
399
399
  TransactionServices &transaction_services= TransactionServices::singleton();
401
401
  uint64_t save_options= session.options;
402
402
  table_list->lock_type= TL_WRITE;
403
403
  session.options&= ~(OPTION_BEGIN | OPTION_NOT_AUTOCOMMIT);
404
 
  mysql_init_select(session.lex);
405
 
  error= mysql_delete(&session, table_list, (COND*) 0, (SQL_LIST*) 0,
 
404
  init_select(session.lex);
 
405
  error= delete_query(&session, table_list, (COND*) 0, (SQL_LIST*) 0,
406
406
                      HA_POS_ERROR, 0L, true);
407
407
  /*
408
408
    Safety, in case the engine ignored ha_enable_transaction(false)