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

Side by Side Diff: third_party/sqlite/src/test/tt3_index.c

Issue 1610963002: Import SQLite 3.10.2. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 11 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 /* 1 /*
2 ** 2014 December 9 2 ** 2014 December 9
3 ** 3 **
4 ** The author disclaims copyright to this source code. In place of 4 ** The author disclaims copyright to this source code. In place of
5 ** a legal notice, here is a blessing: 5 ** a legal notice, here is a blessing:
6 ** 6 **
7 ** May you do good and not evil. 7 ** May you do good and not evil.
8 ** May you find forgiveness for yourself and forgive others. 8 ** May you find forgiveness for yourself and forgive others.
9 ** May you share freely, never taking more than you give. 9 ** May you share freely, never taking more than you give.
10 ** 10 **
11 ************************************************************************* 11 *************************************************************************
12 ** 12 **
13 ** create_drop_index_1 13 ** create_drop_index_1
14 */ 14 */
15 15
16 16
17 static char *create_drop_index_thread(int iTid, int iArg){ 17 static char *create_drop_index_thread(int iTid, void *pArg){
18 Error err = {0}; /* Error code and message */ 18 Error err = {0}; /* Error code and message */
19 Sqlite db = {0}; /* SQLite database connection */ 19 Sqlite db = {0}; /* SQLite database connection */
20 20
21 while( !timetostop(&err) ){ 21 while( !timetostop(&err) ){
22 opendb(&err, &db, "test.db", 0); 22 opendb(&err, &db, "test.db", 0);
23 23
24 sql_script(&err, &db, 24 sql_script(&err, &db,
25
26 "DROP INDEX IF EXISTS i1;" 25 "DROP INDEX IF EXISTS i1;"
27 "DROP INDEX IF EXISTS i2;" 26 "DROP INDEX IF EXISTS i2;"
28 "DROP INDEX IF EXISTS i3;" 27 "DROP INDEX IF EXISTS i3;"
29 "DROP INDEX IF EXISTS i4;" 28 "DROP INDEX IF EXISTS i4;"
30 29
31 "CREATE INDEX IF NOT EXISTS i1 ON t1(a);" 30 "CREATE INDEX IF NOT EXISTS i1 ON t11(a);"
32 "CREATE INDEX IF NOT EXISTS i2 ON t1(b);" 31 "CREATE INDEX IF NOT EXISTS i2 ON t11(b);"
33 "CREATE INDEX IF NOT EXISTS i3 ON t1(c);" 32 "CREATE INDEX IF NOT EXISTS i3 ON t11(c);"
34 "CREATE INDEX IF NOT EXISTS i4 ON t1(d);" 33 "CREATE INDEX IF NOT EXISTS i4 ON t11(d);"
35 34
36 "SELECT * FROM t1 ORDER BY a;" 35 "SELECT * FROM t11 ORDER BY a;"
37 "SELECT * FROM t1 ORDER BY b;" 36 "SELECT * FROM t11 ORDER BY b;"
38 "SELECT * FROM t1 ORDER BY c;" 37 "SELECT * FROM t11 ORDER BY c;"
39 "SELECT * FROM t1 ORDER BY d;" 38 "SELECT * FROM t11 ORDER BY d;"
40 ); 39 );
40 clear_error(&err, SQLITE_LOCKED);
41 41
42 closedb(&err, &db); 42 closedb(&err, &db);
43 } 43 }
44 44
45 print_and_free_err(&err); 45 print_and_free_err(&err);
46 return sqlite3_mprintf("ok"); 46 return sqlite3_mprintf("ok");
47 } 47 }
48 48
49 static void create_drop_index_1(int nMs){ 49 static void create_drop_index_1(int nMs){
50 Error err = {0}; 50 Error err = {0};
51 Sqlite db = {0}; 51 Sqlite db = {0};
52 Threadset threads = {0}; 52 Threadset threads = {0};
53 53
54 opendb(&err, &db, "test.db", 1); 54 opendb(&err, &db, "test.db", 1);
55 sql_script(&err, &db, 55 sql_script(&err, &db,
56 "CREATE TABLE t1(a, b, c, d);" 56 "CREATE TABLE t11(a, b, c, d);"
57 "WITH data(x) AS (SELECT 1 UNION ALL SELECT x+1 FROM data WHERE x<100) " 57 "WITH data(x) AS (SELECT 1 UNION ALL SELECT x+1 FROM data WHERE x<100) "
58 "INSERT INTO t1 SELECT x,x,x,x FROM data;" 58 "INSERT INTO t11 SELECT x,x,x,x FROM data;"
59 ); 59 );
60 closedb(&err, &db); 60 closedb(&err, &db);
61 61
62 setstoptime(&err, nMs); 62 setstoptime(&err, nMs);
63 63
64 sqlite3_enable_shared_cache(1); 64 sqlite3_enable_shared_cache(1);
65 launch_thread(&err, &threads, create_drop_index_thread, 0); 65 launch_thread(&err, &threads, create_drop_index_thread, 0);
66 launch_thread(&err, &threads, create_drop_index_thread, 0); 66 launch_thread(&err, &threads, create_drop_index_thread, 0);
67 launch_thread(&err, &threads, create_drop_index_thread, 0); 67 launch_thread(&err, &threads, create_drop_index_thread, 0);
68 launch_thread(&err, &threads, create_drop_index_thread, 0); 68 launch_thread(&err, &threads, create_drop_index_thread, 0);
69 launch_thread(&err, &threads, create_drop_index_thread, 0); 69 launch_thread(&err, &threads, create_drop_index_thread, 0);
70 sqlite3_enable_shared_cache(0);
71 70
72 join_all_threads(&err, &threads); 71 join_all_threads(&err, &threads);
72 sqlite3_enable_shared_cache(0);
73 print_and_free_err(&err); 73 print_and_free_err(&err);
74 } 74 }
OLDNEW
« no previous file with comments | « third_party/sqlite/src/test/tt3_checkpoint.c ('k') | third_party/sqlite/src/test/tt3_lookaside1.c » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698