home *** CD-ROM | disk | FTP | other *** search
/ Microsoft Internet Business Development Kit / PRODUCT_CD.iso / sqlsvr / odbcsdk / samples / smpldrvr / prepare.c < prev    next >
Encoding:
C/C++ Source or Header  |  1994-12-07  |  2.7 KB  |  153 lines

  1. /*
  2. ** PREPARE.C - This is the ODBC sample driver code for
  3. ** preparing SQL Commands and other functions prior to execution.
  4. **
  5. **    This code is furnished on an as-is basis as part of the ODBC SDK and is
  6. **    intended for example purposes only.
  7. **
  8. */
  9.  
  10. //    -    -    -    -    -    -    -    -    -
  11.  
  12. #include "sample.h"
  13.  
  14. //    -    -    -    -    -    -    -    -    -
  15.  
  16. //    Allocate a SQL statement
  17.  
  18. RETCODE SQL_API SQLAllocStmt(
  19.     HDBC      hdbc,
  20.     HSTMT FAR *phstmt)
  21. {
  22.     HGLOBAL    hstmt;
  23.  
  24.     hstmt = GlobalAlloc (GMEM_MOVEABLE | GMEM_ZEROINIT, sizeof (STMT));
  25.     if (!hstmt || (*phstmt = (HSTMT)GlobalLock (hstmt)) == SQL_NULL_HSTMT)
  26.     {
  27.         GlobalFree (hstmt);    //    Free it if lock fails
  28.         return SQL_ERROR;
  29.     }
  30.     return SQL_SUCCESS;
  31. }
  32.  
  33. //    -    -    -    -    -    -    -    -    -
  34.  
  35. RETCODE SQL_API SQLFreeStmt(
  36.     HSTMT      hstmt,
  37.     UWORD      fOption)
  38. {
  39.     if (fOption == SQL_DROP)
  40.     {
  41.         GlobalUnlock (GlobalPtrHandle(hstmt));
  42.         GlobalFree (GlobalPtrHandle(hstmt));
  43.     }
  44.     return SQL_SUCCESS;
  45. }
  46.  
  47. //    -    -    -    -    -    -    -    -    -
  48.  
  49. //    Perform a Prepare on the SQL statement
  50.  
  51. RETCODE SQL_API SQLPrepare(
  52.     HSTMT      hstmt,
  53.     UCHAR FAR *szSqlStr,
  54.     SDWORD      cbSqlStr)
  55. {
  56.     return SQL_SUCCESS;
  57. }
  58.  
  59. //    -    -    -    -    -    -    -    -    -
  60.  
  61. //    Bind parameters on a statement handle
  62.  
  63. RETCODE SQL_API SQLBindParameter(
  64.     HSTMT       hstmt,
  65.     UWORD       ipar,
  66.     SWORD       fParamType,
  67.     SWORD       fCType,
  68.     SWORD       fSqlType,
  69.     UDWORD       cbColDef,
  70.     SWORD       ibScale,
  71.     PTR        rgbValue,
  72.     SDWORD       cbValueMax,
  73.     SDWORD FAR *pcbValue)
  74. {
  75.     return SQL_SUCCESS;
  76. }
  77.  
  78. //    -    -    -    -    -    -    -    -    -
  79.  
  80. //    Returns the description of a parameter marker.
  81.  
  82. RETCODE SQL_API SQLDescribeParam(
  83.     HSTMT       hstmt,
  84.     UWORD       ipar,
  85.     SWORD  FAR *pfSqlType,
  86.     UDWORD FAR *pcbColDef,
  87.     SWORD  FAR *pibScale,
  88.     SWORD  FAR *pfNullable)
  89. {
  90.     return SQL_SUCCESS;
  91. }
  92.  
  93. //    -    -    -    -    -    -    -    -    -
  94.  
  95. //    Sets multiple values (arrays) for the set of parameter markers.
  96.  
  97. RETCODE SQL_API SQLParamOptions(
  98.     HSTMT       hstmt,
  99.     UDWORD       crow,
  100.     UDWORD FAR *pirow)
  101. {
  102.     return SQL_SUCCESS;
  103. }
  104.  
  105. //    -    -    -    -    -    -    -    -    -
  106.  
  107. //    Returns the number of parameter markers.
  108.  
  109. RETCODE SQL_API SQLNumParams(
  110.     HSTMT       hstmt,
  111.     SWORD  FAR *pcpar)
  112. {
  113.     return SQL_SUCCESS;
  114. }
  115.  
  116. //    -    -    -    -    -    -    -    -    -
  117.  
  118. //    Sets options that control the behavior of cursors.
  119.  
  120. RETCODE SQL_API SQLSetScrollOptions(
  121.     HSTMT       hstmt,
  122.     UWORD       fConcurrency,
  123.     SDWORD    crowKeyset,
  124.     UWORD       crowRowset)
  125. {
  126.     return SQL_SUCCESS;
  127. }
  128.  
  129. //    -    -    -    -    -    -    -    -    -
  130.  
  131. //    Set the cursor name on a statement handle
  132.  
  133. RETCODE SQL_API SQLSetCursorName(
  134.     HSTMT      hstmt,
  135.     UCHAR FAR *szCursor,
  136.     SWORD      cbCursor)
  137. {
  138.     return SQL_SUCCESS;
  139. }
  140.  
  141. //    -    -    -    -    -    -    -    -    -
  142.  
  143. //    Return the cursor name for a statement handle
  144.  
  145. RETCODE SQL_API SQLGetCursorName(
  146.     HSTMT      hstmt,
  147.     UCHAR FAR *szCursor,
  148.     SWORD      cbCursorMax,
  149.     SWORD FAR *pcbCursor)
  150. {
  151.     return SQL_SUCCESS;
  152. }
  153.