~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/sql_load.cc

  • Committer: Brian Aker
  • Date: 2011-01-12 06:45:23 UTC
  • mto: (2073.1.4 catalogs)
  • mto: This revision was merged to the branch mainline in revision 2080.
  • Revision ID: brian@tangent.org-20110112064523-rqhptaqbph22qmj1
RemoveĀ customĀ error.

Show diffs side-by-side

added added

removed removed

Lines of Context:
16
16
 
17
17
/* Copy data from a textfile to table */
18
18
 
19
 
#include <config.h>
20
 
 
 
19
#include "config.h"
21
20
#include <drizzled/sql_load.h>
22
21
#include <drizzled/error.h>
23
22
#include <drizzled/data_home.h>
24
23
#include <drizzled/session.h>
25
24
#include <drizzled/sql_base.h>
26
25
#include <drizzled/field/epoch.h>
27
 
#include <drizzled/internal/my_sys.h>
28
 
#include <drizzled/internal/iocache.h>
29
 
#include <drizzled/plugin/storage_engine.h>
 
26
#include "drizzled/internal/my_sys.h"
 
27
#include "drizzled/internal/iocache.h"
 
28
#include <drizzled/db.h>
30
29
 
31
30
#include <sys/stat.h>
32
31
#include <fcntl.h>
156
155
  if (session->openTablesLock(table_list))
157
156
    return(true);
158
157
 
159
 
  if (setup_tables_and_check_access(session, &session->getLex()->select_lex.context,
160
 
                                    &session->getLex()->select_lex.top_join_list,
 
158
  if (setup_tables_and_check_access(session, &session->lex->select_lex.context,
 
159
                                    &session->lex->select_lex.top_join_list,
161
160
                                    table_list,
162
 
                                    &session->getLex()->select_lex.leaf_tables, true))
 
161
                                    &session->lex->select_lex.leaf_tables, true))
163
162
     return(-1);
164
163
 
165
164
  /*
225
224
 
226
225
  size_t tot_length=0;
227
226
  bool use_blobs= 0, use_vars= 0;
228
 
  List<Item>::iterator it(fields_vars.begin());
 
227
  List_iterator_fast<Item> it(fields_vars);
229
228
  Item *item;
230
229
 
231
230
  while ((item= it++))
320
319
  info.handle_duplicates=handle_duplicates;
321
320
  info.escape_char=escaped->length() ? (*escaped)[0] : INT_MAX;
322
321
 
323
 
  identifier::Schema identifier(*schema);
 
322
  SchemaIdentifier identifier(*schema);
324
323
  READ_INFO read_info(file, tot_length,
325
324
                      ex->cs ? ex->cs : plugin::StorageEngine::getSchemaCollation(identifier),
326
325
                      *field_term, *ex->line_start, *ex->line_term, *enclosed,
366
365
    table->cursor->ha_start_bulk_insert((ha_rows) 0);
367
366
    table->copy_blobs=1;
368
367
 
369
 
    session->setAbortOnWarning(true);
 
368
    session->abort_on_warning= true;
370
369
 
371
370
    if (!field_term->length() && !enclosed->length())
372
371
      error= read_fixed_length(session, info, table_list, fields_vars,
415
414
              session->transaction.stmt.hasModifiedNonTransData());
416
415
  table->cursor->ha_release_auto_increment();
417
416
  table->auto_increment_field_not_null= false;
418
 
  session->setAbortOnWarning(false);
419
 
 
 
417
  session->abort_on_warning= 0;
420
418
  return(error);
421
419
}
422
420
 
431
429
                  List<Item> &set_values, READ_INFO &read_info,
432
430
                  uint32_t skip_lines, bool ignore_check_option_errors)
433
431
{
434
 
  List<Item>::iterator it(fields_vars.begin());
 
432
  List_iterator_fast<Item> it(fields_vars);
435
433
  Item_field *sql_field;
436
434
  Table *table= table_list->table;
437
435
  uint64_t id;
457
455
      skip_lines--;
458
456
      continue;
459
457
    }
460
 
    it= fields_vars.begin();
 
458
    it.rewind();
461
459
    unsigned char *pos=read_info.row_start;
462
460
#ifdef HAVE_VALGRIND
463
461
    read_info.row_end[0]=0;
552
550
               String &enclosed, uint32_t skip_lines,
553
551
               bool ignore_check_option_errors)
554
552
{
555
 
  List<Item>::iterator it(fields_vars.begin());
 
553
  List_iterator_fast<Item> it(fields_vars);
556
554
  Item *item;
557
555
  Table *table= table_list->table;
558
556
  uint32_t enclosed_length;
562
560
  enclosed_length=enclosed.length();
563
561
  id= 0;
564
562
 
565
 
  for (;;it= fields_vars.begin())
 
563
  for (;;it.rewind())
566
564
  {
567
565
    if (session->getKilled())
568
566
    {