User bio
404 bio not found
Member since Dec 12, 2019
Replies:

you try try 

ClassMethod AESEncode(str As %String, key)
{
    Set text=$ZCONVERT(str,"O","UTF8")
    set len=$l(text)
    if (16-len#16)'=0{
        for ii=1:1:(16-len#16){
            set text=text_$c(16-len#16)
        }
    }else{
        for ii=1:1:16{
            set text=text_$c(16)
        }
    }
    s stream=##class(%GlobalCharacterStream).%New()
    d stream.Write(text)
    s textstr=""
    while 'stream.AtEnd{
        set subtx=stream.Read(16)
        Set textstr =textstr_$system.Encryption.AESEncode(subtx,key)
    }
    Set ret=$SYSTEM.Encryption.Base64Encode(textstr)
    s ret = $replace(ret,$c(13,10),"")
    q ret
}

/**
 * 解密
 */
ClassMethod AESDecode(str As %String, key)
{
    s ret = ##class(%SYSTEM.Encryption).Base64Decode(str)
    s ret = ##class(%SYSTEM.Encryption).AESDecode(ret, key)
    s ret = $zcvt(ret, "I", "UTF8")    
    set len=$l(ret)
    set lastch=$e(ret,len,len)
    set pos=0
    for index=1:1:16 {
        if $c(index)=lastch{
            set pos=index
            quit 
        }
    }
    s ret = $e(ret,1,len-pos)
    q ret
}

Thank you very much, but I am not using production.There is a setQueryTimeout method in the% Net.Remote.Java.JDBCGateway class of IRIS, but this method does not exist in Ensemble2016, what should I do?

The code in IRIS is as follows:
ClassMethod jdbc() As %String
{
    
    #dim %JDBCGateway as %Net.Remote.Java.JDBCGateway
    s SQLConName="INC0001"
    s gc=$$GetJConnection^%apiGTW(SQLConName)
    i gc="" QUIT "-1^"_$$$ERROR($$$GTWCConnectionError)
    set myquery= "select top 1 * from SQLUser.OE_OrdTeeth"
    "
    q:myquery="" "-1^sql can't empty"
    
    /// prepare sql
    s command=$ZCONVERT($p(myquery," ",1),"U") 
    If (command["CALL") {
        s sqlhstmt=%JDBCGateway.prepareCall(gc,myquery)
    } else {
        s sqlhstmt=%JDBCGateway.prepareStatement(gc,myquery)
      }
      if (sqlhstmt < 0) {
        q "-1^"_%JDBCGateway.getErrorText()
      }
       s sqlerr=%JDBCGateway.setQueryTimeout(sqlhstmt,5)
      
    if sqlerr<0{
        q "-1^"_%JDBCGateway.getErrorText()
    }
   
    s sqlerr=%JDBCGateway.execQuery(sqlhstmt)
    if sqlerr<0{
        q "-1^"_%JDBCGateway.getErrorText()
    }
  
    /// dump result 
    s colcount=%JDBCGateway.getColumnCount(sqlhstmt)
    s hasdata=%JDBCGateway.next(sqlhstmt)
    while hasdata = 1 {
        
        s tpseudoid=%JDBCGateway.getString(sqlhstmt,1)
    
        
        
        s hasdata=%JDBCGateway.next(sqlhstmt)
    } //matches while hasdata
    
    d %JDBCGateway.removeResultSet(gc)
    
    q
}

Certifications & Credly badges:
li has no Certifications & Credly badges yet.
Global Masters badges:
li has no Global Masters badges yet.
Followers:
li has no followers yet.
Following:
li has not followed anybody yet.