mirror of
https://github.com/MariaDB/server.git
synced 2025-07-30 16:24:05 +03:00
sql_show.cc, handler.h, handler.cc:
Add foreign key defs to SHOW CREATE TABLE
This commit is contained in:
@ -260,13 +260,13 @@ int ha_autocommit_or_rollback(THD *thd, int error)
|
|||||||
/*
|
/*
|
||||||
This function is called when MySQL writes the log segment of a
|
This function is called when MySQL writes the log segment of a
|
||||||
transaction to the binlog. It is called when the LOCK_log mutex is
|
transaction to the binlog. It is called when the LOCK_log mutex is
|
||||||
reserved. Here we communicate to transactional table handlers whta
|
reserved. Here we communicate to transactional table handlers what
|
||||||
binlog position corresponds to the current transaction. The handler
|
binlog position corresponds to the current transaction. The handler
|
||||||
can store it and in recovery print to the user, so that the user
|
can store it and in recovery print to the user, so that the user
|
||||||
knows from what position in the binlog to start possible
|
knows from what position in the binlog to start possible
|
||||||
roll-forward, for example, if the crashed server was a slave in
|
roll-forward, for example, if the crashed server was a slave in
|
||||||
replication. This function also calls the commit of the table
|
replication. This function also calls the commit of the table
|
||||||
handler, because the order of trasnactions in the log of the table
|
handler, because the order of transactions in the log of the table
|
||||||
handler must be the same as in the binlog.
|
handler must be the same as in the binlog.
|
||||||
|
|
||||||
arguments:
|
arguments:
|
||||||
@ -298,7 +298,6 @@ int ha_report_binlog_offset_and_commit(THD *thd,
|
|||||||
return error;
|
return error;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int ha_commit_trans(THD *thd, THD_TRANS* trans)
|
int ha_commit_trans(THD *thd, THD_TRANS* trans)
|
||||||
{
|
{
|
||||||
int error=0;
|
int error=0;
|
||||||
|
@ -294,7 +294,9 @@ public:
|
|||||||
virtual char *update_table_comment(const char * comment)
|
virtual char *update_table_comment(const char * comment)
|
||||||
{ return (char*) comment;}
|
{ return (char*) comment;}
|
||||||
virtual void append_create_info(String *packet) {}
|
virtual void append_create_info(String *packet) {}
|
||||||
|
virtual char* get_foreign_key_create_info()
|
||||||
|
{ return(NULL);} /* gets foreign key create string from InnoDB */
|
||||||
|
virtual void free_foreign_key_create_info(char* str) {}
|
||||||
/* The following can be called without an open handler */
|
/* The following can be called without an open handler */
|
||||||
virtual const char *table_type() const =0;
|
virtual const char *table_type() const =0;
|
||||||
virtual const char **bas_ext() const =0;
|
virtual const char **bas_ext() const =0;
|
||||||
|
@ -889,9 +889,21 @@ store_create_info(THD *thd, TABLE *table, String *packet)
|
|||||||
}
|
}
|
||||||
packet->append(')');
|
packet->append(')');
|
||||||
}
|
}
|
||||||
packet->append("\n)", 2);
|
|
||||||
|
|
||||||
handler *file = table->file;
|
handler *file = table->file;
|
||||||
|
|
||||||
|
/* Get possible foreign key definitions stored in InnoDB and append them
|
||||||
|
to the CREATE TABLE statement */
|
||||||
|
|
||||||
|
char* for_str = file->get_foreign_key_create_info();
|
||||||
|
|
||||||
|
if (for_str) {
|
||||||
|
packet->append(for_str, strlen(for_str));
|
||||||
|
|
||||||
|
file->free_foreign_key_create_info(for_str);
|
||||||
|
}
|
||||||
|
|
||||||
|
packet->append("\n)", 2);
|
||||||
packet->append(" TYPE=", 6);
|
packet->append(" TYPE=", 6);
|
||||||
packet->append(file->table_type());
|
packet->append(file->table_type());
|
||||||
char buff[128];
|
char buff[128];
|
||||||
|
Reference in New Issue
Block a user