feat: structure candidate SQL table data as columns/rows
- Replace literal setupSql strings with structured columns/rows model - Add SqlColumn interface and updated SqlTablePreset with columns/rows arrays - Implement toSqlLiteral() for value escaping and buildSetupSql() for SQL generation - Update sqlTable.ts to call buildSetupSql() instead of accessing setupSql field - Maintains data parity with existing tables (students, employees, products) Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
import { ref } from "vue"
|
||||
import { defaultSqlTableId, sqlTables } from "../data/sqlTables"
|
||||
import { buildSetupSql, defaultSqlTableId, sqlTables } from "../data/sqlTables"
|
||||
|
||||
export const selectedTableId = ref(defaultSqlTableId)
|
||||
|
||||
@@ -12,5 +12,5 @@ export function buildSqlScript(studentSql: string) {
|
||||
sqlTables.find((item) => item.id === selectedTableId.value) ??
|
||||
sqlTables[0]
|
||||
const normalizedSql = studentSql.trim().replace(/;?\s*$/, ";")
|
||||
return `${table.setupSql}\n\n${normalizedSql}\n\nSELECT * FROM ${table.tableName};`
|
||||
return `${buildSetupSql(table)}\n\n${normalizedSql}\n\nSELECT * FROM ${table.tableName};`
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user