| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2010 Google Inc. All rights reserved. | 2 * Copyright (C) 2010 Google Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions | 5 * modification, are permitted provided that the following conditions |
| 6 * are met: | 6 * are met: |
| 7 * | 7 * |
| 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 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 64 virtual String displayName() const; | 64 virtual String displayName() const; |
| 65 virtual unsigned long estimatedSize() const; | 65 virtual unsigned long estimatedSize() const; |
| 66 virtual String fileName() const; | 66 virtual String fileName() const; |
| 67 SQLiteDatabase& sqliteDatabase() { return m_sqliteDatabase; } | 67 SQLiteDatabase& sqliteDatabase() { return m_sqliteDatabase; } |
| 68 | 68 |
| 69 unsigned long long maximumSize() const; | 69 unsigned long long maximumSize() const; |
| 70 void incrementalVacuumIfNeeded(); | 70 void incrementalVacuumIfNeeded(); |
| 71 void interrupt(); | 71 void interrupt(); |
| 72 bool isInterrupted(); | 72 bool isInterrupted(); |
| 73 | 73 |
| 74 // FIXME: move all version-related methods to a DatabaseVersionTracker class | |
| 75 bool versionMatchesExpected() const; | |
| 76 void setExpectedVersion(const String& version); | |
| 77 bool getVersionFromDatabase(String& version); | |
| 78 bool setVersionInDatabase(const String& version); | |
| 79 | |
| 80 void disableAuthorizer(); | 74 void disableAuthorizer(); |
| 81 void enableAuthorizer(); | 75 void enableAuthorizer(); |
| 82 void setAuthorizerReadOnly(); | 76 void setAuthorizerReadOnly(); |
| 83 void setAuthorizerPermissions(int permissions); | 77 void setAuthorizerPermissions(int permissions); |
| 84 bool lastActionChangedDatabase(); | 78 bool lastActionChangedDatabase(); |
| 85 bool lastActionWasInsert(); | 79 bool lastActionWasInsert(); |
| 86 void resetDeletes(); | 80 void resetDeletes(); |
| 87 bool hadDeletes(); | 81 bool hadDeletes(); |
| 88 void resetAuthorizer(); | 82 void resetAuthorizer(); |
| 89 | 83 |
| 90 virtual void markAsDeletedAndClose() = 0; | 84 virtual void markAsDeletedAndClose() = 0; |
| 91 virtual void closeImmediately() = 0; | 85 virtual void closeImmediately() = 0; |
| 92 | 86 |
| 93 protected: | 87 protected: |
| 88 friend class SQLTransactionSync; |
| 89 friend class SQLTransaction; |
| 90 friend class ChangeVersionWrapper; |
| 91 |
| 94 AbstractDatabase(ScriptExecutionContext*, const String& name, const String&
expectedVersion, | 92 AbstractDatabase(ScriptExecutionContext*, const String& name, const String&
expectedVersion, |
| 95 const String& displayName, unsigned long estimatedSize); | 93 const String& displayName, unsigned long estimatedSize); |
| 96 | 94 |
| 97 void closeDatabase(); | 95 void closeDatabase(); |
| 98 | 96 |
| 99 virtual bool performOpenAndVerify(bool shouldSetVersionInNewDatabase, Except
ionCode& ec); | 97 virtual bool performOpenAndVerify(bool shouldSetVersionInNewDatabase, Except
ionCode& ec); |
| 100 | 98 |
| 99 bool getVersionFromDatabase(String& version, bool shouldCacheVersion = true)
; |
| 100 bool setVersionInDatabase(const String& version, bool shouldCacheVersion = t
rue); |
| 101 void setExpectedVersion(const String&); |
| 102 const String& expectedVersion() const { return m_expectedVersion; } |
| 103 String getCachedVersion()const; |
| 104 void setCachedVersion(const String&); |
| 105 bool getActualVersionForTransaction(String& version); |
| 106 |
| 101 static const String& databaseInfoTableName(); | 107 static const String& databaseInfoTableName(); |
| 102 | 108 |
| 103 RefPtr<ScriptExecutionContext> m_scriptExecutionContext; | 109 RefPtr<ScriptExecutionContext> m_scriptExecutionContext; |
| 104 RefPtr<SecurityOrigin> m_contextThreadSecurityOrigin; | 110 RefPtr<SecurityOrigin> m_contextThreadSecurityOrigin; |
| 105 | 111 |
| 106 String m_name; | 112 String m_name; |
| 107 String m_expectedVersion; | 113 String m_expectedVersion; |
| 108 String m_displayName; | 114 String m_displayName; |
| 109 unsigned long m_estimatedSize; | 115 unsigned long m_estimatedSize; |
| 110 String m_filename; | 116 String m_filename; |
| (...skipping 12 matching lines...) Expand all Loading... |
| 123 SQLiteDatabase m_sqliteDatabase; | 129 SQLiteDatabase m_sqliteDatabase; |
| 124 | 130 |
| 125 RefPtr<DatabaseAuthorizer> m_databaseAuthorizer; | 131 RefPtr<DatabaseAuthorizer> m_databaseAuthorizer; |
| 126 }; | 132 }; |
| 127 | 133 |
| 128 } // namespace WebCore | 134 } // namespace WebCore |
| 129 | 135 |
| 130 #endif // ENABLE(DATABASE) | 136 #endif // ENABLE(DATABASE) |
| 131 | 137 |
| 132 #endif // AbstractDatabase_h | 138 #endif // AbstractDatabase_h |
| OLD | NEW |