rana / ora

An Oracle database driver in Go.
MIT License
271 stars 65 forks source link

I am geting BLOB fields with extra content #269

Open amichelins opened 4 years ago

amichelins commented 4 years ago

I have to read a BLOB oracle field and send the data to a WS My code work, is reading the data, but data readed has extra content.

[CODE]

import "gopkg.in/rana/ora.v3"

... ... ... sSql = SELECT SP.XML_SIG FROM INFOAR.SPED050 SP WHERE SP.ID_ENT = '000003' AND SP.STATUS = 6 AND SP.NFE_ID = '3 000770601'

stmt, _ := ses.Prep(sSql, ora.OraBin)

defer stmt.Close()
rset, err := stmt.Qry()

if err != nil {
    panic(err)
}
for rset.Next() {
    println(fmt.Sprintf("%s ", rset.Row[0]))
}

[/CODE]

Data returned:

{%!s(bool=false) <infNFe Id="NFe322001085841160 ........ ( is a long XML file ate> }

Correct format:

amichelins commented 4 years ago

Solved change this line: stmt, _ := ses.Prep(sSql, ora.OraBin)

To this: stmt, _ := ses.Prep(sSql, ora.Bin)