summaryrefslogtreecommitdiff
path: root/sql/ha_sequence.cc
diff options
context:
space:
mode:
authorMonty <monty@mariadb.org>2017-05-08 02:44:55 +0300
committerMonty <monty@mariadb.org>2017-05-08 02:44:55 +0300
commit71fa413c165e644f8f1433356f95fed12579fe3e (patch)
treef319474716dc55b3174fbf29a9dc510983d040a1 /sql/ha_sequence.cc
parent1e04ad284c6ac0a9ce433f827bc6dbfbd6029007 (diff)
downloadmariadb-git-71fa413c165e644f8f1433356f95fed12579fe3e.tar.gz
MDEV-10139 Support for SEQUENCE objects
- SETVAL(sequence_name, next_value, is_used, round) - ALTER SEQUENCE, including RESTART WITH Other things: - Added handler::extra() option HA_EXTRA_PREPARE_FOR_ALTER_TABLE to signal ha_sequence() that it should allow write_row statments. - ALTER ONLINE TABLE now works with SEQUENCE:s
Diffstat (limited to 'sql/ha_sequence.cc')
-rw-r--r--sql/ha_sequence.cc21
1 files changed, 20 insertions, 1 deletions
diff --git a/sql/ha_sequence.cc b/sql/ha_sequence.cc
index 5ff5a4eb213..a918da92be2 100644
--- a/sql/ha_sequence.cc
+++ b/sql/ha_sequence.cc
@@ -201,7 +201,7 @@ int ha_sequence::write_row(uchar *buf)
/*
User tries to write a row
- - Check that row is an accurate object
+ - Check that the new row is an accurate object
- Update the first row in the table
*/
@@ -290,6 +290,25 @@ int ha_sequence::info(uint flag)
DBUG_RETURN(false);
}
+
+int ha_sequence::extra(enum ha_extra_function operation)
+{
+ if (operation == HA_EXTRA_PREPARE_FOR_ALTER_TABLE)
+ {
+ /* In case of ALTER TABLE allow ::write_row() to copy rows */
+ sequence->initialized= SEQUENCE::SEQ_IN_PREPARE;
+ }
+ return file->extra(operation);
+}
+
+bool ha_sequence::check_if_incompatible_data(HA_CREATE_INFO *create_info,
+ uint table_changes)
+{
+ /* Table definition is locked for SEQUENCE tables */
+ return(COMPATIBLE_DATA_YES);
+}
+
+
int ha_sequence::external_lock(THD *thd, int lock_type)
{
int error= file->external_lock(thd, lock_type);