Skip to content

SQL:Pre-process SQL escape syntax #29859

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

Closed
elasticmachine opened this issue Jan 23, 2018 · 3 comments
Closed

SQL:Pre-process SQL escape syntax #29859

elasticmachine opened this issue Jan 23, 2018 · 3 comments

Comments

@elasticmachine
Copy link
Collaborator

Original comment by @costin:

ODBC and JDBC both support the notion of escape syntax to allow users to specify a db-independent query that gets translated to native sql.
JDBC calls this [escape syntax](JDBC Spec 4.2, Chapter 13.4, LINK REDACTED, LINK REDACTED ) while ODBC calls it [escape sequence] (LINK REDACTED).

A note on JDBC: escape processing can be enabled (default) or disabled. I presume the same is valid for ODBC - @bpintea can you confirm?

@elasticmachine
Copy link
Collaborator Author

Original comment by @costin:

P.S. If ODBC doesn't disable escape processing I opt for throwing an exception in case in JDBC the escaping needs to be disabled. It is enabled by default and as far as I can see, most JDBC drivers ignore this flag like LINK REDACTED.
Further more the javadoc is ambiguous - for PreparedStatement this method does not apply rather just for Statement (namely queries without param).
All in all, throwing an exception seems like a good solution moving forward.

@elasticmachine
Copy link
Collaborator Author

Original comment by @bpintea:

That's right, scanning for escape sequences is a part of ODBC and also enabled by default and also off-switchable on a per-statement basis.

AFAI can tell, the syntax seems the same across the two specs (I guess to be expected).

(On the javadoc note: I believe that once a statement is prepared - i.e. seen by the server, normally - no more escaping can or needs to be done -- maybe that's why the difference.)

@elasticmachine elasticmachine added the :Analytics/SQL SQL querying label Apr 25, 2018
@imotov imotov removed their assignment Jun 12, 2018
@costin
Copy link
Member

costin commented Aug 31, 2018

Closed by #31883

@costin costin closed this as completed Aug 31, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants