php ibase_fetch_assoc():长SQL中的动态SQL错误SQL错误代码= -303

时间:2014-09-19 13:02:14

标签: php sql firebird

PHP Version 5.5.12

Firebird / InterBase支持动态 编译时客户端库版本Firebird API版本25 运行时客户端库版本LI-V6.3.2.26539 Firebird 2.5

当我运行长sql时,它以错误ibase_fetch_assoc()结束:动态SQL错误SQL错误代码= -303算术异常,数字溢出或字符串截断字符串右截断

相同的选择在flamerobin中正确运行。

知道PHP方面有什么问题吗?

SELECT COUNT(*) 
FROM EST_ORDERS_ITEMS 
LEFT JOIN EST_ORDERS AS "order" ON EST_ORDERS_ITEMS.ORDER_ID = "order".ORDER_ID 
LEFT JOIN EST_PORTS AS PORT_OF_LOADING ON "order".PORT_OF_LOADING_ID = PORT_OF_LOADING.PORT_ID 
LEFT JOIN EST_PORTS AS PORT_OF_DISCHARGE ON "order".PORT_OF_DISCHARGE_ID = PORT_OF_DISCHARGE.PORT_ID
LEFT JOIN EST_SUBJECTS AS "delivery" ON EST_ORDERS_ITEMS.DELIVERY_ID = "delivery".SUBJECT_ID 
LEFT JOIN EST_SUBJECTS AS "pickup" ON EST_ORDERS_ITEMS.PICKUP_ID = "pickup".SUBJECT_ID 
LEFT JOIN EST_SUBJECTS AS "shipper" ON EST_ORDERS_ITEMS.SHIPPER_ID = "shipper".SUBJECT_ID 
LEFT JOIN EST_SUBJECTS AS "consignee" ON EST_ORDERS_ITEMS.CONSIGNEE_ID = "consignee".SUBJECT_ID 
LEFT JOIN EST_TAB_AIRPORTS AS AIRPORT_ORIGIN ON "order".AIRPORT_ORIGIN_ID =
AIRPORT_ORIGIN.AIRPORT_ID 
LEFT JOIN EST_TAB_AIRPORTS AS AIRPORT_DEST ON "order".AIRPORT_DEST_ID = AIRPORT_DEST.AIRPORT_ID 
WHERE (EST_ORDERS_ITEMS.DELETED = 0 AND "order".DELETED = 0) AND (("order".PARTNER_ID IN (
SELECT SOURCE_ID 
FROM EST_SUBJECTS_USERS 
WHERE USER_ID = 1375))) AND (CLIENT_REF CONTAINING ('Fakultní nemocnice Hradec Králové') OR CLIENT_REF_2 CONTAINING ('Fakultní nemocnice Hradec Králové') OR
CLIENT_REF_3 CONTAINING ('Fakultní nemocnice Hradec Králové') OR HBL CONTAINING ('Fakultní nemocnice Hradec Králové') OR CNTR_NR CONTAINING ('Fakultní nemocnice Hradec Králové') OR JSD CONTAINING ('Fakultní nemocnice Hradec Králové') OR
"order".NUMBER CONTAINING ('Fakultní nemocnice Hradec Králové') OR PORT_OF_LOADING.NAME CONTAINING ('Fakultní nemocnice Hradec Králové') OR PORT_OF_DISCHARGE.NAME
CONTAINING ('Fakultní nemocnice Hradec Králové') OR "delivery".NAME CONTAINING ('Fakultní nemocnice Hradec Králové') OR "delivery".IDENT_2 CONTAINING ('Fakultní nemocnice Hradec Králové') OR
"pickup".NAME CONTAINING ('Fakultní nemocnice Hradec Králové') OR "pickup".IDENT_2 CONTAINING ('Fakultní nemocnice Hradec Králové') OR "shipper".NAME CONTAINING ('Fakultní nemocnice Hradec Králové') OR
"consignee".NAME CONTAINING ('Fakultní nemocnice Hradec Králové') OR AIRPORT_ORIGIN.IDENT||' - '||AIRPORT_ORIGIN.CITY CONTAINING ('Fakultní nemocnice Hradec Králové')
OR AIRPORT_DEST.IDENT||' - '||AIRPORT_DEST.CITY CONTAINING ('Fakultní nemocnice Hradec Králové'))

1 个答案:

答案 0 :(得分:2)

最近我遇到了同样的问题。我通过将搜索字段CASTING到BLOB SUB_TYPE 1

解决了这个问题

因此,请更改所有包含的事件:

CLIENT_REF CONTAINING ('Fakultní nemocnice Hradec Králové')

为:

CAST(CLIENT_REF AS BLOB SUB_TYPE 1) CONTAINING ('Fakultní nemocnice Hradec Králové')

这是因为php ibase扩展有问题,只有当你将搜索文本绑定为? (问号)参数。当您直接在SQL上键入它时,它可以正常工作。

希望有所帮助。