$ psql -c 'PREPARE test AS SELECT ($1 IS NULL)'
ERROR: could not determine data type of parameter $1
$ psql -c 'PREPARE test AS SELECT ($1::int4 IS NULL)'
PREPARE
For full support in DBI, this means that we must postpone sending the query to the database until we have received values for binding. On the other hand, currently the specs require that dbSendQuery() must reject invalid queries.
If we parse query parameters ourselves (r-dbi/DBI#52), we have more control and still can send non-parametrized queries right away (and fail in case of error). Proposed action:
Rewrite parametrized queries
Support everything that SQLite or PostgreSQL supports
Might require a helper in DBI
If query doesn't have parameters, send right away
If query has parameters, wait until types are known before sending, and use these types
Example:
For full support in DBI, this means that we must postpone sending the query to the database until we have received values for binding. On the other hand, currently the specs require that
dbSendQuery()
must reject invalid queries.If we parse query parameters ourselves (r-dbi/DBI#52), we have more control and still can send non-parametrized queries right away (and fail in case of error). Proposed action: