OLD | NEW |
---|---|
(Empty) | |
1 // Copyright (c) 2015 The Chromium Authors. All rights reserved. | |
2 // Use of this source code is governed by a BSD-style license that can be | |
3 // found in the LICENSE file. | |
4 | |
5 #include "config.h" | |
6 #include "bindings/modules/v8/V8BindingForModules.h" | |
7 | |
8 #include "bindings/core/v8/V8Binding.h" | |
9 #include "modules/webdatabase/sqlite/SQLValue.h" | |
10 | |
11 namespace blink { | |
12 | |
13 Vector<SQLValue> toSQLValueArray(const Nullable<Vector<ScriptValue>>& values) | |
Jens Widell
2015/03/05 13:54:37
I think toSQLValueArray(const Vector<ScriptValue>>
bashi
2015/03/06 00:52:58
We might want to have more generic one like follow
| |
14 { | |
15 if (values.isNull()) | |
16 return Vector<SQLValue>(); | |
17 | |
18 Vector<SQLValue> sqlValues; | |
19 const Vector<ScriptValue>& arguments = values.get(); | |
20 for (unsigned i = 0; i < arguments.size(); ++i) { | |
21 const v8::Local<v8::Value>& arg = arguments[i].v8Value(); | |
22 if (arg.IsEmpty() || arg->IsNull()) { | |
23 sqlValues.append(SQLValue()); | |
24 } else if (arg->IsNumber()) { | |
25 sqlValues.append(SQLValue(arg->NumberValue())); | |
26 } else { | |
27 TOSTRING_DEFAULT(V8StringResource<>, stringValue, arg, Vector<SQLVal ue>()); | |
Jens Widell
2015/03/05 13:54:38
Exception handling is wrong here. This function sh
| |
28 sqlValues.append(SQLValue(stringValue)); | |
29 } | |
30 } | |
31 return sqlValues; | |
32 } | |
33 | |
34 } // namespace blink | |
OLD | NEW |