~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/sql_load.cc

  • Committer: Olaf van der Spek
  • Date: 2011-04-05 12:26:58 UTC
  • mto: (2278.1.2 build)
  • mto: This revision was merged to the branch mainline in revision 2272.
  • Revision ID: olafvdspek@gmail.com-20110405122658-xxrvmobwwwwf3oct
Refactor Open_tables_state

Show diffs side-by-side

added added

removed removed

Lines of Context:
27
27
#include <drizzled/internal/my_sys.h>
28
28
#include <drizzled/internal/iocache.h>
29
29
#include <drizzled/plugin/storage_engine.h>
 
30
#include <drizzled/sql_lex.h>
 
31
#include <drizzled/copy_info.h>
 
32
#include <drizzled/file_exchange.h>
 
33
#include <drizzled/util/test.h>
 
34
#include <drizzled/session/transactions.h>
30
35
 
31
36
#include <sys/stat.h>
32
37
#include <fcntl.h>
57
62
  bool error,line_cuted,found_null,enclosed;
58
63
  unsigned char *row_start,                     /* Found row starts here */
59
64
        *row_end;                       /* Found row ends here */
60
 
  const CHARSET_INFO *read_charset;
 
65
  const charset_info_st *read_charset;
61
66
 
62
 
  READ_INFO(int cursor, size_t tot_length, const CHARSET_INFO * const cs,
 
67
  READ_INFO(int cursor, size_t tot_length, const charset_info_st * const cs,
63
68
            String &field_term,String &line_start,String &line_term,
64
69
            String &enclosed,int escape, bool is_fifo);
65
70
  ~READ_INFO();
144
149
  assert(tdb);
145
150
  uint32_t skip_lines= ex->skip_lines;
146
151
  bool transactional_table;
147
 
  Session::killed_state_t killed_status= Session::NOT_KILLED;
148
152
 
149
153
  /* Escape and enclosed character may be a utf8 4-byte character */
150
154
  if (escaped->length() > 4 || enclosed->length() > 4)
156
160
  if (session->openTablesLock(table_list))
157
161
    return(true);
158
162
 
159
 
  if (setup_tables_and_check_access(session, &session->getLex()->select_lex.context,
160
 
                                    &session->getLex()->select_lex.top_join_list,
 
163
  if (setup_tables_and_check_access(session, &session->lex().select_lex.context,
 
164
                                    &session->lex().select_lex.top_join_list,
161
165
                                    table_list,
162
 
                                    &session->getLex()->select_lex.leaf_tables, true))
 
166
                                    &session->lex().select_lex.leaf_tables, true))
163
167
     return(-1);
164
168
 
165
169
  /*
179
183
  table= table_list->table;
180
184
  transactional_table= table->cursor->has_transactions();
181
185
 
182
 
  if (!fields_vars.elements)
 
186
  if (!fields_vars.size())
183
187
  {
184
188
    Field **field;
185
189
    for (field= table->getFields(); *field ; field++)
394
398
     simulated killing in the middle of per-row loop
395
399
     must be effective for binlogging
396
400
  */
397
 
  killed_status= (error == 0)? Session::NOT_KILLED : session->getKilled();
398
 
  if (error)
 
401
  if (error) 
399
402
  {
400
403
    error= -1;                          // Error on read
401
404
    goto err;
434
437
  List<Item>::iterator it(fields_vars.begin());
435
438
  Item_field *sql_field;
436
439
  Table *table= table_list->table;
437
 
  uint64_t id;
438
440
  bool err;
439
441
 
440
 
  id= 0;
441
 
 
442
442
  while (!read_info.read_fixed_length())
443
443
  {
444
444
    if (session->getKilled())
556
556
  Item *item;
557
557
  Table *table= table_list->table;
558
558
  uint32_t enclosed_length;
559
 
  uint64_t id;
560
559
  bool err;
561
560
 
562
561
  enclosed_length=enclosed.length();
563
 
  id= 0;
564
562
 
565
563
  for (;;it= fields_vars.begin())
566
564
  {
660
658
    if (item)
661
659
    {
662
660
      /* Have not read any field, thus input cursor is simply ended */
663
 
      if (item == fields_vars.head())
 
661
      if (item == &fields_vars.front())
664
662
        break;
665
663
      for (; item ; item= it++)
666
664
      {
758
756
 
759
757
 
760
758
READ_INFO::READ_INFO(int file_par, size_t tot_length,
761
 
                     const CHARSET_INFO * const cs,
 
759
                     const charset_info_st * const cs,
762
760
                     String &field_term, String &line_start, String &line_term,
763
761
                     String &enclosed_par, int escape, bool is_fifo)
764
762
  :cursor(file_par),escape_char(escape)