summaryrefslogtreecommitdiff
path: root/core/java/android/database/DatabaseUtils.java
Commit message (Collapse)AuthorAgeFilesLines
* Fixing DatabaseUtils to detect malformed UTF-16 stringsKunal Malhotra2023-10-071-9/+23
| | | | | | | | Test: tested with POC in bug, also using atest Bug: 224771621 (cherry picked from https://googleplex-android-review.googlesource.com/q/commit:fb4a72e3943d166088407e61aa4439ac349f3f12) Merged-In: Ide65205b83063801971c5778af3154bcf3f0e530 Change-Id: Ide65205b83063801971c5778af3154bcf3f0e530
* Apply fixes for EfficientStrings.Jeff Sharkey2020-10-201-3/+3
| | | | | | | | | | Refactoring to avoid paying the cost of extra StringBuilder that are quickly disposed. Bug: 170978902 Test: none Exempt-From-Owner-Approval: trivial refactoring Change-Id: Icd914a63cdadf8123c1e5a5073f85245f0791f0b
* Carry over bugfixes from MediaProvider.Jeff Sharkey2020-05-191-0/+52
| | | | | | | | | | | | A few months ago MediaProvider forked SQLiteQueryBuilder and we fixed bugs in how the new insert(), update(), and delete() methods were executed, but those fixes never made their way back upstream. This CL is a clean cherry-pick of existing logic. Bug: 155149941 Test: atest android.database.sqlite.cts.SQLiteQueryBuilderTest Change-Id: I00d2ee88539b12d27a2ed99fff0546d1e3543b0e
* Deep copy arguments to avoid accidental mutation.Jeff Sharkey2020-03-311-0/+29
| | | | | | | | | Otherwise we'd risk applying different arguments to active versus future connections. Bug: 152005629 Test: atest CtsDatabaseTestCases:android.database.sqlite.cts.SQLiteDatabaseTest Change-Id: I6e83a47d9874825fd14940245412372ef9227e79
* Include pending media as well when deleting mediastore entries.Sudheer Shanka2020-02-241-0/+21
| | | | | | | | Bug: 146914674 Bug: 140565622 Bug: 137381621 Test: manual Change-Id: I903a13deb467b45839a7d03b60754c8fc464456c
* Use new UnsupportedAppUsage annotation.Artur Satayev2020-01-061-1/+1
| | | | | | | | Existing annotations in libcore/ and frameworks/ will deleted after the migration. This also means that any java library that compiles @UnsupportedAppUsage requires a direct dependency on "unsupportedappusage" java_library. Bug: 145132366 Test: m && diff unsupportedappusage_index.csv Change-Id: I0c336de56bc4a041dc97ff9b7927f62f0b44b457
* Limit access to suspected false positives.Mathew Inwood2018-12-281-1/+2
| | | | | | | | | | | | | | | | | | | | | Members modified herein are suspected to be false positives: i.e. things that were added to the greylist in P, but subsequent data analysis suggests that they are not, in fact, used after all. Add a maxTargetSdk=P to these APIs. This is lower-risk that simply removing these things from the greylist, as none of out data sources are perfect nor complete. For APIs that are not supported yet by annotations, move them to hiddenapi-greylist-max-p.txt instead which has the same effect. Exempted-From-Owner-Approval: Automatic changes to the codebase affecting only @UnsupportedAppUsage annotations, themselves added without requiring owners approval earlier. Bug: 115609023 Test: m Change-Id: I020a9c09672ebcae64c5357abc4993e07e744687
* Add @UnsupportedAppUsage annotationsMathew Inwood2018-08-101-0/+3
| | | | | | | | | | | | | | | | | For packages: android.database.sqlite android.database This is an automatically generated CL. See go/UnsupportedAppUsage for more details. Exempted-From-Owner-Approval: Mechanical changes to the codebase which have been approved by Android API council and announced on android-eng@ Bug: 110868826 Test: m Change-Id: I2bcc7f0eee31a1775dd7a5dd0f291d0d37bc1292
* Support for appending "standalone" WHERE chunks.Jeff Sharkey2018-07-271-0/+89
| | | | | | | | | | | | | | | | | | | | | | | The existing appendWhere() methods aren't very friendly for developers, since they require manual tracking of state to decide if subsequent standalone chunks should be prefixed with "AND". While it's tempting to offer direct argument binding on the builder class, we can't really deliver on that API in a secure way, so instead add separate bindSelection() method which explicitly burns arguments into a standalone selection string, which can then be appended to the builder. This was the last piece of new functionality being used by SQLiteStatementBuilder, so we can delete that class and migrate users back to SQLiteQueryBuilder. Bug: 111268862 Test: atest frameworks/base/core/tests/coretests/src/android/database/DatabaseUtilsTest.java Test: atest frameworks/base/core/tests/utiltests/src/com/android/internal/util/ArrayUtilsTest.java Test: atest cts/tests/tests/provider/src/android/provider/cts/MediaStore* Test: atest cts/tests/tests/database/src/android/database/sqlite/cts/SQLiteQueryBuilderTest.java Change-Id: I418f24338c90bae8a9dad473fa76329cea00a8c5
* Distinguish ROLLBACK from ROLLBACK TOFyodor Kupolov2017-08-281-0/+6
| | | | | | | | | | The former aborts the current transaction, the latter restores the state to a specified savepoint. Test: CtsDatabaseTestCases Test: DatabaseGeneralTest Bug: 36957161 Change-Id: Ia0b189e8aac4687f10d8fbc07143a452f5f719c9
* Also parse "1" as true for ContentValues#getAsBooleanMichael Wright2017-01-191-4/+1
| | | | | | | | | | SQLite's internal representation for booleans is an integer with a value of 0 or 1, so without this check, boolean values obtained via DatabaseUtils#cursorRowToContentValues will always return false. Bug: 34365384 Test: demo app, cts Change-Id: I6c0829c992252ca5ee16bd5eac48668507fd4089
* Terminate loop properly when cursor window is full.Jeff Brown2015-06-011-2/+2
| | | | | | | | | | | The existing code exits the column-filling loop immediately but may continue to try to fill rows. Ordinarily this should fail too but it's possible for the process to continue and then blow up a little later. Fixed this problem by exiting the row- filling loop promptly. Bug: 21406130 Change-Id: Ifab59188d5d1b40f3c1f5c97604dd48da71bf37b
* Move apache specific portions of android.net.http to external/apache-http.Narayan Kamath2015-02-121-4/+24
| | | | | | | | | | | | | | | | | | | We continue to compile external/apache-http into ext.jar. This contains a few changes apart fom the classes moving around : - Makefile changes to build docs and api-stubs for now. A future change will revert these changes and remove these classes from stubs and docs. - Hardcode event IDs in legacyerrorstrings to avoid a dependency between the frameworks and apache. These strings are on their way out and will never change anyway. - Remove imports due to {@link} tags and use {@code} instead. - Remove an accidental(?) dependency on apache commons code that's a part of apache-http. bug: 18027885 Change-Id: I51cd038d846ec7d02c283a4541b10a6a9cf62ecf
* If frameworks wants ASCII casing, it should explicity ask for it.Elliott Hughes2013-08-021-1/+1
| | | | | | | http://elliotth.blogspot.com/2012/01/beware-convenience-methods.html Bug: https://code.google.com/p/android/issues/detail?id=58359 Change-Id: Iaab02e718a7be7bda22e626dca05d79bfd2a8fc4
* Add additional Method that check whether a table is empty or notHyoseong Kim2013-04-011-0/+12
| | | | | | | | | | | Application Devleopers are using queryNumEntries API implemented by "COUNT(*)" to check whether a table is empty or not. COUNT(*) has to process the entire table to compute the result. But, "EXISTS" can stop after a single matching row has been found. So, Using "EXISTS" is more faster than "COUNT(*)" I added new API using "EXISTS" to check whether a table is empty or not Change-Id: Idcc2633d0a5349c59f41e125cf34c9dc6622cdbe
* Deprecate DatabaseUtils.InsertHelper.Jeff Brown2012-06-221-12/+32
| | | | | | | | | | | | | | | | | | | | | | | | | | | This class does not offer any advantages over SQLiteStatement and just makes code more complex and error-prone. Documented that the class is not thread-safe. Removed a potential deadlock in insert() and replace() caused by the insertInternal() method being synchronized in the case where the class was being used concurrently (woe to you!). Thread A would start a transaction. Thread B would call insertInternal() and acquire the object monitor, but block because it could not obtain the db connection because thread A is holding onto it. Thread A would call insertInternal() and block because Thread B was holding the object monitor. Deadlock. Changed this code to use a transaction instead of a lock, which provides the necessary mutual exclusion guarantee without the potential for a deadlock. Even so, the class really isn't thread safe. Bug: 6625094 Change-Id: I51d9a15567a6f2bad6f25e550b48f8f6ffcab2a7
* Move CancellationSignal to android.os package.Jeff Brown2012-05-071-1/+1
| | | | | Bug: 6427830 Change-Id: I39451bb1e1d4a8d976ed1c671234f0c8c61658dd
* Prefetch column names in bulk cursor adaptor.Jeff Brown2012-03-141-0/+14
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | If the remote end of a bulk cursor died, then it was possible for getColumnNames() to return null, violating the invariant that it never returns null. As a result, the application could crash in strange ways due to an NPE. Since we are often interested in the column names anyhow, prefetch them when setting up the bulk cursor adaptor. This way, a remote cursor will never return null even if the remote end died. It is possible for an application to continue to use a remote cursor even after the provider has died unless it needs to requery it for some reason. Of course at that point, bad things will happen... but usually the app is better prepared for it than if it just randomly encounters a null array of column names. This change also optimizes the bulk cursor adaptor to return the initial cursor window back to the client, potentially saving an extra RPC. Because the communication protocol between the CursorToBulkCursorAdaptor and BulkCursorToCursorAdaptor was getting a little hard to follow, introduced a new type called BulkCursorDescriptor to hold all of the necessary parameters. Deleted several unnecessary IBulkCursor methods that are never actually called remotely. Bug: 6168809 Change-Id: I9aaf6f067c6434a575e2fdbf678243d5ad10755f
* Don't close the database until all references released.Jeff Brown2012-03-061-52/+45
| | | | | | | | | | | | | | | | | SQLiteDatabase.close() should call releaseReference() rather than closing the database immediately. SQLiteDatabase should also hold a reference to itself while performing certain operations to ensure that they complete normally even if another thread closes the database at the same time. Fixed a couple of missing or redundant uses of acquireReference() related to CursorWindows. To be honest, the reference counting performed by SQLiteClosable should not be needed, but we're stuck with it in the API. Bug: 6104842 Change-Id: I3444a697409905d4a36b56418dc7766f5ba76b59
* Support automatic cancellation of Loaders.Jeff Brown2012-02-011-0/+6
| | | | Change-Id: I18d3f49e413f48fcdd519d15e99c238ad54d35b9
* Fix Music import for Turkish locales.Elliott Hughes2012-01-031-1/+2
| | | | | | | | | | For non-localized strings like the keywords in SQL statements, we shouldn't use locale-specific case transformations. (Cherry pick of 03f8f84c345e7c861a6de889d434b9d82cf04c8d.) Bug: 4284951 Change-Id: Ib5180daf7892af7b645c906fdfeacf9da87bd667
* Optimize fillWindow to improve reverse-seek performance.Jeff Brown2011-10-281-0/+26
| | | | | | | | | | | | | | | | | | | | | Bug: 5520301 When an application requests a row from a SQLiteCursor that is not in the window, instead of filling from the requested row position onwards, fill from a little bit ahead of the requested row position. This fixes a problem with applications that seek backwards in large cursor windows. Previously the application could end up refilling the window every time it moved back one position. We try to fill about 1/3 before the requested position and 2/3 after which substantially improves scrolling responsiveness when the list is bound to a data set that does not fit entirely within one cursor window. Change-Id: I168ff1d3aed1a41ac96267be34a026c108590e52
* Make default implementation of fillWindow typesafe.Jeff Brown2011-10-121-1/+78
| | | | | | | | | | Bug: 5218310 This change fixes problems calling the default fillWindow on Cursors that contain BLOBs. It should also be more efficient by avoiding redundant string conversions for numeric datatypes. Change-Id: Ied515bf6299bc8d3c14e76055d85fd35e7c05952
* Remove the deprecated things from Config.java. These haven't been working ↵Joe Onorato2011-04-071-2/+1
| | | | | | since before 1.0. Change-Id: Ic2e8fa68797ea9d486f4117f3d82c98233cdab1e
* Implement issue # 3255887 could CursorLoader offer...Dianne Hackborn2011-01-081-1/+0
| | | | | | | | | | | | | | | | | | ...to throttle contentobserver-based requeries Why yes, I guess it could. This also reworks AsyncTaskLoader to not generate multiple concurrent tasks if it is getting change notifications before the last background task is complete. And removes some of the old APIs that had been deprecated but need to be gone for final release. And fixes a few little problems with applying the wrong theme in system code. Change-Id: Ic7a665b666d0fb9d348e5f23595532191065884f
* don't compile statement for certain SQL statementsVasu Nori2010-09-171-1/+14
| | | | | | | SQL statements such as Create table, Pragma, Begin, Commit, Rollback etc don't need a compiled statement. Change-Id: I55f5e4e6cbb41cbe83e592e25ba852fe23e2b39f
* Fixing an issue with convert... utility methods.Dmitri Plotnikov2010-09-021-12/+12
| | | | | | | | All these methods promise to do nothing if the requested column is not present, but in fact throw exception. Change-Id: I0e528d53a0425b831b0083ba82c75ba5b41bfdfd
* resolved conflicts for merge of c64b916e to masterJean-Baptiste Queru2010-08-241-8/+34
|\ | | | | | | Change-Id: I31b84d72186a918f19e0c9dee8fdebc83f661cc1
| * resolved conflicts for merge of e7731f0a to gingerbread-plus-aospJean-Baptiste Queru2010-08-201-10/+34
| |\ | | | | | | | | | Change-Id: I8001a95f8c44ef0343e0a50de4bd5b5a85d41c38
| | * Added overload methods for DatabaseUtils.queryNumEntriesChristian Mehlmauer2010-08-201-10/+34
| | | | | | | | | | | | | | | | | | | | | | | | Now you can filter the count statement with a selection and selection args UnitTests for this new methods are added to the cts project Change-Id: Id9233aec0eaac08839041ae7cbaba203470ad3d8
* | | New API and implementation of DB and memory-backed FDsBjorn Bringert2010-08-181-0/+29
| | | | | | | | | | | | | | | | | | | | | | | | | | | This depends on a kernel patch that implements read(2) in the ashmem driver. Bug http://b/issue?id=2595601 Change-Id: Ie3b10aa471aada21812b35e63954c1b2f0a7b042
* | | Add a few helpful APIs.Jeff Hamilton2010-08-101-0/+14
| | | | | | | | | | | | Change-Id: Ie57aa71eb77a1e0fb058f4eb6f40d4144a6dfce7
* | | random but useful stuffVasu Nori2010-08-031-16/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 1. move binding of args to one place - to SQLiteProgram 2. reduce locking time in SQLiteDatabase 3. reduce locking during time of binding of args 4. rmeove test for the deprecated ArrayListCursor 5. a couple of nits here and there Change-Id: I20c33c8ffe3325df67af655f1d20614f7f727cb7
* | | do begin-end transaction before standalone insert/update/delete sqlVasu Nori2010-08-021-0/+56
| | | | | | | | | | | | | | | also fix bug# 2871037 Change-Id: I13325f8eabff4f218d3206905010803b61d8e2cd
* | | am 3e5e21d4: am 1772c34e: Merge "StrictMode: gather and return violating ↵Brad Fitzpatrick2010-07-151-3/+3
|\| | | | | | | | | | | | | | | | | | | | | | | | | | stacks in Binder replies" into gingerbread Merge commit '3e5e21d4dc74751e64d17379c5563ece39a7e35d' * commit '3e5e21d4dc74751e64d17379c5563ece39a7e35d': StrictMode: gather and return violating stacks in Binder replies
| * | StrictMode: gather and return violating stacks in Binder repliesBrad Fitzpatrick2010-07-151-3/+3
| |/ | | | | | | | | | | | | | | | | | | | | Now, when Thread A has a strict mode policy in effect and does a Binder call to Thread B (most likely in another process), the strict mode policy is passed along, but with the GATHER penalty bit set which overrides other policies and instead gathers all offending stack traces to a threadlocal which are then written back in the Parcel's reply header. Change-Id: I7d4497032a0609b37b1a2a15855f5c929ba0584d
* / add API to Cursor to get column value typeVasu Nori2010-06-021-0/+31
|/ | | | Change-Id: I3ef1bcdb2eb1c45f68e829ccb6e3ecde28076591
* am 328c0e79: - removed the concept of Entity from the ContentProvider APIs - ↵Fred Quintana2009-12-101-0/+96
| | | | | | | | | removed the parcelling ability from Entity and EntityIterator and made them public - added an EntityIterator abstract implementation that allow easy wrapping of a Cursor - changed the VCard c Merge commit '328c0e7986aa6bb7752ec6de3da9c999920bb55f' into eclair-mr2-plus-aosp * commit '328c0e7986aa6bb7752ec6de3da9c999920bb55f': - removed the concept of Entity from the ContentProvider APIs
* add ipc support to batchingFred Quintana2009-05-221-0/+15
|
* Automated import from //branches/master/...@141380,141380Fred Quintana2009-03-241-15/+17
|
* auto import from //depot/cupcake/@135843The Android Open Source Project2009-03-031-0/+1018
|
* auto import from //depot/cupcake/@135843The Android Open Source Project2009-03-031-1018/+0
|
* auto import from //branches/cupcake/...@132276The Android Open Source Project2009-02-191-0/+1
|
* Code drop from //branches/cupcake/...@124589The Android Open Source Project2008-12-171-0/+15
|
* Initial ContributionThe Android Open Source Project2008-10-211-0/+1002