1
0
mirror of https://github.com/MariaDB/server.git synced 2025-07-30 16:24:05 +03:00

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.
This commit is contained in:
dlenev@jabberwock.localdomain
2004-04-02 10:12:53 +04:00
parent 4533338075
commit f6bff2e6c6
54 changed files with 686 additions and 178 deletions

View File

@ -120,7 +120,6 @@ int mysql_update(THD *thd,
{
timestamp_query_id=table->timestamp_field->query_id;
table->timestamp_field->query_id=thd->query_id-1;
table->time_stamp= table->timestamp_field->offset() +1;
}
/* Check the fields we are going to modify */
@ -133,7 +132,7 @@ int mysql_update(THD *thd,
{
// Don't set timestamp column if this is modified
if (table->timestamp_field->query_id == thd->query_id)
table->time_stamp=0;
table->timestamp_on_update_now= 0;
else
table->timestamp_field->query_id=timestamp_query_id;
}
@ -486,13 +485,11 @@ int mysql_multi_update(THD *thd,
/* We only need SELECT privilege for columns in the values list */
table->grant.want_privilege= (SELECT_ACL & ~table->grant.privilege);
if (table->timestamp_field)
{
table->time_stamp=0;
// Only set timestamp column if this is not modified
if (table->timestamp_field->query_id != thd->query_id)
table->time_stamp= table->timestamp_field->offset() +1;
}
// Only set timestamp column if this is not modified
if (table->timestamp_field &&
table->timestamp_field->query_id == thd->query_id)
table->timestamp_on_update_now= 0;
if (tl->derived)
derived_tables|= table->map;
}