weigj / go-odbc

ODBC Driver for Go language
Other
122 stars 49 forks source link

Minor change to get full varchar field. #4

Open jtowell opened 13 years ago

jtowell commented 13 years ago

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)

AllanCochrane commented 12 years ago

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? :-)