| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2010 Google Inc. All rights reserved. | 2 * Copyright (C) 2010 Google Inc. All rights reserved. |
| 3 * Copyright (C) 2013 Apple Inc. All rights reserved. | 3 * Copyright (C) 2013 Apple Inc. All rights reserved. |
| 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 are | 6 * modification, are permitted provided that the following conditions are |
| 7 * met: | 7 * met: |
| 8 * | 8 * |
| 9 * * Redistributions of source code must retain the above copyright | 9 * * Redistributions of source code must retain the above copyright |
| 10 * notice, this list of conditions and the following disclaimer. | 10 * notice, this list of conditions and the following disclaimer. |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 76 #else | 76 #else |
| 77 rollbackIfInProgress(); | 77 rollbackIfInProgress(); |
| 78 #endif | 78 #endif |
| 79 } | 79 } |
| 80 | 80 |
| 81 void SQLTransactionBackendSync::trace(Visitor* visitor) | 81 void SQLTransactionBackendSync::trace(Visitor* visitor) |
| 82 { | 82 { |
| 83 visitor->trace(m_database); | 83 visitor->trace(m_database); |
| 84 } | 84 } |
| 85 | 85 |
| 86 PassRefPtr<SQLResultSet> SQLTransactionBackendSync::executeSQL(const String& sql
Statement, const Vector<SQLValue>& arguments, ExceptionState& exceptionState) | 86 PassRefPtrWillBeRawPtr<SQLResultSet> SQLTransactionBackendSync::executeSQL(const
String& sqlStatement, const Vector<SQLValue>& arguments, ExceptionState& except
ionState) |
| 87 { | 87 { |
| 88 ASSERT(m_database->executionContext()->isContextThread()); | 88 ASSERT(m_database->executionContext()->isContextThread()); |
| 89 | 89 |
| 90 m_database->setLastErrorMessage(""); | 90 m_database->setLastErrorMessage(""); |
| 91 | 91 |
| 92 if (!m_database->opened()) { | 92 if (!m_database->opened()) { |
| 93 m_database->setLastErrorMessage("cannot executeSQL because the database
is not open"); | 93 m_database->setLastErrorMessage("cannot executeSQL because the database
is not open"); |
| 94 exceptionState.throwDOMException(UnknownError, SQLError::unknownErrorMes
sage); | 94 exceptionState.throwDOMException(UnknownError, SQLError::unknownErrorMes
sage); |
| 95 return nullptr; | 95 return nullptr; |
| 96 } | 96 } |
| (...skipping 10 matching lines...) Expand all Loading... |
| 107 int permissions = DatabaseAuthorizer::ReadWriteMask; | 107 int permissions = DatabaseAuthorizer::ReadWriteMask; |
| 108 if (!m_database->databaseContext()->allowDatabaseAccess()) | 108 if (!m_database->databaseContext()->allowDatabaseAccess()) |
| 109 permissions |= DatabaseAuthorizer::NoAccessMask; | 109 permissions |= DatabaseAuthorizer::NoAccessMask; |
| 110 else if (m_readOnly) | 110 else if (m_readOnly) |
| 111 permissions |= DatabaseAuthorizer::ReadOnlyMask; | 111 permissions |= DatabaseAuthorizer::ReadOnlyMask; |
| 112 | 112 |
| 113 SQLStatementSync statement(sqlStatement, arguments, permissions); | 113 SQLStatementSync statement(sqlStatement, arguments, permissions); |
| 114 | 114 |
| 115 m_database->resetAuthorizer(); | 115 m_database->resetAuthorizer(); |
| 116 bool retryStatement = true; | 116 bool retryStatement = true; |
| 117 RefPtr<SQLResultSet> resultSet; | 117 RefPtrWillBeRawPtr<SQLResultSet> resultSet; |
| 118 while (retryStatement) { | 118 while (retryStatement) { |
| 119 retryStatement = false; | 119 retryStatement = false; |
| 120 resultSet = statement.execute(m_database.get(), exceptionState); | 120 resultSet = statement.execute(m_database.get(), exceptionState); |
| 121 if (!resultSet) { | 121 if (!resultSet) { |
| 122 if (m_sqliteTransaction->wasRolledBackBySqlite()) | 122 if (m_sqliteTransaction->wasRolledBackBySqlite()) |
| 123 return nullptr; | 123 return nullptr; |
| 124 | 124 |
| 125 if (exceptionState.code() == QuotaExceededError) { | 125 if (exceptionState.code() == QuotaExceededError) { |
| 126 if (m_transactionClient->didExceedQuota(database())) { | 126 if (m_transactionClient->didExceedQuota(database())) { |
| 127 exceptionState.clearException(); | 127 exceptionState.clearException(); |
| (...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 251 if (m_sqliteTransaction) { | 251 if (m_sqliteTransaction) { |
| 252 m_sqliteTransaction->rollback(); | 252 m_sqliteTransaction->rollback(); |
| 253 m_sqliteTransaction.clear(); | 253 m_sqliteTransaction.clear(); |
| 254 } | 254 } |
| 255 m_database->enableAuthorizer(); | 255 m_database->enableAuthorizer(); |
| 256 | 256 |
| 257 ASSERT(!m_database->sqliteDatabase().transactionInProgress()); | 257 ASSERT(!m_database->sqliteDatabase().transactionInProgress()); |
| 258 } | 258 } |
| 259 | 259 |
| 260 } // namespace WebCore | 260 } // namespace WebCore |
| OLD | NEW |