atk4 / dsql

Object-Oriented SQL Query Builder
https://agiletoolkit.org/
MIT License
58 stars 23 forks source link

Forbid bind resource type #272

Closed mvorisek closed 3 years ago

mvorisek commented 3 years ago

This PR is not stictly needed, but resource can be easily missused. As results are fetched by string always anyway, I think we should merge this.

In the future, if this will be an issue for anything, we can revert, but I am not aware of any reasonable scenarion except saving too big data which can not fit in memory, which cheaper every day.

Also easier to debug as resource can not often be read twice this impossible to dump before query.

In Oracle when something is passed as resource/stream, it cannot be used in SQL query, see:

Caused by
atk4\dsql\ExecuteException: DSQL got Exception when executing this query
  error: 'OCIStmtExecute: ORA-00932: inconsistent datatypes: expected CLOB got BLOB
     (ext\pdo_oci\oci_statement.c:157)'
  query: 'update
      "invoice"
    set
      "addr" = 'test'
    where
      "id" = 1'

where test string literal was passed as a bounded resource/stream: image