| 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 are | 5 * modification, are permitted provided that the following conditions are |
| 6 * met: | 6 * met: |
| 7 * | 7 * |
| 8 * * Redistributions of source code must retain the above copyright | 8 * * 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 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 75 return this; | 75 return this; |
| 76 } | 76 } |
| 77 | 77 |
| 78 void DatabaseSync::changeVersion(const String& oldVersion, const String& newVers
ion, PassRefPtr<SQLTransactionSyncCallback> changeVersionCallback, ExceptionStat
e& es) | 78 void DatabaseSync::changeVersion(const String& oldVersion, const String& newVers
ion, PassRefPtr<SQLTransactionSyncCallback> changeVersionCallback, ExceptionStat
e& es) |
| 79 { | 79 { |
| 80 ASSERT(m_scriptExecutionContext->isContextThread()); | 80 ASSERT(m_scriptExecutionContext->isContextThread()); |
| 81 | 81 |
| 82 if (sqliteDatabase().transactionInProgress()) { | 82 if (sqliteDatabase().transactionInProgress()) { |
| 83 reportChangeVersionResult(1, SQLError::DATABASE_ERR, 0); | 83 reportChangeVersionResult(1, SQLError::DATABASE_ERR, 0); |
| 84 setLastErrorMessage("unable to changeVersion from within a transaction")
; | 84 setLastErrorMessage("unable to changeVersion from within a transaction")
; |
| 85 es.throwDOMException(SQLDatabaseError); | 85 es.throwUninformativeAndGenericDOMException(SQLDatabaseError); |
| 86 return; | 86 return; |
| 87 } | 87 } |
| 88 | 88 |
| 89 RefPtr<SQLTransactionSync> transaction = SQLTransactionSync::create(this, ch
angeVersionCallback, false); | 89 RefPtr<SQLTransactionSync> transaction = SQLTransactionSync::create(this, ch
angeVersionCallback, false); |
| 90 transaction->begin(es); | 90 transaction->begin(es); |
| 91 if (es.hadException()) { | 91 if (es.hadException()) { |
| 92 ASSERT(!lastErrorMessage().isEmpty()); | 92 ASSERT(!lastErrorMessage().isEmpty()); |
| 93 return; | 93 return; |
| 94 } | 94 } |
| 95 | 95 |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 152 setLastErrorMessage(""); | 152 setLastErrorMessage(""); |
| 153 return; | 153 return; |
| 154 } | 154 } |
| 155 | 155 |
| 156 void DatabaseSync::runTransaction(PassRefPtr<SQLTransactionSyncCallback> callbac
k, bool readOnly, ExceptionState& es) | 156 void DatabaseSync::runTransaction(PassRefPtr<SQLTransactionSyncCallback> callbac
k, bool readOnly, ExceptionState& es) |
| 157 { | 157 { |
| 158 ASSERT(m_scriptExecutionContext->isContextThread()); | 158 ASSERT(m_scriptExecutionContext->isContextThread()); |
| 159 | 159 |
| 160 if (sqliteDatabase().transactionInProgress()) { | 160 if (sqliteDatabase().transactionInProgress()) { |
| 161 setLastErrorMessage("unable to start a transaction from within a transac
tion"); | 161 setLastErrorMessage("unable to start a transaction from within a transac
tion"); |
| 162 es.throwDOMException(SQLDatabaseError); | 162 es.throwUninformativeAndGenericDOMException(SQLDatabaseError); |
| 163 return; | 163 return; |
| 164 } | 164 } |
| 165 | 165 |
| 166 RefPtr<SQLTransactionSync> transaction = SQLTransactionSync::create(this, ca
llback, readOnly); | 166 RefPtr<SQLTransactionSync> transaction = SQLTransactionSync::create(this, ca
llback, readOnly); |
| 167 transaction->begin(es); | 167 transaction->begin(es); |
| 168 if (es.hadException()) { | 168 if (es.hadException()) { |
| 169 rollbackTransaction(transaction); | 169 rollbackTransaction(transaction); |
| 170 return; | 170 return; |
| 171 } | 171 } |
| 172 | 172 |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 216 ASSERT(m_scriptExecutionContext->isContextThread()); | 216 ASSERT(m_scriptExecutionContext->isContextThread()); |
| 217 | 217 |
| 218 if (!opened()) | 218 if (!opened()) |
| 219 return; | 219 return; |
| 220 | 220 |
| 221 logErrorMessage("forcibly closing database"); | 221 logErrorMessage("forcibly closing database"); |
| 222 closeDatabase(); | 222 closeDatabase(); |
| 223 } | 223 } |
| 224 | 224 |
| 225 } // namespace WebCore | 225 } // namespace WebCore |
| OLD | NEW |