ibmdb / node-ibm_db

IBM DB2 and IBM Informix bindings for node
MIT License
192 stars 150 forks source link

BindParameters WHERE String #354

Closed kaue closed 6 years ago

kaue commented 6 years ago

I can't use BindParameters to filter results using a string, only works if the field is a number.

conn.query("SELECT * FROM table WHERE field = '?'",
        ['test'],
        (err, results) => {
        // returns results = []
})
conn.query("SELECT * FROM table WHERE field = ?",
        ['test'],
        (err, results) => {
        // returns [IBM][CLI Driver][IDS/UNIX64] Error opening required code-set conversion object file.
})
conn.query("SELECT * FROM table WHERE field = 'test'",
        (err, results) => {
        // Works! returns all results that match field = 'test'
})
conn.query("SELECT * FROM table WHERE field_number = ?",
        [1],
        (err, results) => {
        // Works! returns all results that match field_number = 1
})
kaue commented 6 years ago

code-set conversion error If Informix server is not enabled for UNICODE clients or some code-set object file is missing on server; server returns this error to ibm_db: [IBM][CLI Driver][IDS/UNIX64] Error opening required code-set conversion object file.

To avoid this error, remove UNICODE from binding.gyp file and rebuild the ibm_db.

Also to avoid above issues, you can run ibm_db/installer/ifx.sh script on non-windows system. https://github.com/ibmdb/node-ibm_db#code-set-conversion-error