elastic / elasticsearch-sql-odbc

ODBC driver for Elasticsearch SQL
Other
0 stars 30 forks source link

Add an early execution mode for prepared statements #227

Closed bpintea closed 4 years ago

bpintea commented 4 years ago

This PR adds an early execution mode for prepared queries.

Applications generally prepare a statement, optionally reading result set attributes - like columns count and their characteristics (types and names) - before executing. A subset of these apps (generally the ones following older API usage patterns) will fail the entire operation if these column characteristics aren't available before execution.

Elasticsearch/SQL doesn't support the concept of prepared statements. What the driver will now do if this mode is enabled (=the new default) is to execute the query right away, in case this lacks any parameters. In case the parameter marks are present, the early execution is disabled for the statement (and potentially the query will fail). However, most patterns of Elasticsearch/ODBC usage don't involve parameters and/or repeated executions.

This change will allow more applications interop with Elasticsearch/SQL.