Source code of Windows XP (NT5)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

106 lines
6.1 KiB

  1. ///////////////////////////////////////////////////////////////////////////////////////////////////////////
  2. //
  3. // SQLOBJ.H
  4. //
  5. // Defines the SQL Wrapper object
  6. //
  7. // Copyright (c) Microsoft Corporation 1998
  8. //
  9. // protect us from the DLL's not being present and to allow us to run.
  10. // got to be a simplier solution.
  11. //
  12. ///////////////////////////////////////////////////////////////////////////////////////////////////////////
  13. #ifndef _SQLOBJ_HEADER_
  14. #define _SQLOBJ_HEADER_
  15. #include <odbcinst.h>
  16. #include <sqlext.h>
  17. #ifdef __cplusplus
  18. extern "C" {
  19. #endif
  20. typedef BOOL (INSTAPI * SQ_CONFIGDATASOURCE) (HWND,WORD,LPCTSTR, LPCTSTR);
  21. typedef SQLRETURN (SQL_API * SQ_SETPOS) (SQLHSTMT,SQLUSMALLINT,SQLUSMALLINT,SQLUSMALLINT);
  22. typedef SQLRETURN (SQL_API * SQ_EXTENDEDFETCH) (SQLHSTMT,SQLUSMALLINT,SQLINTEGER,SQLUINTEGER *,SQLUSMALLINT *);
  23. typedef SQLRETURN (SQL_API * SQ_FREESTMT) (SQLHSTMT,SQLUSMALLINT);
  24. typedef SQLRETURN (SQL_API * SQ_EXECDIRECT) (SQLHSTMT,SQLCHAR *,SQLINTEGER);
  25. typedef SQLRETURN (SQL_API * SQ_SETSTMTOPTION) (SQLHSTMT,SQLUSMALLINT,SQLUINTEGER);
  26. typedef SQLRETURN (SQL_API * SQ_BINDCOL) (SQLHSTMT,SQLUSMALLINT,SQLSMALLINT,SQLPOINTER,SQLINTEGER,SQLINTEGER *);
  27. typedef SQLRETURN (SQL_API * SQ_ERROR) (SQLHENV,SQLHDBC,SQLHSTMT,SQLCHAR *,SQLINTEGER *,SQLCHAR *,SQLSMALLINT,SQLSMALLINT *);
  28. typedef SQLRETURN (SQL_API * SQ_ALLOCSTMT) (SQLHDBC,SQLHSTMT *);
  29. typedef SQLRETURN (SQL_API * SQ_FREECONNECT) (SQLHDBC);
  30. typedef SQLRETURN (SQL_API * SQ_FREEENV) (SQLHENV);
  31. typedef SQLRETURN (SQL_API * SQ_DISCONNECT) (SQLHDBC);
  32. typedef SQLRETURN (SQL_API * SQ_CONNECT) (SQLHDBC,SQLCHAR *,SQLSMALLINT,SQLCHAR *,SQLSMALLINT,SQLCHAR *,SQLSMALLINT);
  33. typedef SQLRETURN (SQL_API * SQ_ALLOCCONNECT) (SQLHENV,SQLHDBC *);
  34. typedef SQLRETURN (SQL_API * SQ_ALLOCENV) (SQLHENV *);
  35. typedef SQLRETURN (SQL_API * SQ_SETCONNECTOPTION) (SQLHDBC,SQLUSMALLINT,SQLUINTEGER);
  36. typedef SQLRETURN (SQL_API * SQ_TRANSACT) (SQLHENV,SQLHDBC,SQLUSMALLINT);
  37. typedef SQLRETURN (SQL_API * SQ_FETCH) (SQLHSTMT);
  38. typedef SQLRETURN (SQL_API * SQ_STATISTICS) (SQLHSTMT,SQLCHAR *,SQLSMALLINT,SQLCHAR *,SQLSMALLINT,SQLCHAR *,SQLSMALLINT,SQLUSMALLINT,SQLUSMALLINT);
  39. typedef SQLRETURN (SQL_API * SQ_DESCRIBECOL) (SQLHSTMT,SQLSMALLINT,SQLCHAR *,SQLSMALLINT,SQLSMALLINT *,SQLSMALLINT *,SQLUINTEGER *,SQLSMALLINT *,SQLSMALLINT *);
  40. class SQL
  41. {
  42. public:
  43. SQL();
  44. ~SQL();
  45. BOOL Initialize(void);
  46. BOOL INSTAPI ConfigDataSource(HWND hwndParent, WORD fRequest,LPCTSTR lpszDriver, LPCTSTR lpszAttributes);
  47. SQLRETURN SQL_API SetPos( SQLHSTMT hstmt, SQLUSMALLINT irow, SQLUSMALLINT fOption, SQLUSMALLINT fLock);
  48. SQLRETURN SQL_API ExtendedFetch( SQLHSTMT hstmt, SQLUSMALLINT fFetchType, SQLINTEGER irow, SQLUINTEGER *pcrow, SQLUSMALLINT *rgfRowStatus);
  49. SQLRETURN SQL_API FreeStmt(SQLHSTMT StatementHandle, SQLUSMALLINT Option);
  50. SQLRETURN SQL_API ExecDirect(SQLHSTMT StatementHandle, SQLCHAR *StatementText, SQLINTEGER TextLength);
  51. SQLRETURN SQL_API SetStmtOption(SQLHSTMT StatementHandle, SQLUSMALLINT Option, SQLUINTEGER Value);
  52. SQLRETURN SQL_API BindCol(SQLHSTMT StatementHandle, SQLUSMALLINT ColumnNumber, SQLSMALLINT TargetType, SQLPOINTER TargetValue, SQLINTEGER BufferLength, SQLINTEGER *StrLen_or_Ind);
  53. SQLRETURN SQL_API Error(SQLHENV EnvironmentHandle, SQLHDBC ConnectionHandle, SQLHSTMT StatementHandle, SQLCHAR *Sqlstate, SQLINTEGER *NativeError, SQLCHAR *MessageText, SQLSMALLINT BufferLength, SQLSMALLINT *TextLength);
  54. SQLRETURN SQL_API AllocStmt(SQLHDBC ConnectionHandle, SQLHSTMT *StatementHandle);
  55. SQLRETURN SQL_API FreeConnect(SQLHDBC ConnectionHandle);
  56. SQLRETURN SQL_API FreeEnv(SQLHENV EnvironmentHandle);
  57. SQLRETURN SQL_API Disconnect(SQLHDBC ConnectionHandle);
  58. SQLRETURN SQL_API Connect(SQLHDBC ConnectionHandle, SQLCHAR *ServerName, SQLSMALLINT NameLength1, SQLCHAR *UserName, SQLSMALLINT NameLength2, SQLCHAR *Authentication, SQLSMALLINT NameLength3);
  59. SQLRETURN SQL_API AllocConnect(SQLHENV EnvironmentHandle, SQLHDBC *ConnectionHandle);
  60. SQLRETURN SQL_API AllocEnv(SQLHENV *EnvironmentHandle);
  61. SQLRETURN SQL_API SetConnectOption(SQLHDBC ConnectionHandle, SQLUSMALLINT Option, SQLUINTEGER Value);
  62. SQLRETURN SQL_API Transact(SQLHENV EnvironmentHandle, SQLHDBC ConnectionHandle, SQLUSMALLINT CompletionType);
  63. SQLRETURN SQL_API Fetch(SQLHSTMT StatementHandle);
  64. SQLRETURN SQL_API Statistics(SQLHSTMT StatementHandle, SQLCHAR *CatalogName, SQLSMALLINT NameLength1, SQLCHAR *SchemaName, SQLSMALLINT NameLength2, SQLCHAR *TableName, SQLSMALLINT NameLength3, SQLUSMALLINT Unique, SQLUSMALLINT Reserved);
  65. SQLRETURN SQL_API DescribeCol(SQLHSTMT StatementHandle, SQLSMALLINT ColumnNumber, SQLCHAR * ColumnName, SQLSMALLINT BufferLength, SQLSMALLINT * NameLengthPtr, SQLSMALLINT * DataTypePtr, SQLUINTEGER * ColumnSizePtr, SQLSMALLINT * DecimalDigitsPtr, SQLSMALLINT * NullablePtr);
  66. private:
  67. HMODULE m_hODBC;
  68. HMODULE m_hODBCCP;
  69. SQ_CONFIGDATASOURCE m_pfnConfigDataSource;
  70. SQ_SETPOS m_pfnSetPos;
  71. SQ_EXTENDEDFETCH m_pfnExtendedFetch;
  72. SQ_FREESTMT m_pfnFreeStmt;
  73. SQ_EXECDIRECT m_pfnExecDirect;
  74. SQ_SETSTMTOPTION m_pfnSetStmtOption;
  75. SQ_BINDCOL m_pfnBindCol;
  76. SQ_ERROR m_pfnError;
  77. SQ_ALLOCSTMT m_pfnAllocStmt;
  78. SQ_FREECONNECT m_pfnFreeConnect;
  79. SQ_FREEENV m_pfnFreeEnv;
  80. SQ_DISCONNECT m_pfnDisconnect;
  81. SQ_CONNECT m_pfnConnect;
  82. SQ_ALLOCCONNECT m_pfnAllocConnect;
  83. SQ_ALLOCENV m_pfnAllocEnv;
  84. SQ_SETCONNECTOPTION m_pfnSetConnectOption;
  85. SQ_TRANSACT m_pfnTransact;
  86. SQ_FETCH m_pfnFetch;
  87. SQ_STATISTICS m_pfnStatistics;
  88. SQ_DESCRIBECOL m_pfnDescribeCol;
  89. };
  90. #ifdef __cplusplus
  91. };
  92. #endif
  93. #endif //_SQLOBJ_HEADER_