How to pass NULL value to a SQLPOINTER in golang

func SQLColAttribute(statementHandle SQLHSTMT, ColumnNumber SQLSMALLINT, FieldIdentifier SQLSMALLINT, CharacterAttributePtr SQLPOINTER, BufferLength SQLSMALLINT, StringLengthPtr *SQLSMALLINT, NumericAttributePtr SQLPOINTER) (ret SQLRETURN) {

r0, _, _ := syscall.Syscall9(procSQLColAttribute.Addr(), 7, uintptr(statementHandle), uintptr(ColumnNumber), uintptr(FieldIdentifier), uintptr(CharacterAttributePtr), uintptr(BufferLength), uintptr(unsafe.Pointer(StringLengthPtr)), uintptr(NumericAttributePtr), 0, 0)

ret = SQLRETURN(r0)

return

}

The FieldIdentifier in the above function changes if that return value is int then NumericAttributePtr will hold result and other StringLengthPtr,CharacterAttributePtr must be null.

ret := api.SQLColAttribute(r.os.h, api.SQLSMALLINT(i), api.SQL_DESC_PRECISION, nil, 0, nil, &Col[index])

Since go has NIL if i use NIL it produces that NIL cannot be stored in SQLPOINTER, if i use NULL it show null is not defined.

How to solve it? Thanks.

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.