Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
Comment: | Disable connection pooling in SQLITE_HAS_CODEC builds. Add a test for the same. |
---|---|
Downloads: | Tarball | ZIP archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA1: |
954e5a58f1053f74907ada990bd0e8e6 |
User & Date: | dan 2013-12-26 17:31:07.136 |
Context
2013-12-26
| ||
18:29 | Re-enable logging in CloseGuard.java. (check-in: 6e0a73af53 user: dan tags: trunk) | |
17:31 | Disable connection pooling in SQLITE_HAS_CODEC builds. Add a test for the same. (check-in: 954e5a58f1 user: dan tags: trunk) | |
2013-12-25
| ||
19:13 | Do not automatically delete database files in SEE-enabled builds. (check-in: c45018804a user: dan tags: trunk) | |
Changes
Changes to src/org/sqlite/app/customsqlite/CustomSqlite.java.
︙ | ︙ | |||
123 124 125 126 127 128 129 130 131 132 133 134 135 136 | t.start(); try { t.join(); } catch (InterruptedException e) { } } /* ** Use a Cursor to loop through the results of a SELECT query. */ public void csr_test_1() throws Exception { SQLiteDatabase.deleteDatabase(DB_PATH); SQLiteDatabase db = SQLiteDatabase.openOrCreateDatabase(DB_PATH, null); | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 | t.start(); try { t.join(); } catch (InterruptedException e) { } } /* ** Test that a database connection may be accessed from a second thread. */ public void thread_test_2(){ SQLiteDatabase.deleteDatabase(DB_PATH); final SQLiteDatabase db = SQLiteDatabase.openOrCreateDatabase(DB_PATH, null); db.execSQL("CREATE TABLE t1(x, y)"); db.execSQL("INSERT INTO t1 VALUES (1, 2), (3, 4)"); db.enableWriteAheadLogging(); db.beginTransactionNonExclusive(); db.execSQL("INSERT INTO t1 VALUES (5, 6)"); Thread t = new Thread( new Runnable() { public void run() { SQLiteStatement st = db.compileStatement("SELECT sum(x+y) FROM t1"); String res = st.simpleQueryForString(); } }); t.start(); String res = "concurrent"; int i; for(i=0; i<20 && t.isAlive(); i++){ try { Thread.sleep(100); } catch(InterruptedException e) {} } if( t.isAlive() ){ res = "blocked"; } db.endTransaction(); try { t.join(); } catch(InterruptedException e) {} if( SQLiteDatabase.hasCodec() ){ test_result("thread_test_2", res, "blocked"); } else { test_result("thread_test_2", res, "concurrent"); } } /* ** Use a Cursor to loop through the results of a SELECT query. */ public void csr_test_1() throws Exception { SQLiteDatabase.deleteDatabase(DB_PATH); SQLiteDatabase db = SQLiteDatabase.openOrCreateDatabase(DB_PATH, null); |
︙ | ︙ | |||
269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 | myNErr = 0; myNTest = 0; try { report_version(); csr_test_1(); thread_test_1(); see_test_1(); see_test_2(); myTV.append("\n" + myNErr + " errors from " + myNTest + " tests\n"); } catch(Exception e) { myTV.append("Exception: " + e.toString() + "\n"); myTV.append(android.util.Log.getStackTraceString(e) + "\n"); } } } | > | 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 | myNErr = 0; myNTest = 0; try { report_version(); csr_test_1(); thread_test_1(); thread_test_2(); see_test_1(); see_test_2(); myTV.append("\n" + myNErr + " errors from " + myNTest + " tests\n"); } catch(Exception e) { myTV.append("Exception: " + e.toString() + "\n"); myTV.append(android.util.Log.getStackTraceString(e) + "\n"); } } } |
Changes to src/org/sqlite/database/sqlite/SQLiteConnectionPool.java.
︙ | ︙ | |||
942 943 944 945 946 947 948 | } private static int getPriority(int connectionFlags) { return (connectionFlags & CONNECTION_FLAG_INTERACTIVE) != 0 ? 1 : 0; } private void setMaxConnectionPoolSizeLocked() { | > | > | 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 | } private static int getPriority(int connectionFlags) { return (connectionFlags & CONNECTION_FLAG_INTERACTIVE) != 0 ? 1 : 0; } private void setMaxConnectionPoolSizeLocked() { if( !SQLiteDatabase.hasCodec() && (mConfiguration.openFlags & SQLiteDatabase.ENABLE_WRITE_AHEAD_LOGGING) != 0 ) { mMaxConnectionPoolSize = SQLiteGlobal.getWALConnectionPoolSize(); } else { // TODO: We don't actually need to restrict the connection pool size to 1 // for non-WAL databases. There might be reasons to use connection pooling // with other journal modes. For now, enabling connection pooling and // using WAL are the same thing in the API. mMaxConnectionPoolSize = 1; |
︙ | ︙ |