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

Side by Side Diff: sql/meta_table.h

Issue 9592026: Create meta table atomically. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 9 months 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 | Annotate | Revision Log
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_META_TABLE_H_ 5 #ifndef SQL_META_TABLE_H_
6 #define SQL_META_TABLE_H_ 6 #define SQL_META_TABLE_H_
7 #pragma once 7 #pragma once
8 8
9 #include <string> 9 #include <string>
10 10
11 #include "base/basictypes.h" 11 #include "base/basictypes.h"
12 #include "sql/sql_export.h" 12 #include "sql/sql_export.h"
13 13
14 namespace sql { 14 namespace sql {
15 15
16 class Connection; 16 class Connection;
17 class Statement; 17 class Statement;
18 18
19 class SQL_EXPORT MetaTable { 19 class SQL_EXPORT MetaTable {
20 public: 20 public:
21 MetaTable(); 21 MetaTable();
22 ~MetaTable(); 22 ~MetaTable();
23 23
24 // Returns true if the 'meta' table exists. 24 // Returns true if the 'meta' table exists.
25 static bool DoesTableExist(Connection* db); 25 static bool DoesTableExist(Connection* db);
26 26
27 // Initializes the MetaTableHelper, creating the meta table if necessary. For 27 // Initializes the MetaTableHelper, creating the meta table if necessary. For
28 // new tables, it will initialize the version number to |version| and the 28 // new tables, it will initialize the version number to |version| and the
29 // compatible version number to |compatible_version|. 29 // compatible version number to |compatible_version|. Versions must be
30 // greater than 0 to distinguish missing versions (see GetVersionNumber()).
30 bool Init(Connection* db, int version, int compatible_version); 31 bool Init(Connection* db, int version, int compatible_version);
31 32
32 // Resets this MetaTable object, making another call to Init() possible. 33 // Resets this MetaTable object, making another call to Init() possible.
33 void Reset(); 34 void Reset();
34 35
35 // The version number of the database. This should be the version number of 36 // The version number of the database. This should be the version number of
36 // the creator of the file. The version number will be 0 if there is no 37 // the creator of the file. The version number will be 0 if there is no
37 // previously set version number. 38 // previously set version number.
38 // 39 //
39 // See also Get/SetCompatibleVersionNumber(). 40 // See also Get/SetCompatibleVersionNumber().
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
78 bool PrepareGetStatement(Statement* statement, const char* key); 79 bool PrepareGetStatement(Statement* statement, const char* key);
79 80
80 Connection* db_; 81 Connection* db_;
81 82
82 DISALLOW_COPY_AND_ASSIGN(MetaTable); 83 DISALLOW_COPY_AND_ASSIGN(MetaTable);
83 }; 84 };
84 85
85 } // namespace sql 86 } // namespace sql
86 87
87 #endif // SQL_META_TABLE_H_ 88 #endif // SQL_META_TABLE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698