unixODBC + PHP,无效字符串或缓冲区长度错误消息
我通过 unixODBC 使用 PHP 访问 AS400/DB2
但我的AS400的某些字段名称以“££..”命名(无法更改)
当我尝试从 PHP 页面启动 sql 查询时,
select * from LIBNAME.TABLE where ££FIELD like 'test%'
我总是收到相同的错误消息
SQL 错误:[unixODBC][IBM][System i Access ODBC 驱动程序]字符串或缓冲区长度无效。,SQLExecDirect 中的 SQL 状态 S1090
如果有人有线索。
I access to an AS400/DB2 with PHP via unixODBC
But some field name of my AS400 are named with "££.." (it can't be changed)
And when I tried to launch an sql query from my PHP page
select * from LIBNAME.TABLE where ££FIELD like 'test%'
I always get the same error message
SQL error: [unixODBC][IBM][System i Access ODBC Driver]Invalid string or buffer length., SQL state S1090 in SQLExecDirect
If someone have clue.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
尝试在查询执行之前添加此语句:
有关问题的更详细描述:
http://bugs.centos.org/view.php?id=3187
Try adding this statement before the query execution:
For a more detailed description of the issue:
http://bugs.centos.org/view.php?id=3187
DB2 应该有某种方法来封装标识符。有些数据库使用双引号,
而 mySQL 使用反引号。不确定 DB2,但应该不难找到并尝试。如果这不起作用,请查看是否有一种方法可以用字符串中的十六进制值表示字符。就像“hello\x0A\x0Dthere”一样,“hello”和“there”之间用换行符分隔。您可能只需要找到 £ 的值。
DB2 should have some way of enclosing the identifiers. Some databases use double quotes
mySQL uses backticks. Not sure with DB2 but shouldn't be too hard to find out and try. If that doesn't work, see if there is a way to represent characters by hex value in a string. Like 'hello\x0A\x0Dthere' would be the words 'hello' and 'there' separated by a line-break. You may just need to find the value for £.