0
Commit Graph

32 Commits

Author SHA1 Message Date
brettw@chromium.org
b9b4a57299 Move ScopedFILE to base namespace and scoped_file.h
R=viettrungluu@chromium.org

Review URL: https://codereview.chromium.org/196073002

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@257518 0039d316-1c4b-4281-b951-d872f2087c98
2014-03-17 23:11:12 +00:00
michaeln@chromium.org
579446c1f8 AppCache: Run a quick integrity check on the sqlite database when opening. If the test fails, delete the appcache directory and start afresh.
NOTRY=true
TBR=sky
BUG=318544

Review URL: https://codereview.chromium.org/104593010

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@240937 0039d316-1c4b-4281-b951-d872f2087c98
2013-12-16 18:36:52 +00:00
thakis@chromium.org
7600d0b2d5 Revert 239400 "Revert 239280 "Move more file_util functions to b..."
Broke all bots 9_9

> Revert 239280 "Move more file_util functions to base namespace."
> 
> dbus_unittests started fialing on Linux Tests (dbg)(2) and Linux Tests (dbg)(2)(32).
> This CL is the only in the intersection of CLs in the first failing build on
> the two builders, so giving a speculative revert a try (rlarocque already
> tried a clobber, it didn't help).
> 
> http://build.chromium.org/p/chromium.linux/builders/Linux%20Tests%20%28dbg%29%282%29/builds/41806
> http://build.chromium.org/p/chromium.linux/builders/Linux%20Tests%20%28dbg%29%282%29%2832%29/builds/8544
> 
> 
> > Move more file_util functions to base namespace.
> > 
> > TBR=sky
> > 
> > Review URL: https://codereview.chromium.org/109043002
> 
> TBR=brettw@chromium.org
> 
> Review URL: https://codereview.chromium.org/105823009

TBR=thakis@chromium.org

Review URL: https://codereview.chromium.org/100923007

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@239401 0039d316-1c4b-4281-b951-d872f2087c98
2013-12-08 21:43:30 +00:00
thakis@chromium.org
a4f7378f97 Revert 239280 "Move more file_util functions to base namespace."
dbus_unittests started fialing on Linux Tests (dbg)(2) and Linux Tests (dbg)(2)(32).
This CL is the only in the intersection of CLs in the first failing build on
the two builders, so giving a speculative revert a try (rlarocque already
tried a clobber, it didn't help).

http://build.chromium.org/p/chromium.linux/builders/Linux%20Tests%20%28dbg%29%282%29/builds/41806
http://build.chromium.org/p/chromium.linux/builders/Linux%20Tests%20%28dbg%29%282%29%2832%29/builds/8544


> Move more file_util functions to base namespace.
> 
> TBR=sky
> 
> Review URL: https://codereview.chromium.org/109043002

TBR=brettw@chromium.org

Review URL: https://codereview.chromium.org/105823009

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@239400 0039d316-1c4b-4281-b951-d872f2087c98
2013-12-08 21:31:42 +00:00
brettw@chromium.org
5a6ddb1988 Move more file_util functions to base namespace.
TBR=sky

Review URL: https://codereview.chromium.org/109043002

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@239280 0039d316-1c4b-4281-b951-d872f2087c98
2013-12-07 00:04:53 +00:00
brettw@chromium.org
b264eab5d4 Move Posix file utils to the base namespace.
BUG=
R=rvargas@chromium.org

Review URL: https://codereview.chromium.org/89523002

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@237642 0039d316-1c4b-4281-b951-d872f2087c98
2013-11-27 23:22:08 +00:00
kinuko@chromium.org
a8848a7685 Revert 235595 "Revert 235492 "[sql] Recover Favicons v5 database..."
> Revert 235492 "[sql] Recover Favicons v5 databases, with more re..."
> 
> Speculative revert to find the cause for Mac size regression
> (will revert this revert later)
> 
> > [sql] Recover Favicons v5 databases, with more recovery automation.
> > 
> > An entirely automated recovery system runs afoul of questions about
> > whether the corrupt database's schema can be trusted.
> > sql::Recovery::AutoRecoverTable() uses a schema created by the caller
> > to construct the recovery virtual table and then copies the data over.
> > 
> > sql::Recovery::SetupMeta() and GetMetaVersionNumber() simplify
> > accessing meta-table info in the corrupt database.
> > 
> > sql::test::IntegrityCheck() and CorruptSizeInHeader() helpers to
> > simplify common testing operations.
> > 
> > Rewrite ThumbnailDatabase v6 and v7 recovery code and tests using
> > these changes, and add a v5 recovery path.  Additionally handle
> > deprecated versions.
> > 
> > BUG=240396,109482
> > 
> > Review URL: https://codereview.chromium.org/50493012
> 
> TBR=shess@chromium.org
> 
> Review URL: https://codereview.chromium.org/74933002

TBR=kinuko@chromium.org

Review URL: https://codereview.chromium.org/74953002

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@235604 0039d316-1c4b-4281-b951-d872f2087c98
2013-11-18 04:18:47 +00:00
kinuko@chromium.org
5f6595959a Revert 235492 "[sql] Recover Favicons v5 databases, with more re..."
Speculative revert to find the cause for Mac size regression
(will revert this revert later)

> [sql] Recover Favicons v5 databases, with more recovery automation.
> 
> An entirely automated recovery system runs afoul of questions about
> whether the corrupt database's schema can be trusted.
> sql::Recovery::AutoRecoverTable() uses a schema created by the caller
> to construct the recovery virtual table and then copies the data over.
> 
> sql::Recovery::SetupMeta() and GetMetaVersionNumber() simplify
> accessing meta-table info in the corrupt database.
> 
> sql::test::IntegrityCheck() and CorruptSizeInHeader() helpers to
> simplify common testing operations.
> 
> Rewrite ThumbnailDatabase v6 and v7 recovery code and tests using
> these changes, and add a v5 recovery path.  Additionally handle
> deprecated versions.
> 
> BUG=240396,109482
> 
> Review URL: https://codereview.chromium.org/50493012

TBR=shess@chromium.org

Review URL: https://codereview.chromium.org/74933002

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@235595 0039d316-1c4b-4281-b951-d872f2087c98
2013-11-18 03:28:56 +00:00
shess@chromium.org
4f4076506d [sql] Recover Favicons v5 databases, with more recovery automation.
An entirely automated recovery system runs afoul of questions about
whether the corrupt database's schema can be trusted.
sql::Recovery::AutoRecoverTable() uses a schema created by the caller
to construct the recovery virtual table and then copies the data over.

sql::Recovery::SetupMeta() and GetMetaVersionNumber() simplify
accessing meta-table info in the corrupt database.

sql::test::IntegrityCheck() and CorruptSizeInHeader() helpers to
simplify common testing operations.

Rewrite ThumbnailDatabase v6 and v7 recovery code and tests using
these changes, and add a v5 recovery path.  Additionally handle
deprecated versions.

BUG=240396,109482

Review URL: https://codereview.chromium.org/50493012

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@235492 0039d316-1c4b-4281-b951-d872f2087c98
2013-11-16 01:52:04 +00:00
shess@chromium.org
6ed6d14fee Unit tests for sql::MetaTable.
BUG=273203

Review URL: https://chromiumcodereview.appspot.com/23649002

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@221922 0039d316-1c4b-4281-b951-d872f2087c98
2013-09-07 15:48:36 +00:00
shess@chromium.org
dd325f05ae [sql] Use recover virtual table in sql::Recovery.
Load the recover virtual table as part of sql::Recovery::Begin(), and
implement basic unit tests that it correctly recovers valid and
corrupt tables.

BUG=109482

Review URL: https://chromiumcodereview.appspot.com/20022006

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@215764 0039d316-1c4b-4281-b951-d872f2087c98
2013-08-06 02:37:40 +00:00
shess@chromium.org
8d40941e03 [sql] Scoped recovery framework.
sql::Recovery is intended to be used within a sql::Connection error
callback to either recover the database (*) or indicate that the
database is unrecoverable and should be razed.  The intend is that the
code should either progress to a valid database which is composed of
data recovered from the original (likely corrupt) database, or a valid
database which is empty.

This is just the framework without the SQLite-level data-recovery
virtual table.

BUG=109482

Review URL: https://chromiumcodereview.appspot.com/19281002

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@212607 0039d316-1c4b-4281-b951-d872f2087c98
2013-07-19 18:25:30 +00:00
shess@chromium.org
81a2a6094b [sql] Allow restricting database to user read access.
By default POSIX umask is generally 0644.  For some databases, it
makes sense to restrict access to 0600.

Use new setting for password database.

BUG=258771
R=gbillock@chromium.org, isherman@chromium.org, jorgelo@chromium.org

Review URL: https://codereview.chromium.org/5125579611308032

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@212106 0039d316-1c4b-4281-b951-d872f2087c98
2013-07-17 19:10:36 +00:00
shess@chromium.org
fed734a145 [sql] Retry Open() if error handler fixed things.
Since the caller cannot have existing database-derived state before
the database is opened, Open() can be safely retried after the error
handler has razed the database.

BUG=109482

Review URL: https://chromiumcodereview.appspot.com/18641004

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@211936 0039d316-1c4b-4281-b951-d872f2087c98
2013-07-17 04:45:13 +00:00
shess@chromium.org
98cf3002ce [sql] Callback and scoped-ignore tests for sql::Statement.
Test error callback and ScopedErrorIgnorer for running statements.
Share error-callback test code between statement and connection tests.
Test additional error-callback edge cases.

Also fix callback use-after-free case.

BUG=254584

Review URL: https://chromiumcodereview.appspot.com/17726002

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@211281 0039d316-1c4b-4281-b951-d872f2087c98
2013-07-12 01:38:56 +00:00
brettw@chromium.org
7567484144 Move PathExists to base namespace.
BUG=
TBR=jam@chromium.org

Review URL: https://codereview.chromium.org/18286004

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@211147 0039d316-1c4b-4281-b951-d872f2087c98
2013-07-11 17:36:07 +00:00
shess@chromium.org
7bae574cc1 [sql] Additional Raze() unit tests.
Verify that Raze() can handle:
 - empty databases.
 - non-database files.
 - databases overwritten with garbage.
 - databases which cannot be opened successfully.

BUG=none

Review URL: https://chromiumcodereview.appspot.com/17752002

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@210923 0039d316-1c4b-4281-b951-d872f2087c98
2013-07-10 20:46:16 +00:00
shess@chromium.org
8d2e39e922 [sql] Static helper to delete database and all associated files.
Not all of the ad-hoc file_util::Delete() cases handle -journal, and
if -wal was added all of them need to be tracked down.

BUG=none

Review URL: https://chromiumcodereview.appspot.com/17058004

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@208140 0039d316-1c4b-4281-b951-d872f2087c98
2013-06-24 05:55:08 +00:00
shess@chromium.org
4350e321e4 [sql] Framework for allowing tests to handle errors.
sql/ throws FATAL whenever it sees inappropriate calls, which makes
production code to handle errors hard to test.  ScopedErrorIgnorer
provides a way for tests to signal that specific errors are expected
and will be handled.

As a first pass, code up some additional tests for some Raze() edge
cases, and modify things to pass those tests.

BUG=159490

Review URL: https://chromiumcodereview.appspot.com/16664005

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@207096 0039d316-1c4b-4281-b951-d872f2087c98
2013-06-18 22:18:10 +00:00
shess@chromium.org
41a97c81e1 Implement sql::Connection::RazeAndClose().
Raze() clears out the database, but cannot be called within a
transaction.  Close() can only be called once all statements have
cleared.  Error callbacks happen while executing statements (thus
often in a transaction, and at least one statement is outstanding).

RazeAndClose() forcibly breaks outstanding transactions, calls Raze()
to clear the database, then calls Close() to close the handle.  All
future operations against the database should fail safely (without
affecting storage and without crashing).

BUG=166419, 136846


Review URL: https://chromiumcodereview.appspot.com/12096073

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@181152 0039d316-1c4b-4281-b951-d872f2087c98
2013-02-07 02:35:38 +00:00
rsleevi@chromium.org
3dbbf7d631 Linux/ChromeOS Chromium style checker cleanup, sql/ edition.
Automated clean up of style checker errors that were missed due to the plugin
not being executed on implementation files.

BUG=115047

Review URL: https://chromiumcodereview.appspot.com/12211033

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@181004 0039d316-1c4b-4281-b951-d872f2087c98
2013-02-06 18:13:53 +00:00
brettw@chromium.org
a3ef4830d5 Add FilePath to base namespace.
This updates headers that forward-declare it and a few random places to use the namespace explicitly. There us a using declaration in file_path.h that makes the rest compile, which we can do in future passes.
Review URL: https://codereview.chromium.org/12163003

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@180245 0039d316-1c4b-4281-b951-d872f2087c98
2013-02-02 05:12:33 +00:00
brettw@chromium.org
ea1a3f60aa Move scoped_temp_dir from base to base/files
Also add to base namespace.

BUG=

Review URL: https://codereview.chromium.org/11359217

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@168281 0039d316-1c4b-4281-b951-d872f2087c98
2012-11-16 20:34:23 +00:00
shess@chromium.org
6d42f15f09 Make sql::Connection::Raze() more robust against corruptions.
Corruptions resulting from the first page showing a different database
size than the filesystem shows cause very basic functions to fail.
This does fewer queries against the corrupt database, and also enables
a magic pragma to let it make better progress.

BUG=159490


Review URL: https://chromiumcodereview.appspot.com/11369126

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@167019 0039d316-1c4b-4281-b951-d872f2087c98
2012-11-10 00:38:24 +00:00
yfriedman@chromium.org
69c5845f97 Upstream sqlite gyp changes for Android.
Includes a change to sql/Connection to propagate the auto_vacuum pragma across a raze operation. Also updates test expectations.

BUG=137853


Review URL: https://chromiumcodereview.appspot.com/10829062

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@150128 0039d316-1c4b-4281-b951-d872f2087c98
2012-08-06 19:22:42 +00:00
yongsheng.zhu@intel.com
1348765a72 Fix the sqlite errors of content unittests on Android
Many tests are failed due to sqlite errors on Android.
The reason is that sqlite need a temporary directory to
store internal temporary files. However, Android doesn't
have this kind of directory while Linux has /var/tmp.

To fix this, use in-memory temporary files. It also includes:
1) Add one unit test in sql unittests to reproduce this
issue for Android.
2) Remove those disabled cases for content unitests on
Android.

BUG=
TEST=run_tests.py -s sql_unittests; run_test.py -s net_unittests


Review URL: https://chromiumcodereview.appspot.com/10809015

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@148064 0039d316-1c4b-4281-b951-d872f2087c98
2012-07-24 08:25:53 +00:00
rohitrao@chromium.org
e73e8922ac Modify sql unittests to pass on iOS.
BUG=None
TEST=None


Review URL: https://chromiumcodereview.appspot.com/10702203

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@146604 0039d316-1c4b-4281-b951-d872f2087c98
2012-07-13 18:55:22 +00:00
michaelbai@chromium.org
389e0a485f Added parameter 'clear_bound_vars', so we could reset the statement without clearing bound variables, so and current row is reset to the beginning.
It is used to support the Andorid' sqlite cursor feature which could move the cursor around the result set.

BUG=
TEST=Added a new test.
TBR=agl,akalin,michaeln

Review URL: http://codereview.chromium.org/10171014

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@133985 0039d316-1c4b-4281-b951-d872f2087c98
2012-04-25 21:36:41 +00:00
shess@chromium.org
8e0c0128f4 Implement sql::Connection::Raze() in terms of sqlite3_backup API.
Wraps up the notion of reseting a database in a way which respects
SQLite locking constraints and doesn't require closing the database.

A similar outcome could be managed using filesystem operations, which
requires coordination between clients of the database to make sure
that no corruption occurs due to incorrect handling of -journal files.
Also, Windows pins files until the last handle closes, making that
approach challenging in some cases.

BUG=none
TEST=none

Review URL: https://chromiumcodereview.appspot.com/9768006

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@131167 0039d316-1c4b-4281-b951-d872f2087c98
2012-04-06 19:36:49 +00:00
michaelbai@chromium.org
44ad7d9052 Reset needs_rollback after rollback.
Fix issue that the transaction can not be started if the nesting_transaction rollback.

BUG=
TEST=Add a new test to cover this case. Also pass the existing tests.


Review URL: http://codereview.chromium.org/9839021

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@128352 0039d316-1c4b-4281-b951-d872f2087c98
2012-03-23 00:09:05 +00:00
shess@chromium.org
eff1fa525c Put debugging assertions into sql::Statement.
Pulls out the core of gbillock's http://codereview.chromium.org/8283002/
- Move NOTREACHED and similar checks into the sql:: implementation code.
- Add malformed SQL checks to Connection::Execute.
- Add SQL-checking convenience methods to Connection.

The general idea is that the sql:: framework assumes valid statements,
rather than having client code contain scattered ad-hoc (and thus
inconsistent) checks.

This version puts back Statement operator overloading and loosy-goosy
Execute() calls to allow other code to be updated in small batches.

R=gbillock@chromium.org,jhawkins@chromium.org,dhollowa@chromium.org 
BUG=none
TEST=sql_unittests,unit_tests:*Table*.*


Review URL: http://codereview.chromium.org/8899012

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@114118 0039d316-1c4b-4281-b951-d872f2087c98
2011-12-12 23:50:59 +00:00
tfarina@chromium.org
f0a54b2f3f Move app/sql/* files to sql/ directory.
I can't remove app/app.gyp and app/app_base.gypi yet because they are referenced
by third_party gyp files :(

BUG=72317
TEST=None

R=rsesek@chromium.org

move app/sql to sql

Review URL: http://codereview.chromium.org/7353026

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@93069 0039d316-1c4b-4281-b951-d872f2087c98
2011-07-19 18:40:21 +00:00