| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2010 Google Inc. All rights reserved. | 2 * Copyright (C) 2010 Google 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 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 79 virtual void trace(Visitor* visitor) | 79 virtual void trace(Visitor* visitor) |
| 80 { | 80 { |
| 81 visitor->trace(m_requestCallback); | 81 visitor->trace(m_requestCallback); |
| 82 SQLStatementCallback::trace(visitor); | 82 SQLStatementCallback::trace(visitor); |
| 83 } | 83 } |
| 84 | 84 |
| 85 virtual bool handleEvent(SQLTransaction*, SQLResultSet* resultSet) override | 85 virtual bool handleEvent(SQLTransaction*, SQLResultSet* resultSet) override |
| 86 { | 86 { |
| 87 SQLResultSetRowList* rowList = resultSet->rows(); | 87 SQLResultSetRowList* rowList = resultSet->rows(); |
| 88 | 88 |
| 89 RefPtr<TypeBuilder::Array<String> > columnNames = TypeBuilder::Array<Str
ing>::create(); | 89 RefPtr<TypeBuilder::Array<String>> columnNames = TypeBuilder::Array<Stri
ng>::create(); |
| 90 const Vector<String>& columns = rowList->columnNames(); | 90 const Vector<String>& columns = rowList->columnNames(); |
| 91 for (size_t i = 0; i < columns.size(); ++i) | 91 for (size_t i = 0; i < columns.size(); ++i) |
| 92 columnNames->addItem(columns[i]); | 92 columnNames->addItem(columns[i]); |
| 93 | 93 |
| 94 RefPtr<TypeBuilder::Array<JSONValue> > values = TypeBuilder::Array<JSONV
alue>::create(); | 94 RefPtr<TypeBuilder::Array<JSONValue>> values = TypeBuilder::Array<JSONVa
lue>::create(); |
| 95 const Vector<SQLValue>& data = rowList->values(); | 95 const Vector<SQLValue>& data = rowList->values(); |
| 96 for (size_t i = 0; i < data.size(); ++i) { | 96 for (size_t i = 0; i < data.size(); ++i) { |
| 97 const SQLValue& value = rowList->values()[i]; | 97 const SQLValue& value = rowList->values()[i]; |
| 98 switch (value.type()) { | 98 switch (value.type()) { |
| 99 case SQLValue::StringValue: values->addItem(JSONString::create(value
.string())); break; | 99 case SQLValue::StringValue: values->addItem(JSONString::create(value
.string())); break; |
| 100 case SQLValue::NumberValue: values->addItem(JSONBasicValue::create(v
alue.number())); break; | 100 case SQLValue::NumberValue: values->addItem(JSONBasicValue::create(v
alue.number())); break; |
| 101 case SQLValue::NullValue: values->addItem(JSONValue::null()); break; | 101 case SQLValue::NullValue: values->addItem(JSONValue::null()); break; |
| 102 } | 102 } |
| 103 } | 103 } |
| 104 m_requestCallback->sendSuccess(columnNames.release(), values.release(),
nullptr); | 104 m_requestCallback->sendSuccess(columnNames.release(), values.release(),
nullptr); |
| (...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 274 return; | 274 return; |
| 275 m_enabled = false; | 275 m_enabled = false; |
| 276 m_state->setBoolean(DatabaseAgentState::databaseAgentEnabled, m_enabled); | 276 m_state->setBoolean(DatabaseAgentState::databaseAgentEnabled, m_enabled); |
| 277 } | 277 } |
| 278 | 278 |
| 279 void InspectorDatabaseAgent::restore() | 279 void InspectorDatabaseAgent::restore() |
| 280 { | 280 { |
| 281 m_enabled = m_state->getBoolean(DatabaseAgentState::databaseAgentEnabled); | 281 m_enabled = m_state->getBoolean(DatabaseAgentState::databaseAgentEnabled); |
| 282 } | 282 } |
| 283 | 283 |
| 284 void InspectorDatabaseAgent::getDatabaseTableNames(ErrorString* error, const Str
ing& databaseId, RefPtr<TypeBuilder::Array<String> >& names) | 284 void InspectorDatabaseAgent::getDatabaseTableNames(ErrorString* error, const Str
ing& databaseId, RefPtr<TypeBuilder::Array<String>>& names) |
| 285 { | 285 { |
| 286 if (!m_enabled) { | 286 if (!m_enabled) { |
| 287 *error = "Database agent is not enabled"; | 287 *error = "Database agent is not enabled"; |
| 288 return; | 288 return; |
| 289 } | 289 } |
| 290 | 290 |
| 291 names = TypeBuilder::Array<String>::create(); | 291 names = TypeBuilder::Array<String>::create(); |
| 292 | 292 |
| 293 Database* database = databaseForId(databaseId); | 293 Database* database = databaseForId(databaseId); |
| 294 if (database) { | 294 if (database) { |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 339 | 339 |
| 340 void InspectorDatabaseAgent::trace(Visitor* visitor) | 340 void InspectorDatabaseAgent::trace(Visitor* visitor) |
| 341 { | 341 { |
| 342 #if ENABLE(OILPAN) | 342 #if ENABLE(OILPAN) |
| 343 visitor->trace(m_resources); | 343 visitor->trace(m_resources); |
| 344 #endif | 344 #endif |
| 345 InspectorBaseAgent::trace(visitor); | 345 InspectorBaseAgent::trace(visitor); |
| 346 } | 346 } |
| 347 | 347 |
| 348 } // namespace blink | 348 } // namespace blink |
| OLD | NEW |