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.

107 lines
2.7 KiB

  1. /*--------------------------------------------------------------------------
  2. dbcon.h
  3. Normandy 2.0 connection management dll (supporting SQL server hot switch).
  4. Copyright (C) 1996 Microsoft Corporation
  5. All rights reserved.
  6. Authors: Fei Su (feisu)
  7. History: 07/16/96 feisu Created
  8. --------------------------------------------------------------------------*/
  9. #ifndef __DBCON_H__
  10. #define __DBCON_H__
  11. #ifdef _DBSQL_IMPLEMENTING
  12. #define DbSqlDLL __declspec(dllexport)
  13. #else
  14. #define DbSqlDLL __declspec(dllimport)
  15. #endif
  16. #define DBNTWIN32
  17. #pragma warning (disable:4121)
  18. #include <sqlfront.h>
  19. #pragma warning (default:4121)
  20. #include <sqldb.h>
  21. #define MAXSERVERNAME 30 // in sqlfront.h, length of server name ( excluding NULL termintor )
  22. #define MAXNAME 31 // in sqlfront.h, length of login, db, password
  23. // total DB types currently supported
  24. #define AC_MAX_NUMBER_DATABASE_TYPES 1024
  25. // database types are from 0 to AC_MAX_NUMBER_DATABASE_TYPES - 1. The assignment
  26. // of database types must be centralized.
  27. //
  28. // Proposal:
  29. // 0 --> 9 Reserved for future use
  30. // 10 --> 19 Address Book
  31. // 20 --> 29 Security
  32. // 100--> 200 IDS
  33. //
  34. // Add new services here.
  35. #define DT_ABOOK_BASE 10
  36. #define DT_SECURITY_BASE 20
  37. #define DT_IDS_BASE 100
  38. // if dbopen failed for a source, mark it as bad for 2 minutes for the server to recover
  39. // all times are in units of seconds
  40. #define DEFAULT_RECOVER_TIME 120
  41. #define DEFAULT_MAX_CNX_PER_ENTRY 10
  42. #define DEFAULT_QUERY_TIME_OUT 120
  43. #define DEFAULT_LOGIN_TIME_OUT 20
  44. // the following 2 numbers are only used by CPool
  45. // they are the max number of CConnection and CLoginEntry internal structures
  46. #define MAXCONN 256
  47. #define MAXLOGIN 256
  48. // exported functions
  49. extern "C" {
  50. BOOL DbSqlDLL DbInitialize();
  51. BOOL DbSqlDLL DbTerminate();
  52. BOOL DbSqlDLL DbAddSource(LONG lType, LPCTSTR lpszServerName, LPCTSTR lpszLoginName,
  53. LPCTSTR lpszPassWord, LPCTSTR lpszDBName,
  54. LONG lMaxCnx = DEFAULT_MAX_CNX_PER_ENTRY,
  55. LONG lQueryTimeOutInSeconds = DEFAULT_QUERY_TIME_OUT,
  56. DWORD dwRecoverTimeInSeconds = DEFAULT_RECOVER_TIME);
  57. BOOL DbSqlDLL DbDropSource(LONG lType, LPCTSTR lpszServerName, LPCTSTR lpszLoginName);
  58. HANDLE DbSqlDLL DbGetConnection(LONG lType, DBPROCESS **dbproc,
  59. DWORD dwWaitTimeInSeconds = DEFAULT_LOGIN_TIME_OUT);
  60. BOOL DbSqlDLL DbReleaseConnection(HANDLE hCDBConnection);
  61. BOOL DbSqlDLL DbAssociate(LONG lType, LONG lBackup);
  62. BOOL DbSqlDLL DbGetError(PDBPROCESS pDbproc, INT *dberr);
  63. BOOL DbSqlDLL DbGetConnectionFlag(HANDLE hCDBConnection, DWORD* pdwFlag);
  64. BOOL DbSqlDLL DbSetConnectionFlag(HANDLE hCDBConnection, DWORD dwFlag);
  65. }
  66. #endif // #ifndef __DBCON_H__
  67. /* EOF */