Annotation of embedaddon/php/ext/mssql/php_mssql.h, revision 1.1.1.4
1.1 misho 1: /*
2: +----------------------------------------------------------------------+
3: | PHP Version 5 |
4: +----------------------------------------------------------------------+
1.1.1.4 ! misho 5: | Copyright (c) 1997-2014 The PHP Group |
1.1 misho 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: Frank M. Kromann <frank@kromann.info> |
16: +----------------------------------------------------------------------+
17: */
18:
19:
1.1.1.2 misho 20: /* $Id$ */
1.1 misho 21:
22: #ifndef PHP_MSSQL_H
23: #define PHP_MSSQL_H
24:
25:
26: #if HAVE_MSSQL
27: #define MSDBLIB
28:
29: /* FreeTDS checks for PHP_MSSQL_API for avoid type redefinition */
30: #ifdef HAVE_FREETDS
31: #define PHP_MSSQL_API
32: #endif
33:
34: #include <sqlfront.h>
35: #include <sqldb.h>
36:
37: typedef short TDS_SHORT;
38: #ifdef HAVE_FREETDS
39: #define MSSQL_VERSION "FreeTDS"
40: #define SQLTEXT SYBTEXT
41: #define SQLCHAR SYBCHAR
42: #define SQLVARCHAR SYBVARCHAR
43: #define SQLINT1 SYBINT1
44: #define SQLINT2 SYBINT2
45: #define SQLINT4 SYBINT4
46: #define SQLINTN SYBINTN
47: #define SQLBIT SYBBIT
48: #define SQLFLT4 SYBREAL
49: #define SQLFLT8 SYBFLT8
50: #define SQLFLTN SYBFLTN
51: #define SQLDECIMAL SYBDECIMAL
52: #define SQLNUMERIC SYBNUMERIC
53: #define SQLDATETIME SYBDATETIME
54: #define SQLDATETIM4 SYBDATETIME4
55: #define SQLDATETIMN SYBDATETIMN
56: #define SQLMONEY SYBMONEY
57: #define SQLMONEY4 SYBMONEY4
58: #define SQLMONEYN SYBMONEYN
59: #define SQLIMAGE SYBIMAGE
60: #define SQLBINARY SYBBINARY
61: #define SQLVARBINARY SYBVARBINARY
62: #ifdef SQLUNIQUE /* FreeTSD 0.61+ */
63: #define SQLUNIQUE SYBUNIQUE
64: #endif
65: #define DBERRHANDLE(a, b) dberrhandle(b)
66: #define DBMSGHANDLE(a, b) dbmsghandle(b)
67: #define DBSETOPT(a, b, c) dbsetopt(a, b, c, -1)
68: #define NO_MORE_RPC_RESULTS 3
69: #ifndef dbfreelogin
70: #define dbfreelogin dbloginfree
71: #endif
72: #define dbrpcexec dbrpcsend
73: typedef unsigned char *LPBYTE;
74: typedef float DBFLT4;
75: #else
76: #define MSSQL_VERSION "7.0"
77: #define DBERRHANDLE(a, b) dbprocerrhandle(a, b)
78: #define DBMSGHANDLE(a, b) dbprocmsghandle(a, b)
79: #define EHANDLEFUNC DBERRHANDLE_PROC
80: #define MHANDLEFUNC DBMSGHANDLE_PROC
81: #define DBSETOPT(a, b, c) dbsetopt(a, b, c)
82: #endif
83:
84: #define coltype(j) dbcoltype(mssql_ptr->link,j)
85: #define intcol(i) ((int) *(DBINT *) dbdata(mssql_ptr->link,i))
86: #define smallintcol(i) ((int) *(DBSMALLINT *) dbdata(mssql_ptr->link,i))
87: #define tinyintcol(i) ((int) *(DBTINYINT *) dbdata(mssql_ptr->link,i))
88: #define anyintcol(j) (coltype(j)==SQLINT4?intcol(j):(coltype(j)==SQLINT2?smallintcol(j):tinyintcol(j)))
89: #define charcol(i) ((DBCHAR *) dbdata(mssql_ptr->link,i))
90: #define floatcol4(i) (*(DBFLT4 *) dbdata(mssql_ptr->link,i))
91: #define floatcol8(i) (*(DBFLT8 *) dbdata(mssql_ptr->link,i))
92:
93: #ifdef ZTS
94: #include "TSRM.h"
95: #endif
96:
97: extern zend_module_entry mssql_module_entry;
98: #define mssql_module_ptr &mssql_module_entry
99:
100: PHP_MINIT_FUNCTION(mssql);
101: PHP_MSHUTDOWN_FUNCTION(mssql);
102: PHP_RINIT_FUNCTION(mssql);
103: PHP_RSHUTDOWN_FUNCTION(mssql);
104: PHP_MINFO_FUNCTION(mssql);
105:
106: PHP_FUNCTION(mssql_connect);
107: PHP_FUNCTION(mssql_pconnect);
108: PHP_FUNCTION(mssql_close);
109: PHP_FUNCTION(mssql_select_db);
110: PHP_FUNCTION(mssql_query);
111: PHP_FUNCTION(mssql_fetch_batch);
112: PHP_FUNCTION(mssql_rows_affected);
113: PHP_FUNCTION(mssql_free_result);
114: PHP_FUNCTION(mssql_get_last_message);
115: PHP_FUNCTION(mssql_num_rows);
116: PHP_FUNCTION(mssql_num_fields);
117: PHP_FUNCTION(mssql_fetch_field);
118: PHP_FUNCTION(mssql_fetch_row);
119: PHP_FUNCTION(mssql_fetch_array);
120: PHP_FUNCTION(mssql_fetch_assoc);
121: PHP_FUNCTION(mssql_fetch_object);
122: PHP_FUNCTION(mssql_field_length);
123: PHP_FUNCTION(mssql_field_name);
124: PHP_FUNCTION(mssql_field_type);
125: PHP_FUNCTION(mssql_data_seek);
126: PHP_FUNCTION(mssql_field_seek);
127: PHP_FUNCTION(mssql_result);
128: PHP_FUNCTION(mssql_next_result);
129: PHP_FUNCTION(mssql_min_error_severity);
130: PHP_FUNCTION(mssql_min_message_severity);
131: PHP_FUNCTION(mssql_init);
132: PHP_FUNCTION(mssql_bind);
133: PHP_FUNCTION(mssql_execute);
134: PHP_FUNCTION(mssql_free_statement);
135: PHP_FUNCTION(mssql_guid_string);
136:
137: typedef struct mssql_link {
138: LOGINREC *login;
139: DBPROCESS *link;
140: int valid;
141: } mssql_link;
142:
143: typedef struct mssql_statement {
144: int id;
145: mssql_link *link;
146: HashTable *binds;
147: int executed;
148: } mssql_statement;
149:
150: typedef struct {
151:
152: zval *zval;
153: /* TODO: more data for special types (BLOBS, NUMERIC...) */
154: } mssql_bind;
155:
156: ZEND_BEGIN_MODULE_GLOBALS(mssql)
157: long default_link;
158: long num_links,num_persistent;
159: long max_links,max_persistent;
160: zend_bool allow_persistent;
161: char *appname;
162: char *server_message;
163: #ifdef HAVE_FREETDS
164: char *charset;
165: #endif
166: long min_error_severity, min_message_severity;
167: long cfg_min_error_severity, cfg_min_message_severity;
168: long connect_timeout, timeout;
169: zend_bool compatability_mode;
170: void (*get_column_content)(mssql_link *mssql_ptr,int offset,zval *result,int column_type TSRMLS_DC);
171: long textsize, textlimit, batchsize;
172: zend_bool datetimeconvert;
173: HashTable *resource_list, *resource_plist;
174: zend_bool secure_connection;
175: long max_procs;
176: ZEND_END_MODULE_GLOBALS(mssql)
177:
178: #define MSSQL_ROWS_BLOCK 128
179:
180: typedef struct mssql_field {
181: char *name,*column_source;
182: long max_length;
183: int numeric;
184: int type;
185: } mssql_field;
186:
187: typedef struct mssql_result {
188: zval **data;
189: mssql_field *fields;
190: mssql_link *mssql_ptr;
191: mssql_statement * statement;
192: int batchsize;
193: int lastresult;
194: int blocks_initialized;
195: int cur_row,cur_field;
196: int num_rows,num_fields,have_fields;
197: } mssql_result;
198:
199:
200: #ifdef ZTS
201: # define MS_SQL_G(v) TSRMG(mssql_globals_id, zend_mssql_globals *, v)
202: #else
203: # define MS_SQL_G(v) (mssql_globals.v)
204: #endif
205:
206: #else
207:
208: #define mssql_module_ptr NULL
209:
210: #endif /* HAVE_MSSQL */
211:
212: #define phpext_mssql_ptr mssql_module_ptr
213:
214: #endif /* PHP_MSSQL_H */
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>