Back to index

php5  5.3.10
php_pdo_dblib_int.h
Go to the documentation of this file.
00001 /*
00002   +----------------------------------------------------------------------+
00003   | PHP Version 5                                                        |
00004   +----------------------------------------------------------------------+
00005   | Copyright (c) 1997-2012 The PHP Group                                |
00006   +----------------------------------------------------------------------+
00007   | This source file is subject to version 3.01 of the PHP license,      |
00008   | that is bundled with this package in the file LICENSE, and is        |
00009   | available through the world-wide-web at the following url:           |
00010   | http://www.php.net/license/3_01.txt                                  |
00011   | If you did not receive a copy of the PHP license and are unable to   |
00012   | obtain it through the world-wide-web, please send a note to          |
00013   | license@php.net so we can mail you a copy immediately.               |
00014   +----------------------------------------------------------------------+
00015   | Author: Wez Furlong <wez@php.net>                                    |
00016   |         Frank M. Kromann <frank@kromann.info>                        |
00017   +----------------------------------------------------------------------+
00018 */
00019 
00020 /* $Id: php_pdo_dblib_int.h 321634 2012-01-01 13:15:04Z felipe $ */
00021 
00022 #ifndef PHP_PDO_DBLIB_INT_H
00023 #define PHP_PDO_DBLIB_INT_H
00024 
00025 #ifndef PDO_DBLIB_FLAVOUR
00026 # define PDO_DBLIB_FLAVOUR "Generic DB-lib"
00027 #endif
00028 
00029 #if PHP_DBLIB_IS_MSSQL
00030 # include <sqlfront.h>
00031 # include <sqldb.h>
00032 
00033 # define DBERRHANDLE(a, b)  dbprocerrhandle(a, b)
00034 # define DBMSGHANDLE(a, b)  dbprocmsghandle(a, b)
00035 # define EHANDLEFUNC        DBERRHANDLE_PROC
00036 # define MHANDLEFUNC        DBMSGHANDLE_PROC
00037 # define DBSETOPT(a, b, c)  dbsetopt(a, b, c)
00038 # define SYBESMSG           SQLESMSG
00039 # define SYBESEOF           SQLESEOF
00040 # define SYBEFCON           SQLECONN             // SQLEFCON does not exist in MS SQL Server.
00041 # define SYBEMEM            SQLEMEM
00042 # define SYBEPWD            SQLEPWD
00043 
00044 #else
00045 # include <sybfront.h>
00046 # include <sybdb.h>
00047 # include <syberror.h>
00048 
00049 /* alias some types */
00050 # define SQLTEXT     SYBTEXT
00051 # define SQLCHAR     SYBCHAR
00052 # define SQLVARCHAR  SYBVARCHAR
00053 # define SQLINT1     SYBINT1
00054 # define SQLINT2     SYBINT2
00055 # define SQLINT4     SYBINT4
00056 # define SQLINTN     SYBINTN
00057 # define SQLBIT             SYBBIT
00058 # define SQLFLT4     SYBREAL
00059 # define SQLFLT8     SYBFLT8
00060 # define SQLFLTN     SYBFLTN
00061 # define SQLDECIMAL  SYBDECIMAL
00062 # define SQLNUMERIC  SYBNUMERIC
00063 # define SQLDATETIME SYBDATETIME
00064 # define SQLDATETIM4 SYBDATETIME4
00065 # define SQLDATETIMN SYBDATETIMN
00066 # define SQLMONEY           SYBMONEY
00067 # define SQLMONEY4          SYBMONEY4
00068 # define SQLMONEYN          SYBMONEYN
00069 # define SQLIMAGE           SYBIMAGE
00070 # define SQLBINARY          SYBBINARY
00071 # define SQLVARBINARY       SYBVARBINARY
00072 # ifdef SYBUNIQUE
00073 #  define SQLUNIQUE         SYBUNIQUE
00074 # endif
00075 
00076 # define DBERRHANDLE(a, b)  dberrhandle(b)
00077 # define DBMSGHANDLE(a, b)  dbmsghandle(b)
00078 # define DBSETOPT(a, b, c)  dbsetopt(a, b, c, -1)
00079 # define NO_MORE_RPC_RESULTS       3
00080 # define dbfreelogin        dbloginfree
00081 # define dbrpcexec                 dbrpcsend
00082 
00083 typedef short TDS_SHORT;
00084 # ifndef PHP_WIN32
00085 typedef unsigned char *LPBYTE;
00086 # endif
00087 typedef float               DBFLT4;
00088 #endif
00089 
00090 int error_handler(DBPROCESS *dbproc, int severity, int dberr,
00091        int oserr, char *dberrstr, char *oserrstr);
00092 
00093 int msg_handler(DBPROCESS *dbproc, DBINT msgno, int msgstate,
00094        int severity, char *msgtext, char *srvname, char *procname, DBUSMALLINT line);
00095 
00096 extern pdo_driver_t pdo_dblib_driver;
00097 extern struct pdo_stmt_methods dblib_stmt_methods;
00098 
00099 typedef struct {
00100        int severity;
00101        int oserr;
00102        int dberr;
00103        char *oserrstr;
00104        char *dberrstr;
00105        char *sqlstate;
00106        char *lastmsg;
00107 } pdo_dblib_err;
00108 
00109 typedef struct {
00110        LOGINREC      *login;
00111        DBPROCESS     *link;
00112 
00113        pdo_dblib_err err;
00114 } pdo_dblib_db_handle;
00115 
00116 typedef struct {
00117        int coltype;
00118        char *name;
00119        int maxlen;
00120        char *source;
00121 } pdo_dblib_col;
00122 
00123 typedef struct {
00124        unsigned long len;
00125        char *data;
00126 } pdo_dblib_colval;
00127 
00128 typedef struct {
00129        pdo_dblib_db_handle *H;
00130 
00131        int ncols;
00132        pdo_dblib_col *cols;
00133 
00134        pdo_dblib_colval *rows;
00135        int nrows;
00136 
00137        int current;
00138        
00139        pdo_dblib_err err;
00140 } pdo_dblib_stmt;
00141 
00142 ZEND_BEGIN_MODULE_GLOBALS(dblib)
00143        pdo_dblib_err err;
00144        char sqlstate[6];
00145 ZEND_END_MODULE_GLOBALS(dblib)
00146 
00147 #ifdef ZTS
00148 # define DBLIB_G(v) TSRMG(dblib_globals_id, zend_dblib_globals *, v)
00149 #else
00150 # define DBLIB_G(v) (dblib_globals.v)
00151 #endif
00152 
00153 ZEND_EXTERN_MODULE_GLOBALS(dblib);
00154 
00155 #endif
00156