You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In the Readme it says that after running a prepared statement you can get the full SQL with query.sql. However I am finding that it returns the string from the prepared statement directly, containing the question mark, rather than replacing it with the parameters.
Can you show me an example of what you are doing, please? This library doesn't support prepared statements, though it does support doing replacements that look similar to them.
Wow, quick reply! I'm using that cool thing where you can insert a full object. Here's the relevant code:
varquery=pool.query('insert into todmorden set ?',reading,callback);console.log(query.sql);
The insert works perfectly, inserting a row with all the fields from the reading object. However what gets logged to the console is "insert into todmorden set ?"
It doesn't affect the functionality, but just makes it harder to debug.
Ah. It's possible it's an issue with using pool.query vs connection.query. If you can before I get to it, let me know if connection.query works or not.
Activity
dougwilson commentedon Feb 1, 2015
Can you show me an example of what you are doing, please? This library doesn't support prepared statements, though it does support doing replacements that look similar to them.
layerzerolabs commentedon Feb 1, 2015
Wow, quick reply! I'm using that cool thing where you can insert a full object. Here's the relevant code:
The insert works perfectly, inserting a row with all the fields from the reading object. However what gets logged to the console is "insert into todmorden set ?"
It doesn't affect the functionality, but just makes it harder to debug.
layerzerolabs commentedon Feb 1, 2015
Sorry, didn't mean to close the issue! Butter fingers!
dougwilson commentedon Feb 1, 2015
Ah. It's possible it's an issue with using
pool.query
vsconnection.query
. If you can before I get to it, let me know ifconnection.query
works or not.dougwilson commentedon Feb 1, 2015
Ok, I see the issue:
query.sql
is not actually transformed until the query is sent to the database. We may want to actually transform it right away.[-]query.sql returns question mark[/-][+]query.sql unformatted until query sent to connection[/+]Enable returning formatted sql in Pool.query()
14 remaining items