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.

95 lines
3.0 KiB

  1. //+-------------------------------------------------------------------------
  2. //
  3. // Microsoft Windows
  4. //
  5. // Copyright (C) Microsoft Corporation, 1996 - 1999
  6. //
  7. // File: codbc.cpp
  8. //
  9. // Contents: Microsoft Internet Security Common
  10. //
  11. // History: 08-Sep-1997 pberkman created
  12. //
  13. //--------------------------------------------------------------------------
  14. #include "global.hxx"
  15. #include "codbc.hxx"
  16. cODBC_::cODBC_(void)
  17. {
  18. hODBC32 = NULL;
  19. fp_SQLSetStmtOption = NULL;
  20. fp_SQLExecDirect = NULL;
  21. fp_SQLFetch = NULL;
  22. fp_SQLFreeConnect = NULL;
  23. fp_SQLFreeEnv = NULL;
  24. fp_SQLFreeStmt = NULL;
  25. fp_SQLTransact = NULL;
  26. fp_SQLError = NULL;
  27. fp_SQLGetData = NULL;
  28. fp_SQLAllocConnect = NULL;
  29. fp_SQLAllocEnv = NULL;
  30. fp_SQLAllocStmt = NULL;
  31. fp_SQLDriverConnect = NULL;
  32. fp_SQLDisconnect = NULL;
  33. }
  34. cODBC_::~cODBC_(void)
  35. {
  36. if (hODBC32)
  37. {
  38. FreeLibrary(hODBC32);
  39. }
  40. }
  41. BOOL cODBC_::Initialize(void)
  42. {
  43. SetErrorMode(SEM_NOOPENFILEERRORBOX);
  44. if (!(hODBC32 = LoadLibrary("ODBC32.DLL")))
  45. {
  46. goto ErrorDLLLoad;
  47. }
  48. fp_SQLSetStmtOption = (td_SQLSetStmtOption)GetProcAddress(hODBC32, "SQLSetStmtOption");
  49. fp_SQLExecDirect = (td_SQLExecDirect)GetProcAddress(hODBC32, "SQLExecDirect");
  50. fp_SQLFetch = (td_SQLFetch)GetProcAddress(hODBC32, "SQLFetch");
  51. fp_SQLFreeConnect = (td_SQLFreeConnect)GetProcAddress(hODBC32, "SQLFreeConnect");
  52. fp_SQLFreeEnv = (td_SQLFreeEnv)GetProcAddress(hODBC32, "SQLFreeEnv");
  53. fp_SQLFreeStmt = (td_SQLFreeStmt)GetProcAddress(hODBC32, "SQLFreeStmt");
  54. fp_SQLTransact = (td_SQLTransact)GetProcAddress(hODBC32, "SQLTransact");
  55. fp_SQLError = (td_SQLError)GetProcAddress(hODBC32, "SQLError");
  56. fp_SQLGetData = (td_SQLGetData)GetProcAddress(hODBC32, "SQLGetData");
  57. fp_SQLAllocConnect = (td_SQLAllocConnect)GetProcAddress(hODBC32, "SQLAllocConnect");
  58. fp_SQLAllocEnv = (td_SQLAllocEnv)GetProcAddress(hODBC32, "SQLAllocEnv");
  59. fp_SQLAllocStmt = (td_SQLAllocStmt)GetProcAddress(hODBC32, "SQLAllocStmt");
  60. fp_SQLDriverConnect = (td_SQLDriverConnect)GetProcAddress(hODBC32, "SQLDriverConnect");
  61. fp_SQLDisconnect = (td_SQLDisconnect)GetProcAddress(hODBC32, "SQLDisconnect");
  62. if (!(fp_SQLSetStmtOption) ||
  63. !(fp_SQLExecDirect) ||
  64. !(fp_SQLFetch) ||
  65. !(fp_SQLFreeConnect) ||
  66. !(fp_SQLFreeEnv) ||
  67. !(fp_SQLFreeStmt) ||
  68. !(fp_SQLTransact) ||
  69. !(fp_SQLError) ||
  70. !(fp_SQLGetData) ||
  71. !(fp_SQLAllocConnect) ||
  72. !(fp_SQLAllocEnv) ||
  73. !(fp_SQLAllocStmt) ||
  74. !(fp_SQLDriverConnect) ||
  75. !(fp_SQLDisconnect))
  76. {
  77. goto ErrorProcAddress;
  78. }
  79. return(TRUE);
  80. ErrorReturn:
  81. return(FALSE);
  82. TRACE_ERROR_EX(DBG_SS, ErrorDLLLoad);
  83. TRACE_ERROR_EX(DBG_SS, ErrorProcAddress);
  84. }