i meet a problem when use %SQLGatewayConnection
i use %SQLGatewayConnection to insert data to mysql from xml,when if the value`s ascii of any field in the sql equal to 57659 ,
ClassMethod Execute(sql, conn, Output msg) As%Status
{
s$zt="Err"
s msg=""
k hstmt
set sc=conn.AllocateStatement(.hstmt)
set sc=conn.PrepareW(hstmt,sql)
if$$$ISERR(sc) quit sc
//Execute statement
set sc=conn.Execute(hstmt)
if$$$ISERR(sc)
{
k err
Set xsc=conn.GetErrorList(hstmt,.err)
set sc=conn.DropStatement(hstmt)
;Zwrite err
Quit err
}
set sc=conn.DropStatement(hstmt)
q$$$OK
Err
;w $ze,!
q$ze
}this method will stop at this line ' set sc=conn.PrepareW(hstmt,sql) ',and this time ,sql is a insert statement, without error。any solution? and 57659 is just a example,others like 57634.
Product version: Ensemble 2016.1
$ZV: Cache for Windows (x86-64) 2016.2.3 (Build 907_11_20446U) Thu Nov 12 2020 16:56:45 EST
Discussion (1)0
Comments
Before
set sc=conn.PrepareW(hstmt,sql) add:
set sql = $zcvt(sql, "O", "UTF8")It will make the string UTF8 encoded. Docs.