Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Code alignment #244

Merged
merged 75 commits into from
Jul 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
75 commits
Select commit Hold shift + click to select a range
c7dde1d
Create go.yml
vmathur12 Nov 30, 2023
50c37ca
Update go.yml
vmathur12 Nov 30, 2023
80d1213
Update go.yml
vmathur12 Nov 30, 2023
0458f46
Update go.yml
vmathur12 Nov 30, 2023
991a43f
Update go.yml
vmathur12 Nov 30, 2023
edb9d0e
Update go.yml
vmathur12 Nov 30, 2023
12217be
Update go.yml
vmathur12 Nov 30, 2023
32414c4
Update go.yml
vmathur12 Nov 30, 2023
4c8071f
Update go.yml
vmathur12 Nov 30, 2023
1bf6fff
Update go.yml
vmathur12 Nov 30, 2023
21782f2
Update go.yml
vmathur12 Nov 30, 2023
0b31b43
Update go.yml
vmathur12 Nov 30, 2023
8ce1caf
Update go.yml
vmathur12 Nov 30, 2023
c9b1c20
Update go.yml
vmathur12 Nov 30, 2023
e0411ba
Update go.yml
vmathur12 Nov 30, 2023
ffb10f0
Update go.yml
vmathur12 Nov 30, 2023
3ff5f26
Update go.yml
vmathur12 Nov 30, 2023
a0db572
Update go.yml
vmathur12 Nov 30, 2023
34ad029
Update go.yml
vmathur12 Nov 30, 2023
2a91a25
Update go.yml
vmathur12 Nov 30, 2023
70dcd0c
Update go.yml
vmathur12 Nov 30, 2023
dfd4a58
Update go.yml
vmathur12 Nov 30, 2023
969e09f
Update go.yml
vmathur12 Nov 30, 2023
1c8d9ef
Update go.yml
vmathur12 Nov 30, 2023
0b65c2a
Update go.yml
vmathur12 Nov 30, 2023
cec78b7
Update go.yml
vmathur12 Nov 30, 2023
8ddc339
Update go.yml
vmathur12 Nov 30, 2023
f29af86
Update go.yml
vmathur12 Nov 30, 2023
5655330
Update go.yml
vmathur12 Nov 30, 2023
e08e0a3
Update go.yml
vmathur12 Nov 30, 2023
9c40506
Update go.yml
vmathur12 Nov 30, 2023
8fa3673
Update go.yml
vmathur12 Dec 1, 2023
b3dfeb9
Update go.yml
vmathur12 Dec 1, 2023
212de3d
Update go.yml
vmathur12 Dec 1, 2023
9d5a544
Update go.yml
vmathur12 Dec 1, 2023
1980ec2
Update main.go
vmathur12 Dec 1, 2023
9e724d4
Update go.yml
vmathur12 Dec 1, 2023
2999144
Update go.yml
vmathur12 Dec 1, 2023
3f6e1cc
Update go.yml
vmathur12 Dec 1, 2023
195a366
Update go.yml
vmathur12 Dec 1, 2023
ab86465
Update go.yml
vmathur12 Dec 1, 2023
2d06af7
Delete testdata/connectioninvaliddatabasename_test.go
vmathur12 Dec 1, 2023
7f0abe5
Delete testdata/connectioninvalidportno_test.go
vmathur12 Dec 1, 2023
efbbe7c
Delete testdata/connectioninvaliduserid_test.go
vmathur12 Dec 1, 2023
c24ec3c
Delete testdata/connectioninvaliduserpwd_test.go
vmathur12 Dec 1, 2023
88bc4ff
Update go.yml
vmathur12 Dec 1, 2023
8f76b1c
Update go.yml
vmathur12 Dec 1, 2023
1745530
Update go.yml
vmathur12 Dec 1, 2023
0582efa
Delete testdata/queryContext_test.go
vmathur12 Dec 1, 2023
6deac6a
Delete testdata/query_test.go
vmathur12 Dec 1, 2023
48cd212
Delete testdata/scan_test.go
vmathur12 Dec 1, 2023
323a8dc
Delete testdata/spArray_test.go
vmathur12 Dec 1, 2023
90ee19a
Delete testdata/spInOut_test.go
vmathur12 Dec 1, 2023
9e7b4dc
Delete testdata/sp_test.go
vmathur12 Dec 1, 2023
0d53519
Update go.yml
vmathur12 Dec 1, 2023
7e77431
Update go.yml
vmathur12 Dec 1, 2023
ef60c2a
Update go.yml
vmathur12 Dec 1, 2023
820e6b6
Update go.yml
vmathur12 Dec 1, 2023
524c95a
Update go.yml
vmathur12 Dec 1, 2023
1a136b9
Update go.yml
vmathur12 Dec 1, 2023
98da70a
Update go.yml
vmathur12 Dec 1, 2023
8e7ef67
Update go.yml
vmathur12 Dec 1, 2023
60bbced
Update go.yml
vmathur12 Dec 1, 2023
59a6da2
Update go.yml
vmathur12 Dec 1, 2023
9ccf1f4
Update go.yml
vmathur12 Dec 1, 2023
c8ed7b7
Update go.yml
vmathur12 Dec 4, 2023
8ab6c64
Update go.yml
vmathur12 Dec 4, 2023
450492e
Update go.yml
vmathur12 Dec 4, 2023
19c8983
Merge branch 'ibmdb:master' into master
vmathur12 Jun 20, 2024
2fb90b0
Merge branch 'ibmdb:master' into master
vmathur12 Jul 2, 2024
e7c9203
Code alignment
Jul 2, 2024
8234416
Updated code alignment
Jul 8, 2024
2f16340
Updated code alignment
Jul 8, 2024
82f9a64
Removed the files
Jul 17, 2024
e907bb0
Updated connection string
Jul 25, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 8 additions & 8 deletions api/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ type (
// UTF16ToString returns the UTF-8 encoding of the UTF-16 sequence s,
// with a terminating NUL removed.
func UTF16ToString(s []uint16) string {
trc.Trace1("api/api.go UTF16ToString() - ENTRY")
trc.Trace1("api/api.go UTF16ToString() - ENTRY")
for i, v := range s {
if v == 0 {
s = s[0:i]
Expand All @@ -74,9 +74,9 @@ func UTF16ToString(s []uint16) string {
// with a terminating NUL added.
//func StringToUTF16(s string) []uint16 { return utf16.Encode([]rune(s + "\u0000")) }
func StringToUTF16(s string) []uint16 {
trc.Trace1("api/api.go StringToUTF16()")
trc.Trace1("api/api.go StringToUTF16()")
trc.Trace1(fmt.Sprintf("api/api.go StringToUTF16() - s = %s", s))

if runtime.GOOS == "zos"{
return utf16.Encode([]rune(s))
}else {
Expand All @@ -91,26 +91,26 @@ func StringToUTF16Ptr(s string) *uint16 { return &StringToUTF16(s)[0] }

// ExtractUTF16Str uses unsafe package to copy UTF16 string to a byte slice.
func ExtractUTF16Str(s []uint16) []byte {
trc.Trace1("api/api.go ExtractUTF16Str() - ENTRY")
trc.Trace1("api/api.go ExtractUTF16Str() - ENTRY")

var out []byte
for i := range s {
b := Extract(unsafe.Pointer(&s[i]), unsafe.Sizeof(s[i]))
out = append(out, b...)
}

trc.Trace1("api/api.go ExtractUTF16Str() - EXIT")
return out
}

func Extract(ptr unsafe.Pointer, size uintptr) []byte {
trc.Trace1("api/api.go Extract() - ENTRY")

out := make([]byte, size)
for i := range out {
out[i] = *((*byte)(unsafe.Pointer(uintptr(ptr) + uintptr(i))))
}

trc.Trace1("api/api.go Extract() - EXIT")
return out
}
16 changes: 8 additions & 8 deletions api/api_unix.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
package api

import (
trc "github.com/ibmdb/go_ibm_db/log2"
trc "github.com/ibmdb/go_ibm_db/log2"
"fmt"
)

Expand Down Expand Up @@ -177,23 +177,23 @@ type (
)

func SQLSetEnvUIntPtrAttr(environmentHandle SQLHENV, attribute SQLINTEGER, valuePtr uintptr, stringLength SQLINTEGER) (ret SQLRETURN) {
trc.Trace1("api/api_unix.go SQLSetEnvUIntPtrAttr() - ENTRY)
trc.Trace1("api/api_unix.go SQLSetEnvUIntPtrAttr() - ENTRY")
trc.Trace1(fmt.Sprintf("attribute=%d, valuePtr=0x%x, stringLength=%d", attribute, valuePtr, stringLength))

r := C.sqlSetEnvUIntPtrAttr(C.SQLHENV(environmentHandle), C.SQLINTEGER(attribute), C.uintptr_t(valuePtr), C.SQLINTEGER(stringLength))

trc.Trace1(fmt.Sprintf("r = %d", r))
trc.Trace1("api/api_unix.go SQLSetEnvUIntPtrAttr() - EXIT)
trc.Trace1("api/api_unix.go SQLSetEnvUIntPtrAttr() - EXIT")
return SQLRETURN(r)
}

func SQLSetConnectUIntPtrAttr(connectionHandle SQLHDBC, attribute SQLINTEGER, valuePtr uintptr, stringLength SQLINTEGER) (ret SQLRETURN) {
trc.Trace1("api/api_unix.go SQLSetConnectUIntPtrAttr() - ENTRY)
trc.Trace1("api/api_unix.go SQLSetConnectUIntPtrAttr() - ENTRY")
trc.Trace1(fmt.Sprintf("attribute=%d, valuePtr=%x, stringLength=%d", attribute, valuePtr, stringLength))

r := C.sqlSetConnectUIntPtrAttr(C.SQLHDBC(connectionHandle), C.SQLINTEGER(attribute), C.uintptr_t(valuePtr), C.SQLINTEGER(stringLength))

trc.Trace1(fmt.Sprintf("r = %d", r))
trc.Trace1("api/api_unix.go SQLSetConnectUIntPtrAttr() - EXIT)
trc.Trace1("api/api_unix.go SQLSetConnectUIntPtrAttr() - EXIT")
return SQLRETURN(r)
}
72 changes: 57 additions & 15 deletions api/api_windows.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ package api

import (
"syscall"
trc "github.com/ibmdb/go_ibm_db/log2"
trc "github.com/ibmdb/go_ibm_db/log2"
"fmt"
)

Expand Down Expand Up @@ -112,10 +112,51 @@ const (
SQL_AUTOCOMMIT_ON = 1
SQL_AUTOCOMMIT_DEFAULT = SQL_AUTOCOMMIT_ON
SQL_ATTR_PARAMSET_SIZE = 22
// Statement attributes
SQL_ROW_NUMBER = 14

// Statement attributes for ODBC 3.0
SQL_ATTR_CURSOR_TYPE = 6
//SQL_ATTR_PARAMSET_SIZE = 22
SQL_ATTR_ROW_NUMBER = SQL_ROW_NUMBER
SQL_ATTR_ROW_ARRAY_SIZE = 27
SQL_ATTR_ROW_STATUS_PTR = 25
SQL_ATTR_ROWS_FETCHED_PTR = 26

// SQL_CURSOR_TYPE options
SQL_CURSOR_FORWARD_ONLY = 0
SQL_CURSOR_KEYSET_DRIVEN = 1
SQL_CURSOR_DYNAMIC = 2
SQL_CURSOR_STATIC = 3
SQL_CURSOR_TYPE_DEFAULT = SQL_CURSOR_FORWARD_ONLY

// Operations in SQLSetPos
SQL_POSITION = 0
SQL_REFRESH = 1
SQL_UPDATE = 2
SQL_DELETE = 3

// Operations in SQLBulkOperations
SQL_ADD = 4
SQL_SETPOS_MAX_OPTION_VALUE = SQL_ADD
SQL_UPDATE_BY_BOOKMARK = 5 // Check if to be removed
SQL_DELETE_BY_BOOKMARK = 6
SQL_FETCH_BY_BOOKMARK = 7

// Lock options in SQLSetPos
SQL_LOCK_NO_CHANGE = 0

SQL_IS_UINTEGER = -5
SQL_IS_INTEGER = -6

// Fetch Orientation in SQLFetchScroll
SQL_FETCH_NEXT = 1
SQL_FETCH_FIRST = 2
SQL_FETCH_LAST = 3
SQL_FETCH_PRIOR = 4
SQL_FETCH_ABSOLUTE = 5
SQL_FETCH_RELATIVE = 6

//Connection pooling
SQL_ATTR_CONNECTION_POOLING = 201
SQL_ATTR_CP_MATCH = 202
Expand Down Expand Up @@ -145,14 +186,15 @@ type (
SQLHSTMT SQLHANDLE
SQLHWND uintptr

SQLWCHAR uint16
SQLSCHAR int8
SQLSMALLINT int16
SQLUSMALLINT uint16
SQLINTEGER int32
SQLUINTEGER uint32
SQLPOINTER uintptr
SQLRETURN SQLSMALLINT
SQLWCHAR uint16
SQLSCHAR int8
SQLSMALLINT int16
SQLUSMALLINT uint16
SQLINTEGER int32
SQLUINTEGER uint32
SQLPOINTER uintptr
SQLRETURN SQLSMALLINT
SQLSETPOSIROW SQLUSMALLINT

SQLGUID struct {
Data1 uint32
Expand All @@ -163,24 +205,24 @@ type (
)

func SQLSetEnvUIntPtrAttr(environmentHandle SQLHENV, attribute SQLINTEGER, valuePtr uintptr, stringLength SQLINTEGER) (ret SQLRETURN) {
trc.Trace1("api/api_windows.go SQLSetEnvUIntPtrAttr() - ENTRY")
trc.Trace1("api/api_windows.go SQLSetEnvUIntPtrAttr() - ENTRY")
trc.Trace1(fmt.Sprintf("attribute=%d, valuePtr=0x%x, stringLength=%d", attribute, valuePtr, stringLength))

r0, _, _ := syscall.Syscall6(procSQLSetEnvAttr.Addr(), 4, uintptr(environmentHandle), uintptr(attribute), uintptr(valuePtr), uintptr(stringLength), 0, 0)
ret = SQLRETURN(r0)

trc.Trace1(fmt.Sprintf("ret = %d", ret))
trc.Trace1(fmt.Sprintf("ret = %d", ret))
trc.Trace1("api/api_windows.go SQLSetEnvUIntPtrAttr() - EXIT")
return
}

func SQLSetConnectUIntPtrAttr(connectionHandle SQLHDBC, attribute SQLINTEGER, valuePtr uintptr, stringLength SQLINTEGER) (ret SQLRETURN) {
trc.Trace1("api/api_windows.go SQLSetConnectUIntPtrAttr() - ENTRY")
trc.Trace1("api/api_windows.go SQLSetConnectUIntPtrAttr() - ENTRY")
trc.Trace1(fmt.Sprintf("attribute=%d, valuePtr=%x, stringLength=%d", attribute, valuePtr, stringLength))

r0, _, _ := syscall.Syscall6(procSQLSetConnectAttrW.Addr(), 4, uintptr(connectionHandle), uintptr(attribute), uintptr(valuePtr), uintptr(stringLength), 0, 0)
ret = SQLRETURN(r0)

trc.Trace1(fmt.Sprintf("ret = %d", ret))
trc.Trace1("api/api_windows.go SQLSetConnectUIntPtrAttr() - EXIT")
return
Expand Down
13 changes: 6 additions & 7 deletions api/api_zos.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ import (
"log"
"runtime"
"unsafe"

"github.com/ibmruntimes/go-recordio/v2/utils"
trc "github.com/ibmdb/go_ibm_db/log2"
"fmt"
Expand Down Expand Up @@ -166,21 +165,21 @@ type (
)

func SQLSetEnvUIntPtrAttr(environmentHandle SQLHENV, attribute SQLINTEGER, valuePtr uintptr, stringLength SQLINTEGER) (ret SQLRETURN) {
trc.Trace1("api/api_zos.go SQLSetEnvUIntPtrAttr() - ENTRY")
trc.Trace1("api/api_zos.go SQLSetEnvUIntPtrAttr() - ENTRY")

r := utils.CfuncEbcdic(getFunc(&dll, "SQLSetEnvAttr"), uintptr(environmentHandle), uintptr(attribute), uintptr(valuePtr), uintptr(stringLength))

trc.Trace1(fmt.Sprintf("r = %d", r))
trc.Trace1("api/api_zos.go SQLSetEnvUIntPtrAttr() - EXIT")
return SQLRETURN(r)
}

func SQLSetConnectUIntPtrAttr(connectionHandle SQLHDBC, attribute SQLINTEGER, valuePtr uintptr, stringLength SQLINTEGER) (ret SQLRETURN) {
trc.Trace1("api/api_zos.go SQLSetConnectUIntPtrAttr() - ENTRY")
trc.Trace1("api/api_zos.go SQLSetConnectUIntPtrAttr() - ENTRY")

r := utils.CfuncEbcdic(getFunc(&dll, "SQLSetConnectAttr"), uintptr(connectionHandle), uintptr(attribute), uintptr(valuePtr), uintptr(stringLength))

trc.Trace1(fmt.Sprintf("r = %d", r))
trc.Trace1("api/api_zos.go SQLSetConnectUIntPtrAttr() - EXIT")
return SQLRETURN(r)
}
}
Loading