Back to index

php5  5.3.10
php_pdo_firebird_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: Ard Biesheuvel <abies@php.net>                               |
00016   +----------------------------------------------------------------------+
00017 */
00018 
00019 /* $Id: php_pdo_firebird_int.h 321634 2012-01-01 13:15:04Z felipe $ */
00020 
00021 #ifndef PHP_PDO_FIREBIRD_INT_H
00022 #define PHP_PDO_FIREBIRD_INT_H
00023 
00024 #include <ibase.h>
00025 
00026 #ifdef SQLDA_VERSION
00027 #define PDO_FB_SQLDA_VERSION SQLDA_VERSION
00028 #else
00029 #define PDO_FB_SQLDA_VERSION 1
00030 #endif
00031 
00032 #define PDO_FB_DIALECT 3
00033 
00034 #define PDO_FB_DEF_DATE_FMT "%Y-%m-%d"
00035 #define PDO_FB_DEF_TIME_FMT "%H:%M:%S"
00036 #define PDO_FB_DEF_TIMESTAMP_FMT PDO_FB_DEF_DATE_FMT " " PDO_FB_DEF_TIME_FMT
00037 
00038 #define SHORT_MAX (1 << (8*sizeof(short)-1))
00039 
00040 #if SIZEOF_LONG == 8
00041 # define LL_MASK "l"
00042 # define LL_LIT(lit) lit ## L
00043 #else
00044 # ifdef PHP_WIN32
00045 #  define LL_MASK "I64"
00046 #  define LL_LIT(lit) lit ## I64
00047 # else
00048 #  define LL_MASK "ll"
00049 #  define LL_LIT(lit) lit ## LL
00050 # endif
00051 #endif
00052 
00053 /* Firebird API has a couple of missing const decls in its API */
00054 #define const_cast(s) ((char*)(s))
00055 
00056 #ifdef PHP_WIN32
00057 typedef void (__stdcall *info_func_t)(char*);
00058 #else
00059 typedef void (*info_func_t)(char*);
00060 #endif
00061 
00062 #ifndef min
00063 #define min(a,b) ((a)<(b)?(a):(b))
00064 #endif
00065 
00066 typedef struct {
00067 
00068        /* the result of the last API call */
00069        ISC_STATUS isc_status[20];
00070 
00071        /* the connection handle */
00072        isc_db_handle db;
00073 
00074        /* the transaction handle */
00075        isc_tr_handle tr;
00076 
00077        /* the last error that didn't come from the API */
00078        char const *last_app_error;
00079        
00080        /* date and time format strings, can be set by the set_attribute method */
00081        char *date_format;
00082        char *time_format;
00083        char *timestamp_format;
00084        
00085        /* prepend table names on column names in fetch */
00086        unsigned fetch_table_names:1;
00087        
00088        unsigned _reserved:31;
00089        
00090 } pdo_firebird_db_handle;
00091 
00092 
00093 typedef struct {
00094        
00095        /* the link that owns this statement */
00096        pdo_firebird_db_handle *H;
00097        
00098        /* the statement handle */
00099        isc_stmt_handle stmt;
00100        
00101        /* the name of the cursor (if it has one) */
00102        char name[32];
00103        
00104        /* the type of statement that was issued */
00105        char statement_type:8;
00106        
00107        /* whether EOF was reached for this statement */
00108        unsigned exhausted:1;
00109 
00110        /* successful isc_dsql_execute opens a cursor */
00111        unsigned cursor_open:1;
00112 
00113        unsigned _reserved:22;
00114 
00115        /* the named params that were converted to ?'s by the driver */
00116        HashTable *named_params;
00117        
00118        /* allocated space to convert fields values to other types */
00119        char **fetch_buf;
00120        
00121        /* the input SQLDA */
00122        XSQLDA *in_sqlda;
00123        
00124        /* the output SQLDA */
00125        XSQLDA out_sqlda; /* last member */
00126        
00127 } pdo_firebird_stmt;
00128 
00129 extern pdo_driver_t pdo_firebird_driver;
00130 
00131 extern struct pdo_stmt_methods firebird_stmt_methods;
00132 
00133 void _firebird_error(pdo_dbh_t *dbh, pdo_stmt_t *stmt, char const *file, long line TSRMLS_DC);
00134 
00135 enum {
00136        PDO_FB_ATTR_DATE_FORMAT = PDO_ATTR_DRIVER_SPECIFIC,
00137        PDO_FB_ATTR_TIME_FORMAT,
00138        PDO_FB_ATTR_TIMESTAMP_FORMAT,
00139 };
00140 
00141 #endif /* PHP_PDO_FIREBIRD_INT_H */
00142 
00143 /*
00144  * Local variables:
00145  * tab-width: 4
00146  * c-basic-offset: 4
00147  * End:
00148  * vim600: noet sw=4 ts=4 fdm=marker
00149  * vim<600: noet sw=4 ts=4
00150  */