~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/sql_load.cc

fixed build warnings

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)
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
 
487
488
        if (!field->maybe_null() && field->type() == DRIZZLE_TYPE_TIMESTAMP)
488
 
            ((Field_timestamp*) field)->set_time();
 
489
            ((field::Epoch::pointer) field)->set_time();
489
490
      }
490
491
      else
491
492
      {
604
605
          if (!field->maybe_null())
605
606
          {
606
607
            if (field->type() == DRIZZLE_TYPE_TIMESTAMP)
607
 
              ((Field_timestamp*) field)->set_time();
 
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)
669
673
            return(1);
670
674
          }
671
675
          if (!field->maybe_null() && field->type() == DRIZZLE_TYPE_TIMESTAMP)
672
 
              ((Field_timestamp*) field)->set_time();
 
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