~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/sql_insert.cc

  • Committer: Mark Atwood
  • Date: 2011-08-01 05:22:14 UTC
  • mfrom: (1919.3.53 drizzle_pbms)
  • Revision ID: me@mark.atwood.name-20110801052214-3wdsx3xgld6b5v4f
mergeĀ lp:~barry-leslie/drizzle/drizzle_pbms

Show diffs side-by-side

added added

removed removed

Lines of Context:
41
41
#include <drizzled/session/transactions.h>
42
42
#include <drizzled/open_tables_state.h>
43
43
#include <drizzled/table/cache.h>
44
 
#include <drizzled/create_field.h>
45
44
 
46
45
namespace drizzled {
47
46
 
550
549
     than INSERT.
551
550
  */
552
551
 
553
 
  return setup_tables_and_check_access(session, &session->lex().select_lex.context,
554
 
    &session->lex().select_lex.top_join_list, table_list, &session->lex().select_lex.leaf_tables, select_insert);
 
552
  if (setup_tables_and_check_access(session, &session->lex().select_lex.context,
 
553
                                    &session->lex().select_lex.top_join_list,
 
554
                                    table_list,
 
555
                                    &session->lex().select_lex.leaf_tables,
 
556
                                    select_insert))
 
557
    return true;
 
558
 
 
559
  return false;
555
560
}
556
561
 
557
562
 
627
632
  if (duplic == DUP_UPDATE)
628
633
  {
629
634
    /* it should be allocated before Item::fix_fields() */
630
 
    table_list->set_insert_values();
 
635
    if (table_list->set_insert_values(session->mem_root))
 
636
      return true;
631
637
  }
632
638
 
633
639
  if (prepare_insert_check_table(session, table_list, fields, select_insert))
684
690
  if (not table)
685
691
    table= table_list->table;
686
692
 
687
 
  if (not select_insert && unique_table(table_list, table_list->next_global, true))
 
693
  if (not select_insert)
688
694
  {
689
 
    my_error(ER_UPDATE_TABLE_USED, MYF(0), table_list->alias);
690
 
    return true;
 
695
    TableList *duplicate;
 
696
    if ((duplicate= unique_table(table_list, table_list->next_global, true)))
 
697
    {
 
698
      my_error(ER_UPDATE_TABLE_USED, MYF(0), table_list->alias);
 
699
 
 
700
      return true;
 
701
    }
691
702
  }
692
703
 
693
704
  if (duplic == DUP_UPDATE || duplic == DUP_REPLACE)