~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/sql_load.cc

  • Committer: Toru Maesaka
  • Date: 2008-12-17 07:16:37 UTC
  • mto: (685.1.40 devel) (713.1.5 devel)
  • mto: This revision was merged to the branch mainline in revision 713.
  • Revision ID: dev@torum.net-20081217071637-7j9040w7lpms77r2
Removed my_time() and added error checking

Show diffs side-by-side

added added

removed removed

Lines of Context:
17
17
/* Copy data from a textfile to table */
18
18
 
19
19
#include <drizzled/server_includes.h>
20
 
#include "sql_repl.h"
21
 
#include <drizzled/drizzled_error_messages.h>
22
 
 
 
20
#include <drizzled/sql_load.h>
 
21
#include <drizzled/replication/replication.h>
 
22
#include <drizzled/error.h>
 
23
#include <drizzled/data_home.h>
 
24
#include <drizzled/session.h>
 
25
#include <drizzled/sql_base.h>
 
26
#include <drizzled/field/timestamp.h>
23
27
 
24
28
class READ_INFO {
25
29
  File  file;
66
70
  /*
67
71
    Either this method, or we need to make cache public
68
72
    Arg must be set from mysql_load() since constructor does not see
69
 
    either the table or THD value
 
73
    either the table or Session value
70
74
  */
71
75
  void set_io_cache_arg(void* arg) { cache.arg = arg; }
72
76
};
73
77
 
74
 
static int read_fixed_length(THD *thd, COPY_INFO &info, TableList *table_list,
 
78
static int read_fixed_length(Session *session, COPY_INFO &info, TableList *table_list,
75
79
                             List<Item> &fields_vars, List<Item> &set_fields,
76
80
                             List<Item> &set_values, READ_INFO &read_info,
77
81
                             uint32_t skip_lines,
78
82
                             bool ignore_check_option_errors);
79
 
static int read_sep_field(THD *thd, COPY_INFO &info, TableList *table_list,
 
83
static int read_sep_field(Session *session, COPY_INFO &info, TableList *table_list,
80
84
                          List<Item> &fields_vars, List<Item> &set_fields,
81
85
                          List<Item> &set_values, READ_INFO &read_info,
82
86
                          String &enclosed, uint32_t skip_lines,
83
87
                          bool ignore_check_option_errors);
84
88
 
85
 
static bool write_execute_load_query_log_event(THD *thd,
86
 
                                               bool duplicates, bool ignore,
87
 
                                               bool transactional_table,
88
 
                                               THD::killed_state killed_status);
89
89
 
90
90
/*
91
91
  Execute LOAD DATA query
92
92
 
93
93
  SYNOPSYS
94
94
    mysql_load()
95
 
      thd - current thread
 
95
      session - current thread
96
96
      ex  - sql_exchange object representing source file and its parsing rules
97
97
      table_list  - list of tables to which we are loading data
98
98
      fields_vars - list of fields and variables to which we read
108
108
    true - error / false - success
109
109
*/
110
110
 
111
 
int mysql_load(THD *thd,sql_exchange *ex,TableList *table_list,
 
111
int mysql_load(Session *session,sql_exchange *ex,TableList *table_list,
112
112
                List<Item> &fields_vars, List<Item> &set_fields,
113
113
                List<Item> &set_values,
114
114
                enum enum_duplicates handle_duplicates, bool ignore,
121
121
  String *field_term=ex->field_term,*escaped=ex->escaped;
122
122
  String *enclosed=ex->enclosed;
123
123
  bool is_fifo=0;
124
 
  LOAD_FILE_INFO lf_info;
125
 
  char *db = table_list->db;                    // This is never null
 
124
  char *db= table_list->db;                     // This is never null
 
125
  assert(db);
126
126
  /*
127
127
    If path for file is not defined, we will use the current database.
128
128
    If this is not set, we will use the directory where the table to be
129
129
    loaded is located
130
130
  */
131
 
  char *tdb= thd->db ? thd->db : db;            // Result is never null
 
131
  char *tdb= session->db ? session->db : db;            // Result is never null
 
132
  assert(tdb);
132
133
  uint32_t skip_lines= ex->skip_lines;
133
134
  bool transactional_table;
134
 
  THD::killed_state killed_status= THD::NOT_KILLED;
 
135
  Session::killed_state killed_status= Session::NOT_KILLED;
135
136
 
136
137
  if (escaped->length() > 1 || enclosed->length() > 1)
137
138
  {
139
140
               MYF(0));
140
141
    return(true);
141
142
  }
142
 
  if (open_and_lock_tables(thd, table_list))
 
143
  if (open_and_lock_tables(session, table_list))
143
144
    return(true);
144
 
  if (setup_tables_and_check_access(thd, &thd->lex->select_lex.context,
145
 
                                    &thd->lex->select_lex.top_join_list,
 
145
  if (setup_tables_and_check_access(session, &session->lex->select_lex.context,
 
146
                                    &session->lex->select_lex.top_join_list,
146
147
                                    table_list,
147
 
                                    &thd->lex->select_lex.leaf_tables, true))
 
148
                                    &session->lex->select_lex.leaf_tables, true))
148
149
     return(-1);
149
150
 
150
151
  /*
155
156
    table is marked to be 'used for insert' in which case we should never
156
157
    mark this table as 'const table' (ie, one that has only one row).
157
158
  */
158
 
  if (unique_table(thd, table_list, table_list->next_global, 0))
 
159
  if (unique_table(session, table_list, table_list->next_global, 0))
159
160
  {
160
161
    my_error(ER_UPDATE_TABLE_USED, MYF(0), table_list->table_name);
161
162
    return(true);
175
176
      Let us also prepare SET clause, altough it is probably empty
176
177
      in this case.
177
178
    */
178
 
    if (setup_fields(thd, 0, set_fields, MARK_COLUMNS_WRITE, 0, 0) ||
179
 
        setup_fields(thd, 0, set_values, MARK_COLUMNS_READ, 0, 0))
 
179
    if (setup_fields(session, 0, set_fields, MARK_COLUMNS_WRITE, 0, 0) ||
 
180
        setup_fields(session, 0, set_values, MARK_COLUMNS_READ, 0, 0))
180
181
      return(true);
181
182
  }
182
183
  else
183
184
  {                                             // Part field list
184
185
    /* TODO: use this conds for 'WITH CHECK OPTIONS' */
185
 
    if (setup_fields(thd, 0, fields_vars, MARK_COLUMNS_WRITE, 0, 0) ||
186
 
        setup_fields(thd, 0, set_fields, MARK_COLUMNS_WRITE, 0, 0) ||
187
 
        check_that_all_fields_are_given_values(thd, table, table_list))
 
186
    if (setup_fields(session, 0, fields_vars, MARK_COLUMNS_WRITE, 0, 0) ||
 
187
        setup_fields(session, 0, set_fields, MARK_COLUMNS_WRITE, 0, 0) ||
 
188
        check_that_all_fields_are_given_values(session, table, table_list))
188
189
      return(true);
189
190
    /*
190
191
      Check whenever TIMESTAMP field with auto-set feature specified
202
203
      }
203
204
    }
204
205
    /* Fix the expressions in SET clause */
205
 
    if (setup_fields(thd, 0, set_values, MARK_COLUMNS_READ, 0, 0))
 
206
    if (setup_fields(session, 0, set_values, MARK_COLUMNS_READ, 0, 0))
206
207
      return(true);
207
208
  }
208
209
 
249
250
 
250
251
  if (read_file_from_client)
251
252
  {
252
 
    (void)net_request_file(&thd->net,ex->file_name);
 
253
    (void)net_request_file(&session->net,ex->file_name);
253
254
    file = -1;
254
255
  }
255
256
  else
259
260
#endif
260
261
    if (!dirname_length(ex->file_name))
261
262
    {
262
 
      strxnmov(name, FN_REFLEN-1, mysql_real_data_home, tdb, NULL);
 
263
      strcpy(name, drizzle_real_data_home);
 
264
      strncat(name, tdb, FN_REFLEN-strlen(drizzle_real_data_home)-1);
263
265
      (void) fn_format(name, ex->file_name, name, "",
264
266
                       MY_RELATIVE_PATH | MY_UNPACK_FILENAME);
265
267
    }
266
268
    else
267
269
    {
268
 
      (void) fn_format(name, ex->file_name, mysql_real_data_home, "",
 
270
      (void) fn_format(name, ex->file_name, drizzle_real_data_home, "",
269
271
                       MY_RELATIVE_PATH | MY_UNPACK_FILENAME);
270
272
 
271
273
      if (opt_secure_file_priv &&
281
283
        return(true);
282
284
 
283
285
      // if we are not in slave thread, the file must be:
284
 
      if (!thd->slave_thread &&
 
286
      if (!session->slave_thread &&
285
287
          !((stat_info.st_mode & S_IROTH) == S_IROTH &&  // readable by others
286
288
            (stat_info.st_mode & S_IFLNK) != S_IFLNK && // and not a symlink
287
289
            ((stat_info.st_mode & S_IFREG) == S_IFREG ||
304
306
  info.escape_char=escaped->length() ? (*escaped)[0] : INT_MAX;
305
307
 
306
308
  READ_INFO read_info(file,tot_length,
307
 
                      ex->cs ? ex->cs : thd->variables.collation_database,
 
309
                      ex->cs ? ex->cs : session->variables.collation_database,
308
310
                      *field_term,*ex->line_start, *ex->line_term, *enclosed,
309
311
                      info.escape_char, read_file_from_client, is_fifo);
310
312
  if (read_info.error)
314
316
    return(true);                               // Can't allocate buffers
315
317
  }
316
318
 
317
 
  if (mysql_bin_log.is_open())
318
 
  {
319
 
    lf_info.thd = thd;
320
 
    lf_info.wrote_create_file = 0;
321
 
    lf_info.last_pos_in_file = HA_POS_ERROR;
322
 
    lf_info.log_delayed= transactional_table;
323
 
    read_info.set_io_cache_arg((void*) &lf_info);
324
 
  }
325
 
 
326
 
  thd->count_cuted_fields= CHECK_FIELD_WARN;            /* calc cuted fields */
327
 
  thd->cuted_fields=0L;
 
319
  session->count_cuted_fields= CHECK_FIELD_WARN;                /* calc cuted fields */
 
320
  session->cuted_fields=0L;
328
321
  /* Skip lines if there is a line terminator */
329
322
  if (ex->line_term->length())
330
323
  {
349
342
    table->file->ha_start_bulk_insert((ha_rows) 0);
350
343
    table->copy_blobs=1;
351
344
 
352
 
    thd->abort_on_warning= true;
 
345
    session->abort_on_warning= true;
353
346
 
354
347
    if (!field_term->length() && !enclosed->length())
355
 
      error= read_fixed_length(thd, info, table_list, fields_vars,
 
348
      error= read_fixed_length(session, info, table_list, fields_vars,
356
349
                               set_fields, set_values, read_info,
357
350
                               skip_lines, ignore);
358
351
    else
359
 
      error= read_sep_field(thd, info, table_list, fields_vars,
 
352
      error= read_sep_field(session, info, table_list, fields_vars,
360
353
                            set_fields, set_values, read_info,
361
354
                            *enclosed, skip_lines, ignore);
362
355
    if (table->file->ha_end_bulk_insert() && !error)
372
365
    my_close(file,MYF(0));
373
366
  free_blobs(table);                            /* if pack_blob was used */
374
367
  table->copy_blobs=0;
375
 
  thd->count_cuted_fields= CHECK_FIELD_IGNORE;
376
 
  /* 
 
368
  session->count_cuted_fields= CHECK_FIELD_IGNORE;
 
369
  /*
377
370
     simulated killing in the middle of per-row loop
378
371
     must be effective for binlogging
379
372
  */
380
 
  killed_status= (error == 0)? THD::NOT_KILLED : thd->killed;
 
373
  killed_status= (error == 0)? Session::NOT_KILLED : session->killed;
381
374
  if (error)
382
375
  {
383
376
    if (read_file_from_client)
384
377
      while (!read_info.next_line())
385
378
        ;
386
379
 
387
 
    if (mysql_bin_log.is_open())
388
 
    {
389
 
      {
390
 
        /*
391
 
          Make sure last block (the one which caused the error) gets
392
 
          logged.  This is needed because otherwise after write of (to
393
 
          the binlog, not to read_info (which is a cache))
394
 
          Delete_file_log_event the bad block will remain in read_info
395
 
          (because pre_read is not called at the end of the last
396
 
          block; remember pre_read is called whenever a new block is
397
 
          read from disk).  At the end of mysql_load(), the destructor
398
 
          of read_info will call end_io_cache() which will flush
399
 
          read_info, so we will finally have this in the binlog:
400
 
 
401
 
          Append_block # The last successfull block
402
 
          Delete_file
403
 
          Append_block # The failing block
404
 
          which is nonsense.
405
 
          Or could also be (for a small file)
406
 
          Create_file  # The failing block
407
 
          which is nonsense (Delete_file is not written in this case, because:
408
 
          Create_file has not been written, so Delete_file is not written, then
409
 
          when read_info is destroyed end_io_cache() is called which writes
410
 
          Create_file.
411
 
        */
412
 
        read_info.end_io_cache();
413
 
        /* If the file was not empty, wrote_create_file is true */
414
 
        if (lf_info.wrote_create_file)
415
 
        {
416
 
          if (thd->transaction.stmt.modified_non_trans_table)
417
 
            write_execute_load_query_log_event(thd, handle_duplicates,
418
 
                                               ignore, transactional_table,
419
 
                                               killed_status);
420
 
          else
421
 
          {
422
 
            Delete_file_log_event d(thd, db, transactional_table);
423
 
            d.flags|= LOG_EVENT_UPDATE_TABLE_MAP_VERSION_F;
424
 
            mysql_bin_log.write(&d);
425
 
          }
426
 
        }
427
 
      }
428
 
    }
429
380
    error= -1;                          // Error on read
430
381
    goto err;
431
382
  }
432
383
  sprintf(name, ER(ER_LOAD_INFO), (uint32_t) info.records, (uint32_t) info.deleted,
433
 
          (uint32_t) (info.records - info.copied), (uint32_t) thd->cuted_fields);
434
 
 
435
 
  if (thd->transaction.stmt.modified_non_trans_table)
436
 
    thd->transaction.all.modified_non_trans_table= true;
437
 
 
438
 
  if (mysql_bin_log.is_open())
439
 
  {
440
 
    /*
441
 
      We need to do the job that is normally done inside
442
 
      binlog_query() here, which is to ensure that the pending event
443
 
      is written before tables are unlocked and before any other
444
 
      events are written.  We also need to update the table map
445
 
      version for the binary log to mark that table maps are invalid
446
 
      after this point.
447
 
     */
448
 
    if (thd->current_stmt_binlog_row_based)
449
 
      thd->binlog_flush_pending_rows_event(true);
450
 
    else
451
 
    {
452
 
      /*
453
 
        As already explained above, we need to call end_io_cache() or the last
454
 
        block will be logged only after Execute_load_query_log_event (which is
455
 
        wrong), when read_info is destroyed.
456
 
      */
457
 
      read_info.end_io_cache();
458
 
      if (lf_info.wrote_create_file)
459
 
      {
460
 
        write_execute_load_query_log_event(thd, handle_duplicates, ignore,
461
 
                                           transactional_table,killed_status);
462
 
      }
463
 
    }
464
 
  }
 
384
          (uint32_t) (info.records - info.copied), (uint32_t) session->cuted_fields);
 
385
 
 
386
  if (session->transaction.stmt.modified_non_trans_table)
 
387
    session->transaction.all.modified_non_trans_table= true;
465
388
 
466
389
  /* ok to client sent only after binlog write and engine commit */
467
 
  my_ok(thd, info.copied + info.deleted, 0L, name);
 
390
  my_ok(session, info.copied + info.deleted, 0L, name);
468
391
err:
469
392
  assert(transactional_table || !(info.copied || info.deleted) ||
470
 
              thd->transaction.stmt.modified_non_trans_table);
 
393
              session->transaction.stmt.modified_non_trans_table);
471
394
  table->file->ha_release_auto_increment();
472
395
  table->auto_increment_field_not_null= false;
473
 
  thd->abort_on_warning= 0;
 
396
  session->abort_on_warning= 0;
474
397
  return(error);
475
398
}
476
399
 
477
400
 
478
 
/* Not a very useful function; just to avoid duplication of code */
479
 
static bool write_execute_load_query_log_event(THD *thd,
480
 
                                               bool duplicates, bool ignore,
481
 
                                               bool transactional_table,
482
 
                                               THD::killed_state killed_err_arg)
483
 
{
484
 
  Execute_load_query_log_event
485
 
    e(thd, thd->query, thd->query_length,
486
 
      (char*)thd->lex->fname_start - (char*)thd->query,
487
 
      (char*)thd->lex->fname_end - (char*)thd->query,
488
 
      (duplicates == DUP_REPLACE) ? LOAD_DUP_REPLACE :
489
 
      (ignore ? LOAD_DUP_IGNORE : LOAD_DUP_ERROR),
490
 
      transactional_table, false, killed_err_arg);
491
 
  e.flags|= LOG_EVENT_UPDATE_TABLE_MAP_VERSION_F;
492
 
  return mysql_bin_log.write(&e);
493
 
}
494
 
 
495
 
 
496
401
/****************************************************************************
497
402
** Read of rows of fixed size + optional garage + optonal newline
498
403
****************************************************************************/
499
404
 
500
405
static int
501
 
read_fixed_length(THD *thd, COPY_INFO &info, TableList *table_list,
 
406
read_fixed_length(Session *session, COPY_INFO &info, TableList *table_list,
502
407
                  List<Item> &fields_vars, List<Item> &set_fields,
503
408
                  List<Item> &set_values, READ_INFO &read_info,
504
409
                  uint32_t skip_lines, bool ignore_check_option_errors)
510
415
  bool err;
511
416
 
512
417
  id= 0;
513
 
 
 
418
 
514
419
  while (!read_info.read_fixed_length())
515
420
  {
516
 
    if (thd->killed)
 
421
    if (session->killed)
517
422
    {
518
 
      thd->send_kill_message();
 
423
      session->send_kill_message();
519
424
      return(1);
520
425
    }
521
426
    if (skip_lines)
542
447
    */
543
448
    while ((sql_field= (Item_field*) it++))
544
449
    {
545
 
      Field *field= sql_field->field;                  
 
450
      Field *field= sql_field->field;
546
451
      if (field == table->next_number_field)
547
452
        table->auto_increment_field_not_null= true;
548
453
      /*
554
459
 
555
460
      if (pos == read_info.row_end)
556
461
      {
557
 
        thd->cuted_fields++;                    /* Not enough fields */
558
 
        push_warning_printf(thd, DRIZZLE_ERROR::WARN_LEVEL_WARN, 
559
 
                            ER_WARN_TOO_FEW_RECORDS, 
560
 
                            ER(ER_WARN_TOO_FEW_RECORDS), thd->row_count);
 
462
        session->cuted_fields++;                        /* Not enough fields */
 
463
        push_warning_printf(session, DRIZZLE_ERROR::WARN_LEVEL_WARN,
 
464
                            ER_WARN_TOO_FEW_RECORDS,
 
465
                            ER(ER_WARN_TOO_FEW_RECORDS), session->row_count);
561
466
        if (!field->maybe_null() && field->type() == DRIZZLE_TYPE_TIMESTAMP)
562
467
            ((Field_timestamp*) field)->set_time();
563
468
      }
577
482
    }
578
483
    if (pos != read_info.row_end)
579
484
    {
580
 
      thd->cuted_fields++;                      /* To long row */
581
 
      push_warning_printf(thd, DRIZZLE_ERROR::WARN_LEVEL_WARN, 
582
 
                          ER_WARN_TOO_MANY_RECORDS, 
583
 
                          ER(ER_WARN_TOO_MANY_RECORDS), thd->row_count); 
 
485
      session->cuted_fields++;                  /* To long row */
 
486
      push_warning_printf(session, DRIZZLE_ERROR::WARN_LEVEL_WARN,
 
487
                          ER_WARN_TOO_MANY_RECORDS,
 
488
                          ER(ER_WARN_TOO_MANY_RECORDS), session->row_count);
584
489
    }
585
490
 
586
 
    if (thd->killed ||
587
 
        fill_record(thd, set_fields, set_values,
 
491
    if (session->killed ||
 
492
        fill_record(session, set_fields, set_values,
588
493
                    ignore_check_option_errors))
589
494
      return(1);
590
495
 
591
 
    err= write_record(thd, table, &info);
 
496
    err= write_record(session, table, &info);
592
497
    table->auto_increment_field_not_null= false;
593
498
    if (err)
594
499
      return(1);
595
 
   
 
500
 
596
501
    /*
597
502
      We don't need to reset auto-increment field since we are restoring
598
503
      its default value at the beginning of each loop iteration.
601
506
      break;
602
507
    if (read_info.line_cuted)
603
508
    {
604
 
      thd->cuted_fields++;                      /* To long row */
605
 
      push_warning_printf(thd, DRIZZLE_ERROR::WARN_LEVEL_WARN, 
606
 
                          ER_WARN_TOO_MANY_RECORDS, 
607
 
                          ER(ER_WARN_TOO_MANY_RECORDS), thd->row_count); 
 
509
      session->cuted_fields++;                  /* To long row */
 
510
      push_warning_printf(session, DRIZZLE_ERROR::WARN_LEVEL_WARN,
 
511
                          ER_WARN_TOO_MANY_RECORDS,
 
512
                          ER(ER_WARN_TOO_MANY_RECORDS), session->row_count);
608
513
    }
609
 
    thd->row_count++;
 
514
    session->row_count++;
610
515
  }
611
516
  return(test(read_info.error));
612
517
}
614
519
 
615
520
 
616
521
static int
617
 
read_sep_field(THD *thd, COPY_INFO &info, TableList *table_list,
 
522
read_sep_field(Session *session, COPY_INFO &info, TableList *table_list,
618
523
               List<Item> &fields_vars, List<Item> &set_fields,
619
524
               List<Item> &set_values, READ_INFO &read_info,
620
525
               String &enclosed, uint32_t skip_lines,
632
537
 
633
538
  for (;;it.rewind())
634
539
  {
635
 
    if (thd->killed)
 
540
    if (session->killed)
636
541
    {
637
 
      thd->send_kill_message();
 
542
      session->send_kill_message();
638
543
      return(1);
639
544
    }
640
545
 
668
573
          if (field->reset())
669
574
          {
670
575
            my_error(ER_WARN_NULL_TO_NOTNULL, MYF(0), field->field_name,
671
 
                     thd->row_count);
 
576
                     session->row_count);
672
577
            return(1);
673
578
          }
674
579
          field->set_null();
736
641
          if (field->reset())
737
642
          {
738
643
            my_error(ER_WARN_NULL_TO_NOTNULL, MYF(0),field->field_name,
739
 
                     thd->row_count);
 
644
                     session->row_count);
740
645
            return(1);
741
646
          }
742
647
          if (!field->maybe_null() && field->type() == DRIZZLE_TYPE_TIMESTAMP)
744
649
          /*
745
650
            QQ: We probably should not throw warning for each field.
746
651
            But how about intention to always have the same number
747
 
            of warnings in THD::cuted_fields (and get rid of cuted_fields
 
652
            of warnings in Session::cuted_fields (and get rid of cuted_fields
748
653
            in the end ?)
749
654
          */
750
 
          thd->cuted_fields++;
751
 
          push_warning_printf(thd, DRIZZLE_ERROR::WARN_LEVEL_WARN,
 
655
          session->cuted_fields++;
 
656
          push_warning_printf(session, DRIZZLE_ERROR::WARN_LEVEL_WARN,
752
657
                              ER_WARN_TOO_FEW_RECORDS,
753
 
                              ER(ER_WARN_TOO_FEW_RECORDS), thd->row_count);
 
658
                              ER(ER_WARN_TOO_FEW_RECORDS), session->row_count);
754
659
        }
755
660
        else if (item->type() == Item::STRING_ITEM)
756
661
        {
765
670
      }
766
671
    }
767
672
 
768
 
    if (thd->killed ||
769
 
        fill_record(thd, set_fields, set_values,
 
673
    if (session->killed ||
 
674
        fill_record(session, set_fields, set_values,
770
675
                    ignore_check_option_errors))
771
676
      return(1);
772
677
 
773
 
    err= write_record(thd, table, &info);
 
678
    err= write_record(session, table, &info);
774
679
    table->auto_increment_field_not_null= false;
775
680
    if (err)
776
681
      return(1);
782
687
      break;
783
688
    if (read_info.line_cuted)
784
689
    {
785
 
      thd->cuted_fields++;                      /* To long row */
786
 
      push_warning_printf(thd, DRIZZLE_ERROR::WARN_LEVEL_WARN, 
787
 
                          ER_WARN_TOO_MANY_RECORDS, ER(ER_WARN_TOO_MANY_RECORDS), 
788
 
                          thd->row_count);   
789
 
      if (thd->killed)
 
690
      session->cuted_fields++;                  /* To long row */
 
691
      push_warning_printf(session, DRIZZLE_ERROR::WARN_LEVEL_WARN,
 
692
                          ER_WARN_TOO_MANY_RECORDS, ER(ER_WARN_TOO_MANY_RECORDS),
 
693
                          session->row_count);
 
694
      if (session->killed)
790
695
        return(1);
791
696
    }
792
 
    thd->row_count++;
 
697
    session->row_count++;
793
698
  }
794
699
  return(test(read_info.error));
795
700
}
864
769
  set_if_bigger(length,line_start.length());
865
770
  stack=stack_pos=(int*) sql_alloc(sizeof(int)*length);
866
771
 
867
 
  if (!(buffer=(unsigned char*) my_malloc(buff_length+1,MYF(0))))
 
772
  if (!(buffer=(unsigned char*) malloc(buff_length+1)))
868
773
    error=1; /* purecov: inspected */
869
774
  else
870
775
  {
889
794
      if (get_it_from_net)
890
795
        cache.read_function = _my_b_net_read;
891
796
 
892
 
      if (mysql_bin_log.is_open())
 
797
      if (drizzle_bin_log.is_open())
893
798
        cache.pre_read = cache.pre_close =
894
799
          (IO_CACHE_CALLBACK) log_loaded_block;
895
800
    }
1082
987
    /*
1083
988
    ** We come here if buffer is too small. Enlarge it and continue
1084
989
    */
1085
 
    if (!(new_buffer=(unsigned char*) my_realloc((char*) buffer,buff_length+1+IO_SIZE,
1086
 
                                        MYF(MY_WME))))
 
990
    if (!(new_buffer=(unsigned char*) realloc(buffer, buff_length+1+IO_SIZE)))
1087
991
      return (error=1);
1088
992
    to=new_buffer + (to-buffer);
1089
993
    buffer=new_buffer;