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 |
11 * notice, this list of conditions and the following disclaimer in the | 11 * notice, this list of conditions and the following disclaimer in the |
12 * documentation and/or other materials provided with the distribution. | 12 * documentation and/or other materials provided with the distribution. |
13 * | 13 * |
14 * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY | 14 * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY |
15 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | 15 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
16 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR | 16 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR |
17 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR | 17 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR |
18 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, | 18 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, |
19 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, | 19 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, |
20 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR | 20 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR |
21 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY | 21 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY |
22 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 22 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
23 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 23 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
24 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 24 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
25 */ | 25 */ |
26 | 26 |
27 #ifndef SQLiteDatabase_h | 27 #ifndef SQLiteDatabase_h |
28 #define SQLiteDatabase_h | 28 #define SQLiteDatabase_h |
29 | 29 |
| 30 #include "heap/Handle.h" |
30 #include "wtf/Threading.h" | 31 #include "wtf/Threading.h" |
31 #include "wtf/ThreadingPrimitives.h" | 32 #include "wtf/ThreadingPrimitives.h" |
32 #include "wtf/text/CString.h" | 33 #include "wtf/text/CString.h" |
33 #include "wtf/text/WTFString.h" | 34 #include "wtf/text/WTFString.h" |
34 | 35 |
35 #if COMPILER(MSVC) | 36 #if COMPILER(MSVC) |
36 #pragma warning(disable: 4800) | 37 #pragma warning(disable: 4800) |
37 #endif | 38 #endif |
38 | 39 |
39 struct sqlite3; | 40 struct sqlite3; |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
90 int64_t totalSize(); | 91 int64_t totalSize(); |
91 | 92 |
92 int lastError(); | 93 int lastError(); |
93 const char* lastErrorMsg(); | 94 const char* lastErrorMsg(); |
94 | 95 |
95 sqlite3* sqlite3Handle() const { | 96 sqlite3* sqlite3Handle() const { |
96 ASSERT(m_sharable || currentThread() == m_openingThread || !m_db); | 97 ASSERT(m_sharable || currentThread() == m_openingThread || !m_db); |
97 return m_db; | 98 return m_db; |
98 } | 99 } |
99 | 100 |
100 void setAuthorizer(PassRefPtr<DatabaseAuthorizer>); | 101 void setAuthorizer(DatabaseAuthorizer*); |
101 | 102 |
102 Mutex& databaseMutex() { return m_lockingMutex; } | 103 Mutex& databaseMutex() { return m_lockingMutex; } |
103 bool isAutoCommitOn() const; | 104 bool isAutoCommitOn() const; |
104 | 105 |
105 // The SQLite AUTO_VACUUM pragma can be either NONE, FULL, or INCREMENTAL. | 106 // The SQLite AUTO_VACUUM pragma can be either NONE, FULL, or INCREMENTAL. |
106 // NONE - SQLite does not do any vacuuming | 107 // NONE - SQLite does not do any vacuuming |
107 // FULL - SQLite moves all empty pages to the end of the DB file and truncat
es | 108 // FULL - SQLite moves all empty pages to the end of the DB file and truncat
es |
108 // the file to remove those pages after every transaction. This optio
n | 109 // the file to remove those pages after every transaction. This optio
n |
109 // requires SQLite to store additional information about each page in | 110 // requires SQLite to store additional information about each page in |
110 // the database file. | 111 // the database file. |
(...skipping 10 matching lines...) Expand all Loading... |
121 | 122 |
122 int pageSize(); | 123 int pageSize(); |
123 | 124 |
124 sqlite3* m_db; | 125 sqlite3* m_db; |
125 int m_pageSize; | 126 int m_pageSize; |
126 | 127 |
127 bool m_transactionInProgress; | 128 bool m_transactionInProgress; |
128 bool m_sharable; | 129 bool m_sharable; |
129 | 130 |
130 Mutex m_authorizerLock; | 131 Mutex m_authorizerLock; |
131 RefPtr<DatabaseAuthorizer> m_authorizer; | 132 RefPtrWillBePersistent<DatabaseAuthorizer> m_authorizer; |
132 | 133 |
133 Mutex m_lockingMutex; | 134 Mutex m_lockingMutex; |
134 ThreadIdentifier m_openingThread; | 135 ThreadIdentifier m_openingThread; |
135 | 136 |
136 Mutex m_databaseClosingMutex; | 137 Mutex m_databaseClosingMutex; |
137 bool m_interrupted; | 138 bool m_interrupted; |
138 | 139 |
139 int m_openError; | 140 int m_openError; |
140 CString m_openErrorMessage; | 141 CString m_openErrorMessage; |
141 | 142 |
142 int m_lastChangesCount; | 143 int m_lastChangesCount; |
143 }; | 144 }; |
144 | 145 |
145 } // namespace WebCore | 146 } // namespace WebCore |
146 | 147 |
147 #endif | 148 #endif |
OLD | NEW |