Skip to content

Commit

Permalink
readme, null terminator modified and 2GB spported
Browse files Browse the repository at this point in the history
  • Loading branch information
akhilravuri1 committed Sep 9, 2019
1 parent 64e65fd commit 909a2f5
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 10 deletions.
11 changes: 8 additions & 3 deletions column.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,13 @@ func (l *BufferLen) GetData(h api.SQLHSTMT, idx int, ctype api.SQLSMALLINT, buf
}

func (l *BufferLen) Bind(h api.SQLHSTMT, idx int, ctype api.SQLSMALLINT, buf []byte) api.SQLRETURN {
if len(buf) <= 2147483647 {
return api.SQLBindCol(h, api.SQLUSMALLINT(idx+1), ctype,
buf, api.SQLLEN(len(buf)),
(*api.SQLLEN)(l))
}
return api.SQLBindCol(h, api.SQLUSMALLINT(idx+1), ctype,
buf, api.SQLLEN(len(buf)),
buf, api.SQLLEN(len(buf)-1),
(*api.SQLLEN)(l))
}

Expand Down Expand Up @@ -235,10 +240,10 @@ func NewVariableWidthColumn(b *BaseColumn, ctype api.SQLSMALLINT, colWidth api.S
l := int(colWidth)
switch ctype {
case api.SQL_C_WCHAR, api.SQL_C_DBCHAR:
//l += 1 // room for null-termination character
l++ // room for null-termination character
l *= 2 // wchars take 2 bytes each
case api.SQL_C_CHAR:
//l += 1 // room for null-termination character
l++ // room for null-termination character
case api.SQL_C_BINARY:
// nothing to do
default:
Expand Down
18 changes: 11 additions & 7 deletions installer/setup.go
Original file line number Diff line number Diff line change
Expand Up @@ -79,13 +79,17 @@ func linux_untar(clidriver string, targetDirectory string) error {
func main() {
var target, cliFileName string
var unpackageType int
_, errDir := os.LookupEnv("IBM_DB_DIR")
_, errHome := os.LookupEnv("IBM_DB_HOME")
_, errLib := os.LookupEnv("IBM_DB_LIB")

if errDir || errHome || errLib {
fmt.Printf("Failed to fetch environment variables.")
os.Exit(1)
value, errDir := os.LookupEnv("DB2HOME")
if errDir {
if runtime.GOOS == "windows" {
fmt.Println("clidriver is already present in this path ", value)
fmt.Println("Please add this path to PATH environment variable")
os.Exit(1)
} else {
fmt.Println("clidriver is already present in this path ", value)
fmt.Println("Please set CGO_CFLAGS, CGO_LDFLAGS and LD_LIBRARY_PATH or DYLD_LIBRARY_PATH environment variables")
os.Exit(1)
}
}
if len(os.Args) == 2 {
target = os.Args[1]
Expand Down

0 comments on commit 909a2f5

Please sign in to comment.