| 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 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 57 static const char databaseAgentEnabled[] = "databaseAgentEnabled"; | 57 static const char databaseAgentEnabled[] = "databaseAgentEnabled"; |
| 58 }; | 58 }; |
| 59 | 59 |
| 60 namespace { | 60 namespace { |
| 61 | 61 |
| 62 void reportTransactionFailed(ExecuteSQLCallback* requestCallback, SQLError* erro
r) | 62 void reportTransactionFailed(ExecuteSQLCallback* requestCallback, SQLError* erro
r) |
| 63 { | 63 { |
| 64 RefPtr<TypeBuilder::Database::Error> errorObject = TypeBuilder::Database::Er
ror::create() | 64 RefPtr<TypeBuilder::Database::Error> errorObject = TypeBuilder::Database::Er
ror::create() |
| 65 .setMessage(error->message()) | 65 .setMessage(error->message()) |
| 66 .setCode(error->code()); | 66 .setCode(error->code()); |
| 67 requestCallback->sendSuccess(0, 0, errorObject.release()); | 67 requestCallback->sendSuccess(nullptr, nullptr, errorObject.release()); |
| 68 } | 68 } |
| 69 | 69 |
| 70 class StatementCallback FINAL : public SQLStatementCallback { | 70 class StatementCallback FINAL : public SQLStatementCallback { |
| 71 public: | 71 public: |
| 72 static PassOwnPtr<StatementCallback> create(PassRefPtr<ExecuteSQLCallback> r
equestCallback) | 72 static PassOwnPtr<StatementCallback> create(PassRefPtr<ExecuteSQLCallback> r
equestCallback) |
| 73 { | 73 { |
| 74 return adoptPtr(new StatementCallback(requestCallback)); | 74 return adoptPtr(new StatementCallback(requestCallback)); |
| 75 } | 75 } |
| 76 | 76 |
| 77 virtual ~StatementCallback() { } | 77 virtual ~StatementCallback() { } |
| (...skipping 10 matching lines...) Expand all Loading... |
| 88 RefPtr<TypeBuilder::Array<JSONValue> > values = TypeBuilder::Array<JSONV
alue>::create(); | 88 RefPtr<TypeBuilder::Array<JSONValue> > values = TypeBuilder::Array<JSONV
alue>::create(); |
| 89 const Vector<SQLValue>& data = rowList->values(); | 89 const Vector<SQLValue>& data = rowList->values(); |
| 90 for (size_t i = 0; i < data.size(); ++i) { | 90 for (size_t i = 0; i < data.size(); ++i) { |
| 91 const SQLValue& value = rowList->values()[i]; | 91 const SQLValue& value = rowList->values()[i]; |
| 92 switch (value.type()) { | 92 switch (value.type()) { |
| 93 case SQLValue::StringValue: values->addItem(JSONString::create(value
.string())); break; | 93 case SQLValue::StringValue: values->addItem(JSONString::create(value
.string())); break; |
| 94 case SQLValue::NumberValue: values->addItem(JSONBasicValue::create(v
alue.number())); break; | 94 case SQLValue::NumberValue: values->addItem(JSONBasicValue::create(v
alue.number())); break; |
| 95 case SQLValue::NullValue: values->addItem(JSONValue::null()); break; | 95 case SQLValue::NullValue: values->addItem(JSONValue::null()); break; |
| 96 } | 96 } |
| 97 } | 97 } |
| 98 m_requestCallback->sendSuccess(columnNames.release(), values.release(),
0); | 98 m_requestCallback->sendSuccess(columnNames.release(), values.release(),
nullptr); |
| 99 return true; | 99 return true; |
| 100 } | 100 } |
| 101 | 101 |
| 102 private: | 102 private: |
| 103 StatementCallback(PassRefPtr<ExecuteSQLCallback> requestCallback) | 103 StatementCallback(PassRefPtr<ExecuteSQLCallback> requestCallback) |
| 104 : m_requestCallback(requestCallback) { } | 104 : m_requestCallback(requestCallback) { } |
| 105 RefPtr<ExecuteSQLCallback> m_requestCallback; | 105 RefPtr<ExecuteSQLCallback> m_requestCallback; |
| 106 }; | 106 }; |
| 107 | 107 |
| 108 class StatementErrorCallback FINAL : public SQLStatementErrorCallback { | 108 class StatementErrorCallback FINAL : public SQLStatementErrorCallback { |
| (...skipping 204 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 313 | 313 |
| 314 Database* InspectorDatabaseAgent::databaseForId(const String& databaseId) | 314 Database* InspectorDatabaseAgent::databaseForId(const String& databaseId) |
| 315 { | 315 { |
| 316 DatabaseResourcesMap::iterator it = m_resources.find(databaseId); | 316 DatabaseResourcesMap::iterator it = m_resources.find(databaseId); |
| 317 if (it == m_resources.end()) | 317 if (it == m_resources.end()) |
| 318 return 0; | 318 return 0; |
| 319 return it->value->database(); | 319 return it->value->database(); |
| 320 } | 320 } |
| 321 | 321 |
| 322 } // namespace WebCore | 322 } // namespace WebCore |
| OLD | NEW |