Skip to content

Commit

Permalink
update v1 to connect to oracle 9
Browse files Browse the repository at this point in the history
  • Loading branch information
sijms committed Jul 27, 2022
1 parent 4a5c179 commit 8a9103e
Show file tree
Hide file tree
Showing 3 changed files with 95 additions and 85 deletions.
3 changes: 2 additions & 1 deletion connection.go
Original file line number Diff line number Diff line change
Expand Up @@ -572,7 +572,8 @@ func (conn *Connection) doAuth() error {
conn.LogonMode = conn.LogonMode | NoNewPass
conn.session.PutUint(int(conn.LogonMode), 4, true, true)
conn.session.PutBytes(1, 1, 5, 1, 1)
conn.session.PutBytes([]byte(conn.connOption.UserID)...)
conn.session.PutClr([]byte(conn.connOption.UserID))
//conn.session.PutBytes([]byte(conn.connOption.UserID)...)
conn.session.PutKeyValString("AUTH_TERMINAL", conn.connOption.ClientInfo.HostName, 0)
conn.session.PutKeyValString("AUTH_PROGRAM_NM", conn.connOption.ClientInfo.ProgramName, 0)
conn.session.PutKeyValString("AUTH_MACHINE", conn.connOption.ClientInfo.HostName, 0)
Expand Down
8 changes: 4 additions & 4 deletions network/summary_object.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,10 +49,10 @@ func NewSummary(session *Session) (*SummaryObject, error) {
return nil, err
}
}
result.CurRowNumber, err = session.GetInt(4, true, true)
if err != nil {
return nil, err
}
//result.CurRowNumber, err = session.GetInt(4, true, true)
//if err != nil {
// return nil, err
//}
result.RetCode, err = session.GetInt(2, true, true)
if err != nil {
return nil, err
Expand Down
169 changes: 89 additions & 80 deletions old-network/summary_object.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ type SummaryObject struct {
errorPos int // uint16
sqlType uint8
oerFatal uint8
Flags int // uint16
userCursorOPT int // uint16
Flags uint8 // uint16
userCursorOPT uint8 // uint16
upiParam uint8
warningFlag uint8
rba int // uint32
Expand All @@ -41,18 +41,21 @@ type SummaryObject struct {
func NewSummary(session *Session) (*SummaryObject, error) {
result := new(SummaryObject)
var err error
if session.HasEOSCapability {
result.EndOfCallStatus, err = session.GetInt(4, true, true)
if err != nil {
return nil, err
}
}
if session.HasFSAPCapability {
result.EndToEndECIDSequence, err = session.GetInt(2, true, true)
if err != nil {
return nil, err
if session.TTCVersion >= 3 {
if session.HasFSAPCapability {
result.EndToEndECIDSequence, err = session.GetInt(2, true, true)
if err != nil {
return nil, err
}
}
}
//if session.HasEOSCapability {
// result.EndOfCallStatus, err = session.GetInt(4, true, true)
// if err != nil {
// return nil, err
// }
//}

result.CurRowNumber, err = session.GetInt(4, true, true)
if err != nil {
return nil, err
Expand Down Expand Up @@ -85,11 +88,13 @@ func NewSummary(session *Session) (*SummaryObject, error) {
if err != nil {
return nil, err
}
result.Flags, err = session.GetInt(2, true, true)
result.Flags, err = session.GetByte()
//result.Flags, err = session.GetInt(2, true, true)
if err != nil {
return nil, err
}
result.userCursorOPT, err = session.GetInt(2, true, true)
result.userCursorOPT, err = session.GetByte()
//result.userCursorOPT, err = session.GetInt(2, true, true)
if err != nil {
return nil, err
}
Expand Down Expand Up @@ -142,72 +147,76 @@ func NewSummary(session *Session) (*SummaryObject, error) {
return nil, err
}
_, _ = session.GetDlc()
length, err := session.GetInt(2, true, true)
if err != nil {
return nil, err
}
if length > 0 {
result.bindErrors = make([]BindError, length)
num, err := session.GetByte()
if err != nil {
return nil, err
}
flag := num == 0xFE
for x := 0; x < length; x++ {
if flag {
_, _ = session.GetByte()
}
result.bindErrors[x].errorCode, err = session.GetInt(2, true, true)
if err != nil {
return nil, err
}
}
if flag {
_, _ = session.GetByte()
}
}
length, err = session.GetInt(4, true, true)
if err != nil {
return nil, err
}
if length > 0 {
num, err := session.GetByte()
if err != nil {
return nil, err
}
flag := num == 0xFE
for x := 0; x < length; x++ {
if flag {
_, _ = session.GetByte()
}
result.bindErrors[x].rowOffset, err = session.GetInt(4, true, true)
if err != nil {
return nil, err
}
}
if flag {
_, _ = session.GetByte()
}
}
length, err = session.GetInt(2, true, true)
if err != nil {
return nil, err
}
if length > 0 {
_, _ = session.GetByte()
for x := 0; x < length; x++ {
_, err := session.GetInt(2, true, true)
if err != nil {
return nil, err
}
result.bindErrors[x].errorMsg, err = session.GetClr()
if err != nil {
return nil, err
}
_, _ = session.GetByte()
_, _ = session.GetByte()
}
}
_, _ = session.GetDlc()
_, _ = session.GetDlc()
_, _ = session.GetDlc()
//length, err := session.GetDlc()
//length, err := session.GetInt(2, true, true)
//if err != nil {
// return nil, err
//}
//if length > 0 {
// result.bindErrors = make([]BindError, length)
// num, err := session.GetByte()
// if err != nil {
// return nil, err
// }
// flag := num == 0xFE
// for x := 0; x < length; x++ {
// if flag {
// _, _ = session.GetByte()
// }
// result.bindErrors[x].errorCode, err = session.GetInt(2, true, true)
// if err != nil {
// return nil, err
// }
// }
// if flag {
// _, _ = session.GetByte()
// }
//}
//length, err = session.GetInt(4, true, true)
//if err != nil {
// return nil, err
//}
//if length > 0 {
// num, err := session.GetByte()
// if err != nil {
// return nil, err
// }
// flag := num == 0xFE
// for x := 0; x < length; x++ {
// if flag {
// _, _ = session.GetByte()
// }
// result.bindErrors[x].rowOffset, err = session.GetInt(4, true, true)
// if err != nil {
// return nil, err
// }
// }
// if flag {
// _, _ = session.GetByte()
// }
//}
//length, err = session.GetInt(2, true, true)
//if err != nil {
// return nil, err
//}
//if length > 0 {
// _, _ = session.GetByte()
// for x := 0; x < length; x++ {
// _, err := session.GetInt(2, true, true)
// if err != nil {
// return nil, err
// }
// result.bindErrors[x].errorMsg, err = session.GetClr()
// if err != nil {
// return nil, err
// }
// _, _ = session.GetByte()
// _, _ = session.GetByte()
// }
//}
if result.RetCode != 0 {
result.ErrorMessage, err = session.GetClr()
if err != nil {
Expand Down

0 comments on commit 8a9103e

Please sign in to comment.