title: php ibase_fetch_assoc(): Dynamic SQL Error SQL error code = -303 in long SQL
body: <p>PHP Version 5.5.12</p>
  
  <p>Firebird/InterBase Support  dynamic
  Compile-time Client Library Version Firebird API version 25
  Run-time Client Library Version LI-V6.3.2.26539 Firebird 2.5</p>
  
  <p>When I run long sql it's end with error ibase_fetch_assoc(): Dynamic SQL Error SQL error code = -303 arithmetic exception, numeric overflow, or string truncation string right truncation</p>
  
  <p>The same select run correctly in flamerobin.</p>
  
  <p>Any idea what is wrong on PHP side?</p>
  
  <pre class="lang-sql prettyprint-override"><code>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é'))
  </code></pre>