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

Side by Side Diff: sql/connection.h

Issue 11369126: Make sql::Connection::Raze() more robust against corruptions. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Fix for android. Created 8 years, 1 month 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
« no previous file with comments | « no previous file | sql/connection.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef SQL_CONNECTION_H_ 5 #ifndef SQL_CONNECTION_H_
6 #define SQL_CONNECTION_H_ 6 #define SQL_CONNECTION_H_
7 7
8 #include <map> 8 #include <map>
9 #include <set> 9 #include <set>
10 #include <string> 10 #include <string>
(...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after
188 // process. RazeWithTimeout() may be used if appropriate. 188 // process. RazeWithTimeout() may be used if appropriate.
189 // 189 //
190 // NOTE(shess): Raze() will DCHECK in the following situations: 190 // NOTE(shess): Raze() will DCHECK in the following situations:
191 // - database is not open. 191 // - database is not open.
192 // - the connection has a transaction open. 192 // - the connection has a transaction open.
193 // - a SQLite issue occurs which is structural in nature (like the 193 // - a SQLite issue occurs which is structural in nature (like the
194 // statements used are broken). 194 // statements used are broken).
195 // Since Raze() is expected to be called in unexpected situations, 195 // Since Raze() is expected to be called in unexpected situations,
196 // these all return false, since it is unlikely that the caller 196 // these all return false, since it is unlikely that the caller
197 // could fix them. 197 // could fix them.
198 //
199 // The database's page size is taken from |page_size_|. The
200 // existing database's |auto_vacuum| setting is lost (the
201 // possibility of corruption makes it unreliable to pull it from the
202 // existing database). To re-enable on the empty database requires
203 // running "PRAGMA auto_vacuum = 1;" then "VACUUM".
204 //
205 // NOTE(shess): For Android, SQLITE_DEFAULT_AUTOVACUUM is set to 1,
206 // so Raze() sets auto_vacuum to 1.
207 //
208 // TODO(shess): Raze() needs a connection so cannot clear SQLITE_NOTADB.
209 // TODO(shess): Bake auto_vacuum into Connection's API so it can
210 // just pick up the default.
198 bool Raze(); 211 bool Raze();
199 bool RazeWithTimout(base::TimeDelta timeout); 212 bool RazeWithTimout(base::TimeDelta timeout);
200 213
201 // Transactions -------------------------------------------------------------- 214 // Transactions --------------------------------------------------------------
202 215
203 // Transaction management. We maintain a virtual transaction stack to emulate 216 // Transaction management. We maintain a virtual transaction stack to emulate
204 // nested transactions since sqlite can't do nested transactions. The 217 // nested transactions since sqlite can't do nested transactions. The
205 // limitation is you can't roll back a sub transaction: if any transaction 218 // limitation is you can't roll back a sub transaction: if any transaction
206 // fails, all transactions open will also be rolled back. Any nested 219 // fails, all transactions open will also be rolled back. Any nested
207 // transactions after one has rolled back will return fail for Begin(). If 220 // transactions after one has rolled back will return fail for Begin(). If
(...skipping 235 matching lines...) Expand 10 before | Expand all | Expand 10 after
443 // This object handles errors resulting from all forms of executing sqlite 456 // This object handles errors resulting from all forms of executing sqlite
444 // commands or statements. It can be null which means default handling. 457 // commands or statements. It can be null which means default handling.
445 scoped_ptr<ErrorDelegate> error_delegate_; 458 scoped_ptr<ErrorDelegate> error_delegate_;
446 459
447 DISALLOW_COPY_AND_ASSIGN(Connection); 460 DISALLOW_COPY_AND_ASSIGN(Connection);
448 }; 461 };
449 462
450 } // namespace sql 463 } // namespace sql
451 464
452 #endif // SQL_CONNECTION_H_ 465 #endif // SQL_CONNECTION_H_
OLDNEW
« no previous file with comments | « no previous file | sql/connection.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698