Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(515)

Side by Side Diff: third_party/sqlite/src/test/autoinc.test

Issue 901033002: Import SQLite 3.8.7.4. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Chromium changes to support SQLite 3.8.7.4. Created 5 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 # 2004 November 12 1 # 2004 November 12
2 # 2 #
3 # The author disclaims copyright to this source code. In place of 3 # The author disclaims copyright to this source code. In place of
4 # a legal notice, here is a blessing: 4 # a legal notice, here is a blessing:
5 # 5 #
6 # May you do good and not evil. 6 # May you do good and not evil.
7 # May you find forgiveness for yourself and forgive others. 7 # May you find forgiveness for yourself and forgive others.
8 # May you share freely, never taking more than you give. 8 # May you share freely, never taking more than you give.
9 # 9 #
10 #************************************************************************* 10 #*************************************************************************
(...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after
209 SELECT * FROM t1; 209 SELECT * FROM t1;
210 } 210 }
211 } {235 1 1235 2 1236 3 1237 4 1238 5} 211 } {235 1 1235 2 1236 3 1237 4 1238 5}
212 do_test autoinc-2.27 { 212 do_test autoinc-2.27 {
213 execsql { 213 execsql {
214 SELECT * FROM sqlite_sequence; 214 SELECT * FROM sqlite_sequence;
215 } 215 }
216 } {t1 1238} 216 } {t1 1238}
217 do_test autoinc-2.28 { 217 do_test autoinc-2.28 {
218 execsql { 218 execsql {
219 UPDATE sqlite_sequence SET seq='12345678901234567890' 219 UPDATE sqlite_sequence SET seq='-12345678901234567890'
220 WHERE name='t1'; 220 WHERE name='t1';
221 INSERT INTO t1 VALUES(NULL,6); 221 INSERT INTO t1 VALUES(NULL,6);
222 SELECT * FROM t1; 222 SELECT * FROM t1;
223 } 223 }
224 } {235 1 1235 2 1236 3 1237 4 1238 5 1239 6} 224 } {235 1 1235 2 1236 3 1237 4 1238 5 1239 6}
225 do_test autoinc-2.29 { 225 do_test autoinc-2.29 {
226 execsql { 226 execsql {
227 SELECT * FROM sqlite_sequence; 227 SELECT * FROM sqlite_sequence;
228 } 228 }
229 } {t1 1239} 229 } {t1 1239}
(...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after
420 SELECT 1, * FROM main.sqlite_sequence; 420 SELECT 1, * FROM main.sqlite_sequence;
421 SELECT 2, * FROM temp.sqlite_sequence; 421 SELECT 2, * FROM temp.sqlite_sequence;
422 } 422 }
423 } {} 423 } {}
424 } 424 }
425 425
426 # Make sure AUTOINCREMENT works on ATTACH-ed tables. 426 # Make sure AUTOINCREMENT works on ATTACH-ed tables.
427 # 427 #
428 ifcapable tempdb&&attach { 428 ifcapable tempdb&&attach {
429 do_test autoinc-5.1 { 429 do_test autoinc-5.1 {
430 file delete -force test2.db 430 forcedelete test2.db
431 file delete -force test2.db-journal 431 forcedelete test2.db-journal
432 sqlite3 db2 test2.db 432 sqlite3 db2 test2.db
433 execsql { 433 execsql {
434 CREATE TABLE t4(m INTEGER PRIMARY KEY AUTOINCREMENT, n); 434 CREATE TABLE t4(m INTEGER PRIMARY KEY AUTOINCREMENT, n);
435 CREATE TABLE t5(o, p INTEGER PRIMARY KEY AUTOINCREMENT); 435 CREATE TABLE t5(o, p INTEGER PRIMARY KEY AUTOINCREMENT);
436 } db2; 436 } db2;
437 execsql { 437 execsql {
438 ATTACH 'test2.db' as aux; 438 ATTACH 'test2.db' as aux;
439 SELECT 1, * FROM main.sqlite_sequence; 439 SELECT 1, * FROM main.sqlite_sequence;
440 SELECT 2, * FROM temp.sqlite_sequence; 440 SELECT 2, * FROM temp.sqlite_sequence;
441 SELECT 3, * FROM aux.sqlite_sequence; 441 SELECT 3, * FROM aux.sqlite_sequence;
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
513 } 513 }
514 } {1 {AUTOINCREMENT is only allowed on an INTEGER PRIMARY KEY}} 514 } {1 {AUTOINCREMENT is only allowed on an INTEGER PRIMARY KEY}}
515 515
516 516
517 # Ticket #1283. Make sure that preparing but never running a statement 517 # Ticket #1283. Make sure that preparing but never running a statement
518 # that creates the sqlite_sequence table does not mess up the database. 518 # that creates the sqlite_sequence table does not mess up the database.
519 # 519 #
520 do_test autoinc-8.1 { 520 do_test autoinc-8.1 {
521 catch {db2 close} 521 catch {db2 close}
522 catch {db close} 522 catch {db close}
523 file delete -force test.db 523 forcedelete test.db
524 sqlite3 db test.db 524 sqlite3 db test.db
525 set DB [sqlite3_connection_pointer db] 525 set DB [sqlite3_connection_pointer db]
526 set STMT [sqlite3_prepare $DB { 526 set STMT [sqlite3_prepare $DB {
527 CREATE TABLE t1( 527 CREATE TABLE t1(
528 x INTEGER PRIMARY KEY AUTOINCREMENT 528 x INTEGER PRIMARY KEY AUTOINCREMENT
529 ) 529 )
530 } -1 TAIL] 530 } -1 TAIL]
531 sqlite3_finalize $STMT 531 sqlite3_finalize $STMT
532 set STMT [sqlite3_prepare $DB { 532 set STMT [sqlite3_prepare $DB {
533 CREATE TABLE t1( 533 CREATE TABLE t1(
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after
659 END; 659 END;
660 INSERT INTO va69637_2 VALUES(123); 660 INSERT INTO va69637_2 VALUES(123);
661 SELECT * FROM ta69637_1; 661 SELECT * FROM ta69637_1;
662 } 662 }
663 } {1 124 2 10123} 663 } {1 124 2 10123}
664 } 664 }
665 665
666 666
667 667
668 finish_test 668 finish_test
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698