Best way to get raw SQL for a SQLite insert statement (with inline parameters)?

I tried doing this:
class InlineSQLiteSyncDialect extends SQLiteSyncDialect {
public inlineParams = true;
}
const dialect = new InlineSQLiteSyncDialect();
const statement: SQLiteInsert = ...;
statement.getSQL().toQuery(dialect).sql;
class InlineSQLiteSyncDialect extends SQLiteSyncDialect {
public inlineParams = true;
}
const dialect = new InlineSQLiteSyncDialect();
const statement: SQLiteInsert = ...;
statement.getSQL().toQuery(dialect).sql;
But get an error error: TypeError: escapeName is not a function. Any ideas? I could us .toSQL() to get the parameterized SQL and the parameters and then have custom logic to combine them but I'm thinking there's a better way.
2 Replies
Gruntilda
GruntildaOP15mo ago
Got it working with dialect.sqlToQuery(statement.getSQL().inlineParams()).sql, still curious if there's a better / more proper way!
Dan
Dan15mo ago
you shouldn't really inline the parameters as it's a road to SQL injections. But if you must, the way you came up with is good enough.
Want results from more Discord servers?
Add your server