Leaked source code of windows server 2003
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.

255 lines
13 KiB

  1. #ifndef _INC_SQLDB
  2. #define _INC_SQLDB
  3. #ifdef __cplusplus
  4. extern "C" {
  5. #endif
  6. /*****************************************************************************
  7. * *
  8. * SQLDB.H - DB-Library header file for the Microsoft SQL Server. *
  9. * *
  10. * Copyright (c) 1989 - 1995 by Microsoft Corp. All rights reserved. *
  11. * *
  12. *****************************************************************************/
  13. // Macros for setting the PLOGINREC
  14. #define DBSETLHOST(a,b) dbsetlname ((a), (b), DBSETHOST)
  15. #define DBSETLUSER(a,b) dbsetlname ((a), (b), DBSETUSER)
  16. #define DBSETLPWD(a,b) dbsetlname ((a), (b), DBSETPWD)
  17. #define DBSETLAPP(a,b) dbsetlname ((a), (b), DBSETAPP)
  18. #define BCP_SETL(a,b) bcp_setl ((a), (b))
  19. #define DBSETLNATLANG(a,b) dbsetlname ((a), (b), DBSETLANG)
  20. #define DBSETLPACKET(a,b) dbsetlpacket ((a), (b))
  21. #define DBSETLSECURE(a) dbsetlname ((a), 0, DBSETSECURE)
  22. #define DBSETLVERSION(a,b) dbsetlname ((a), 0, (b))
  23. #define DBSETLTIME(a,b) dbsetlname ((a), (LPCSTR)(ULONG)(b), DBSETLOGINTIME)
  24. #define DBSETLFALLBACK(a,b) dbsetlname ((a), (b), DBSETFALLBACK)
  25. /*****************************************************************************
  26. * Windows 3.x and Non-Windows 3.x differences. *
  27. *****************************************************************************/
  28. #ifdef DBMSWIN
  29. extern void SQLAPI dbwinexit(void);
  30. void SQLAPI dblocklib (void);
  31. void SQLAPI dbunlocklib (void);
  32. #define DBLOCKLIB() dblocklib()
  33. #define DBUNLOCKLIB() dbunlocklib()
  34. #define DBERRHANDLE_PROC FARPROC
  35. #define DBMSGHANDLE_PROC FARPROC
  36. extern DBERRHANDLE_PROC dberrhandle (DBERRHANDLE_PROC);
  37. extern DBMSGHANDLE_PROC dbmsghandle (DBMSGHANDLE_PROC);
  38. #else
  39. #define dbwinexit()
  40. #define DBLOCKLIB()
  41. #define DBUNLOCKLIB()
  42. typedef INT (SQLAPI *DBERRHANDLE_PROC)(PDBPROCESS, INT, INT, INT, LPCSTR, LPCSTR);
  43. typedef INT (SQLAPI *DBMSGHANDLE_PROC)(PDBPROCESS, DBINT, INT, INT, LPCSTR, LPCSTR, LPCSTR, DBUSMALLINT);
  44. extern DBERRHANDLE_PROC SQLAPI dberrhandle(DBERRHANDLE_PROC);
  45. extern DBMSGHANDLE_PROC SQLAPI dbmsghandle(DBMSGHANDLE_PROC);
  46. extern DBERRHANDLE_PROC SQLAPI dbprocerrhandle(PDBHANDLE, DBERRHANDLE_PROC);
  47. extern DBMSGHANDLE_PROC SQLAPI dbprocmsghandle(PDBHANDLE, DBMSGHANDLE_PROC);
  48. #endif
  49. /*****************************************************************************
  50. * Function Prototypes *
  51. *****************************************************************************/
  52. // Functions macros
  53. #define DBCMDROW(a) dbcmdrow(a)
  54. #define DBCOUNT(a) dbcount (a)
  55. #define DBCURCMD(a) dbcurcmd(a)
  56. #define DBCURROW(a) dbcurrow(a)
  57. #define DBDEAD(a) dbdead(a)
  58. #define DBFIRSTROW(a) dbfirstrow(a)
  59. #define DBGETTIME() dbgettime()
  60. #define DBISAVAIL(a) dbisavail(a)
  61. #define DBLASTROW(a) dblastrow(a)
  62. #define DBMORECMDS(a) dbmorecmds(a)
  63. #define DBNUMORDERS(a) dbnumorders(a)
  64. #define dbrbuf(a) ((DBINT)dbdataready(a))
  65. #define DBRBUF(a) ((DBINT)dbdataready(a))
  66. #define DBROWS(a) dbrows (a)
  67. #define DBROWTYPE(a) dbrowtype (a)
  68. // Two-phase commit functions
  69. extern RETCODE SQLAPI abort_xact (PDBPROCESS, DBINT);
  70. extern void SQLAPI build_xact_string (LPCSTR, LPCSTR, DBINT, LPSTR);
  71. extern void SQLAPI close_commit (PDBPROCESS);
  72. extern RETCODE SQLAPI commit_xact (PDBPROCESS, DBINT);
  73. extern PDBPROCESS SQLAPI open_commit (PLOGINREC, LPCSTR);
  74. extern RETCODE SQLAPI remove_xact (PDBPROCESS, DBINT, INT);
  75. extern RETCODE SQLAPI scan_xact (PDBPROCESS, DBINT);
  76. extern DBINT SQLAPI start_xact (PDBPROCESS, LPCSTR, LPCSTR, INT);
  77. extern INT SQLAPI stat_xact (PDBPROCESS, DBINT);
  78. // BCP functions
  79. extern DBINT SQLAPI bcp_batch (PDBPROCESS);
  80. extern RETCODE SQLAPI bcp_bind (PDBPROCESS, LPCBYTE, INT, DBINT, LPCBYTE, INT, INT, INT);
  81. extern RETCODE SQLAPI bcp_colfmt (PDBPROCESS, INT, BYTE, INT, DBINT, LPCBYTE, INT, INT);
  82. extern RETCODE SQLAPI bcp_collen (PDBPROCESS, DBINT, INT);
  83. extern RETCODE SQLAPI bcp_colptr (PDBPROCESS, LPCBYTE, INT);
  84. extern RETCODE SQLAPI bcp_columns (PDBPROCESS, INT);
  85. extern RETCODE SQLAPI bcp_control (PDBPROCESS, INT, DBINT);
  86. extern DBINT SQLAPI bcp_done (PDBPROCESS);
  87. extern RETCODE SQLAPI bcp_exec (PDBPROCESS, LPDBINT);
  88. extern RETCODE SQLAPI bcp_init (PDBPROCESS, LPCSTR, LPCSTR, LPCSTR, INT);
  89. extern RETCODE SQLAPI bcp_moretext (PDBPROCESS, DBINT, LPCBYTE);
  90. extern RETCODE SQLAPI bcp_readfmt (PDBPROCESS, LPCSTR);
  91. extern RETCODE SQLAPI bcp_sendrow (PDBPROCESS);
  92. extern RETCODE SQLAPI bcp_setl (PLOGINREC, BOOL);
  93. extern RETCODE SQLAPI bcp_writefmt (PDBPROCESS, LPCSTR);
  94. // Standard DB-Library functions
  95. extern LPCBYTE SQLAPI dbadata (PDBPROCESS, INT, INT);
  96. extern DBINT SQLAPI dbadlen (PDBPROCESS, INT, INT);
  97. extern RETCODE SQLAPI dbaltbind (PDBPROCESS, INT, INT, INT, DBINT, LPCBYTE);
  98. extern INT SQLAPI dbaltcolid (PDBPROCESS, INT, INT);
  99. extern DBINT SQLAPI dbaltlen (PDBPROCESS, INT, INT);
  100. extern INT SQLAPI dbaltop (PDBPROCESS, INT, INT);
  101. extern INT SQLAPI dbalttype (PDBPROCESS, INT, INT);
  102. extern DBINT SQLAPI dbaltutype (PDBPROCESS, INT, INT);
  103. extern RETCODE SQLAPI dbanullbind (PDBPROCESS, INT, INT, LPCDBINT);
  104. extern RETCODE SQLAPI dbbind (PDBPROCESS, INT, INT, DBINT, LPBYTE);
  105. extern LPCBYTE SQLAPI dbbylist (PDBPROCESS, INT, LPINT);
  106. extern RETCODE SQLAPI dbcancel (PDBPROCESS);
  107. extern RETCODE SQLAPI dbcanquery (PDBPROCESS);
  108. extern LPCSTR SQLAPI dbchange (PDBPROCESS);
  109. extern RETCODE SQLAPI dbclose (PDBPROCESS);
  110. extern void SQLAPI dbclrbuf (PDBPROCESS, DBINT);
  111. extern RETCODE SQLAPI dbclropt (PDBPROCESS, INT, LPCSTR);
  112. extern RETCODE SQLAPI dbcmd (PDBPROCESS, LPCSTR);
  113. extern RETCODE SQLAPI dbcmdrow (PDBPROCESS);
  114. extern BOOL SQLAPI dbcolbrowse (PDBPROCESS, INT);
  115. extern RETCODE SQLAPI dbcolinfo (PDBHANDLE, INT, INT, INT, LPDBCOL);
  116. extern DBINT SQLAPI dbcollen (PDBPROCESS, INT);
  117. extern LPCSTR SQLAPI dbcolname (PDBPROCESS, INT);
  118. extern LPCSTR SQLAPI dbcolsource (PDBPROCESS, INT);
  119. extern INT SQLAPI dbcoltype (PDBPROCESS, INT);
  120. extern DBINT SQLAPI dbcolutype (PDBPROCESS, INT);
  121. extern INT SQLAPI dbconvert (PDBPROCESS, INT, LPCBYTE, DBINT, INT, LPBYTE, DBINT);
  122. extern DBINT SQLAPI dbcount (PDBPROCESS);
  123. extern INT SQLAPI dbcurcmd (PDBPROCESS);
  124. extern DBINT SQLAPI dbcurrow (PDBPROCESS);
  125. extern RETCODE SQLAPI dbcursor (PDBCURSOR, INT, INT, LPCSTR, LPCSTR);
  126. extern RETCODE SQLAPI dbcursorbind (PDBCURSOR, INT, INT, DBINT, LPDBINT, LPBYTE);
  127. extern RETCODE SQLAPI dbcursorclose (PDBHANDLE);
  128. extern RETCODE SQLAPI dbcursorcolinfo (PDBCURSOR, INT, LPSTR, LPINT, LPDBINT, LPINT);
  129. extern RETCODE SQLAPI dbcursorfetch (PDBCURSOR, INT, INT);
  130. extern RETCODE SQLAPI dbcursorfetchex (PDBCURSOR, INT, DBINT, DBINT, DBINT);
  131. extern RETCODE SQLAPI dbcursorinfo (PDBCURSOR, LPINT, LPDBINT);
  132. extern RETCODE SQLAPI dbcursorinfoex (PDBCURSOR, LPDBCURSORINFO);
  133. extern PDBCURSOR SQLAPI dbcursoropen (PDBPROCESS, LPCSTR, INT, INT,UINT, LPDBINT);
  134. extern LPCBYTE SQLAPI dbdata (PDBPROCESS, INT);
  135. extern BOOL SQLAPI dbdataready (PDBPROCESS);
  136. extern RETCODE SQLAPI dbdatecrack (PDBPROCESS, LPDBDATEREC, LPCDBDATETIME);
  137. extern DBINT SQLAPI dbdatlen (PDBPROCESS, INT);
  138. extern BOOL SQLAPI dbdead (PDBPROCESS);
  139. extern void SQLAPI dbexit (void);
  140. extern RETCODE SQLAPI dbenlisttrans(PDBPROCESS, LPVOID);
  141. extern RETCODE SQLAPI dbenlistxatrans(PDBPROCESS, BOOL);
  142. extern RETCODE SQLAPI dbfcmd (PDBPROCESS, LPCSTR, ...);
  143. extern DBINT SQLAPI dbfirstrow (PDBPROCESS);
  144. extern void SQLAPI dbfreebuf (PDBPROCESS);
  145. extern void SQLAPI dbfreelogin (PLOGINREC);
  146. extern void SQLAPI dbfreequal (LPCSTR);
  147. extern LPSTR SQLAPI dbgetchar (PDBPROCESS, INT);
  148. extern SHORT SQLAPI dbgetmaxprocs (void);
  149. extern INT SQLAPI dbgetoff (PDBPROCESS, DBUSMALLINT, INT);
  150. extern UINT SQLAPI dbgetpacket (PDBPROCESS);
  151. extern STATUS SQLAPI dbgetrow (PDBPROCESS, DBINT);
  152. extern INT SQLAPI dbgettime (void);
  153. extern LPVOID SQLAPI dbgetuserdata (PDBPROCESS);
  154. extern BOOL SQLAPI dbhasretstat (PDBPROCESS);
  155. extern LPCSTR SQLAPI dbinit (void);
  156. extern BOOL SQLAPI dbisavail (PDBPROCESS);
  157. extern BOOL SQLAPI dbiscount (PDBPROCESS);
  158. extern BOOL SQLAPI dbisopt (PDBPROCESS, INT, LPCSTR);
  159. extern DBINT SQLAPI dblastrow (PDBPROCESS);
  160. extern PLOGINREC SQLAPI dblogin (void);
  161. extern RETCODE SQLAPI dbmorecmds (PDBPROCESS);
  162. extern RETCODE SQLAPI dbmoretext (PDBPROCESS, DBINT, LPCBYTE);
  163. extern LPCSTR SQLAPI dbname (PDBPROCESS);
  164. extern STATUS SQLAPI dbnextrow (PDBPROCESS);
  165. extern RETCODE SQLAPI dbnullbind (PDBPROCESS, INT, LPCDBINT);
  166. extern INT SQLAPI dbnumalts (PDBPROCESS, INT);
  167. extern INT SQLAPI dbnumcols (PDBPROCESS);
  168. extern INT SQLAPI dbnumcompute (PDBPROCESS);
  169. extern INT SQLAPI dbnumorders (PDBPROCESS);
  170. extern INT SQLAPI dbnumrets (PDBPROCESS);
  171. extern PDBPROCESS SQLAPI dbopen (PLOGINREC, LPCSTR);
  172. extern INT SQLAPI dbordercol (PDBPROCESS, INT);
  173. extern RETCODE SQLAPI dbprocinfo (PDBPROCESS, LPDBPROCINFO);
  174. extern void SQLAPI dbprhead (PDBPROCESS);
  175. extern RETCODE SQLAPI dbprrow (PDBPROCESS);
  176. extern LPCSTR SQLAPI dbprtype (INT);
  177. extern LPCSTR SQLAPI dbqual (PDBPROCESS, INT, LPCSTR);
  178. extern DBINT SQLAPI dbreadpage (PDBPROCESS, LPCSTR, DBINT, LPBYTE);
  179. extern DBINT SQLAPI dbreadtext (PDBPROCESS, LPVOID, DBINT);
  180. extern RETCODE SQLAPI dbresults (PDBPROCESS);
  181. extern LPCBYTE SQLAPI dbretdata (PDBPROCESS, INT);
  182. extern DBINT SQLAPI dbretlen (PDBPROCESS, INT);
  183. extern LPCSTR SQLAPI dbretname (PDBPROCESS, INT);
  184. extern DBINT SQLAPI dbretstatus (PDBPROCESS);
  185. extern INT SQLAPI dbrettype (PDBPROCESS, INT);
  186. extern RETCODE SQLAPI dbrows (PDBPROCESS);
  187. extern STATUS SQLAPI dbrowtype (PDBPROCESS);
  188. extern RETCODE SQLAPI dbrpcinit (PDBPROCESS, LPCSTR, DBSMALLINT);
  189. extern RETCODE SQLAPI dbrpcparam (PDBPROCESS, LPCSTR, BYTE, INT, DBINT, DBINT, LPCBYTE);
  190. extern RETCODE SQLAPI dbrpcsend (PDBPROCESS);
  191. extern RETCODE SQLAPI dbrpcexec (PDBPROCESS);
  192. extern void SQLAPI dbrpwclr (PLOGINREC);
  193. extern RETCODE SQLAPI dbrpwset (PLOGINREC, LPCSTR, LPCSTR, INT);
  194. extern INT SQLAPI dbserverenum (USHORT, LPSTR, USHORT, LPUSHORT);
  195. extern void SQLAPI dbsetavail (PDBPROCESS);
  196. extern RETCODE SQLAPI dbsetmaxprocs (SHORT);
  197. extern RETCODE SQLAPI dbsetlname (PLOGINREC, LPCSTR, INT);
  198. extern RETCODE SQLAPI dbsetlogintime (INT);
  199. extern RETCODE SQLAPI dbsetlpacket (PLOGINREC, USHORT);
  200. extern RETCODE SQLAPI dbsetnull (PDBPROCESS, INT, INT, LPCBYTE);
  201. extern RETCODE SQLAPI dbsetopt (PDBPROCESS, INT, LPCSTR);
  202. extern RETCODE SQLAPI dbsettime (INT);
  203. extern void SQLAPI dbsetuserdata (PDBPROCESS, LPVOID);
  204. extern RETCODE SQLAPI dbsqlexec (PDBPROCESS);
  205. extern RETCODE SQLAPI dbsqlok (PDBPROCESS);
  206. extern RETCODE SQLAPI dbsqlsend (PDBPROCESS);
  207. extern RETCODE SQLAPI dbstrcpy (PDBPROCESS, INT, INT, LPSTR);
  208. extern INT SQLAPI dbstrlen (PDBPROCESS);
  209. extern BOOL SQLAPI dbtabbrowse (PDBPROCESS, INT);
  210. extern INT SQLAPI dbtabcount (PDBPROCESS);
  211. extern LPCSTR SQLAPI dbtabname (PDBPROCESS, INT);
  212. extern LPCSTR SQLAPI dbtabsource (PDBPROCESS, INT, LPINT);
  213. extern INT SQLAPI dbtsnewlen (PDBPROCESS);
  214. extern LPCDBBINARY SQLAPI dbtsnewval (PDBPROCESS);
  215. extern RETCODE SQLAPI dbtsput (PDBPROCESS, LPCDBBINARY, INT, INT, LPCSTR);
  216. extern LPCDBBINARY SQLAPI dbtxptr (PDBPROCESS, INT);
  217. extern LPCDBBINARY SQLAPI dbtxtimestamp (PDBPROCESS, INT);
  218. extern LPCDBBINARY SQLAPI dbtxtsnewval (PDBPROCESS);
  219. extern RETCODE SQLAPI dbtxtsput (PDBPROCESS, LPCDBBINARY, INT);
  220. extern RETCODE SQLAPI dbuse (PDBPROCESS, LPCSTR);
  221. extern BOOL SQLAPI dbvarylen (PDBPROCESS, INT);
  222. extern BOOL SQLAPI dbwillconvert (INT, INT);
  223. extern RETCODE SQLAPI dbwritepage (PDBPROCESS, LPCSTR, DBINT, DBINT, LPBYTE);
  224. extern RETCODE SQLAPI dbwritetext (PDBPROCESS, LPCSTR, LPCDBBINARY, DBTINYINT, LPCDBBINARY, BOOL, DBINT, LPCBYTE);
  225. extern RETCODE SQLAPI dbupdatetext(PDBPROCESS, LPCSTR, LPCDBBINARY, LPCDBBINARY, INT, DBINT, DBINT, LPCSTR, DBINT, LPCDBBINARY);
  226. #ifdef __cplusplus
  227. }
  228. #endif
  229. #endif // _INC_SQLDB