~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/sql_load.cc

  • Committer: Jay Pipes
  • Date: 2008-12-17 04:02:20 UTC
  • mto: This revision was merged to the branch mainline in revision 717.
  • Revision ID: jpipes@serialcoder-20081217040220-b062yr3pwibi0j2o
Enabled the null.test.

* Fixed numerous SQL syntax change errors in null.test
* Added tests to ensure that UPDATE .. SET col=NULL produced appropriate errors, but only when rows were contained in the table.
* Added tests to ensure that LOAD DATA INFILE produces errors when setting NULL on NOT NULL columns

sql_insert.cc:

Modified the check_that_all_fields_are_given_values() function to ensure
an error is thrown instead of a warning when NULL is inserted into a NOT NULL column.

sql_update.cc:

Modifed mysql_update(), setting ignore to only CHECK_FIELD_ERROR_FOR_NULL, which 
is used by field_conv:set_field_to_null() and set_field_to_null_with_conversions() 
during the update

field_conv.cc:

Raise an error, not a warning, when NULL is set for NOT NULL columns

sql_load.cc:

Set ignore again, same as in sql_update.cc, but leave error as 1263 which 
gives additional information in a LOAD statement.

Added a null_test.txt file to check the LOAD DATA INFILE statement in null.test

Show diffs side-by-side

added added

removed removed

Lines of Context:
316
316
    return(true);                               // Can't allocate buffers
317
317
  }
318
318
 
319
 
  session->count_cuted_fields= CHECK_FIELD_WARN;                /* calc cuted fields */
 
319
  /*
 
320
   * Per the SQL standard, inserting NULL into a NOT NULL
 
321
   * field requires an error to be thrown.
 
322
   *
 
323
   * @NOTE
 
324
   *
 
325
   * NULL check and handling occurs in field_conv.cc
 
326
   */
 
327
  session->count_cuted_fields= CHECK_FIELD_ERROR_FOR_NULL;
320
328
  session->cuted_fields=0L;
321
329
  /* Skip lines if there is a line terminator */
322
330
  if (ex->line_term->length())