Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(569)

Side by Side Diff: Source/modules/webdatabase/SQLStatementSync.cpp

Issue 207453006: Oilpan: Prepare to move SQLResultSet and SQLResultSetRowList to oilpan heap. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Remove setValid Created 6 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2007 Apple Inc. All rights reserved. 2 * Copyright (C) 2007 Apple Inc. All rights reserved.
3 * Copyright (C) 2010 Google Inc. All rights reserved. 3 * Copyright (C) 2010 Google 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 6 * modification, are permitted provided that the following conditions
7 * are met: 7 * are met:
8 * 8 *
9 * 1. Redistributions of source code must retain the above copyright 9 * 1. 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 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
43 namespace WebCore { 43 namespace WebCore {
44 44
45 SQLStatementSync::SQLStatementSync(const String& statement, const Vector<SQLValu e>& arguments, int permissions) 45 SQLStatementSync::SQLStatementSync(const String& statement, const Vector<SQLValu e>& arguments, int permissions)
46 : m_statement(statement) 46 : m_statement(statement)
47 , m_arguments(arguments) 47 , m_arguments(arguments)
48 , m_permissions(permissions) 48 , m_permissions(permissions)
49 { 49 {
50 ASSERT(!m_statement.isEmpty()); 50 ASSERT(!m_statement.isEmpty());
51 } 51 }
52 52
53 PassRefPtr<SQLResultSet> SQLStatementSync::execute(DatabaseSync* db, ExceptionSt ate& exceptionState) 53 PassRefPtrWillBeRawPtr<SQLResultSet> SQLStatementSync::execute(DatabaseSync* db, ExceptionState& exceptionState)
54 { 54 {
55 db->setAuthorizerPermissions(m_permissions); 55 db->setAuthorizerPermissions(m_permissions);
56 56
57 SQLiteDatabase* database = &db->sqliteDatabase(); 57 SQLiteDatabase* database = &db->sqliteDatabase();
58 58
59 SQLiteStatement statement(*database, m_statement); 59 SQLiteStatement statement(*database, m_statement);
60 int result = statement.prepare(); 60 int result = statement.prepare();
61 if (result != SQLResultOk) { 61 if (result != SQLResultOk) {
62 if (result == SQLResultInterrupt) 62 if (result == SQLResultInterrupt)
63 exceptionState.throwDOMException(SQLDatabaseError, "Connection to th e database interrupted."); 63 exceptionState.throwDOMException(SQLDatabaseError, "Connection to th e database interrupted.");
(...skipping 20 matching lines...) Expand all
84 return nullptr; 84 return nullptr;
85 } 85 }
86 86
87 if (result != SQLResultOk) { 87 if (result != SQLResultOk) {
88 exceptionState.throwDOMException(SQLDatabaseError, "Could not bind v alue."); 88 exceptionState.throwDOMException(SQLDatabaseError, "Could not bind v alue.");
89 db->setLastErrorMessage("could not bind value", result, database->la stErrorMsg()); 89 db->setLastErrorMessage("could not bind value", result, database->la stErrorMsg());
90 return nullptr; 90 return nullptr;
91 } 91 }
92 } 92 }
93 93
94 RefPtr<SQLResultSet> resultSet = SQLResultSet::create(); 94 RefPtrWillBeRawPtr<SQLResultSet> resultSet = SQLResultSet::create();
95 95
96 // Step so we can fetch the column names. 96 // Step so we can fetch the column names.
97 result = statement.step(); 97 result = statement.step();
98 if (result == SQLResultRow) { 98 if (result == SQLResultRow) {
99 int columnCount = statement.columnCount(); 99 int columnCount = statement.columnCount();
100 SQLResultSetRowList* rows = resultSet->rows(); 100 SQLResultSetRowList* rows = resultSet->rows();
101 101
102 for (int i = 0; i < columnCount; i++) 102 for (int i = 0; i < columnCount; i++)
103 rows->addColumn(statement.getColumnName(i)); 103 rows->addColumn(statement.getColumnName(i));
104 104
(...skipping 26 matching lines...) Expand all
131 exceptionState.throwDOMException(SQLDatabaseError, "Could not execute st atement."); 131 exceptionState.throwDOMException(SQLDatabaseError, "Could not execute st atement.");
132 db->setLastErrorMessage("could not execute statement", result, database- >lastErrorMsg()); 132 db->setLastErrorMessage("could not execute statement", result, database- >lastErrorMsg());
133 return nullptr; 133 return nullptr;
134 } 134 }
135 135
136 resultSet->setRowsAffected(database->lastChanges()); 136 resultSet->setRowsAffected(database->lastChanges());
137 return resultSet.release(); 137 return resultSet.release();
138 } 138 }
139 139
140 } // namespace WebCore 140 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/modules/webdatabase/SQLStatementSync.h ('k') | Source/modules/webdatabase/SQLTransactionBackendSync.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698