Skip to content

Instantly share code, notes, and snippets.

@altherlex
Last active August 29, 2015 14:07
Show Gist options
  • Save altherlex/7a76186f2da3cd7096a8 to your computer and use it in GitHub Desktop.
Save altherlex/7a76186f2da3cd7096a8 to your computer and use it in GitHub Desktop.
Tests for select query with ISO-8859-1 param in where like
# Issue IBMDB
#https://github.com/ibmdb/ruby-ibmdb/issues/1
# test#1
db = IBM_DB.connect "DBTESTE", 'teste', 'bala123'
sql2 = "SELECT glb.books.* FROM glb.books WHERE author = '?'"
st = IBM_DB.prepare db, sql2 #, IBM_DB::SQL_PARAM_INPUT, IBM_DB::SQL_CHAR
value = 'Júlio Verne'
IBM_DB.bind_param st, 1, 'value'
IBM_DB.execute st
st.to_json
xx=IBM_DB.fetch_array(st)
#----------------
# teste#2
sql1 = "SELECT * FROM glb.books fetch first 3 row only"
sql = "SELECT * FROM glb.books WHERE (author=u&'Júlio Verne')"
sql = "SELECT * FROM glb.glb_analise WHERE (nme_analise like u&'BENEFÍCIO%')"
db = IBM_DB.connect "DBTESTE", 'teste', 'bala123'
st1 = IBM_DB.exec db, sql1
st = IBM_DB.exec db, sql
IBM_DB.fetch_array st
#---------------
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment