xref: /PHP-5.4/ext/sybase_ct/php_sybase_ct.h (revision c0d060f5)
1 /*
2    +----------------------------------------------------------------------+
3    | PHP Version 5                                                        |
4    +----------------------------------------------------------------------+
5    | Copyright (c) 1997-2014 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    | Authors: Zeev Suraski <zeev@zend.com>                                |
16    |          Timm Friebe <php_sybase_ct@thekid.de>                       |
17    +----------------------------------------------------------------------+
18 */
19 
20 /* $Id$ */
21 
22 #ifndef PHP_SYBASE_CT_H
23 #define PHP_SYBASE_CT_H
24 
25 #if HAVE_SYBASE_CT
26 
27 #define CTLIB_VERSION CS_VERSION_100
28 
29 extern zend_module_entry sybase_module_entry;
30 #define sybase_module_ptr &sybase_module_entry
31 
32 PHP_MINIT_FUNCTION(sybase);
33 PHP_MSHUTDOWN_FUNCTION(sybase);
34 PHP_RINIT_FUNCTION(sybase);
35 PHP_RSHUTDOWN_FUNCTION(sybase);
36 PHP_MINFO_FUNCTION(sybase);
37 
38 PHP_FUNCTION(sybase_connect);
39 PHP_FUNCTION(sybase_pconnect);
40 PHP_FUNCTION(sybase_close);
41 PHP_FUNCTION(sybase_select_db);
42 PHP_FUNCTION(sybase_query);
43 PHP_FUNCTION(sybase_unbuffered_query);
44 PHP_FUNCTION(sybase_free_result);
45 PHP_FUNCTION(sybase_get_last_message);
46 PHP_FUNCTION(sybase_num_rows);
47 PHP_FUNCTION(sybase_num_fields);
48 PHP_FUNCTION(sybase_fetch_row);
49 PHP_FUNCTION(sybase_fetch_array);
50 PHP_FUNCTION(sybase_fetch_assoc);
51 PHP_FUNCTION(sybase_fetch_object);
52 PHP_FUNCTION(sybase_data_seek);
53 PHP_FUNCTION(sybase_result);
54 PHP_FUNCTION(sybase_affected_rows);
55 PHP_FUNCTION(sybase_field_seek);
56 PHP_FUNCTION(sybase_min_client_severity);
57 PHP_FUNCTION(sybase_min_server_severity);
58 PHP_FUNCTION(sybase_fetch_field);
59 PHP_FUNCTION(sybase_set_message_handler);
60 PHP_FUNCTION(sybase_deadlock_retry_count);
61 
62 #include <ctpublic.h>
63 
64 ZEND_BEGIN_MODULE_GLOBALS(sybase)
65 	long default_link;
66 	long num_links,num_persistent;
67 	long max_links,max_persistent;
68 	long login_timeout;
69 	long allow_persistent;
70 	char *appname;
71 	char *hostname;
72 	char *server_message;
73 	long min_server_severity, min_client_severity;
74 	long deadlock_retry_count;
75 	zval *callback_name;
76 	CS_CONTEXT *context;
77 ZEND_END_MODULE_GLOBALS(sybase)
78 
79 typedef struct {
80 	CS_CONNECTION *connection;
81 	CS_COMMAND *cmd;
82 	int valid;
83 	int deadlock;
84 	int dead;
85 	int active_result_index;
86 	long affected_rows;
87 	zval *callback_name;
88 } sybase_link;
89 
90 #define SYBASE_ROWS_BLOCK 128
91 
92 typedef struct {
93 	char *name,*column_source;
94 	int max_length, numeric;
95 	CS_INT type;
96 } sybase_field;
97 
98 typedef struct {
99 	zval **data;
100 	sybase_field *fields;
101 	sybase_link *sybase_ptr;
102 	int cur_row,cur_field;
103 	int num_rows,num_fields;
104 
105 	/* For unbuffered reads */
106 	CS_INT *lengths;
107 	CS_SMALLINT *indicators;
108 	char **tmp_buffer;
109 	unsigned char *numerics;
110 	CS_INT *types;
111 	CS_DATAFMT *datafmt;
112 	int blocks_initialized;
113 	CS_RETCODE last_retcode;
114 	int store;
115 } sybase_result;
116 
117 #ifdef ZTS
118 # define SybCtG(v) TSRMG(sybase_globals_id, zend_sybase_globals *, v)
119 #else
120 # define SybCtG(v) (sybase_globals.v)
121 #endif
122 
123 #else
124 
125 #define sybase_module_ptr NULL
126 
127 #endif
128 
129 #define phpext_sybase_ct_ptr sybase_module_ptr
130 
131 #endif /* PHP_SYBASE_CT_H */
132