   SQLDisconnect succeeded? [ "odbc-disconnect failed" throw ] unless ;
 
 : odbc-prepare ( dbc string -- statement )
-  >r alloc-stmt-handle dup r> dup length SQLPrepare succeeded? [ "odbc-prepare failed" throw ] unless ;
+  [ alloc-stmt-handle dup ] dip dup length SQLPrepare succeeded? [ "odbc-prepare failed" throw ] unless ;
 
 : odbc-free-statement ( statement -- )
   SQL-HANDLE-STMT swap SQLFreeHandle succeeded? [ "odbc-free-statement failed" throw ] unless ;

  ] keep ;

: odbc-connect ( env dsn -- dbc )
   >r alloc-dbc-handle dup r>
   f swap dup length 1024 temp-string 0 short <ref> SQL-DRIVER-NOPROMPT
   SQLDriverConnect succeeded? [ "odbc-connect failed" throw ] unless ;



C: <field> field

:: odbc-get-field ( statement column! -- field )
  column column? [ statement column odbc-describe-column column! ] unless
  8192 :> bufferLen
  bufferLen CHAR: space <string> ascii string>alien :> targetValuePtr

  statement column number>> SQL-C-DEFAULT
  targetValuePtr bufferLen f SQLGetData succeeded? [
      targetValuePtr column [ dereference-type-pointer ] keep <field>
  ] [
    column [
      "SQLGetData Failed for Column: " %
      dup name>> %
      " of type: " % dup type>> name>> %
