Skip to content

Commit

Permalink
set length to 0 to get non-bindable column for strings
Browse files Browse the repository at this point in the history
  • Loading branch information
hawkaa committed Oct 22, 2021
1 parent d924060 commit ae0055c
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion column.go
Original file line number Diff line number Diff line change
Expand Up @@ -93,8 +93,11 @@ func NewColumn(h api.SQLHSTMT, idx int) (Column, error) {
case api.SQL_GUID:
var v api.SQLGUID
return NewBindableColumn(b, api.SQL_C_GUID, int(unsafe.Sizeof(v))), nil
case api.SQL_CHAR, api.SQL_VARCHAR:
case api.SQL_CHAR:
return NewVariableWidthColumn(b, api.SQL_C_CHAR, size)
case api.SQL_VARCHAR:
// hack: set length to 0 to get non-bindable column for strings
return NewVariableWidthColumn(b, api.SQL_C_CHAR, 0)
case api.SQL_WCHAR, api.SQL_WVARCHAR:
return NewVariableWidthColumn(b, api.SQL_C_WCHAR, size)
case api.SQL_BINARY, api.SQL_VARBINARY:
Expand Down

0 comments on commit ae0055c

Please sign in to comment.