| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2007, 2013 Apple Inc. All rights reserved. | 2 * Copyright (C) 2007, 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 25 matching lines...) Expand all Loading... |
| 36 #include "modules/webdatabase/SQLStatementErrorCallback.h" | 36 #include "modules/webdatabase/SQLStatementErrorCallback.h" |
| 37 #include "modules/webdatabase/SQLTransaction.h" | 37 #include "modules/webdatabase/SQLTransaction.h" |
| 38 #include "modules/webdatabase/sqlite/SQLiteDatabase.h" | 38 #include "modules/webdatabase/sqlite/SQLiteDatabase.h" |
| 39 #include "modules/webdatabase/sqlite/SQLiteStatement.h" | 39 #include "modules/webdatabase/sqlite/SQLiteStatement.h" |
| 40 #include "platform/Logging.h" | 40 #include "platform/Logging.h" |
| 41 #include "wtf/text/CString.h" | 41 #include "wtf/text/CString.h" |
| 42 | 42 |
| 43 namespace blink { | 43 namespace blink { |
| 44 | 44 |
| 45 PassOwnPtrWillBeRawPtr<SQLStatement> SQLStatement::create(Database* database, | 45 PassOwnPtrWillBeRawPtr<SQLStatement> SQLStatement::create(Database* database, |
| 46 PassOwnPtrWillBeRawPtr<SQLStatementCallback> callback, PassOwnPtrWillBeRawPt
r<SQLStatementErrorCallback> errorCallback) | 46 SQLStatementCallback* callback, SQLStatementErrorCallback* errorCallback) |
| 47 { | 47 { |
| 48 return adoptPtrWillBeNoop(new SQLStatement(database, callback, errorCallback
)); | 48 return adoptPtrWillBeNoop(new SQLStatement(database, callback, errorCallback
)); |
| 49 } | 49 } |
| 50 | 50 |
| 51 SQLStatement::SQLStatement(Database* database, PassOwnPtrWillBeRawPtr<SQLStateme
ntCallback> callback, | 51 SQLStatement::SQLStatement(Database* database, SQLStatementCallback* callback, |
| 52 PassOwnPtrWillBeRawPtr<SQLStatementErrorCallback> errorCallback) | 52 SQLStatementErrorCallback* errorCallback) |
| 53 : m_statementCallbackWrapper(callback, database->executionContext()) | 53 : m_statementCallbackWrapper(callback, database->executionContext()) |
| 54 , m_statementErrorCallbackWrapper(errorCallback, database->executionContext(
)) | 54 , m_statementErrorCallbackWrapper(errorCallback, database->executionContext(
)) |
| 55 { | 55 { |
| 56 } | 56 } |
| 57 | 57 |
| 58 SQLStatement::~SQLStatement() | 58 SQLStatement::~SQLStatement() |
| 59 { | 59 { |
| 60 } | 60 } |
| 61 | 61 |
| 62 void SQLStatement::trace(Visitor* visitor) | 62 void SQLStatement::trace(Visitor* visitor) |
| (...skipping 18 matching lines...) Expand all Loading... |
| 81 return m_statementErrorCallbackWrapper.hasCallback(); | 81 return m_statementErrorCallbackWrapper.hasCallback(); |
| 82 } | 82 } |
| 83 | 83 |
| 84 bool SQLStatement::performCallback(SQLTransaction* transaction) | 84 bool SQLStatement::performCallback(SQLTransaction* transaction) |
| 85 { | 85 { |
| 86 ASSERT(transaction); | 86 ASSERT(transaction); |
| 87 ASSERT(m_backend); | 87 ASSERT(m_backend); |
| 88 | 88 |
| 89 bool callbackError = false; | 89 bool callbackError = false; |
| 90 | 90 |
| 91 OwnPtrWillBeRawPtr<SQLStatementCallback> callback = m_statementCallbackWrapp
er.unwrap(); | 91 SQLStatementCallback* callback = m_statementCallbackWrapper.unwrap(); |
| 92 OwnPtrWillBeRawPtr<SQLStatementErrorCallback> errorCallback = m_statementErr
orCallbackWrapper.unwrap(); | 92 SQLStatementErrorCallback* errorCallback = m_statementErrorCallbackWrapper.u
nwrap(); |
| 93 SQLErrorData* error = m_backend->sqlError(); | 93 SQLErrorData* error = m_backend->sqlError(); |
| 94 | 94 |
| 95 // Call the appropriate statement callback and track if it resulted in an er
ror, | 95 // Call the appropriate statement callback and track if it resulted in an er
ror, |
| 96 // because then we need to jump to the transaction error callback. | 96 // because then we need to jump to the transaction error callback. |
| 97 if (error) { | 97 if (error) { |
| 98 if (errorCallback) { | 98 if (errorCallback) { |
| 99 RefPtrWillBeRawPtr<SQLError> sqlError = SQLError::create(*error); | 99 RefPtrWillBeRawPtr<SQLError> sqlError = SQLError::create(*error); |
| 100 callbackError = errorCallback->handleEvent(transaction, sqlError.get
()); | 100 callbackError = errorCallback->handleEvent(transaction, sqlError.get
()); |
| 101 } | 101 } |
| 102 } else if (callback) { | 102 } else if (callback) { |
| 103 RefPtrWillBeRawPtr<SQLResultSet> resultSet = m_backend->sqlResultSet(); | 103 RefPtrWillBeRawPtr<SQLResultSet> resultSet = m_backend->sqlResultSet(); |
| 104 callbackError = !callback->handleEvent(transaction, resultSet.get()); | 104 callbackError = !callback->handleEvent(transaction, resultSet.get()); |
| 105 } | 105 } |
| 106 | 106 |
| 107 return callbackError; | 107 return callbackError; |
| 108 } | 108 } |
| 109 | 109 |
| 110 } // namespace blink | 110 } // namespace blink |
| OLD | NEW |