Open basickarl opened 5 years ago
There isn't; squel is simply an SQL string builder.
To execute raw SQL, send it directly to your DB connection. E.g. if you're using https://github.com/mysqljs/mysql, something like this works:
const mysql = require('mysql')
const connection = mysql.createConnection({ ... }).connect()
connection.query('SELECT * FROM tbl', (error, results, fields) => {
...
})
If your function expect squel objects, you could try to reverse engineer the method(s) they end up calling and pass an object that implements those. Perhaps simply implementing toString()
(returns your SQL string) would do the trick?
If it doesn't further compose your query you can fake it by doing something like this:
const fakeSquel = { toString(){ return 'SELECT * FROM table'; }};
I have functions which require a squel object. I have however written the SQL string myself without using this library.
Is there a way to insert the raw SQL string statement into a squel object?