OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2006, 2007, 2008 Apple Inc. All rights reserved. | 2 * Copyright (C) 2006, 2007, 2008 Apple Inc. All rights reserved. |
3 * Copyright (C) 2007 Justin Haygood (jhaygood@reaktix.com) | 3 * Copyright (C) 2007 Justin Haygood (jhaygood@reaktix.com) |
4 * | 4 * |
5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
6 * modification, are permitted provided that the following conditions | 6 * modification, are permitted provided that the following conditions |
7 * are met: | 7 * are met: |
8 * 1. Redistributions of source code must retain the above copyright | 8 * 1. Redistributions of source code must retain the above copyright |
9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
10 * 2. Redistributions in binary form must reproduce the above copyright | 10 * 2. Redistributions in binary form must reproduce the above copyright |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
46 class SQLiteTransaction; | 46 class SQLiteTransaction; |
47 | 47 |
48 extern const int SQLResultDone; | 48 extern const int SQLResultDone; |
49 extern const int SQLResultOk; | 49 extern const int SQLResultOk; |
50 extern const int SQLResultRow; | 50 extern const int SQLResultRow; |
51 extern const int SQLResultFull; | 51 extern const int SQLResultFull; |
52 extern const int SQLResultInterrupt; | 52 extern const int SQLResultInterrupt; |
53 extern const int SQLResultConstraint; | 53 extern const int SQLResultConstraint; |
54 | 54 |
55 class SQLiteDatabase { | 55 class SQLiteDatabase { |
| 56 DISALLOW_ALLOCATION(); |
56 WTF_MAKE_NONCOPYABLE(SQLiteDatabase); | 57 WTF_MAKE_NONCOPYABLE(SQLiteDatabase); |
57 friend class SQLiteTransaction; | 58 friend class SQLiteTransaction; |
58 public: | 59 public: |
59 SQLiteDatabase(); | 60 SQLiteDatabase(); |
60 ~SQLiteDatabase(); | 61 ~SQLiteDatabase(); |
61 | 62 |
62 bool open(const String& filename, bool forWebSQLDatabase = false); | 63 bool open(const String& filename, bool forWebSQLDatabase = false); |
63 bool isOpen() const { return m_db; } | 64 bool isOpen() const { return m_db; } |
64 void close(); | 65 void close(); |
65 void interrupt(); | 66 void interrupt(); |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
108 // FULL - SQLite moves all empty pages to the end of the DB file and truncat
es | 109 // FULL - SQLite moves all empty pages to the end of the DB file and truncat
es |
109 // the file to remove those pages after every transaction. This optio
n | 110 // the file to remove those pages after every transaction. This optio
n |
110 // requires SQLite to store additional information about each page in | 111 // requires SQLite to store additional information about each page in |
111 // the database file. | 112 // the database file. |
112 // INCREMENTAL - SQLite stores extra information for each page in the databa
se | 113 // INCREMENTAL - SQLite stores extra information for each page in the databa
se |
113 // file, but removes the empty pages only when PRAGMA INCREMAN
TAL_VACUUM | 114 // file, but removes the empty pages only when PRAGMA INCREMAN
TAL_VACUUM |
114 // is called. | 115 // is called. |
115 enum AutoVacuumPragma { AutoVacuumNone = 0, AutoVacuumFull = 1, AutoVacuumIn
cremental = 2 }; | 116 enum AutoVacuumPragma { AutoVacuumNone = 0, AutoVacuumFull = 1, AutoVacuumIn
cremental = 2 }; |
116 bool turnOnIncrementalAutoVacuum(); | 117 bool turnOnIncrementalAutoVacuum(); |
117 | 118 |
| 119 void trace(Visitor*); |
| 120 |
118 private: | 121 private: |
119 static int authorizerFunction(void*, int, const char*, const char*, const ch
ar*, const char*); | 122 static int authorizerFunction(void*, int, const char*, const char*, const ch
ar*, const char*); |
120 | 123 |
121 void enableAuthorizer(bool enable); | 124 void enableAuthorizer(bool enable); |
122 | 125 |
123 int pageSize(); | 126 int pageSize(); |
124 | 127 |
125 sqlite3* m_db; | 128 sqlite3* m_db; |
126 int m_pageSize; | 129 int m_pageSize; |
127 | 130 |
128 bool m_transactionInProgress; | 131 bool m_transactionInProgress; |
129 bool m_sharable; | 132 bool m_sharable; |
130 | 133 |
131 Mutex m_authorizerLock; | 134 Mutex m_authorizerLock; |
132 RefPtrWillBePersistent<DatabaseAuthorizer> m_authorizer; | 135 RefPtrWillBeMember<DatabaseAuthorizer> m_authorizer; |
133 | 136 |
134 Mutex m_lockingMutex; | 137 Mutex m_lockingMutex; |
135 ThreadIdentifier m_openingThread; | 138 ThreadIdentifier m_openingThread; |
136 | 139 |
137 Mutex m_databaseClosingMutex; | 140 Mutex m_databaseClosingMutex; |
138 bool m_interrupted; | 141 bool m_interrupted; |
139 | 142 |
140 int m_openError; | 143 int m_openError; |
141 CString m_openErrorMessage; | 144 CString m_openErrorMessage; |
142 | 145 |
143 int m_lastChangesCount; | 146 int m_lastChangesCount; |
144 }; | 147 }; |
145 | 148 |
146 } // namespace WebCore | 149 } // namespace WebCore |
147 | 150 |
148 #endif | 151 #endif |
OLD | NEW |