mirror of
https://github.com/MariaDB/server.git
synced 2025-07-27 18:02:13 +03:00
Merged with lp:maria revision #3766
This commit is contained in:
@ -1,5 +1,5 @@
|
||||
/*
|
||||
Copyright (c) 2000, 2012, Oracle and/or its affiliates.
|
||||
Copyright (c) 2000, 2013, Oracle and/or its affiliates.
|
||||
Copyright (c) 2010, 2013, Monty Program Ab.
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
@ -53,6 +53,7 @@
|
||||
#include "sql_parse.h"
|
||||
#include "sql_show.h"
|
||||
#include "transaction.h"
|
||||
#include "sql_audit.h"
|
||||
|
||||
#ifdef __WIN__
|
||||
#include <io.h>
|
||||
@ -1690,7 +1691,8 @@ bool mysql_write_frm(ALTER_PARTITION_PARAM_TYPE *lpt, uint flags)
|
||||
&syntax_len,
|
||||
TRUE, TRUE,
|
||||
lpt->create_info,
|
||||
lpt->alter_info)))
|
||||
lpt->alter_info,
|
||||
NULL)))
|
||||
{
|
||||
DBUG_RETURN(TRUE);
|
||||
}
|
||||
@ -1793,7 +1795,8 @@ bool mysql_write_frm(ALTER_PARTITION_PARAM_TYPE *lpt, uint flags)
|
||||
&syntax_len,
|
||||
TRUE, TRUE,
|
||||
lpt->create_info,
|
||||
lpt->alter_info)))
|
||||
lpt->alter_info,
|
||||
NULL)))
|
||||
{
|
||||
error= 1;
|
||||
goto err;
|
||||
@ -2379,6 +2382,7 @@ int mysql_rm_table_no_locks(THD *thd, TABLE_LIST *tables, bool if_exists,
|
||||
PSI_CALL_drop_table_share(table->internal_tmp_table,
|
||||
table->db, table->db_length,
|
||||
table->table_name, table->table_name_length);
|
||||
mysql_audit_drop_table(thd, table);
|
||||
}
|
||||
|
||||
DBUG_PRINT("table", ("table: 0x%lx s: 0x%lx", (long) table->table,
|
||||
@ -2786,6 +2790,8 @@ int prepare_create_field(Create_field *sql_field,
|
||||
case MYSQL_TYPE_NEWDATE:
|
||||
case MYSQL_TYPE_TIME:
|
||||
case MYSQL_TYPE_DATETIME:
|
||||
case MYSQL_TYPE_TIME2:
|
||||
case MYSQL_TYPE_DATETIME2:
|
||||
case MYSQL_TYPE_NULL:
|
||||
sql_field->pack_flag=f_settype((uint) sql_field->sql_type);
|
||||
break;
|
||||
@ -2804,6 +2810,7 @@ int prepare_create_field(Create_field *sql_field,
|
||||
(sql_field->decimals << FIELDFLAG_DEC_SHIFT));
|
||||
break;
|
||||
case MYSQL_TYPE_TIMESTAMP:
|
||||
case MYSQL_TYPE_TIMESTAMP2:
|
||||
/* fall-through */
|
||||
default:
|
||||
sql_field->pack_flag=(FIELDFLAG_NUMBER |
|
||||
@ -2889,7 +2896,7 @@ void promote_first_timestamp_column(List<Create_field> *column_definitions)
|
||||
|
||||
while ((column_definition= it++) != NULL)
|
||||
{
|
||||
if (column_definition->sql_type == MYSQL_TYPE_TIMESTAMP || // TIMESTAMP
|
||||
if (is_timestamp_type(column_definition->sql_type) || // TIMESTAMP
|
||||
column_definition->unireg_check == Field::TIMESTAMP_OLD_FIELD) // Legacy
|
||||
{
|
||||
if ((column_definition->flags & NOT_NULL_FLAG) != 0 && // NOT NULL,
|
||||
@ -3850,7 +3857,7 @@ mysql_prepare_create_table(THD *thd, HA_CREATE_INFO *create_info,
|
||||
|
||||
if (thd->variables.sql_mode & MODE_NO_ZERO_DATE &&
|
||||
!sql_field->def &&
|
||||
sql_field->sql_type == MYSQL_TYPE_TIMESTAMP &&
|
||||
is_timestamp_type(sql_field->sql_type) &&
|
||||
(sql_field->flags & NOT_NULL_FLAG) &&
|
||||
(type == Field::NONE || type == Field::TIMESTAMP_UN_FIELD))
|
||||
{
|
||||
@ -4206,7 +4213,8 @@ handler *mysql_create_frm_image(THD *thd,
|
||||
&syntax_len,
|
||||
TRUE, TRUE,
|
||||
create_info,
|
||||
alter_info)))
|
||||
alter_info,
|
||||
NULL)))
|
||||
goto err;
|
||||
part_info->part_info_string= part_syntax_buf;
|
||||
part_info->part_info_len= syntax_len;
|
||||
@ -4688,6 +4696,8 @@ mysql_rename_table(handlerton *base, const char *old_db,
|
||||
my_error(ER_NOT_SUPPORTED_YET, MYF(0), "ALTER TABLE");
|
||||
else if (error)
|
||||
my_error(ER_ERROR_ON_RENAME, MYF(0), from, to, error);
|
||||
else if (!(flags & FN_IS_TMP))
|
||||
mysql_audit_rename_table(thd, old_db, old_name, new_db, new_name);
|
||||
|
||||
/*
|
||||
Remove the old table share from the pfs table share array. The new table
|
||||
@ -5943,7 +5953,8 @@ mysql_prepare_alter_table(THD *thd, TABLE *table,
|
||||
*/
|
||||
if ((def->sql_type == MYSQL_TYPE_DATE ||
|
||||
def->sql_type == MYSQL_TYPE_NEWDATE ||
|
||||
def->sql_type == MYSQL_TYPE_DATETIME) &&
|
||||
def->sql_type == MYSQL_TYPE_DATETIME ||
|
||||
def->sql_type == MYSQL_TYPE_DATETIME2) &&
|
||||
!alter_info->datetime_field &&
|
||||
!(~def->flags & (NO_DEFAULT_VALUE_FLAG | NOT_NULL_FLAG)) &&
|
||||
thd->variables.sql_mode & MODE_NO_ZERO_DATE)
|
||||
@ -6355,6 +6366,8 @@ bool mysql_alter_table(THD *thd,char *new_db, char *new_name,
|
||||
|
||||
mysql_ha_rm_tables(thd, table_list);
|
||||
|
||||
mysql_audit_alter_table(thd, table_list);
|
||||
|
||||
/* DISCARD/IMPORT TABLESPACE is always alone in an ALTER TABLE */
|
||||
if (alter_info->tablespace_op != NO_TABLESPACE_OP)
|
||||
/* Conditionally writes to binlog. */
|
||||
@ -7579,6 +7592,7 @@ err:
|
||||
t_type= MYSQL_TIMESTAMP_DATE;
|
||||
break;
|
||||
case MYSQL_TYPE_DATETIME:
|
||||
case MYSQL_TYPE_DATETIME2:
|
||||
f_val= "0000-00-00 00:00:00";
|
||||
t_type= MYSQL_TIMESTAMP_DATETIME;
|
||||
break;
|
||||
|
Reference in New Issue
Block a user