php_pdo_dblib_int.h 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143
  1. /*
  2. +----------------------------------------------------------------------+
  3. | PHP Version 5 |
  4. +----------------------------------------------------------------------+
  5. | Copyright (c) 1997-2016 The PHP Group |
  6. +----------------------------------------------------------------------+
  7. | This source file is subject to version 3.01 of the PHP license, |
  8. | that is bundled with this package in the file LICENSE, and is |
  9. | available through the world-wide-web at the following url: |
  10. | http://www.php.net/license/3_01.txt |
  11. | If you did not receive a copy of the PHP license and are unable to |
  12. | obtain it through the world-wide-web, please send a note to |
  13. | license@php.net so we can mail you a copy immediately. |
  14. +----------------------------------------------------------------------+
  15. | Author: Wez Furlong <wez@php.net> |
  16. | Frank M. Kromann <frank@kromann.info> |
  17. +----------------------------------------------------------------------+
  18. */
  19. /* $Id$ */
  20. #ifndef PHP_PDO_DBLIB_INT_H
  21. #define PHP_PDO_DBLIB_INT_H
  22. #ifndef PDO_DBLIB_FLAVOUR
  23. # define PDO_DBLIB_FLAVOUR "Generic DB-lib"
  24. #endif
  25. #if PHP_DBLIB_IS_MSSQL
  26. # include <sqlfront.h>
  27. # include <sqldb.h>
  28. # define DBERRHANDLE(a, b) dbprocerrhandle(a, b)
  29. # define DBMSGHANDLE(a, b) dbprocmsghandle(a, b)
  30. # define EHANDLEFUNC DBERRHANDLE_PROC
  31. # define MHANDLEFUNC DBMSGHANDLE_PROC
  32. # define DBSETOPT(a, b, c) dbsetopt(a, b, c)
  33. # define SYBESMSG SQLESMSG
  34. # define SYBESEOF SQLESEOF
  35. # define SYBEFCON SQLECONN // SQLEFCON does not exist in MS SQL Server.
  36. # define SYBEMEM SQLEMEM
  37. # define SYBEPWD SQLEPWD
  38. #else
  39. # include <sybfront.h>
  40. # include <sybdb.h>
  41. # include <syberror.h>
  42. /* alias some types */
  43. # define SQLTEXT SYBTEXT
  44. # define SQLCHAR SYBCHAR
  45. # define SQLVARCHAR SYBVARCHAR
  46. # define SQLINT1 SYBINT1
  47. # define SQLINT2 SYBINT2
  48. # define SQLINT4 SYBINT4
  49. # define SQLINTN SYBINTN
  50. # define SQLBIT SYBBIT
  51. # define SQLFLT4 SYBREAL
  52. # define SQLFLT8 SYBFLT8
  53. # define SQLFLTN SYBFLTN
  54. # define SQLDECIMAL SYBDECIMAL
  55. # define SQLNUMERIC SYBNUMERIC
  56. # define SQLDATETIME SYBDATETIME
  57. # define SQLDATETIM4 SYBDATETIME4
  58. # define SQLDATETIMN SYBDATETIMN
  59. # define SQLMONEY SYBMONEY
  60. # define SQLMONEY4 SYBMONEY4
  61. # define SQLMONEYN SYBMONEYN
  62. # define SQLIMAGE SYBIMAGE
  63. # define SQLBINARY SYBBINARY
  64. # define SQLVARBINARY SYBVARBINARY
  65. # ifdef SYBUNIQUE
  66. # define SQLUNIQUE SYBUNIQUE
  67. #else
  68. # define SQLUNIQUE 36 /* FreeTDS Hack */
  69. # endif
  70. # define DBERRHANDLE(a, b) dberrhandle(b)
  71. # define DBMSGHANDLE(a, b) dbmsghandle(b)
  72. # define DBSETOPT(a, b, c) dbsetopt(a, b, c, -1)
  73. # define NO_MORE_RPC_RESULTS 3
  74. # define dbfreelogin dbloginfree
  75. # define dbrpcexec dbrpcsend
  76. typedef short TDS_SHORT;
  77. # ifndef PHP_WIN32
  78. typedef unsigned char *LPBYTE;
  79. # endif
  80. typedef float DBFLT4;
  81. #endif
  82. int error_handler(DBPROCESS *dbproc, int severity, int dberr,
  83. int oserr, char *dberrstr, char *oserrstr);
  84. int msg_handler(DBPROCESS *dbproc, DBINT msgno, int msgstate,
  85. int severity, char *msgtext, char *srvname, char *procname, DBUSMALLINT line);
  86. extern pdo_driver_t pdo_dblib_driver;
  87. extern struct pdo_stmt_methods dblib_stmt_methods;
  88. typedef struct {
  89. int severity;
  90. int oserr;
  91. int dberr;
  92. char *oserrstr;
  93. char *dberrstr;
  94. char *sqlstate;
  95. char *lastmsg;
  96. } pdo_dblib_err;
  97. typedef struct {
  98. LOGINREC *login;
  99. DBPROCESS *link;
  100. pdo_dblib_err err;
  101. } pdo_dblib_db_handle;
  102. typedef struct {
  103. pdo_dblib_db_handle *H;
  104. pdo_dblib_err err;
  105. } pdo_dblib_stmt;
  106. typedef struct {
  107. const char* key;
  108. int value;
  109. } pdo_dblib_keyval;
  110. ZEND_BEGIN_MODULE_GLOBALS(dblib)
  111. pdo_dblib_err err;
  112. char sqlstate[6];
  113. ZEND_END_MODULE_GLOBALS(dblib)
  114. #ifdef ZTS
  115. # define DBLIB_G(v) TSRMG(dblib_globals_id, zend_dblib_globals *, v)
  116. #else
  117. # define DBLIB_G(v) (dblib_globals.v)
  118. #endif
  119. ZEND_EXTERN_MODULE_GLOBALS(dblib);
  120. #endif