node-mysql2
node-mysql2 copied to clipboard
[Feature Request] At library layer, bind prepared statements to their schema
This is related to #1234 (Nice).
When preparing statements, the table referenced in the query is specifically referenced in the prepared statement. This may not be clear, so as an example... If you prepare a statement in one schema and change to another schema, the prepared statement will reference the original table, despite any schema change.
Can execute be modified to reference the schema in the statement ID? I'm making guesses about how the underlying mechanics work. If the schema that the statement is prepared against is included in the statement name, this can allow seamless preparation of statements on different schemas.
If a connection knows about its current schema, I think this could be a trivial change. Otherwise, it may not be reasonable due to performance concerns, i.e. back-and-forth with the database to check the current schema.
Thoughts? Need clarification?
sorry looks like I missed this and linked conversation. Can you log result of prepare ? There is quite a bit of info in it, both for returned fields and for input parameters