We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
Need to call SQLGetData multiple times to get long field, limit per Get is set by ODBC driver. I'm using a Windows 2003 PostgreSQL ODBC driver.
Example patch.
--- /weigj-go-odbc-514210d/odbc.go +++ /weigj-go-odbc-514210d-2/odbc.go @@ -453,12 +453,22 @@ case C.SQL_WCHAR, C.SQL_WVARCHAR, C.SQL_WLONGVARCHAR: value := make([]uint16, int(field_len)+8) ret = C.SQLGetData(C.SQLHSTMT(stmt.handle), C.SQLUSMALLINT(field_index+1), C.SQL_C_WCHAR, C.SQLPOINTER(unsafe.Pointer(&value[0])), C.SQLINTEGER(int(field_len)+4), &fl)
s := UTF16ToString(value)
s := ""
for Success(ret) {
if len(UTF16ToString(value))<=0 { break }
s += UTF16ToString(value)
ret = C.SQLGetData(C.SQLHSTMT(stmt.handle), C.SQLUSMALLINT(field_index+1), C.SQL_C_WCHAR, C.SQLPOINTER(unsafe.Pointer(&value[0])), C.SQLINTEGER(int(field_len)+4), &fl)
} v = s
s := string(value[0:])
if len(string(value[0:]))<=0 { break }
s += string(value[0:])
ret = C.SQLGetData(C.SQLHSTMT(stmt.handle), C.SQLUSMALLINT(field_index+1), C.SQL_C_CHAR, C.SQLPOINTER(unsafe.Pointer(&value[0])), C.SQLINTEGER(int(field_len)+4), &fl)
} v = s debugPrint("default type", value, fl, s)
The text was updated successfully, but these errors were encountered:
Hi, I have applied these changes to a local copy of odbc.go but am getting a 'FormatError 100' and empty result set. Any ideas? :-)
Sorry, something went wrong.
No branches or pull requests
Need to call SQLGetData multiple times to get long field, limit per Get is set by ODBC driver. I'm using a Windows 2003 PostgreSQL ODBC driver.
Example patch.
--- /weigj-go-odbc-514210d/odbc.go
+++ /weigj-go-odbc-514210d-2/odbc.go
@@ -453,12 +453,22 @@
case C.SQL_WCHAR, C.SQL_WVARCHAR, C.SQL_WLONGVARCHAR:
value := make([]uint16, int(field_len)+8)
ret = C.SQLGetData(C.SQLHSTMT(stmt.handle), C.SQLUSMALLINT(field_index+1), C.SQL_C_WCHAR, C.SQLPOINTER(unsafe.Pointer(&value[0])), C.SQLINTEGER(int(field_len)+4), &fl)
value := make([]byte, int(fl)+2)
ret = C.SQLGetData(C.SQLHSTMT(stmt.handle), C.SQLUSMALLINT(field_index+1), C.SQL_C_CHAR, C.SQLPOINTER(unsafe.Pointer(&value[0])), C.SQLINTEGER(int(field_len)+4), &fl)
The text was updated successfully, but these errors were encountered: