Skip to content

Commit 7c3bc67

Browse files
authored
revert changes to sqlite describe (#290)
1 parent 4035402 commit 7c3bc67

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

src/sqlite.js

+5-2
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,11 @@ export class SQLiteDatabaseClient {
3737
if (!rows.length) throw new Error(`table not found: ${table}`);
3838
return rows.map(({name, type, notnull}) => ({name, type: sqliteType(type), databaseType: type, nullable: !notnull}));
3939
}
40-
async describe(table) {
41-
const rows = await (table === undefined ? this.describeTables() : this.describeColumns({table}));
40+
async describe(object) {
41+
const rows = await (object === undefined
42+
? this.query(`SELECT name FROM sqlite_master WHERE type = 'table'`)
43+
: this.query(`SELECT * FROM pragma_table_info(?)`, [object]));
44+
if (!rows.length) throw new Error("Not found");
4245
const {columns} = rows;
4346
return element("table", {value: rows}, [
4447
element("thead", [element("tr", columns.map(c => element("th", [text(c)])))]),

0 commit comments

Comments
 (0)