MCPcopy Create free account
hub / github.com/ChatLab/ChatLab / getAiSchema

Method getAiSchema

packages/node-runtime/src/ai/chats.ts:449–475  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

447 // ==================== Debug ====================
448
449 getAiSchema(): Array<{
450 name: string
451 columns: Array<{ name: string; type: string; notnull: boolean; pk: boolean }>
452 }> {
453 const db = this.getDb()
454 const tables = db
455 .prepare("SELECT name FROM sqlite_master WHERE type='table' AND name NOT LIKE 'sqlite_%'")
456 .all() as Array<{ name: string }>
457
458 return tables.map((t) => {
459 const columns = db.pragma(`table_info("${t.name}")`) as Array<{
460 name: string
461 type: string
462 notnull: number
463 pk: number
464 }>
465 return {
466 name: t.name,
467 columns: columns.map((c) => ({
468 name: c.name,
469 type: c.type,
470 notnull: !!c.notnull,
471 pk: !!c.pk,
472 })),
473 }
474 })
475 }
476
477 executeAiSQL(sql: string): {
478 columns: string[]

Callers

nothing calls this directly

Calls 4

getDbMethod · 0.95
allMethod · 0.65
prepareMethod · 0.65
pragmaMethod · 0.65

Tested by

no test coverage detected