New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Feature] SEQUENCE ENGINE #238
Conversation
xpchild07
commented
Jan 3, 2019
Summary: Description: ------------ SEQUENCE engine as an embedded logical engine, it mainly used to generate unique number, it is the middle layer engine that use InnoDB or other storage engine as the based table engine, All query on sequence table will be changed into the operation on based table. the cache or other sequence value management is decided by SEQUENCE engine handler. According to the setting which is defined by 'CREATE SEQUENCE ... ' or 'CREATE TABLE...Engine=Sequence + INSERT VALUES'. user can query the nextval or currval from sequence. In order to distinguish the normal SELECT statement, we supply two functions; 1. 'SELECT NEXTVAL FROM SEQUENCE' will return the based table record directly. 2. 'SELECT NEXTVAL(), CURRVAL()' will return the iterated record. Syntax: ------- CREATE SEQUENCE SYNTAX: CREATE SEQUENCE [IF NOT EXISTS] schema.sequence_name [START WITH <constant>] [MINVALUE <constant>] [MAXVALUE <constant>] [INCREMENT BY <constant>] [CACHE <constant> | NOCACHE] [CYCLE | NOCYCLE] ; OR: CREATE TABLE schema.sequence_name ( `currval` bigint(21) NOT NULL COMMENT 'current value', `nextval` bigint(21) NOT NULL COMMENT 'next value', `minvalue` bigint(21) NOT NULL COMMENT 'min value', `maxvalue` bigint(21) NOT NULL COMMENT 'max value', `start` bigint(21) NOT NULL COMMENT 'start value', `increment` bigint(21) NOT NULL COMMENT 'increment value', `cache` bigint(21) NOT NULL COMMENT 'cache size', `cycle` bigint(21) NOT NULL COMMENT 'cycle state', `round` bigint(21) NOT NULL COMMENT 'already how many round' ) ENGINE=Sequence DEFAULT CHARSET=latin1 INSERT INTO schema.sequence_name VALUES(0,0,1,9223372036854775807,1,1,10000,1,0); COMMIT; Strongly recommend the first CREATE SEQUENCE syntax. SHOW SYNTAX: SHOW CREATE TABLE schema.sequence_name; QUERY SYNTAX: SELECT [nextval | currval | *] FROM schema.sequence_name; Usage: ------ FOR EXAMPLE: CREATE SEQUENCE s; INSERT INTO t VALUES(NEXTVAL(s));
Hi, thank you for submitting this pull request. In order to consider your code we need you to sign the Oracle Contribution Agreement (OCA). Please review the details and follow the instructions at http://www.oracle.com/technetwork/community/oca-486395.html |
Hi, I has signed the OCA, MySQL bug system user: xpchild07@gmail.com |
@xpchild07 thanks for your contribution - OCA processing is delayed a bit due to the holidays - we should catch up next week |
Hi, thank you for your contribution. Please confirm this code is submitted under the terms of the OCA (Oracle's Contribution Agreement) you have previously signed by cutting and pasting the following text as a comment: |
Hi, I confirm the code being submitted is offered under the terms of the OCA, and that I am authorized to contribute it. |
Hi, thank you for your contribution. Your code has been assigned to an internal queue. Please follow |
@xpchild07: Note this is tracked in a different bug - not the one you submitted (because of the change in the OCA). Thanks for your contribution |