Commit Graph

151 Commits

Author SHA1 Message Date
The Android Open Source Project
7701041955 am 7e343b8d: merge from froyo-plus-aosp
Merge commit '7e343b8d39309d2c9d73cc5d1ec2434e666ae48b'

* commit '7e343b8d39309d2c9d73cc5d1ec2434e666ae48b':
  fillWindow's start position must be smaller than getCount value
2010-06-25 14:22:06 -07:00
The Android Open Source Project
7e343b8d39 merge from froyo-plus-aosp
Change-Id: Ic1d0535cb746af0c53a5277b008061f7a2d973a2
2010-06-25 11:20:45 -07:00
Vasu Nori
6188c2746d remove some not-so-useful-logging
the sql statement is already printed if SqlStatements is set to VERBOSE
anyway. so no need for this extra logging
Change-Id: Id0e6c5acbbbd453ea45f08bcb802213bc22896fc
2010-06-25 11:10:54 -07:00
Dianne Hackborn
36e5f667bc resolved conflicts for merge of 2eb12a47 to master
Change-Id: I79eb9d9f083e51ec1b99145d81632683669e7a99
2010-06-24 16:29:54 -07:00
Dianne Hackborn
01e4cfc47d Some ActivityThread/ActivityManager cleanup.
- Move PackageInfo out of ActivityThread, renaming to LoadedApk.
- Rename some of the other PacakgeInfo inner classes to better
  represent what they are.
- Rename HistoryRecord to ActivityRecord.
- Introduce AppGlobals, to eventually let ActivityThread become
  package scoped.

Change-Id: Ib714c54ceb3cdbb525dce3db9505f31042e88cf0
2010-06-24 15:20:48 -07:00
Vasu Nori
8d1110383d if attach database sql statement is exec'ed, disable write WAL
an app can execute 'attach database..' statement anytime after WAL is
enabled. since WAL doesn't work with atatched databases,
disable WAL whenever the caller executes 'attach database'
sql statement.

Change-Id: I77dfcb744b59476c357d44296c14d63455985a7b
2010-06-22 18:34:21 -07:00
Vasu Nori
a98cb2632d for memory databases, don't set journal_mode and don't allow WAL
WAL and journal_mode are not applicable to memory databases

Change-Id: I06fcbfe9ce76878c57d1542efe9cc060598262ff
2010-06-22 15:52:12 -07:00
Vasu Nori
5666170c1e when corruption occurs, not clsing the db is casuing stack overflow
due to a bug in DefaultDatabaseErrorHandler, if the corruption is
so bad that the list of attached databases can't even be retrieved,
then database is not closed in DefaultDatabaseErrorHandler,
this causes the corrupted file to remain on disk.
this causes corruption detection to occur forever until the stack
overflows.

Change-Id: I9896bee220231cbde0b1620ad0a617420424967c
2010-06-22 12:22:31 -07:00
Andrew Stadler
359cf08fb6 Merge "Add getWrappedCursor, and update the JavaDoc." 2010-06-21 11:35:51 -07:00
Vasu Nori
194897da94 journal_mode should be set only on non-memory databases
setting journal_mode to TRUNCATE on memory databases causes an error message
to be displayed by SQLIteDatabase.

Change-Id: Ie8b8ae22cb9fba99cee59dba35b260195c63eadc
2010-06-21 10:41:14 -07:00
Andrew Stadler
46baf533f5 Add getWrappedCursor, and update the JavaDoc.
Change-Id: I7d0513056b4d83b457374d783465fe848b7e530c
2010-06-21 10:23:52 -07:00
The Android Open Source Project
e5a023bfbb merge from open-source master
Change-Id: I8e7ccd470e8b90347686985aa2d8337d0c38900c
2010-06-18 12:40:42 -07:00
Vasu Nori
daa4e4faff throw correct exception
when an argument is incorrect, throw IllegalArgumentException
not IllegalStateException

Change-Id: I9a33410617ab6a00147c3ab2010ed31251983329
2010-06-15 11:32:27 -07:00
Vasu Nori
d127fb69ae Merge "fix bugs introduced by I3ef1bcdb2eb1c45f68e829ccb6e3ecde28076591" 2010-06-14 17:11:20 -07:00
Vasu Nori
ad239ab8fa when closing db, close all pending statements also
Change-Id: Ia543933e0cd70852c4e60623de698bb51b976900
2010-06-14 16:58:47 -07:00
Vasu Nori
0a2c6cc013 fix bugs introduced by I3ef1bcdb2eb1c45f68e829ccb6e3ecde28076591
two bugs were introduced by the above CL
1. to test if the column value is NULL, getType_native() should check if
the columnindiex is valid. (it seems sometimes callers could ask if a
given non-existent column is null - and the answer should be true.)
2. if a column is null and isBlob_native, isString_native methods should
return true - not false.

Change-Id: I64df75d0a3840a4502c00db8759c66ba4b268a26
2010-06-14 15:57:30 -07:00
Vasu Nori
6c354da943 read old version of data and use multiple connections to db
cts tests are in Change-Id: Ifcc89b4ff484c7c810fd2d450ded212a43360dda
dependency on: Change-Id: I938c42afc3fb50f5296d01c55ffcf4a102d8b0cb

1. Use sqlite's work-in-progress writeahead logging feature to read old
     versions of data and thus increase concurrency of readers
     even when there is a writer on the database
2. New API executeQueriesInParallel() sets up a database connecion pool
     automatically created and managed by sqlite java layer
3. To increase reader concurrency, add an option to do BEGIN IMMEDIATE xaction
     instead of BEGIN EXCLUSIVE

Change-Id: I3ce55a8a7cba538f01f731736e7de8ae1e2a8a1f
2010-06-14 14:50:03 -07:00
Vasu Nori
49686ea3ed NPE in database corruption handler if attached database list is null
sometimes the database can be so corrupt that it cannot even be queried
for attached database list.

Change-Id: Ib8fe3bd94157acab3fbf1011c3f8a532ef5019f4
2010-06-10 17:40:01 -07:00
Brad Fitzpatrick
37d33a546b am 599f7287: am 9ac3743d: Merge "Log.wtf when databases go to be downgraded." into kraken 2010-06-08 12:40:57 -07:00
Brad Fitzpatrick
44dc76a8a7 Log.wtf when databases go to be downgraded.
BUG=2734435

Change-Id: I686d6d9415f3081544c3fbe379287c31e0ecec20
2010-06-08 12:20:51 -07:00
Tatsuo Nagamatsu
6d3acde839 fillWindow's start position must be smaller than getCount value
Change-Id: I3664ae8f6172f02bf6e2472320e79e3bf8683cc0
2010-06-07 02:07:51 +09:00
Vasu Nori
f9e2bd085f when database is opened, set journal_mode to TRAUNCATE
this journal_mode is more efficnent than the default journal_mode (DELETE)

Change-Id: I8879d3fe8dda410f4674ead9270aa7ecdaf91b5e
2010-06-04 17:08:31 -07:00
Brad Fitzpatrick
e407a608b0 resolved conflicts for merge of 7d6362de to master
Change-Id: Ic26dd6d617f0edba549c992256511613df00caa6
2010-06-03 17:15:48 -07:00
Vasu Nori
2134369e80 set some members to final, set database errorhandler to default if null.
Change-Id: I1c2d8181e7fe60c869178a43dcc00519dd0072c7
2010-06-03 16:01:39 -07:00
Brad Fitzpatrick
cfda9f3a47 Sprinkle new BlockGuard around SQLiteDatabase.
SQLite is JNI to native code and doesn't go via IFileSystem, so it
needs custom sprinkling, at least for now.

Change-Id: Ic7fded1b64a4f483dfc17b3a7b136c803df1e111
2010-06-03 12:52:54 -07:00
Vasu Nori
74f170f946 new API in Context. on openDatabase, new param DatabaseErrorHandler
add new method openOrCreateDatabase in Context.java to allow
callers specify a DatabaseErrorHandler object to be used when
database corruption occurs.
add new constructor in SQLiteOpenHelper to accept DatabaseErrorHandler
as an additional param to be used when SQLiteDatabase instance is
created.

Change-Id: I912a0202a74510f9ca0206dd8101c4abab9102ae
2010-06-03 12:38:11 -07:00
Vasu Nori
ac7ae9cc91 Merge "add API to Cursor to get column value type" 2010-06-03 11:46:03 -07:00
Vasu Nori
ccd954480c cleanup some small but ugly things. all minor things.
Change-Id: I6a3ea9ad563ea895e7f3c37647bdadd2cfa8fc29
2010-06-03 11:06:47 -07:00
Vasu Nori
8b0dd7da36 add API to Cursor to get column value type
Change-Id: I3ef1bcdb2eb1c45f68e829ccb6e3ecde28076591
2010-06-02 17:40:41 -07:00
Vasu Nori
a8c24904eb set sqlite pagesize to the size, in bytes, of a block on "/data"
Change-Id: I40b2bdac348a611eb9fe12ea05b6bd9a87f2310a
2010-06-01 13:03:32 -07:00
Vasu Nori
fea6f6dcb7 sqlite crashes when closing the database
A change was made in the last CL to ask sqlite for all unfinalized statements
and then finalizing them before closing the database.
But this crashes sqlite! because sqlite's FTS3
module keeps some prepared statements around and they should not
be finalized before closing the database.
(when sqlite is asked for all unfianlized statements, it also returns
the FTS3's reserved prepared statements which should not be
finalized!!)

Change-Id: I141ab4563985b8cd1305a1228c4cb01bc7281bcb
2010-05-21 15:41:58 -07:00
Vasu Nori
6f37f83a48 close() on anything other than database shouldn't acquire db lock.
bug:2683001
implmentation details:
 1.close() on any sql statement is should simply queued up for finalization
    to be performed later. caller doesn't acquire database lock.
 2. the only effect of NOT close immediately is non-release of some memory.
 3. all such queued-up-finalizations are performed whenever there is
    another execute() of some sql statement on that database from ANY
    thread in the process.
 4. database close() automatically releases all unfinalized statements
    before closing the database.

Change-Id: If4c9c7fde6b8945a41abc6c8b992aa8c69854512
2010-05-20 12:35:17 -07:00
Vasu Nori
85f08f9eae DatabaseCorruptionHandler causes NPE
it is trying to get attachedDb list (by executing a pragma) after closing
the database.
also added unittests.

Change-Id: I7dce665ec7354402cdef6fbe055455f5798e123c
2010-05-19 13:55:09 -07:00
Jeff Hamilton
7cd51efcbd Remove the deprecated cursor methods.
Change-Id: Ie3571fea9f36996c31c327240b11086f8cc487f0
2010-05-13 23:44:09 -05:00
The Android Open Source Project
6df9720b8d am fd5b040a: am 485b800e: am 1a3b3d48: merge from open-source master 2010-05-13 09:57:11 -07:00
The Android Open Source Project
1a3b3d4841 merge from open-source master
Change-Id: I51b4eccfde8e74c69ab8e0c051bb8ea718ee7101
2010-05-13 09:04:45 -07:00
Jeff Hamilton
f3ca9a5c7e Add some documentation about the thread safety of Cursor and some of the SQLite* classes.
Change-Id: Icae51052d1c942d7d60bb958d3703411da001079
2010-05-12 16:44:19 -07:00
Vasu Nori
9463f297ef sometimes database lock is not held before compiling a statement
indirectly uncovered by bug:2631971

Change-Id: I71059b6b62bc21612fc98689aefd4534884c8e7c
2010-05-03 12:24:20 -07:00
Makoto Onuki
2589716964 Make RequeryOnUiThreadException warning less spamy
- Moved the thread check from AbstractCursor to SQLiteCursor.
- Show warning only once per database

Bug 2633883

Change-Id: I915bfba8715a469c45fb68ba1282231279f2a50c
2010-04-29 11:36:48 -07:00
Vasu Nori
ca3a7b9bc5 am 43f2c35b: am 91a62f3d: am a07c4cbe: Merge "bug:2622719 move \'forcing of cursor execution\' to ContentProvider" into froyo 2010-04-28 15:50:49 -07:00
Vasu Nori
020e534579 bug:2622719 move 'forcing of cursor execution' to ContentProvider
revert part of the CL: Ia561135e974a44ad3e3774ecb23c6a3d0fc38176
and add it to ContentProvider.query() to force query execution
in worker thread, instead of having the main thread incur the cost
of query execution and potentially get ANR

Change-Id: I0ea8a170bd954a421f4ad825f8090319a83a5b2b
2010-04-28 15:32:54 -07:00
Vasu Nori
b57f85bc5b am 6813f8d2: am 785c8983: am 996960de: Merge "remove myname accidentally included in one of the files" into froyo 2010-04-27 18:57:14 -07:00
Vasu Nori
0f43f2f700 remove myname accidentally included in one of the files
Change-Id: I189db1cc60069b4318fa32a8b5aea6916ac5aa4e
2010-04-27 16:24:20 -07:00
Vasu Nori
9504c70f88 fix a bug introduced when prepared-statement cache was made LRU-based
1. when an entry is pushed out of cache, it should be released if it is not
in use by any thread. This didn't have to be done when cache was NOT LRU
because the object either got into the cache while the caller had a reference
to it or it didn't. if it didn't get into cache (because cache is full),
the caller's close() released the object. But in LRU cache, an object
could get pushed out of cache due to LRU policy and if it is NOT in use
by any thread at the time it was pushed out of cache, then it
got GC'ed - which caused warnings to be pronted in the log.
2. also delete some unused methods in SQLiteDatabase.

Change-Id: I7831952647d3a057342bcc8ac186a6a26eb58f33
2010-04-23 11:32:57 -07:00
Vasu Nori
20f549fd2f several minor bugs and things listed below
bug:1648729
   print warning if a requery is attemped on main thread
bug:2459293
   browser death because of NoSuchElementException. don't use iterator
   to march thru the ArrayList. use old style for() loop.
bug:1609474
   don't allow downgrades of databases
other stuff
   use LRUcache to maintain statement-cache in SQLiteDatabase
Change-Id: I3a42022162f4dfcc75f7d0cfcad8f20f1d193249
2010-04-16 15:50:41 -07:00
Vasu Nori
3bf1e8220a am 99d43435: am 66bee813: am 1fc46c62: Merge "accept close() on database objects even if the database is closed" into froyo 2010-04-16 15:04:16 -07:00
Vasu Nori
0dbb9cee58 accept close() on database objects even if the database is closed
bug:2602878
Change-Id: I3075f801ef35d72792ff3daaa1e887e53b58f5f8
2010-04-16 14:24:57 -07:00
android-build SharedAccount
120c457672 manual merge
Change-Id: I235ae925559b5db6d64cc8f8b188704a84d7b6a2
2010-04-15 16:36:34 -07:00
Vasu Nori
119c106f8d am 9d3b3e13: am bad5f620: am 0bbcdc6c: Merge "verify database state before calling sqlite. Bug:2593970" into froyo 2010-04-15 12:33:34 -07:00
Vasu Nori
062fc7ce36 allow apps to specify actions to take on database corruption error
let the user specify an interface impl class to specify the actions
to take when db corruption is detected.
this class is specified when the database is opened/created.

Change-Id: I84eb57208c8fedfa7235805b0ec58165efdc1560
2010-04-15 09:31:47 -07:00