Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support client-side variable substitution in queries as a fallback #10

Open
mjoerussell opened this issue May 19, 2021 · 0 comments
Open
Labels
bug Something isn't working enhancement New feature or request

Comments

@mjoerussell
Copy link
Owner

I was doing some testing with a Snowflake database and discovered that Snowflake does not support query parameters like, for example, Postgres. An example of using query parameters in zdb would be:

var prepared_statement = try connection.prepareStatement("SELECT * from my_table where id > ?");
try prepared_statement.addParam(1, 10);

zdb should support some level of query parameters even with drivers that do not support driver-side parameters. This could be done with simple serialization and substitution, however we should also make some calls to SQLColumns to ensure that the value's type matches the column.

This system should only be used as a fallback - we want to use the driver's parameter system whenever possible. This should probably also be handled automatically. The programmer shouldn't have to make any code changes if they switch to a new database that implements this differently.

@mjoerussell mjoerussell added bug Something isn't working enhancement New feature or request labels May 19, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant