Skip to content

Commit

Permalink
fix bug in retrieving CLOB from server
Browse files Browse the repository at this point in the history
  • Loading branch information
sijms committed Feb 24, 2021
1 parent d862030 commit 8981c93
Showing 1 changed file with 11 additions and 5 deletions.
16 changes: 11 additions & 5 deletions command.go
Original file line number Diff line number Diff line change
Expand Up @@ -678,21 +678,27 @@ func (stmt *defaultStmt) read(dataSet *DataSet) error {
if err != nil {
return err
}
if dataSize != int64(len(lobData)) {
return errors.New("error reading lob data")
}
session.LoadState()
if dataSet.Cols[x].DataType == OCIBlobLocator {
if dataSize != int64(len(lobData)) {
return errors.New("error reading lob data")
}
dataSet.currentRow[x] = lobData
} else {
var resultClobString string
if stmt.connection.strConv.LangID != dataSet.Cols[x].CharsetID {
tempCharset := stmt.connection.strConv.LangID
stmt.connection.strConv.LangID = dataSet.Cols[x].CharsetID
dataSet.currentRow[x] = stmt.connection.strConv.Decode(lobData)
resultClobString = stmt.connection.strConv.Decode(lobData)
stmt.connection.strConv.LangID = tempCharset
} else {
dataSet.currentRow[x] = stmt.connection.strConv.Decode(lobData)
resultClobString = stmt.connection.strConv.Decode(lobData)

}
if dataSize != int64(len([]rune(resultClobString))) {
return errors.New("error reading clob data")
}
dataSet.currentRow[x] = resultClobString
}
default:
dataSet.currentRow[x] = temp
Expand Down

0 comments on commit 8981c93

Please sign in to comment.