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

Unified Diff: Source/modules/webdatabase/SQLTransaction.cpp

Issue 949193002: [bindings] Remove SQLTransaction's usage of custom binding. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Adding null check for arguments. Created 5 years, 10 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « Source/modules/webdatabase/SQLTransaction.h ('k') | Source/modules/webdatabase/SQLTransaction.idl » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/modules/webdatabase/SQLTransaction.cpp
diff --git a/Source/modules/webdatabase/SQLTransaction.cpp b/Source/modules/webdatabase/SQLTransaction.cpp
index 31a6605d36e5dd9e5d4f14ee97032f92a789056c..1648056862a9613fbcb3f55c1d83c7adfa4c860d 100644
--- a/Source/modules/webdatabase/SQLTransaction.cpp
+++ b/Source/modules/webdatabase/SQLTransaction.cpp
@@ -269,7 +269,7 @@ void SQLTransaction::performPendingCallback()
runStateMachine();
}
-void SQLTransaction::executeSQL(const String& sqlStatement, const Vector<SQLValue>& arguments, SQLStatementCallback* callback, SQLStatementErrorCallback* callbackError, ExceptionState& exceptionState)
+void SQLTransaction::executeSql(const String& sqlStatement, const Nullable<Vector<ScriptValue>>& arguments, SQLStatementCallback* callback, SQLStatementErrorCallback* callbackError, ExceptionState& exceptionState)
{
if (!m_executeSqlAllowed) {
exceptionState.throwDOMException(InvalidStateError, "SQL execution is disallowed.");
@@ -287,8 +287,28 @@ void SQLTransaction::executeSQL(const String& sqlStatement, const Vector<SQLValu
else if (m_readOnly)
permissions |= DatabaseAuthorizer::ReadOnlyMask;
+ Vector<SQLValue> sqlArguments;
+ if (!arguments.isNull()) {
+ const Vector<ScriptValue>& args = arguments.get();
+ for (unsigned i = 0; i < args.size(); ++i) {
+ v8::Local<v8::Value> arg = args[i].v8Value();
jsbell 2015/03/03 18:33:14 Can we factor this out into toSQLValue(const Scrip
haraken 2015/03/04 02:00:07 Sounds nice to put the function into IDBBindingUti
bashi 2015/03/04 03:33:02 Is is possible to use toImplArray()? (You need to
+ if (arg.IsEmpty() || arg->IsNull()) {
+ sqlArguments.append(SQLValue());
+ } else if (arg->IsNumber()) {
+ sqlArguments.append(SQLValue(arg->NumberValue()));
bashi 2015/03/04 03:33:02 FYI, NumberValue() is going to be deprecated. Numb
+ } else {
+ TOSTRING_VOID(V8StringResource<>, stringValue, arg);
+ sqlArguments.append(SQLValue(stringValue));
+ }
+ }
+ }
SQLStatement* statement = SQLStatement::create(m_database.get(), callback, callbackError);
- m_backend->executeSQL(statement, sqlStatement, arguments, permissions);
+ m_backend->executeSQL(statement, sqlStatement, sqlArguments, permissions);
+}
+
+void SQLTransaction::executeSql(const String& sqlStatement, ExceptionState& exceptionState)
+{
+ executeSql(sqlStatement, Vector<ScriptValue>(), nullptr, nullptr, exceptionState);
}
bool SQLTransaction::computeNextStateAndCleanupIfNeeded()
« no previous file with comments | « Source/modules/webdatabase/SQLTransaction.h ('k') | Source/modules/webdatabase/SQLTransaction.idl » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698