~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/sql_load.cc

  • Committer: Brian Aker
  • Date: 2010-10-27 21:19:18 UTC
  • mto: This revision was merged to the branch mainline in revision 1886.
  • Revision ID: brian@tangent.org-20101027211918-1xnp5koya8stw35j
Additional documenation.

Show diffs side-by-side

added added

removed removed

Lines of Context:
75
75
  */
76
76
  void end_io_cache()
77
77
  {
78
 
    cache.end_io_cache();
 
78
    internal::end_io_cache(&cache);
79
79
    need_end_io_cache = 0;
80
80
  }
81
81
 
138
138
    If this is not set, we will use the directory where the table to be
139
139
    loaded is located
140
140
  */
141
 
  util::string::const_shared_ptr schema(session->schema());
142
 
  const char *tdb= (schema and not schema->empty()) ? schema->c_str() : table_list->getSchemaName(); // Result should never be null
 
141
  const char *tdb= session->db.empty() ? table_list->getSchemaName()  : session->db.c_str();            // Result is never null
143
142
  assert(tdb);
144
143
  uint32_t skip_lines= ex->skip_lines;
145
144
  bool transactional_table;
146
 
  Session::killed_state_t killed_status= Session::NOT_KILLED;
 
145
  Session::killed_state killed_status= Session::NOT_KILLED;
147
146
 
148
147
  /* Escape and enclosed character may be a utf8 4-byte character */
149
148
  if (escaped->length() > 4 || enclosed->length() > 4)
206
205
    */
207
206
    if (table->timestamp_field)
208
207
    {
209
 
      if (table->isWriteSet(table->timestamp_field->position()))
210
 
      {
 
208
      if (table->isWriteSet(table->timestamp_field->field_index))
211
209
        table->timestamp_field_type= TIMESTAMP_NO_AUTO_SET;
212
 
      }
213
210
      else
214
211
      {
215
 
        table->setWriteSet(table->timestamp_field->position());
 
212
        table->setWriteSet(table->timestamp_field->field_index);
216
213
      }
217
214
    }
218
215
    /* Fix the expressions in SET clause */
319
316
  info.handle_duplicates=handle_duplicates;
320
317
  info.escape_char=escaped->length() ? (*escaped)[0] : INT_MAX;
321
318
 
322
 
  SchemaIdentifier identifier(*schema);
 
319
  SchemaIdentifier identifier(session->db);
323
320
  READ_INFO read_info(file, tot_length,
324
321
                      ex->cs ? ex->cs : plugin::StorageEngine::getSchemaCollation(identifier),
325
322
                      *field_term, *ex->line_start, *ex->line_term, *enclosed,
393
390
     simulated killing in the middle of per-row loop
394
391
     must be effective for binlogging
395
392
  */
396
 
  killed_status= (error == 0)? Session::NOT_KILLED : session->getKilled();
 
393
  killed_status= (error == 0)? Session::NOT_KILLED : session->killed;
397
394
  if (error)
398
395
  {
399
396
    error= -1;                          // Error on read
439
436
 
440
437
  while (!read_info.read_fixed_length())
441
438
  {
442
 
    if (session->getKilled())
 
439
    if (session->killed)
443
440
    {
444
441
      session->send_kill_message();
445
442
      return(1);
512
509
                          ER(ER_WARN_TOO_MANY_RECORDS), session->row_count);
513
510
    }
514
511
 
515
 
    if (session->getKilled() ||
 
512
    if (session->killed ||
516
513
        fill_record(session, set_fields, set_values,
517
514
                    ignore_check_option_errors))
518
515
      return(1);
561
558
 
562
559
  for (;;it.rewind())
563
560
  {
564
 
    if (session->getKilled())
 
561
    if (session->killed)
565
562
    {
566
563
      session->send_kill_message();
567
564
      return(1);
694
691
      }
695
692
    }
696
693
 
697
 
    if (session->getKilled() ||
 
694
    if (session->killed ||
698
695
        fill_record(session, set_fields, set_values,
699
696
                    ignore_check_option_errors))
700
697
      return(1);
715
712
      push_warning_printf(session, DRIZZLE_ERROR::WARN_LEVEL_WARN,
716
713
                          ER_WARN_TOO_MANY_RECORDS, ER(ER_WARN_TOO_MANY_RECORDS),
717
714
                          session->row_count);
718
 
      if (session->getKilled())
 
715
      if (session->killed)
719
716
        return(1);
720
717
    }
721
718
    session->row_count++;
798
795
  else
799
796
  {
800
797
    end_of_buff=buffer+buff_length;
801
 
    if (cache.init_io_cache((false) ? -1 : cursor, 0,
802
 
                            (false) ? internal::READ_NET :
803
 
                            (is_fifo ? internal::READ_FIFO : internal::READ_CACHE),0L,1,
804
 
                            MYF(MY_WME)))
 
798
    if (init_io_cache(&cache,(false) ? -1 : cursor, 0,
 
799
                      (false) ? internal::READ_NET :
 
800
                      (is_fifo ? internal::READ_FIFO : internal::READ_CACHE),0L,1,
 
801
                      MYF(MY_WME)))
805
802
    {
806
803
      free((unsigned char*) buffer);
807
804
      error=1;
824
821
  if (!error)
825
822
  {
826
823
    if (need_end_io_cache)
827
 
      cache.end_io_cache();
 
824
      internal::end_io_cache(&cache);
828
825
    free(buffer);
829
826
    error=1;
830
827
  }