Clean
This commit is contained in:
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user