   SQLFetch succeeded? ;
 
 : odbc-number-of-columns ( statement -- number )
-  0 <short> [ SQLNumResultCols succeeded? ] keep swap [
-    *short
+  0 short <ref> [ SQLNumResultCols succeeded? ] keep swap [
+    short deref
   ] [
     drop f
   ] if ;

FUNCTION: SQLRETURN SQLGetData ( SQLHSTMT statementHandle, SQLUSMALLINT columnNumber, SQLSMALLINT targetType, SQLPOINTER targetValuePtr, SQLINTEGER bufferLength, SQLINTEGER* strlen_or_indPtr )

: alloc-handle ( type parent -- handle )
  f <void*> [ SQLAllocHandle ] keep swap succeeded? [
    *void*
  ] [
    drop f
  ] if ;

    { SQL-WCHAR [ ascii alien>string ] }
    { SQL-WCHARVAR [ ascii alien>string ] }
    { SQL-WLONGCHARVAR [ ascii alien>string ] }
    { SQL-SMALLINT [ short deref ] }
    { SQL-INTEGER [ long deref ] }
    { SQL-REAL [ float deref ] }
    { SQL-FLOAT [ double deref ] }
    { SQL-DOUBLE [ double deref ] }
    { SQL-TINYINT [ char deref ] }
    { SQL-BIGINT [ longlong deref ] }
    [ nip [ "Unknown SQL Type: " % name>> % ] "" make ]
  } case ;

