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.

137 lines
4.3 KiB

  1. /***************************************************************************/
  2. /* DBASE.H */
  3. /* Copyright 1993-96 SYWARE, Inc. All rights reserved. */
  4. /***************************************************************************/
  5. #ifdef _UNIX_
  6. #include "unixdefs.h"
  7. #include "sqltype.h"
  8. #else
  9. #include "windows.h"
  10. #include "windowsx.h"
  11. typedef unsigned char FAR* LPUSTR;
  12. //#define ODBCVER 0x0210
  13. #include <sql.h>
  14. #include <sqlext.h>
  15. #ifndef RC_INVOKED
  16. #ifndef WIN32
  17. #include <dos.h>
  18. #endif
  19. #endif
  20. #endif
  21. #ifdef _UNIX_
  22. #define PATH_SEPARATOR_CHAR '/'
  23. #define PATH_SEPARATOR_STR "/"
  24. #else
  25. #define PATH_SEPARATOR_CHAR '\\'
  26. #define PATH_SEPARATOR_STR "\\"
  27. #endif
  28. #define DBASE_ERR_SUCCESS 0
  29. #define DBASE_ERR_MEMALLOCFAIL 1
  30. #define DBASE_ERR_NODATAFOUND 2
  31. #define DBASE_ERR_WRITEERROR 3
  32. #define DBASE_ERR_TABLEACCESSERROR 4
  33. #define DBASE_ERR_CONVERSIONERROR 5
  34. #define DBASE_ERR_CORRUPTFILE 6
  35. #define DBASE_ERR_CREATEERROR 7
  36. #define DBASE_ERR_CLOSEERROR 8
  37. #define DBASE_ERR_NOTSUPPORTED 9
  38. #define DBASE_ERR_NOSUCHCOLUMN 10
  39. #define DBASE_ERR_TRUNCATION 11
  40. #define DBASE_ERR_NOTNULL 12
  41. #define DBASE_ERR_NULL 13
  42. #define DBASE_MAX_PATHNAME_SIZE 127
  43. #define DBASE_COLUMN_NAME_SIZE 11
  44. typedef struct tagDBASECOL {
  45. /* The following fields are in the disk file */
  46. UCHAR name[DBASE_COLUMN_NAME_SIZE];
  47. UCHAR type;
  48. UCHAR reserved1[4];
  49. UCHAR length;
  50. UCHAR scale;
  51. UCHAR reserved2[2];
  52. UCHAR workarea;
  53. UCHAR reserved3[10];
  54. UCHAR mdx;
  55. /* The following fields are not in the disk file */
  56. UCHAR FAR * value;
  57. } DBASECOL,
  58. FAR *LPDBASECOL;
  59. //forward declaration
  60. class CSafeIEnumWbemClassObject;
  61. #define IMPLTMT_PASSTHROUGH 1
  62. #define BATCH_NUM_OF_INSTANCES 10
  63. typedef struct tagDBASEFILE {
  64. UWORD columnCount;
  65. UDWORD FAR* sortArray;
  66. UDWORD currentRecord;
  67. CSafeIEnumWbemClassObject* tempEnum;
  68. CMapWordToPtr* pAllRecords; //only next 10 for passthrough SQL
  69. IWbemClassObject* record;
  70. //Passthrough SQL specific
  71. BOOL fMoreToCome; //flag to indicate if there are more instances to fetch
  72. } DBASEFILE,
  73. FAR * LPDBASEFILE;
  74. #define DBASE_HEADER_LENGTH 32
  75. #define DBASE_COLUMN_DESCR_LENGTH 32
  76. #define DBASE_RECORD_LENGTH_OFFSET 10
  77. #define DBASE_HEADER_SIZE_OFFSET 8
  78. #define DBASE_NOT_ENCRYPTED 0x00
  79. #define DBASE_MDX_FLAG_OFF 0x00
  80. #define DBASE_END_OF_COLUMNS 0x0D
  81. #define DBASE_RECORD_DELETED 0x2A
  82. #define DBASE_RECORD_NOT_DELETED 0x20
  83. #define DBASE_FILE_END 0x1A
  84. #define DBASE_3_FILE 0x03
  85. #define DBASE_4_FILE 0x03
  86. #define DBASE_CHAR 'C'
  87. #define DBASE_NUMERIC 'N'
  88. #define DBASE_FLOAT 'F'
  89. #define DBASE_LOGICAL 'L'
  90. #define DBASE_DATE 'D'
  91. #define DBASE_MEMO 'M'
  92. /***************************************************************************/
  93. SWORD FAR PASCAL dBaseCreate(LPUSTR);
  94. SWORD FAR PASCAL dBaseAddColumn(LPUSTR, LPUSTR, UCHAR, UCHAR, UCHAR);
  95. SWORD FAR PASCAL dBaseOpen(LPUSTR, BOOL, LPDBASEFILE FAR *);
  96. SWORD FAR PASCAL dBaseColumnCount(LPDBASEFILE, UWORD FAR *);
  97. SWORD FAR PASCAL dBaseColumnName(LPDBASEFILE, UWORD, LPUSTR);
  98. SWORD FAR PASCAL dBaseColumnType(LPDBASEFILE, UWORD, UCHAR FAR *);
  99. SWORD FAR PASCAL dBaseColumnLength(LPDBASEFILE, UWORD, UCHAR FAR *);
  100. SWORD FAR PASCAL dBaseColumnScale(LPDBASEFILE, UWORD, UCHAR FAR *);
  101. SWORD FAR PASCAL dBaseSort(LPDBASEFILE, UWORD, BOOL);
  102. SWORD FAR PASCAL dBaseReadFirst(LPDBASEFILE);
  103. SWORD FAR PASCAL dBaseReadNext(LPDBASEFILE);
  104. SWORD FAR PASCAL dBaseColumnCharVal(LPDBASEFILE, UWORD, UDWORD, SDWORD, UCHAR FAR *, BOOL FAR *);
  105. SWORD FAR PASCAL dBaseColumnNumVal(LPDBASEFILE, UWORD, SDOUBLE FAR *, BOOL FAR *);
  106. SWORD FAR PASCAL dBaseAddRecord(LPDBASEFILE);
  107. SWORD FAR PASCAL dBaseSetColumnCharVal(LPDBASEFILE, UWORD, UCHAR FAR *, SDWORD);
  108. SWORD FAR PASCAL dBaseSetColumnNull(LPDBASEFILE, UWORD);
  109. SWORD FAR PASCAL dBaseDeleteRecord(LPDBASEFILE);
  110. SWORD FAR PASCAL dBaseGetBookmark(LPDBASEFILE, UDWORD far *);
  111. SWORD FAR PASCAL dBasePosition(LPDBASEFILE, UDWORD);
  112. SWORD FAR PASCAL dBaseClose(LPDBASEFILE);
  113. SWORD FAR PASCAL dBaseDestroy(LPUSTR);
  114. /***************************************************************************/