Skip to content

Commit

Permalink
fix cannot read LONG type
Browse files Browse the repository at this point in the history
  • Loading branch information
sijms committed Nov 27, 2020
1 parent c9e66ca commit 6f6d813
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 3 deletions.
13 changes: 12 additions & 1 deletion command.go
Original file line number Diff line number Diff line change
Expand Up @@ -366,7 +366,9 @@ func (stmt *Stmt) getExeOption() int {
if stmt.stmtType == PLSQL || stmt.hasReturnClause {
op |= 0x40000
}

if stmt.arrayBindCount > 1 {
op |= 0x80000
}
if stmt.connection.autoCommit && stmt.stmtType == DML {
op |= 0x100
}
Expand All @@ -376,6 +378,9 @@ func (stmt *Stmt) getExeOption() int {
if stmt.execute {
op |= 0x20
}
if !stmt.parse && !stmt.execute {
op |= 0x40
}
if len(stmt.Pars) > 0 {
op |= 0x8
if stmt.stmtType == PLSQL || stmt.hasReturnClause {
Expand All @@ -385,6 +390,9 @@ func (stmt *Stmt) getExeOption() int {
if stmt.stmtType != PLSQL && !stmt.hasReturnClause {
op |= 0x8000
}
if stmt.define {
op |= 0x10
}
return op

/* HasReturnClause
Expand Down Expand Up @@ -493,6 +501,7 @@ func (stmt *Stmt) read(dataSet *DataSet) error {
}
} else {
// see if it is re-execute
//fmt.Println(dataSet.Cols)
if len(dataSet.Cols) == 0 && len(stmt.columns) > 0 {
dataSet.Cols = make([]ParameterInfo, len(stmt.columns))
copy(dataSet.Cols, stmt.columns)
Expand All @@ -501,6 +510,7 @@ func (stmt *Stmt) read(dataSet *DataSet) error {
if dataSet.Cols[x].getDataFromServer {

temp, err := session.GetClr()
//fmt.Println("buffer: ", temp)
if err != nil {
return err
}
Expand Down Expand Up @@ -544,6 +554,7 @@ func (stmt *Stmt) read(dataSet *DataSet) error {
//default:
// throw new Exception("UnmarshalColumnData: Unimplemented type");
//}
//fmt.Println("type: ", dataSet.Cols[x].DataType)
switch dataSet.Cols[x].DataType {
case NCHAR, CHAR, LONG:
if stmt.connection.strConv.LangID != dataSet.Cols[x].CharsetID {
Expand Down
2 changes: 1 addition & 1 deletion data_set.go
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ func (dataSet *DataSet) Next(dest []driver.Value) error {
// dataSet.parent.noOfRowsToFetch = oldFetchCount
// fmt.Println("row count after first fetch: ", len(dataSet.Rows))
//}
if dataSet.parent.hasMoreRows && dataSet.index%dataSet.parent.noOfRowsToFetch == 0 {
if dataSet.parent.hasMoreRows && dataSet.index != 0 && dataSet.index%dataSet.parent.noOfRowsToFetch == 0 {
dataSet.Rows = make([]Row, 0, dataSet.parent.noOfRowsToFetch)
err := dataSet.parent.fetch(dataSet)
if err != nil {
Expand Down
2 changes: 1 addition & 1 deletion parameter.go
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,7 @@ func (par *ParameterInfo) read(session *network.Session) error {
return err
}
par.AllowNull = num1 > 0
_, err = session.GetInt(1, false, false)
_, err = session.GetByte() // session.GetInt(1, false, false)
if err != nil {
return err
}
Expand Down

0 comments on commit 6f6d813

Please sign in to comment.