Skip to content

Commit 7bb699a

Browse files
Merge pull request #76 from lyz19890927/master
list table name in non case sensitive alphabetical order
2 parents 8cbb669 + df5cab0 commit 7bb699a

2 files changed

Lines changed: 15 additions & 5 deletions

File tree

debug-db/src/main/assets/app.js

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,7 @@ function getDBList() {
8181

8282
}
8383

84+
var lastTableName = getHashValue('table');
8485
function openDatabaseAndGetTableList(db) {
8586

8687
if("APP_SHARED_PREFERENCES" == db) {
@@ -110,10 +111,14 @@ function openDatabaseAndGetTableList(db) {
110111
}
111112
$('#table-list').empty()
112113
for(var count = 0; count < tableList.length; count++){
113-
var tableName = tableList[count];
114-
$("#table-list").append("<a href='#' data-db-name='"+db+"' data-table-name='"+tableName+"' class='list-group-item' onClick='getData(\""+ tableName + "\");'>" +tableName + "</a>");
115-
}
116-
114+
var tableName = tableList[count];
115+
$("#table-list").append("<a href='#table=" + tableName + "' data-db-name='" + db + "' data-table-name='" + tableName
116+
+ "' class='list-group-item' onClick='getData(\"" + tableName + "\");'>" + tableName + "</a>");
117+
}
118+
119+
if (lastTableName !== null) {
120+
$('a[data-table-name=' + lastTableName + ']').trigger('click');
121+
}
117122
}});
118123

119124
}
@@ -389,3 +394,8 @@ function showErrorInfo(message){
389394
snackbarElement.removeClass("show");
390395
}, 3000);
391396
}
397+
398+
function getHashValue(key) {
399+
var matches = location.hash.match(new RegExp(key + '=([^&]*)'));
400+
return matches ? matches[1] : null;
401+
}

debug-db/src/main/java/com/amitshekhar/utils/DatabaseHelper.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ private DatabaseHelper() {
4646

4747
public static Response getAllTableName(SQLiteDatabase database) {
4848
Response response = new Response();
49-
Cursor c = database.rawQuery("SELECT name FROM sqlite_master WHERE type='table' OR type='view'", null);
49+
Cursor c = database.rawQuery("SELECT name FROM sqlite_master WHERE type='table' OR type='view' ORDER BY name COLLATE NOCASE", null);
5050
if (c.moveToFirst()) {
5151
while (!c.isAfterLast()) {
5252
response.rows.add(c.getString(0));

0 commit comments

Comments
 (0)