This commit is contained in:
RochesterX
2026-01-22 13:24:25 -05:00
parent 006b1b206b
commit a5c46e2dc7

View File

@@ -62,16 +62,13 @@ class FakeMssqlRequest {
// 2. Determine if it's a SELECT or INSERT/UPDATE
const stmt = this.db.prepare(cleanSql);
console.log(`Running:\n${cleanSql}`)
if (cleanSql.trim().toUpperCase().startsWith('SELECT')) {
// READ: Use .all()
const rows = stmt.all(this.params);
console.log(rows);
return { recordset: rows, rowsAffected: [rows.length] };
} else {
// WRITE: Use .run()
const info = stmt.run(this.params);
console.log(`else`)
return { recordset: [], rowsAffected: [info.changes] };
}
} catch (err) {