diff options
Diffstat (limited to 'WebCore/inspector/front-end/DatabaseQueryView.js')
-rw-r--r-- | WebCore/inspector/front-end/DatabaseQueryView.js | 32 |
1 files changed, 14 insertions, 18 deletions
diff --git a/WebCore/inspector/front-end/DatabaseQueryView.js b/WebCore/inspector/front-end/DatabaseQueryView.js index 429c2c3..6c5fa02 100644 --- a/WebCore/inspector/front-end/DatabaseQueryView.js +++ b/WebCore/inspector/front-end/DatabaseQueryView.js @@ -81,11 +81,15 @@ WebInspector.DatabaseQueryView.prototype = { return; } } + + function tableNamesCallback(tableNames) + { + accumulateMatches(tableNames.map(function(name) { return name + " " })); + accumulateMatches(["SELECT ", "FROM ", "WHERE ", "LIMIT ", "DELETE FROM ", "CREATE ", "DROP ", "TABLE ", "INDEX ", "UPDATE ", "INSERT INTO ", "VALUES ("]); - accumulateMatches(this.database.tableNames.map(function(name) { return name + " " })); - accumulateMatches(["SELECT ", "FROM ", "WHERE ", "LIMIT ", "DELETE FROM ", "CREATE ", "DROP ", "TABLE ", "INDEX ", "UPDATE ", "INSERT INTO ", "VALUES ("]); - - completionsReadyCallback(results); + completionsReadyCallback(results); + } + this.database.getTableNames(tableNamesCallback); }, _promptKeyDown: function(event) @@ -132,22 +136,19 @@ WebInspector.DatabaseQueryView.prototype = { this.prompt.historyOffset = 0; this.prompt.text = ""; - function queryTransaction(tx) - { - tx.executeSql(query, null, InspectorController.wrapCallback(this._queryFinished.bind(this, query)), InspectorController.wrapCallback(this._executeSqlError.bind(this, query))); - } - - this.database.database.transaction(InspectorController.wrapCallback(queryTransaction.bind(this)), InspectorController.wrapCallback(this._queryError.bind(this, query))); + this.database.executeSql(query, this._queryFinished.bind(this, query), this._queryError.bind(this, query)); }, - _queryFinished: function(query, tx, result) + _queryFinished: function(query, result) { - var dataGrid = WebInspector.panels.databases.dataGridForResult(result); + var dataGrid = WebInspector.panels.storage.dataGridForResult(result); + if (!dataGrid) + return; dataGrid.element.addStyleClass("inline"); this._appendQueryResult(query, dataGrid.element); if (query.match(/^create /i) || query.match(/^drop table /i)) - WebInspector.panels.databases.updateDatabaseTables(this.database); + WebInspector.panels.storage.updateDatabaseTables(this.database); }, _queryError: function(query, error) @@ -162,11 +163,6 @@ WebInspector.DatabaseQueryView.prototype = { this._appendQueryResult(query, message, "error"); }, - _executeSqlError: function(query, tx, error) - { - this._queryError(query, error); - }, - _appendQueryResult: function(query, result, resultClassName) { var element = document.createElement("div"); |