File tree Expand file tree Collapse file tree 1 file changed +10
-1
lines changed Expand file tree Collapse file tree 1 file changed +10
-1
lines changed Original file line number Diff line number Diff line change @@ -647,7 +647,7 @@ def connect *args
647
647
context 'write operations api' do
648
648
before ( :each ) do
649
649
@client . query "USE test"
650
- @client . query "CREATE TABLE IF NOT EXISTS lastIdTest (`id` int(11) NOT NULL AUTO_INCREMENT, blah INT(11), PRIMARY KEY (`id`))"
650
+ @client . query "CREATE TABLE IF NOT EXISTS lastIdTest (`id` BIGINT NOT NULL AUTO_INCREMENT, blah INT(11), PRIMARY KEY (`id`))"
651
651
end
652
652
653
653
after ( :each ) do
@@ -674,6 +674,15 @@ def connect *args
674
674
@client . query "UPDATE lastIdTest SET blah=4321 WHERE id=1"
675
675
@client . affected_rows . should eql ( 1 )
676
676
end
677
+
678
+ it "#last_id should handle BIGINT auto-increment ids above 32 bits" do
679
+ # The id column type must be BIGINT. Surprise: INT(x) is limited to 32-bits for all values of x.
680
+ # Insert a row with a given ID, this should raise the auto-increment state
681
+ @client . query "INSERT INTO lastIdTest (id, blah) VALUES (5000000000, 5000)"
682
+ @client . last_id . should eql ( 5000000000 )
683
+ @client . query "INSERT INTO lastIdTest (blah) VALUES (5001)"
684
+ @client . last_id . should eql ( 5000000001 )
685
+ end
677
686
end
678
687
679
688
it "should respond to #thread_id" do
You can’t perform that action at this time.
0 commit comments