summaryrefslogtreecommitdiff
path: root/sql/field_conv.cc
diff options
context:
space:
mode:
authorunknown <monty@hundin.mysql.fi>2002-10-16 13:11:25 +0300
committerunknown <monty@hundin.mysql.fi>2002-10-16 13:11:25 +0300
commit7013d8ef0ae0a21fadfcc0a159ee1d83fdad8a9d (patch)
treed165b4baadac24102545d94c8f9fe180537a64f5 /sql/field_conv.cc
parente1d7b8414f14de681127f4e19340e4f7737d5bdb (diff)
parent74b73109c1304e62430faa85d2a63a6f2ffa626d (diff)
downloadmariadb-git-7013d8ef0ae0a21fadfcc0a159ee1d83fdad8a9d.tar.gz
Merge with 3.23.54
BitKeeper/etc/logging_ok: auto-union BitKeeper/deleted/.del-LICENSE~4cfaff8de837acb8: Auto merged BitKeeper/deleted/.del-MySQLEULA.txt: Delete: Docs/MySQLEULA.txt BitKeeper/deleted/.del-global.h~e80d28157acfdcb5: Auto merged Build-tools/mysql-copyright-2: Auto merged Build-tools/mysql-copyright: Auto merged heap/heapdef.h: Auto merged heap/hp_open.c: Auto merged innobase/btr/btr0cur.c: Auto merged innobase/lock/lock0lock.c: Auto merged innobase/os/os0file.c: Auto merged innobase/os/os0thread.c: Auto merged myisam/mi_open.c: Auto merged mysql-test/Makefile.am: Auto merged mysql-test/t/null_key.test: Auto merged mysys/safemalloc.c: Auto merged scripts/make_binary_distribution.sh: Auto merged scripts/mysqld_safe.sh: Auto merged scripts/mysqlhotcopy.sh: Auto merged sql/field.h: Auto merged sql/field_conv.cc: Auto merged sql/ha_innodb.h: Auto merged sql/item.cc: Auto merged sql/sql_db.cc: Auto merged sql/sql_parse.cc: Auto merged sql/sql_select.cc: Auto merged sql/table.cc: Auto merged tests/grant.res: Auto merged Build-tools/Do-compile: merge Docs/manual.texi: merge configure.in: merge mysql-test/r/distinct.result: merge mysql-test/r/null_key.result: merge sql/ha_innodb.cc: merge sql/item.h: merge sql/log.cc: merge sql/mysqld.cc: merge support-files/mysql.spec.sh: merge
Diffstat (limited to 'sql/field_conv.cc')
-rw-r--r--sql/field_conv.cc55
1 files changed, 36 insertions, 19 deletions
diff --git a/sql/field_conv.cc b/sql/field_conv.cc
index c7a6d778953..53b26920c14 100644
--- a/sql/field_conv.cc
+++ b/sql/field_conv.cc
@@ -112,35 +112,52 @@ static void do_outer_field_to_null_str(Copy_field *copy)
bool
set_field_to_null(Field *field)
{
- if (field->maybe_null())
+ if (field->real_maybe_null())
{
field->set_null();
field->reset();
+ return 0;
}
- else
+ return 1;
+}
+
+
+bool
+set_field_to_null_with_conversions(Field *field)
+{
+ if (field->real_maybe_null())
{
- if (field->type() == FIELD_TYPE_TIMESTAMP)
- {
- ((Field_timestamp*) field)->set_time();
- return 0; // Ok to set time to NULL
- }
+ field->set_null();
field->reset();
- if (field == field->table->next_number_field)
- return 0; // field is set in handler.cc
- if (current_thd->count_cuted_fields)
- {
- current_thd->cuted_fields++; // Increment error counter
- return 0;
- }
- if (!current_thd->no_errors)
- my_printf_error(ER_BAD_NULL_ERROR,ER(ER_BAD_NULL_ERROR),MYF(0),
- field->field_name);
- return 1;
+ return 0;
+ }
+
+ /*
+ Check if this is a special type, which will get a special walue
+ when set to NULL
+ */
+ if (field->type() == FIELD_TYPE_TIMESTAMP)
+ {
+ ((Field_timestamp*) field)->set_time();
+ return 0; // Ok to set time to NULL
+ }
+ field->reset();
+ if (field == field->table->next_number_field)
+ return 0; // field is set in handler.cc
+ if (current_thd->count_cuted_fields)
+ {
+ current_thd->cuted_fields++; // Increment error counter
+ return 0;
}
- return 0;
+ if (!current_thd->no_errors)
+ my_printf_error(ER_BAD_NULL_ERROR,ER(ER_BAD_NULL_ERROR),MYF(0),
+ field->field_name);
+ return 1;
}
+
+
static void do_skip(Copy_field *copy __attribute__((unused)))
{
}