Skip to content

Commit c227bcc

Browse files
Fix select query error
1 parent bae78e9 commit c227bcc

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

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

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,25 @@ public static TableDataResponse getTableData(SQLiteDB db, String selectQuery, St
124124

125125
tableData.isSuccessful = true;
126126
tableData.rows = new ArrayList<>();
127+
128+
String[] columnNames = cursor.getColumnNames();
129+
130+
List<TableDataResponse.TableInfo> tableInfoListModified = new ArrayList<>();
131+
132+
for (String columnName : columnNames) {
133+
for (TableDataResponse.TableInfo tableInfo : tableData.tableInfos) {
134+
if (columnName.equals(tableInfo.title)) {
135+
tableInfoListModified.add(tableInfo);
136+
break;
137+
}
138+
}
139+
}
140+
141+
if (tableData.tableInfos.size() != tableInfoListModified.size()) {
142+
tableData.tableInfos = tableInfoListModified;
143+
tableData.isEditable = false;
144+
}
145+
127146
if (cursor.getCount() > 0) {
128147

129148
do {

0 commit comments

Comments
 (0)