| 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 14 matching lines...) Expand all Loading... |
| 25 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF | 25 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF |
| 26 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 26 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 27 */ | 27 */ |
| 28 #include "config.h" | 28 #include "config.h" |
| 29 #include "modules/webdatabase/SQLStatement.h" | 29 #include "modules/webdatabase/SQLStatement.h" |
| 30 | 30 |
| 31 #include "platform/Logging.h" | 31 #include "platform/Logging.h" |
| 32 #include "modules/webdatabase/sqlite/SQLiteDatabase.h" | 32 #include "modules/webdatabase/sqlite/SQLiteDatabase.h" |
| 33 #include "modules/webdatabase/sqlite/SQLiteStatement.h" | 33 #include "modules/webdatabase/sqlite/SQLiteStatement.h" |
| 34 #include "modules/webdatabase/AbstractDatabaseServer.h" | 34 #include "modules/webdatabase/AbstractDatabaseServer.h" |
| 35 #include "modules/webdatabase/AbstractSQLStatementBackend.h" | |
| 36 #include "modules/webdatabase/Database.h" | 35 #include "modules/webdatabase/Database.h" |
| 37 #include "modules/webdatabase/DatabaseManager.h" | 36 #include "modules/webdatabase/DatabaseManager.h" |
| 37 #include "modules/webdatabase/SQLError.h" |
| 38 #include "modules/webdatabase/SQLStatementBackend.h" |
| 38 #include "modules/webdatabase/SQLStatementCallback.h" | 39 #include "modules/webdatabase/SQLStatementCallback.h" |
| 39 #include "modules/webdatabase/SQLStatementErrorCallback.h" | 40 #include "modules/webdatabase/SQLStatementErrorCallback.h" |
| 40 #include "modules/webdatabase/SQLTransaction.h" | 41 #include "modules/webdatabase/SQLTransaction.h" |
| 41 #include "wtf/text/CString.h" | 42 #include "wtf/text/CString.h" |
| 42 | 43 |
| 43 namespace blink { | 44 namespace blink { |
| 44 | 45 |
| 45 PassOwnPtrWillBeRawPtr<SQLStatement> SQLStatement::create(Database* database, | 46 PassOwnPtrWillBeRawPtr<SQLStatement> SQLStatement::create(Database* database, |
| 46 PassOwnPtrWillBeRawPtr<SQLStatementCallback> callback, PassOwnPtrWillBeRawPt
r<SQLStatementErrorCallback> errorCallback) | 47 PassOwnPtrWillBeRawPtr<SQLStatementCallback> callback, PassOwnPtrWillBeRawPt
r<SQLStatementErrorCallback> errorCallback) |
| 47 { | 48 { |
| 48 return adoptPtrWillBeNoop(new SQLStatement(database, callback, errorCallback
)); | 49 return adoptPtrWillBeNoop(new SQLStatement(database, callback, errorCallback
)); |
| 49 } | 50 } |
| 50 | 51 |
| 51 SQLStatement::SQLStatement(Database* database, PassOwnPtrWillBeRawPtr<SQLStateme
ntCallback> callback, | 52 SQLStatement::SQLStatement(Database* database, PassOwnPtrWillBeRawPtr<SQLStateme
ntCallback> callback, |
| 52 PassOwnPtrWillBeRawPtr<SQLStatementErrorCallback> errorCallback) | 53 PassOwnPtrWillBeRawPtr<SQLStatementErrorCallback> errorCallback) |
| 53 : m_statementCallbackWrapper(callback, database->executionContext()) | 54 : m_statementCallbackWrapper(callback, database->executionContext()) |
| 54 , m_statementErrorCallbackWrapper(errorCallback, database->executionContext(
)) | 55 , m_statementErrorCallbackWrapper(errorCallback, database->executionContext(
)) |
| 55 { | 56 { |
| 56 } | 57 } |
| 57 | 58 |
| 59 SQLStatement::~SQLStatement() |
| 60 { |
| 61 } |
| 62 |
| 58 void SQLStatement::trace(Visitor* visitor) | 63 void SQLStatement::trace(Visitor* visitor) |
| 59 { | 64 { |
| 60 visitor->trace(m_backend); | 65 visitor->trace(m_backend); |
| 61 visitor->trace(m_statementCallbackWrapper); | 66 visitor->trace(m_statementCallbackWrapper); |
| 62 visitor->trace(m_statementErrorCallbackWrapper); | 67 visitor->trace(m_statementErrorCallbackWrapper); |
| 63 AbstractSQLStatement::trace(visitor); | |
| 64 } | 68 } |
| 65 | 69 |
| 66 void SQLStatement::setBackend(AbstractSQLStatementBackend* backend) | 70 void SQLStatement::setBackend(SQLStatementBackend* backend) |
| 67 { | 71 { |
| 68 m_backend = backend; | 72 m_backend = backend; |
| 69 } | 73 } |
| 70 | 74 |
| 71 bool SQLStatement::hasCallback() | 75 bool SQLStatement::hasCallback() |
| 72 { | 76 { |
| 73 return m_statementCallbackWrapper.hasCallback(); | 77 return m_statementCallbackWrapper.hasCallback(); |
| 74 } | 78 } |
| 75 | 79 |
| 76 bool SQLStatement::hasErrorCallback() | 80 bool SQLStatement::hasErrorCallback() |
| (...skipping 21 matching lines...) Expand all Loading... |
| 98 } | 102 } |
| 99 } else if (callback) { | 103 } else if (callback) { |
| 100 RefPtrWillBeRawPtr<SQLResultSet> resultSet = m_backend->sqlResultSet(); | 104 RefPtrWillBeRawPtr<SQLResultSet> resultSet = m_backend->sqlResultSet(); |
| 101 callbackError = !callback->handleEvent(transaction, resultSet.get()); | 105 callbackError = !callback->handleEvent(transaction, resultSet.get()); |
| 102 } | 106 } |
| 103 | 107 |
| 104 return callbackError; | 108 return callbackError; |
| 105 } | 109 } |
| 106 | 110 |
| 107 } // namespace blink | 111 } // namespace blink |
| OLD | NEW |