From 2865c53f8b68f5ae596024117d05dc0a7bb00b68 Mon Sep 17 00:00:00 2001 From: akshay Date: Thu, 11 Jul 2019 22:51:19 +0530 Subject: [PATCH] generate generate query templates directly into search query input --- debug-db-base/src/main/assets/app.js | 33 ++++++++++++++++++------ debug-db-base/src/main/assets/index.html | 3 +++ 2 files changed, 28 insertions(+), 8 deletions(-) diff --git a/debug-db-base/src/main/assets/app.js b/debug-db-base/src/main/assets/app.js index beb12cb..f4d642a 100644 --- a/debug-db-base/src/main/assets/app.js +++ b/debug-db-base/src/main/assets/app.js @@ -74,6 +74,23 @@ function deleteDb() { } } +function fillQuery(id){ + switch(id){ + case "select_query": + $('#query').val("Select * from "); + $('#query').focus(); + break; + case "update_query": + $('#query').val("Update set = where "); + $('#query').focus(); + break; + case "delete_query": + $('#query').val("Delete from where "); + $('#query').focus(); + break; + } +} + function getDBList() { $.ajax({url: "getDbList", success: function(result){ @@ -142,13 +159,13 @@ function openDatabaseAndGetTableList(db, isDownloadable) { $('#table-list').empty() for(var count = 0; count < tableList.length; count++){ var tableName = tableList[count]; - $("#table-list").append("" + tableName + ""); - } + $("#table-list").append("" + tableName + ""); + } - if (lastTableName !== null) { - $('a[data-table-name=' + lastTableName + ']').trigger('click'); - } + if (lastTableName !== null) { + $('a[data-table-name=' + lastTableName + ']').trigger('click'); + } }}); } @@ -426,6 +443,6 @@ function showErrorInfo(message){ } function getHashValue(key) { - var matches = location.hash.match(new RegExp(key + '=([^&]*)')); - return matches ? matches[1] : null; + var matches = location.hash.match(new RegExp(key + '=([^&]*)')); + return matches ? matches[1] : null; } diff --git a/debug-db-base/src/main/assets/index.html b/debug-db-base/src/main/assets/index.html index 8352148..bf5ec2a 100644 --- a/debug-db-base/src/main/assets/index.html +++ b/debug-db-base/src/main/assets/index.html @@ -116,6 +116,9 @@
+ + +