ODBC SQL update语句如果超过32,000个字符

ODBC SQL update语句如果超过32,000个字符

问题描述:

Here is the problem: I have one giant string of xml data stored in a (BLOB)field in a table. It holds some strings 70k characters or more at times. I pull it out using an ODBC_Connection.

I can import (no problem).
I can manipulate the XML and save it back as a string (no problem).
I can save the string back into a mySQL field (no problem).

The problem comes when i try to save it back to its original field that i pulled it from. If I save the string with less than 32,000 characters, we are golden. If there are more than that many characters in the string, BAM. I get this error message.

( ! ) Warning: odbc_exec() [function.odbc-exec]: SQL error: [DataDirect][ODBC InterBase
driver][InterBase]Dynamic SQL Error, SQL error code = -104, token size exceeds limit,
SQL state 37000 in SQLExecDirect in ...\Test\index4.php on line 129 Call Stack

#   Time    Memory  Function    Location
1   0.0011  482872  {main}( )   ..\index4.php:0
2   0.1260  1033760 odbc_exec ( )   ..\index4.php:129

Here is the PHP code i am using just in case:

// Now save it back to the system
$conn=odbc_connect($DBNAME_O,$DBUSER_O,$DBPW_O);
if (!$conn)
{exit("Connection Failed: " . $conn);}
echo $tempFileXML;
$sql="UPDATE EHR_VISITS SET RECORD='$tempFileXML' WHERE EHR_VISITS_ID='1396'";
//  echo $theData;
$rs=odbc_exec($conn,$sql);
odbc_close($conn);  

Thanks for the help...

UPDATE: This is connected to an interbase database, not MS SQL. Also, I tried using a different ODBC driver, and got the same message but with a slightly higher character tolerance: 42000 instead of 37000.

HELP please....

问题是:我有一个巨大的xml数据字符串存储在表格的(BLOB)字段中。 它有时会包含70k或更多字符串。 我使用ODBC_Connection将其拉出来。 p>

我可以导入(没问题)。
我可以操作XML并将其保存为字符串(没问题)。 > 我可以将字符串保存回mySQL字段(没问题)。 p>

当我尝试将其保存回原始字段时,问题就出现了。 如果我保存少于32,000个字符的字符串,我们就是金色的。 如果字符串中有多个字符,则为BAM。 我收到此错误消息。 p>

 (!)警告:odbc_exec()[function.odbc-exec]:SQL错误:[DataDirect] [ODBC InterBase 
driver] [InterBase]动态SQL错误,SQL 错误代码= -104,令牌大小超过限制,
 SQL状态37000在SQLExecDirect中... \ Test \ index4.php在第129行调用堆栈
 
#时间内存函数位置
1 0.0011 482872 {main}()  .. \ index4.php:0 
2 0.1260 1033760 odbc_exec().. \ index4.php:129 
  code>  pre> 
 
 

这是我正在使用的PHP代码 case: p>

  //现在将其保存回系统
 $ conn = odbc_connect($ DBNAME_O,$ DBUSER_O,$ DBPW_O); 
if(!$ conn)\  n {exit(“Connection Failed:”。$ conn);} 
echo $ tempFileXML; 
 $ sql =“UPDATE EHR_VISITS SET RECORD ='$ tempFileXML'WHERE EHR_VISITS_ID ='1396'”; 
 // echo $ theData  ; 
 $的RS = odbc_exec($康恩,$ SQL); 
odbc_close($ conn);在 
  code>  pre> 
 
 

感谢您的帮助...... p>

更新:这是连接到interbase数据库,而不是MS SQL。 此外,我尝试使用不同的ODBC驱动程序,并获得相同的消息,但具有稍高的字符容差:42000而不是37000. p>

请帮助.... p> \ n div>

Have you tried passing the data in as a parameter ?

E.g:

$sql = UPDATE EHR_VISITS SET RECORD=? WHERE EHR_VISITS_ID='1396'; 
$stmt = odbc_prepare($conn, $sql); 
$rs = odbc_execute($stmt, $tempFileXML);