summaryrefslogtreecommitdiff
path: root/include/mysqld_error.h
diff options
context:
space:
mode:
authorunknown <dlenev@jabberwock.localdomain>2004-04-02 10:12:53 +0400
committerunknown <dlenev@jabberwock.localdomain>2004-04-02 10:12:53 +0400
commit32b28f92980ca2c057e61cb662f5c244e998d121 (patch)
tree9a60588328f7225c26e34d7cf0ce3ae4875c3523 /include/mysqld_error.h
parenta62a5fc9c0cef8d9f1ae685b43b6dc539d6fcfc8 (diff)
downloadmariadb-git-32b28f92980ca2c057e61cb662f5c244e998d121.tar.gz
WL#1266 "Separate auto-set logic from TIMESTAMP type."
Final version of patch. Adds support for specifying of DEFAULT NOW() and/or ON UPDATE NOW() clauses for TIMESTAMP field definition. Current implementation allows only one such field per table and uses several unireg types for storing info about this properties of field. It should be replaced with better implementation when new .frm format is introduced. include/mysqld_error.h: Added error codes for case when we have more than one column with NOW() in DEFAULT or ON UPDATE clauses and for case when we are using ON UPDATE clause with wrong type. mysql-test/r/create.result: Added tests for using of DEFAULT NOW() and ON UPDATE NOW() with non-TIMESTAMP fields. mysql-test/r/show_check.result: Updated test results to reflect new default look of TIMESTAMP fields in SHOW CREATE TABLE. mysql-test/r/system_mysql_db.result: Updated test results to reflect new default look of TIMESTAMP fields in SHOW CREATE TABLE. mysql-test/r/type_ranges.result: Updated test results to reflect new default look of TIMESTAMP fields in SHOW COLUMNS. mysql-test/r/type_timestamp.result: Added tests for various DEFAULT and ON UPDATE clauses for TIMESTAMP fields definitions. mysql-test/t/create.test: Added tests for using of DEFAULT NOW() and ON UPDATE NOW() with non-TIMESTAMP fields. mysql-test/t/type_timestamp.test: Added tests for various DEFAULT and ON UPDATE clauses for TIMESTAMP fields definitions. sql/field.cc: Added support for various combinations of DEFAULT and ON UPDATE clauses for TIMESTAMP field. Setting TABLE::timestamp* members for TIMESTAMP fields with auto-set option taking into account their unireg type (which corresponds to various DEFAULT/ON UPDATE values combinations). Replaced TABLE::time_stamp with TABLE::timestamp_default_now/on_update_now couple moved their setup to separate method set_timestamp_offsets(), which now is called from open_table instead of Field_timestamp cons. sql/field.h: Added more unireg types for handling of DEFAULT NOW() and ON UPDATE NOW() for TIMESTAMP fields. Fixed value corresponding to DEFAULT item for TIMESTAMP field. sql/ha_berkeley.cc: Now TIMESTAMP column with auto-set property could be updated during INSERT or/and UPDATE independently. sql/ha_heap.cc: Now TIMESTAMP column with auto-set property could be updated during INSERT or/and UPDATE independently. sql/ha_innodb.cc: Now TIMESTAMP column with auto-set property could be updated during INSERT or/and UPDATE independently. sql/ha_isam.cc: Now TIMESTAMP column with auto-set property could be updated during INSERT or/and UPDATE independently. sql/ha_isammrg.cc: Now TIMESTAMP column with auto-set property could be updated during INSERT or/and UPDATE independently. sql/ha_myisam.cc: Now TIMESTAMP column with auto-set property could be updated during INSERT or/and UPDATE independently. sql/ha_myisammrg.cc: Now TIMESTAMP column with auto-set property could be updated during INSERT or/and UPDATE independently. sql/item_func.h: We need to distinguish NOW() from other function for using in DEFAULT and in ON UPDATE clauses. sql/item_timefunc.h: We need to distinguish NOW() from other function for using in DEFAULT and in ON UPDATE clauses. sql/mysql_priv.h: Added parameter for ON UPDATE value to add_field_to_list() function. sql/share/czech/errmsg.txt: Added error messages for case when we have more than one column with NOW() (CURRENT_TIMESTAMP is just more standard alias) in DEFAULT or ON UPDATE clauses and for case when we are using ON UPDATE clause with wrong type. sql/share/danish/errmsg.txt: Added error messages for case when we have more than one column with NOW() (CURRENT_TIMESTAMP is just more standard alias) in DEFAULT or ON UPDATE clauses and for case when we are using ON UPDATE clause with wrong type. sql/share/dutch/errmsg.txt: Added error messages for case when we have more than one column with NOW() (CURRENT_TIMESTAMP is just more standard alias) in DEFAULT or ON UPDATE clauses and for case when we are using ON UPDATE clause with wrong type. sql/share/english/errmsg.txt: Added error messages for case when we have more than one column with NOW() (CURRENT_TIMESTAMP is just more standard alias) in DEFAULT or ON UPDATE clauses and for case when we are using ON UPDATE clause with wrong type. sql/share/estonian/errmsg.txt: Added error messages for case when we have more than one column with NOW() (CURRENT_TIMESTAMP is just more standard alias) in DEFAULT or ON UPDATE clauses and for case when we are using ON UPDATE clause with wrong type. sql/share/french/errmsg.txt: Added error messages for case when we have more than one column with NOW() (CURRENT_TIMESTAMP is just more standard alias) in DEFAULT or ON UPDATE clauses and for case when we are using ON UPDATE clause with wrong type. sql/share/german/errmsg.txt: Added error messages for case when we have more than one column with NOW() (CURRENT_TIMESTAMP is just more standard alias) in DEFAULT or ON UPDATE clauses and for case when we are using ON UPDATE clause with wrong type. sql/share/greek/errmsg.txt: Added error messages for case when we have more than one column with NOW() (CURRENT_TIMESTAMP is just more standard alias) in DEFAULT or ON UPDATE clauses and for case when we are using ON UPDATE clause with wrong type. sql/share/hungarian/errmsg.txt: Added error messages for case when we have more than one column with NOW() (CURRENT_TIMESTAMP is just more standard alias) in DEFAULT or ON UPDATE clauses and for case when we are using ON UPDATE clause with wrong type. sql/share/italian/errmsg.txt: Added error messages for case when we have more than one column with NOW() (CURRENT_TIMESTAMP is just more standard alias) in DEFAULT or ON UPDATE clauses and for case when we are using ON UPDATE clause with wrong type. sql/share/japanese/errmsg.txt: Added error messages for case when we have more than one column with NOW() (CURRENT_TIMESTAMP is just more standard alias) in DEFAULT or ON UPDATE clauses and for case when we are using ON UPDATE clause with wrong type. sql/share/korean/errmsg.txt: Added error messages for case when we have more than one column with NOW() (CURRENT_TIMESTAMP is just more standard alias) in DEFAULT or ON UPDATE clauses and for case when we are using ON UPDATE clause with wrong type. sql/share/norwegian-ny/errmsg.txt: Added error messages for case when we have more than one column with NOW() (CURRENT_TIMESTAMP is just more standard alias) in DEFAULT or ON UPDATE clauses and for case when we are using ON UPDATE clause with wrong type. sql/share/norwegian/errmsg.txt: Added error messages for case when we have more than one column with NOW() (CURRENT_TIMESTAMP is just more standard alias) in DEFAULT or ON UPDATE clauses and for case when we are using ON UPDATE clause with wrong type. sql/share/polish/errmsg.txt: Added error messages for case when we have more than one column with NOW() (CURRENT_TIMESTAMP is just more standard alias) in DEFAULT or ON UPDATE clauses and for case when we are using ON UPDATE clause with wrong type. sql/share/portuguese/errmsg.txt: Added error messages for case when we have more than one column with NOW() (CURRENT_TIMESTAMP is just more standard alias) in DEFAULT or ON UPDATE clauses and for case when we are using ON UPDATE clause with wrong type. sql/share/romanian/errmsg.txt: Added error messages for case when we have more than one column with NOW() (CURRENT_TIMESTAMP is just more standard alias) in DEFAULT or ON UPDATE clauses and for case when we are using ON UPDATE clause with wrong type. sql/share/russian/errmsg.txt: Added error messages for case when we have more than one column with NOW() (CURRENT_TIMESTAMP is just more standard alias) in DEFAULT or ON UPDATE clauses and for case when we are using ON UPDATE clause with wrong type. sql/share/serbian/errmsg.txt: Added error messages for case when we have more than one column with NOW() (CURRENT_TIMESTAMP is just more standard alias) in DEFAULT or ON UPDATE clauses and for case when we are using ON UPDATE clause with wrong type. sql/share/slovak/errmsg.txt: Added error messages for case when we have more than one column with NOW() (CURRENT_TIMESTAMP is just more standard alias) in DEFAULT or ON UPDATE clauses and for case when we are using ON UPDATE clause with wrong type. sql/share/spanish/errmsg.txt: Added error messages for case when we have more than one column with NOW() (CURRENT_TIMESTAMP is just more standard alias) in DEFAULT or ON UPDATE clauses and for case when we are using ON UPDATE clause with wrong type. sql/share/swedish/errmsg.txt: Added error messages for case when we have more than one column with NOW() (CURRENT_TIMESTAMP is just more standard alias) in DEFAULT or ON UPDATE clauses and for case when we are using ON UPDATE clause with wrong type. sql/share/ukrainian/errmsg.txt: Added error messages for case when we have more than one column with NOW() (CURRENT_TIMESTAMP is just more standard alias) in DEFAULT or ON UPDATE clauses and for case when we are using ON UPDATE clause with wrong type. sql/sql_base.cc: Added setup of TABLE::timestamp_default_now/on_update_now pair for each statement to open_table(). sql/sql_insert.cc: Using TABLE::timestamp_default_now/on_update_now pair instead of old TABLE::time_stamp. Added check for case then REPLACE could not be converted to UPDATE because of different DEFAULT/ON UPDATE values for TIMESTAMP field. sql/sql_lex.h: Added member for value used in ON UPDATE clause to st_lex. sql/sql_load.cc: Using TABLE::timestamp_default_now/on_update_now pair instead of old TABLE::time_stamp. We don't need to restore these members since they are set up for each statement in open_table(). sql/sql_parse.cc: Added handling of DEFAULT NOW() and ON UPDATE NOW() clauses for TIMESTAMP fields to add_field_to_list() function. sql/sql_show.cc: Added support for DEFAULT CURRENT_TIMESTAMP (aka NOW() ) and ON UPDATE CURRENT_TIMESTAMP to SHOW CREATE TABLE and SHOW COLUMNS. sql/sql_table.cc: mysql_create_table() function - added check for number of TIMESTAMP fields with auto-set values and replacing of old style TIMESTAMPs with their newer analogs. mysql_alter_table(): Using TABLE::timestamp_default_now/on_update_now pair instead of old TABLE::time_stamp. We don't need to restore these members since they are set up for each statement in open_table(). sql/sql_update.cc: Left only setting of TABLE::timestamp_default_now/on_update_now to 0 since they should be already set up in open_table(). sql/sql_yacc.yy: Added support for DEFAULT NOW() and ON UPDATE NOW() in field definitions. sql/table.h: Replaced TABLE::time_stamp withTABLE::timestamp_default_now/timestamp_on_update_now pair which allows to distinguish TIMESTAMP's with various DEFAULT/ON UPDATE clauses and optimize checks if TIMESTAMP field should be set to NOW() in handlers. sql/unireg.cc: Now we are marking only TIMESTAMP fields with NOW() as default or as on update value as special field for unireg.
Diffstat (limited to 'include/mysqld_error.h')
-rw-r--r--include/mysqld_error.h4
1 files changed, 3 insertions, 1 deletions
diff --git a/include/mysqld_error.h b/include/mysqld_error.h
index 77164e637cb..6ae6111a8bb 100644
--- a/include/mysqld_error.h
+++ b/include/mysqld_error.h
@@ -309,4 +309,6 @@
#define ER_OPTION_PREVENTS_STATEMENT 1290
#define ER_DUPLICATED_VALUE_IN_TYPE 1291
#define ER_TRUNCATED_WRONG_VALUE 1292
-#define ER_ERROR_MESSAGES 293
+#define ER_TOO_MUCH_AUTO_TIMESTAMP_COLS 1293
+#define ER_INVALID_ON_UPDATE 1294
+#define ER_ERROR_MESSAGES 295