diff options
author | unknown <monty@mishka.local> | 2004-09-28 20:08:00 +0300 |
---|---|---|
committer | unknown <monty@mishka.local> | 2004-09-28 20:08:00 +0300 |
commit | 2a49121590930ad9ef69718caad67304e94b9c00 (patch) | |
tree | 7f0311baaca32e6242f23dcf0a89ed38e39c9ac0 /sql/mysql_priv.h | |
parent | e74b00bbc98c1082086422dc9c8578dade9d4a11 (diff) | |
download | mariadb-git-2a49121590930ad9ef69718caad67304e94b9c00.tar.gz |
Strict mode & better warnings
Under strict mode MySQL will generate an error message if there was any conversion when assigning data to a field.
Added checking of date/datetime fields.
If strict mode, give error if we have not given value to field without a default value (for INSERT)
client/mysqltest.c:
Added --exit as an option to abort a test in a middle (good for debugging)
include/my_time.h:
Added flags to allow checking of dates in strict mode
include/mysql_com.h:
Added flag to check if field has a default value or not
include/mysqld_error.h:
New error messages for strict mode
include/sql_state.h:
Fixed SQL states (for strict mode tests)
mysql-test/r/auto_increment.result:
Updated error messages
mysql-test/r/func_sapdb.result:
Added test for ALLOW_INVALID_DATES
mysql-test/r/func_str.result:
Updated error messages
mysql-test/r/func_time.result:
Updated error messages
mysql-test/r/insert.result:
Updated error messages
mysql-test/r/loaddata.result:
Updated error messages
mysql-test/r/select.result:
Updated error messages
mysql-test/r/sp.result:
Updated error messages
mysql-test/r/timezone2.result:
Updated error messages
mysql-test/r/type_datetime.result:
Updated error messages
mysql-test/r/type_decimal.result:
Updated error messages
mysql-test/r/type_float.result:
Updated error messages
mysql-test/r/type_ranges.result:
Updated error messages
mysql-test/r/type_time.result:
Updated error messages
mysql-test/r/type_uint.result:
Updated error messages
mysql-test/r/warnings.result:
Updated error messages
mysql-test/t/func_sapdb.test:
Aded test
sql-common/my_time.c:
Added checking of dates
sql/field.cc:
Better error messages
Optimization of warning handling (by introducing of check_int())
Changed to use my_strtoll10()
sql/field.h:
Added check_int()
sql/item_func.cc:
Warnings when dividing by NULL
sql/item_func.h:
Warnings when dividing by NULL
sql/item_timefunc.cc:
Testing of date/datetime
Use macros instead of constants
sql/mysql_priv.h:
New modes (part of strict mode)
sql/mysqld.cc:
New modes (part of strict mode)
sql/opt_range.cc:
Simple optimizations
sql/protocol.cc:
Add note/warning level to find_handler()
sql/set_var.cc:
Added mode 'traditional'
sql/share/czech/errmsg.txt:
New error messages for strict mode
sql/share/danish/errmsg.txt:
New error messages for strict mode
sql/share/dutch/errmsg.txt:
New error messages for strict mode
sql/share/english/errmsg.txt:
New error messages for strict mode
sql/share/estonian/errmsg.txt:
New error messages for strict mode
sql/share/french/errmsg.txt:
New error messages for strict mode
sql/share/german/errmsg.txt:
New error messages for strict mode
sql/share/greek/errmsg.txt:
New error messages for strict mode
sql/share/hungarian/errmsg.txt:
New error messages for strict mode
sql/share/italian/errmsg.txt:
New error messages for strict mode
sql/share/japanese/errmsg.txt:
New error messages for strict mode
sql/share/korean/errmsg.txt:
New error messages for strict mode
sql/share/norwegian-ny/errmsg.txt:
New error messages for strict mode
sql/share/norwegian/errmsg.txt:
New error messages for strict mode
sql/share/polish/errmsg.txt:
New error messages for strict mode
sql/share/portuguese/errmsg.txt:
New error messages for strict mode
sql/share/romanian/errmsg.txt:
New error messages for strict mode
sql/share/russian/errmsg.txt:
New error messages for strict mode
sql/share/serbian/errmsg.txt:
New error messages for strict mode
sql/share/slovak/errmsg.txt:
New error messages for strict mode
sql/share/spanish/errmsg.txt:
New error messages for strict mode
sql/share/swedish/errmsg.txt:
New error messages for strict mode
sql/share/ukrainian/errmsg.txt:
New error messages for strict mode
sql/sp_rcontext.cc:
Add note/warning level to find_handler()
sql/sp_rcontext.h:
Add note/warning level to find_handler()
sql/sql_base.cc:
Fix bug for detecting crashed table
sql/sql_class.cc:
Variables for strct mode
sql/sql_class.h:
Variables for strct mode
sql/sql_error.cc:
In strict mode, convert warnings to errors
sql/sql_insert.cc:
Strict mode
If strict mode, give error if we have not given value to field without a default value
sql/sql_load.cc:
Strict mode
sql/sql_parse.cc:
Strict mode.
Add flag to field if it doesn't have a default value
sql/sql_select.cc:
Added comment
Prepare for upper level handling of table->status
sql/sql_union.cc:
Added THD to write_record()
sql/sql_update.cc:
Strict mode
sql/table.cc:
Handling of default values
sql/time.cc:
Checking of dates
Diffstat (limited to 'sql/mysql_priv.h')
-rw-r--r-- | sql/mysql_priv.h | 28 |
1 files changed, 18 insertions, 10 deletions
diff --git a/sql/mysql_priv.h b/sql/mysql_priv.h index 6ba76cf52b6..99474467065 100644 --- a/sql/mysql_priv.h +++ b/sql/mysql_priv.h @@ -266,13 +266,20 @@ extern CHARSET_INFO *national_charset_info, *table_alias_charset; #define MODE_DB2 2048 #define MODE_MAXDB 4096 #define MODE_NO_KEY_OPTIONS 8192 -#define MODE_NO_TABLE_OPTIONS 16384 -#define MODE_NO_FIELD_OPTIONS 32768 -#define MODE_MYSQL323 65536 -#define MODE_MYSQL40 (MODE_MYSQL323*2) -#define MODE_ANSI (MODE_MYSQL40*2) -#define MODE_NO_AUTO_VALUE_ON_ZERO (MODE_ANSI*2) -#define MODE_NO_BACKSLASH_ESCAPES (MODE_NO_AUTO_VALUE_ON_ZERO*2) +#define MODE_NO_TABLE_OPTIONS 16384 +#define MODE_NO_FIELD_OPTIONS 32768 +#define MODE_MYSQL323 65536 +#define MODE_MYSQL40 (MODE_MYSQL323*2) +#define MODE_ANSI (MODE_MYSQL40*2) +#define MODE_NO_AUTO_VALUE_ON_ZERO (MODE_ANSI*2) +#define MODE_NO_BACKSLASH_ESCAPES (MODE_NO_AUTO_VALUE_ON_ZERO*2) +#define MODE_STRICT_TRANS_TABLES (MODE_NO_BACKSLASH_ESCAPES*2) +#define MODE_STRICT_ALL_TABLES (MODE_STRICT_TRANS_TABLES*2) +#define MODE_NO_ZERO_IN_DATE (MODE_STRICT_ALL_TABLES*2) +#define MODE_NO_ZERO_DATE (MODE_NO_ZERO_IN_DATE*2) +#define MODE_INVALID_DATES (MODE_NO_ZERO_DATE*2) +#define MODE_ERROR_FOR_DIVISION_BY_ZERO (MODE_INVALID_DATES*2) +#define MODE_TRADITIONAL (MODE_ERROR_FOR_DIVISION_BY_ZERO*2) #define RAID_BLOCK_SIZE 1024 @@ -619,6 +626,7 @@ int mysql_prepare_insert(THD *thd, TABLE_LIST *table_list, TABLE *table, int mysql_insert(THD *thd,TABLE_LIST *table,List<Item> &fields, List<List_item> &values, List<Item> &update_fields, List<Item> &update_values, enum_duplicates flag); +int check_that_all_fields_are_given_values(THD *thd, TABLE *entry); int mysql_prepare_delete(THD *thd, TABLE_LIST *table_list, Item **conds); int mysql_delete(THD *thd, TABLE_LIST *table, COND *conds, SQL_LIST *order, ha_rows rows, ulong options); @@ -831,7 +839,7 @@ bool eval_const_cond(COND *cond); int mysql_load(THD *thd,sql_exchange *ex, TABLE_LIST *table_list, List<Item> &fields, enum enum_duplicates handle_duplicates, bool local_file,thr_lock_type lock_type); -int write_record(TABLE *table,COPY_INFO *info); +int write_record(THD *thd, TABLE *table, COPY_INFO *info); /* sql_manager.cc */ /* bits set in manager_status */ @@ -1082,7 +1090,6 @@ void free_blobs(TABLE *table); int set_zone(int nr,int min_zone,int max_zone); ulong convert_period_to_month(ulong period); ulong convert_month_to_period(ulong month); -uint calc_days_in_year(uint year); void get_date_from_daynr(long daynr,uint *year, uint *month, uint *day); my_time_t TIME_to_timestamp(THD *thd, const TIME *t, bool *not_exist); @@ -1095,7 +1102,8 @@ void localtime_to_TIME(TIME *to, struct tm *from); void calc_time_from_sec(TIME *to, long seconds, long microseconds); void make_truncated_value_warning(THD *thd, const char *str_val, - uint str_length, timestamp_type time_type); + uint str_length, timestamp_type time_type, + const char *field_name); extern DATE_TIME_FORMAT *date_time_format_make(timestamp_type format_type, const char *format_str, uint format_length); |