Last active
August 29, 2015 14:07
-
-
Save sholden/325df262310e33f1877c to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
drop table if exists shard_seq_tbl; | |
create table shard_seq_tbl ( nextval bigint not null primary key auto_increment ) engine = MyISAM; | |
alter table shard_seq_tbl AUTO_INCREMENT = 10000; | |
drop function if exists shard_nextval; | |
DELIMITER // | |
create function shard_nextval() | |
RETURNS bigint NOT DETERMINISTIC | |
begin | |
insert into shard_seq_tbl values (NULL) ; | |
set @R_ObjectId_val=LAST_INSERT_ID() ; | |
delete from shard_seq_tbl ; | |
return @R_ObjectId_val ; | |
end // | |
DELIMITER ; | |
drop function if exists now_msec; | |
CREATE FUNCTION now_msec RETURNS STRING SONAME "now_msec.so" ; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment