d24d11a274
- Standardized missing-file read errors and now return `File not found: <path>` for absent edit targets. - Centralized AI provider, usage, and OAuth helpers into shared modules to remove duplicated logic. - Migrated OAuth/API-key login flows to shared factory helpers and removed inline prompt/token-exchange code. - Reused shared tools and formatter utilities for discovery, stream tails, LSP batching, and source formatting. - Consolidated repeated test helpers and fixtures into shared modules, replacing inline helper duplicates.
14 lines
396 B
TypeScript
14 lines
396 B
TypeScript
import { Database } from "bun:sqlite";
|
|
|
|
export function readTableSql(dbPath: string, tableName: string): string | null {
|
|
const db = new Database(dbPath, { readonly: true });
|
|
try {
|
|
const row = db.prepare("SELECT sql FROM sqlite_master WHERE type = 'table' AND name = ?").get(tableName) as
|
|
| { sql?: string | null }
|
|
| undefined;
|
|
return row?.sql ?? null;
|
|
} finally {
|
|
db.close();
|
|
}
|
|
}
|