~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/sql_load.cc

  • Committer: Andrew Hutchings
  • Date: 2011-01-23 21:32:31 UTC
  • mto: (2108.1.1 build)
  • mto: This revision was merged to the branch mainline in revision 2109.
  • Revision ID: andrew@linuxjedi.co.uk-20110123213231-dp2r4enepa9k4g36
Convert all unit tests to boost::test
Add pandora support for boost::test
Remove pandora support for gtest

Show diffs side-by-side

added added

removed removed

Lines of Context:
22
22
#include <drizzled/data_home.h>
23
23
#include <drizzled/session.h>
24
24
#include <drizzled/sql_base.h>
25
 
#include <drizzled/field/timestamp.h>
 
25
#include <drizzled/field/epoch.h>
26
26
#include "drizzled/internal/my_sys.h"
27
27
#include "drizzled/internal/iocache.h"
28
28
#include <drizzled/db.h>
81
81
 
82
82
  /*
83
83
    Either this method, or we need to make cache public
84
 
    Arg must be set from mysql_load() since constructor does not see
 
84
    Arg must be set from load() since constructor does not see
85
85
    either the table or Session value
86
86
  */
87
87
  void set_io_cache_arg(void* arg) { cache.arg = arg; }
103
103
  Execute LOAD DATA query
104
104
 
105
105
  SYNOPSYS
106
 
    mysql_load()
 
106
    load()
107
107
      session - current thread
108
108
      ex  - file_exchange object representing source cursor and its parsing rules
109
109
      table_list  - list of tables to which we are loading data
119
119
    true - error / false - success
120
120
*/
121
121
 
122
 
int mysql_load(Session *session,file_exchange *ex,TableList *table_list,
 
122
int load(Session *session,file_exchange *ex,TableList *table_list,
123
123
                List<Item> &fields_vars, List<Item> &set_fields,
124
124
                List<Item> &set_values,
125
125
                enum enum_duplicates handle_duplicates, bool ignore)
319
319
  info.handle_duplicates=handle_duplicates;
320
320
  info.escape_char=escaped->length() ? (*escaped)[0] : INT_MAX;
321
321
 
322
 
  SchemaIdentifier identifier(*schema);
 
322
  identifier::Schema identifier(*schema);
323
323
  READ_INFO read_info(file, tot_length,
324
324
                      ex->cs ? ex->cs : plugin::StorageEngine::getSchemaCollation(identifier),
325
325
                      *field_term, *ex->line_start, *ex->line_term, *enclosed,
484
484
        push_warning_printf(session, DRIZZLE_ERROR::WARN_LEVEL_WARN,
485
485
                            ER_WARN_TOO_FEW_RECORDS,
486
486
                            ER(ER_WARN_TOO_FEW_RECORDS), session->row_count);
487
 
        if (!field->maybe_null() && field->type() == DRIZZLE_TYPE_TIMESTAMP)
488
 
            ((Field_timestamp*) field)->set_time();
 
487
 
 
488
        if (not field->maybe_null() and field->is_timestamp())
 
489
            ((field::Epoch::pointer) field)->set_time();
489
490
      }
490
491
      else
491
492
      {
601
602
            return(1);
602
603
          }
603
604
          field->set_null();
604
 
          if (!field->maybe_null())
 
605
          if (not field->maybe_null())
605
606
          {
606
 
            if (field->type() == DRIZZLE_TYPE_TIMESTAMP)
607
 
              ((Field_timestamp*) field)->set_time();
 
607
            if (field->is_timestamp())
 
608
            {
 
609
              ((field::Epoch::pointer) field)->set_time();
 
610
            }
608
611
            else if (field != table->next_number_field)
609
 
              field->set_warning(DRIZZLE_ERROR::WARN_LEVEL_WARN,
610
 
                                 ER_WARN_NULL_TO_NOTNULL, 1);
 
612
            {
 
613
              field->set_warning(DRIZZLE_ERROR::WARN_LEVEL_WARN, ER_WARN_NULL_TO_NOTNULL, 1);
 
614
            }
611
615
          }
612
616
        }
613
617
        else if (item->type() == Item::STRING_ITEM)
668
672
                     session->row_count);
669
673
            return(1);
670
674
          }
671
 
          if (!field->maybe_null() && field->type() == DRIZZLE_TYPE_TIMESTAMP)
672
 
              ((Field_timestamp*) field)->set_time();
 
675
          if (not field->maybe_null() and field->is_timestamp())
 
676
              ((field::Epoch::pointer) field)->set_time();
673
677
          /*
674
678
            QQ: We probably should not throw warning for each field.
675
679
            But how about intention to always have the same number