OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2007, 2008, 2013 Apple Inc. All rights reserved. | 2 * Copyright (C) 2007, 2008, 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 299 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
310 exception_state); | 310 exception_state); |
311 } | 311 } |
312 | 312 |
313 void SQLTransaction::executeSql(ScriptState* script_state, | 313 void SQLTransaction::executeSql(ScriptState* script_state, |
314 const String& sql_statement, | 314 const String& sql_statement, |
315 const Nullable<Vector<ScriptValue>>& arguments, | 315 const Nullable<Vector<ScriptValue>>& arguments, |
316 SQLStatementCallback* callback, | 316 SQLStatementCallback* callback, |
317 SQLStatementErrorCallback* callback_error, | 317 SQLStatementErrorCallback* callback_error, |
318 ExceptionState& exception_state) { | 318 ExceptionState& exception_state) { |
319 Vector<SQLValue> sql_values; | 319 Vector<SQLValue> sql_values; |
320 if (!arguments.IsNull()) | 320 if (!arguments.IsNull()) { |
321 sql_values = ToImplArray<Vector<SQLValue>>( | 321 sql_values.ReserveInitialCapacity(arguments.Get().size()); |
322 arguments.Get(), script_state->GetIsolate(), exception_state); | 322 for (const auto& script_value : arguments.Get()) { |
| 323 sql_values.emplace_back(ScriptValue::To<SQLValue>( |
| 324 script_state->GetIsolate(), script_value, exception_state)); |
| 325 } |
| 326 } |
323 ExecuteSQL(sql_statement, sql_values, callback, callback_error, | 327 ExecuteSQL(sql_statement, sql_values, callback, callback_error, |
324 exception_state); | 328 exception_state); |
325 } | 329 } |
326 | 330 |
327 bool SQLTransaction::ComputeNextStateAndCleanupIfNeeded() { | 331 bool SQLTransaction::ComputeNextStateAndCleanupIfNeeded() { |
328 // Only honor the requested state transition if we're not supposed to be | 332 // Only honor the requested state transition if we're not supposed to be |
329 // cleaning up and shutting down: | 333 // cleaning up and shutting down: |
330 if (database_->Opened()) { | 334 if (database_->Opened()) { |
331 SetStateToRequestedState(); | 335 SetStateToRequestedState(); |
332 DCHECK(next_state_ == SQLTransactionState::kEnd || | 336 DCHECK(next_state_ == SQLTransactionState::kEnd || |
(...skipping 19 matching lines...) Expand all Loading... |
352 callback_.Clear(); | 356 callback_.Clear(); |
353 success_callback_.Clear(); | 357 success_callback_.Clear(); |
354 error_callback_.Clear(); | 358 error_callback_.Clear(); |
355 } | 359 } |
356 | 360 |
357 SQLTransactionErrorCallback* SQLTransaction::ReleaseErrorCallback() { | 361 SQLTransactionErrorCallback* SQLTransaction::ReleaseErrorCallback() { |
358 return error_callback_.Release(); | 362 return error_callback_.Release(); |
359 } | 363 } |
360 | 364 |
361 } // namespace blink | 365 } // namespace blink |
OLD | NEW |