Annotation of embedaddon/php/ext/pdo_odbc/php_pdo_odbc_int.h, revision 1.1.1.1
1.1 misho 1: /*
2: +----------------------------------------------------------------------+
3: | PHP Version 5 |
4: +----------------------------------------------------------------------+
5: | Copyright (c) 1997-2012 The PHP Group |
6: +----------------------------------------------------------------------+
7: | This source file is subject to version 3.0 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_0.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: +----------------------------------------------------------------------+
17: */
18:
19: /* $Id: php_pdo_odbc_int.h 321634 2012-01-01 13:15:04Z felipe $ */
20:
21: #ifdef PHP_WIN32
22: # define PDO_ODBC_TYPE "Win32"
23: #endif
24:
25: #ifndef PDO_ODBC_TYPE
26: # warning Please fix configure to give your ODBC libraries a name
27: # define PDO_ODBC_TYPE "Unknown"
28: #endif
29:
30: /* {{{ Roll a dice, pick a header at random... */
31: #if HAVE_SQLCLI1_H
32: # include <sqlcli1.h>
33: # if defined(DB268K) && HAVE_LIBRARYMANAGER_H
34: # include <LibraryManager.h>
35: # endif
36: #endif
37:
38: #if HAVE_ODBC_H
39: # include <odbc.h>
40: #endif
41:
42: #if HAVE_IODBC_H
43: # include <iodbc.h>
44: #endif
45:
46: #if HAVE_SQLUNIX_H && !defined(PHP_WIN32)
47: # include <sqlunix.h>
48: #endif
49:
50: #if HAVE_SQLTYPES_H
51: # include <sqltypes.h>
52: #endif
53:
54: #if HAVE_SQLUCODE_H
55: # include <sqlucode.h>
56: #endif
57:
58: #if HAVE_SQL_H
59: # include <sql.h>
60: #endif
61:
62: #if HAVE_ISQL_H
63: # include <isql.h>
64: #endif
65:
66: #if HAVE_SQLEXT_H
67: # include <sqlext.h>
68: #endif
69:
70: #if HAVE_ISQLEXT_H
71: # include <isqlext.h>
72: #endif
73:
74: #if HAVE_UDBCEXT_H
75: # include <udbcext.h>
76: #endif
77:
78: #if HAVE_CLI0CORE_H
79: # include <cli0core.h>
80: #endif
81:
82: #if HAVE_CLI0EXT1_H
83: # include <cli0ext.h>
84: #endif
85:
86: #if HAVE_CLI0CLI_H
87: # include <cli0cli.h>
88: #endif
89:
90: #if HAVE_CLI0DEFS_H
91: # include <cli0defs.h>
92: #endif
93:
94: #if HAVE_CLI0ENV_H
95: # include <cli0env.h>
96: #endif
97:
98: #if HAVE_ODBCSDK_H
99: # include <odbcsdk.h>
100: #endif
101:
102: /* }}} */
103:
104: /* {{{ Figure out the type for handles */
105: #if !defined(HENV) && !defined(SQLHENV) && defined(SQLHANDLE)
106: # define PDO_ODBC_HENV SQLHANDLE
107: # define PDO_ODBC_HDBC SQLHANDLE
108: # define PDO_ODBC_HSTMT SQLHANDLE
109: #elif !defined(HENV) && (defined(SQLHENV) || defined(DB2CLI_VER))
110: # define PDO_ODBC_HENV SQLHENV
111: # define PDO_ODBC_HDBC SQLHDBC
112: # define PDO_ODBC_HSTMT SQLHSTMT
113: #else
114: # define PDO_ODBC_HENV HENV
115: # define PDO_ODBC_HDBC HDBC
116: # define PDO_ODBC_HSTMT HSTMT
117: #endif
118: /* }}} */
119:
120: typedef struct {
121: char last_state[6];
122: char last_err_msg[SQL_MAX_MESSAGE_LENGTH];
123: SDWORD last_error;
124: const char *file, *what;
125: int line;
126: } pdo_odbc_errinfo;
127:
128: typedef struct {
129: PDO_ODBC_HENV env;
130: PDO_ODBC_HDBC dbc;
131: pdo_odbc_errinfo einfo;
132: unsigned assume_utf8:1;
133: unsigned _spare:31;
134: } pdo_odbc_db_handle;
135:
136: typedef struct {
137: char *data;
138: unsigned long datalen;
139: SQLLEN fetched_len;
140: SWORD coltype;
141: char colname[128];
142: unsigned is_long;
143: unsigned is_unicode:1;
144: unsigned _spare:31;
145: } pdo_odbc_column;
146:
147: typedef struct {
148: PDO_ODBC_HSTMT stmt;
149: pdo_odbc_column *cols;
150: pdo_odbc_db_handle *H;
151: pdo_odbc_errinfo einfo;
152: char *convbuf;
153: unsigned long convbufsize;
154: unsigned going_long:1;
155: unsigned assume_utf8:1;
156: unsigned _spare:30;
157: } pdo_odbc_stmt;
158:
159: typedef struct {
160: SQLINTEGER len;
161: SQLSMALLINT paramtype;
162: char *outbuf;
163: unsigned is_unicode:1;
164: unsigned _spare:31;
165: } pdo_odbc_param;
166:
167: extern pdo_driver_t pdo_odbc_driver;
168: extern struct pdo_stmt_methods odbc_stmt_methods;
169:
170: void pdo_odbc_error(pdo_dbh_t *dbh, pdo_stmt_t *stmt, PDO_ODBC_HSTMT statement, char *what, const char *file, int line TSRMLS_DC);
171: #define pdo_odbc_drv_error(what) pdo_odbc_error(dbh, NULL, SQL_NULL_HSTMT, what, __FILE__, __LINE__ TSRMLS_CC)
172: #define pdo_odbc_stmt_error(what) pdo_odbc_error(stmt->dbh, stmt, SQL_NULL_HSTMT, what, __FILE__, __LINE__ TSRMLS_CC)
173: #define pdo_odbc_doer_error(what) pdo_odbc_error(dbh, NULL, stmt, what, __FILE__, __LINE__ TSRMLS_CC)
174:
175: void pdo_odbc_init_error_table(void);
176: void pdo_odbc_fini_error_table(void);
177:
178: #ifdef SQL_ATTR_CONNECTION_POOLING
179: extern SQLUINTEGER pdo_odbc_pool_on;
180: extern SQLUINTEGER pdo_odbc_pool_mode;
181: #endif
182:
183: enum {
184: PDO_ODBC_ATTR_USE_CURSOR_LIBRARY = PDO_ATTR_DRIVER_SPECIFIC,
185: PDO_ODBC_ATTR_ASSUME_UTF8 /* assume that input strings are UTF-8 when feeding data to unicode columns */
186: };
187:
188: /*
189: * Local variables:
190: * tab-width: 4
191: * c-basic-offset: 4
192: * End:
193: * vim600: noet sw=4 ts=4 fdm=marker
194: * vim<600: noet sw=4 ts=4
195: */
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>