OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2007, 2008, 2013 Apple Inc. All rights reserved. | 2 * Copyright (C) 2007, 2008, 2013 Apple 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 273 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
284 int permissions = DatabaseAuthorizer::ReadWriteMask; | 284 int permissions = DatabaseAuthorizer::ReadWriteMask; |
285 if (!m_database->databaseContext()->allowDatabaseAccess()) | 285 if (!m_database->databaseContext()->allowDatabaseAccess()) |
286 permissions |= DatabaseAuthorizer::NoAccessMask; | 286 permissions |= DatabaseAuthorizer::NoAccessMask; |
287 else if (m_readOnly) | 287 else if (m_readOnly) |
288 permissions |= DatabaseAuthorizer::ReadOnlyMask; | 288 permissions |= DatabaseAuthorizer::ReadOnlyMask; |
289 | 289 |
290 SQLStatement* statement = SQLStatement::create(m_database.get(), callback, c
allbackError); | 290 SQLStatement* statement = SQLStatement::create(m_database.get(), callback, c
allbackError); |
291 m_backend->executeSQL(statement, sqlStatement, arguments, permissions); | 291 m_backend->executeSQL(statement, sqlStatement, arguments, permissions); |
292 } | 292 } |
293 | 293 |
| 294 void SQLTransaction::executeSql(ScriptState* scriptState, const String& sqlState
ment, ExceptionState& exceptionState) |
| 295 { |
| 296 executeSQL(sqlStatement, Vector<SQLValue>(), nullptr, nullptr, exceptionStat
e); |
| 297 } |
| 298 |
| 299 void SQLTransaction::executeSql(ScriptState* scriptState, const String& sqlState
ment, const Nullable<Vector<ScriptValue>>& arguments, SQLStatementCallback* call
back, SQLStatementErrorCallback* callbackError, ExceptionState& exceptionState) |
| 300 { |
| 301 Vector<SQLValue> sqlValues; |
| 302 if (!arguments.isNull()) |
| 303 sqlValues = toImplArray<SQLValue>(arguments.get(), scriptState->isolate(
), exceptionState); |
| 304 executeSQL(sqlStatement, sqlValues, callback, callbackError, exceptionState)
; |
| 305 } |
| 306 |
294 bool SQLTransaction::computeNextStateAndCleanupIfNeeded() | 307 bool SQLTransaction::computeNextStateAndCleanupIfNeeded() |
295 { | 308 { |
296 // Only honor the requested state transition if we're not supposed to be | 309 // Only honor the requested state transition if we're not supposed to be |
297 // cleaning up and shutting down: | 310 // cleaning up and shutting down: |
298 if (m_database->opened()) { | 311 if (m_database->opened()) { |
299 setStateToRequestedState(); | 312 setStateToRequestedState(); |
300 ASSERT(m_nextState == SQLTransactionState::End | 313 ASSERT(m_nextState == SQLTransactionState::End |
301 || m_nextState == SQLTransactionState::DeliverTransactionCallback | 314 || m_nextState == SQLTransactionState::DeliverTransactionCallback |
302 || m_nextState == SQLTransactionState::DeliverTransactionErrorCallba
ck | 315 || m_nextState == SQLTransactionState::DeliverTransactionErrorCallba
ck |
303 || m_nextState == SQLTransactionState::DeliverStatementCallback | 316 || m_nextState == SQLTransactionState::DeliverStatementCallback |
(...skipping 16 matching lines...) Expand all Loading... |
320 m_successCallback.clear(); | 333 m_successCallback.clear(); |
321 m_errorCallback.clear(); | 334 m_errorCallback.clear(); |
322 } | 335 } |
323 | 336 |
324 SQLTransactionErrorCallback* SQLTransaction::releaseErrorCallback() | 337 SQLTransactionErrorCallback* SQLTransaction::releaseErrorCallback() |
325 { | 338 { |
326 return m_errorCallback.release(); | 339 return m_errorCallback.release(); |
327 } | 340 } |
328 | 341 |
329 } // namespace blink | 342 } // namespace blink |
OLD | NEW |