1 /**
2 * Copyright 2015-2017 DataStax, Inc.
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17 #ifndef PHP_DRIVER_TYPES_H
18 #define PHP_DRIVER_TYPES_H
19
20 #if PHP_MAJOR_VERSION >= 7
21 #define PHP_DRIVER_BEGIN_OBJECT_TYPE(type_name) \
22 typedef struct php_driver_##type_name##_ {
23
24 #define PHP_DRIVER_END_OBJECT_TYPE(type_name) \
25 zend_object zval; \
26 } php_driver_##type_name; \
27 static inline php_driver_##type_name *php_driver_##type_name##_object_fetch(zend_object *obj) { \
28 return (php_driver_##type_name *)((char *)obj - XtOffsetOf(php_driver_##type_name, zval)); \
29 }
30 #else
31 #define PHP_DRIVER_BEGIN_OBJECT_TYPE(type_name) \
32 typedef struct php_driver_##type_name##_ { \
33 zend_object zval;
34
35 #define PHP_DRIVER_END_OBJECT_TYPE(type_name) \
36 } php_driver_##type_name;
37 #endif
38
39 #if PHP_MAJOR_VERSION >= 7
40 #define PHP_DRIVER_GET_NUMERIC(obj) php_driver_numeric_object_fetch(Z_OBJ_P(obj))
41 #define PHP_DRIVER_GET_BLOB(obj) php_driver_blob_object_fetch(Z_OBJ_P(obj))
42 #define PHP_DRIVER_GET_TIMESTAMP(obj) php_driver_timestamp_object_fetch(Z_OBJ_P(obj))
43 #define PHP_DRIVER_GET_DATE(obj) php_driver_date_object_fetch(Z_OBJ_P(obj))
44 #define PHP_DRIVER_GET_TIME(obj) php_driver_time_object_fetch(Z_OBJ_P(obj))
45 #define PHP_DRIVER_GET_UUID(obj) php_driver_uuid_object_fetch(Z_OBJ_P(obj))
46 #define PHP_DRIVER_GET_INET(obj) php_driver_inet_object_fetch(Z_OBJ_P(obj))
47 #define PHP_DRIVER_GET_COLLECTION(obj) php_driver_collection_object_fetch(Z_OBJ_P(obj))
48 #define PHP_DRIVER_GET_MAP(obj) php_driver_map_object_fetch(Z_OBJ_P(obj))
49 #define PHP_DRIVER_GET_SET(obj) php_driver_set_object_fetch(Z_OBJ_P(obj))
50 #define PHP_DRIVER_GET_TUPLE(obj) php_driver_tuple_object_fetch(Z_OBJ_P(obj))
51 #define PHP_DRIVER_GET_USER_TYPE_VALUE(obj) php_driver_user_type_value_object_fetch(Z_OBJ_P(obj))
52 #define PHP_DRIVER_GET_CLUSTER(obj) php_driver_cluster_object_fetch(Z_OBJ_P(obj))
53 #define PHP_DRIVER_GET_STATEMENT(obj) php_driver_statement_object_fetch(Z_OBJ_P(obj))
54 #define PHP_DRIVER_GET_EXECUTION_OPTIONS(obj) php_driver_execution_options_object_fetch(Z_OBJ_P(obj))
55 #define PHP_DRIVER_GET_ROWS(obj) php_driver_rows_object_fetch(Z_OBJ_P(obj))
56 #define PHP_DRIVER_GET_FUTURE_ROWS(obj) php_driver_future_rows_object_fetch(Z_OBJ_P(obj))
57 #define PHP_DRIVER_GET_CLUSTER_BUILDER(obj) php_driver_cluster_builder_object_fetch(Z_OBJ_P(obj))
58 #define PHP_DRIVER_GET_FUTURE_PREPARED_STATEMENT(obj) php_driver_future_prepared_statement_object_fetch(Z_OBJ_P(obj))
59 #define PHP_DRIVER_GET_FUTURE_VALUE(obj) php_driver_future_value_object_fetch(Z_OBJ_P(obj))
60 #define PHP_DRIVER_GET_FUTURE_CLOSE(obj) php_driver_future_close_object_fetch(Z_OBJ_P(obj))
61 #define PHP_DRIVER_GET_FUTURE_SESSION(obj) php_driver_future_session_object_fetch(Z_OBJ_P(obj))
62 #define PHP_DRIVER_GET_SESSION(obj) php_driver_session_object_fetch(Z_OBJ_P(obj))
63 #define PHP_DRIVER_GET_SSL(obj) php_driver_ssl_object_fetch(Z_OBJ_P(obj))
64 #define PHP_DRIVER_GET_SSL_BUILDER(obj) php_driver_ssl_builder_object_fetch(Z_OBJ_P(obj))
65 #define PHP_DRIVER_GET_SCHEMA(obj) php_driver_schema_object_fetch(Z_OBJ_P(obj))
66 #define PHP_DRIVER_GET_KEYSPACE(obj) php_driver_keyspace_object_fetch(Z_OBJ_P(obj))
67 #define PHP_DRIVER_GET_TABLE(obj) php_driver_table_object_fetch(Z_OBJ_P(obj))
68 #define PHP_DRIVER_GET_COLUMN(obj) php_driver_column_object_fetch(Z_OBJ_P(obj))
69 #define PHP_DRIVER_GET_INDEX(obj) php_driver_index_object_fetch(Z_OBJ_P(obj))
70 #define PHP_DRIVER_GET_MATERIALIZED_VIEW(obj) php_driver_materialized_view_object_fetch(Z_OBJ_P(obj))
71 #define PHP_DRIVER_GET_FUNCTION(obj) php_driver_function_object_fetch(Z_OBJ_P(obj))
72 #define PHP_DRIVER_GET_AGGREGATE(obj) php_driver_aggregate_object_fetch(Z_OBJ_P(obj))
73 #define PHP_DRIVER_GET_TYPE(obj) php_driver_type_object_fetch(Z_OBJ_P(obj))
74 #define PHP_DRIVER_GET_RETRY_POLICY(obj) php_driver_retry_policy_object_fetch(Z_OBJ_P(obj))
75 #define PHP_DRIVER_GET_TIMESTAMP_GEN(obj) php_driver_timestamp_gen_object_fetch(Z_OBJ_P(obj))
76 #define PHP_DRIVER_GET_DURATION(obj) php_driver_duration_object_fetch(Z_OBJ_P(obj))
77 #else
78 #define PHP_DRIVER_GET_NUMERIC(obj) ((php_driver_numeric *)zend_object_store_get_object((obj) TSRMLS_CC))
79 #define PHP_DRIVER_GET_BLOB(obj) ((php_driver_blob *)zend_object_store_get_object((obj) TSRMLS_CC))
80 #define PHP_DRIVER_GET_TIMESTAMP(obj) ((php_driver_timestamp *)zend_object_store_get_object((obj) TSRMLS_CC))
81 #define PHP_DRIVER_GET_DATE(obj) ((php_driver_date *)zend_object_store_get_object((obj) TSRMLS_CC))
82 #define PHP_DRIVER_GET_TIME(obj) ((php_driver_time *)zend_object_store_get_object((obj) TSRMLS_CC))
83 #define PHP_DRIVER_GET_UUID(obj) ((php_driver_uuid *)zend_object_store_get_object((obj) TSRMLS_CC))
84 #define PHP_DRIVER_GET_INET(obj) ((php_driver_inet *)zend_object_store_get_object((obj) TSRMLS_CC))
85 #define PHP_DRIVER_GET_COLLECTION(obj) ((php_driver_collection *)zend_object_store_get_object((obj) TSRMLS_CC))
86 #define PHP_DRIVER_GET_MAP(obj) ((php_driver_map *)zend_object_store_get_object((obj) TSRMLS_CC))
87 #define PHP_DRIVER_GET_SET(obj) ((php_driver_set *)zend_object_store_get_object((obj) TSRMLS_CC))
88 #define PHP_DRIVER_GET_TUPLE(obj) ((php_driver_tuple *)zend_object_store_get_object((obj) TSRMLS_CC))
89 #define PHP_DRIVER_GET_USER_TYPE_VALUE(obj) ((php_driver_user_type_value *)zend_object_store_get_object((obj) TSRMLS_CC))
90 #define PHP_DRIVER_GET_CLUSTER(obj) ((php_driver_cluster *)zend_object_store_get_object((obj) TSRMLS_CC))
91 #define PHP_DRIVER_GET_STATEMENT(obj) ((php_driver_statement *)zend_object_store_get_object((obj) TSRMLS_CC))
92 #define PHP_DRIVER_GET_EXECUTION_OPTIONS(obj) ((php_driver_execution_options *)zend_object_store_get_object((obj) TSRMLS_CC))
93 #define PHP_DRIVER_GET_ROWS(obj) ((php_driver_rows *)zend_object_store_get_object((obj) TSRMLS_CC))
94 #define PHP_DRIVER_GET_FUTURE_ROWS(obj) ((php_driver_future_rows *)zend_object_store_get_object((obj) TSRMLS_CC))
95 #define PHP_DRIVER_GET_CLUSTER_BUILDER(obj) ((php_driver_cluster_builder *)zend_object_store_get_object((obj) TSRMLS_CC))
96 #define PHP_DRIVER_GET_FUTURE_PREPARED_STATEMENT(obj) ((php_driver_future_prepared_statement *)zend_object_store_get_object((obj) TSRMLS_CC))
97 #define PHP_DRIVER_GET_FUTURE_VALUE(obj) ((php_driver_future_value *)zend_object_store_get_object((obj) TSRMLS_CC))
98 #define PHP_DRIVER_GET_FUTURE_CLOSE(obj) ((php_driver_future_close *)zend_object_store_get_object((obj) TSRMLS_CC))
99 #define PHP_DRIVER_GET_FUTURE_SESSION(obj) ((php_driver_future_session *)zend_object_store_get_object((obj) TSRMLS_CC))
100 #define PHP_DRIVER_GET_SESSION(obj) ((php_driver_session *)zend_object_store_get_object((obj) TSRMLS_CC))
101 #define PHP_DRIVER_GET_SSL(obj) ((php_driver_ssl *)zend_object_store_get_object((obj) TSRMLS_CC))
102 #define PHP_DRIVER_GET_SSL_BUILDER(obj) ((php_driver_ssl_builder *)zend_object_store_get_object((obj) TSRMLS_CC))
103 #define PHP_DRIVER_GET_SCHEMA(obj) ((php_driver_schema *)zend_object_store_get_object((obj) TSRMLS_CC))
104 #define PHP_DRIVER_GET_KEYSPACE(obj) ((php_driver_keyspace *)zend_object_store_get_object((obj) TSRMLS_CC))
105 #define PHP_DRIVER_GET_TABLE(obj) ((php_driver_table *)zend_object_store_get_object((obj) TSRMLS_CC))
106 #define PHP_DRIVER_GET_COLUMN(obj) ((php_driver_column *)zend_object_store_get_object((obj) TSRMLS_CC))
107 #define PHP_DRIVER_GET_INDEX(obj) ((php_driver_index *)zend_object_store_get_object((obj) TSRMLS_CC))
108 #define PHP_DRIVER_GET_MATERIALIZED_VIEW(obj) ((php_driver_materialized_view *)zend_object_store_get_object((obj) TSRMLS_CC))
109 #define PHP_DRIVER_GET_FUNCTION(obj) ((php_driver_function *)zend_object_store_get_object((obj) TSRMLS_CC))
110 #define PHP_DRIVER_GET_AGGREGATE(obj) ((php_driver_aggregate *)zend_object_store_get_object((obj) TSRMLS_CC))
111 #define PHP_DRIVER_GET_TYPE(obj) ((php_driver_type *)zend_object_store_get_object((obj) TSRMLS_CC))
112 #define PHP_DRIVER_GET_RETRY_POLICY(obj) ((php_driver_retry_policy *)zend_object_store_get_object((obj) TSRMLS_CC))
113 #define PHP_DRIVER_GET_TIMESTAMP_GEN(obj) ((php_driver_timestamp_gen *)zend_object_store_get_object((obj) TSRMLS_CC))
114 #define PHP_DRIVER_GET_DURATION(obj) ((php_driver_duration *)zend_object_store_get_object((obj) TSRMLS_CC))
115 #endif
116
117 typedef enum {
118 PHP_DRIVER_BIGINT,
119 PHP_DRIVER_DECIMAL,
120 PHP_DRIVER_FLOAT,
121 PHP_DRIVER_VARINT,
122 PHP_DRIVER_SMALLINT,
123 PHP_DRIVER_TINYINT
124 } php_driver_numeric_type;
125
PHP_DRIVER_BEGIN_OBJECT_TYPE(numeric)126 PHP_DRIVER_BEGIN_OBJECT_TYPE(numeric)
127 php_driver_numeric_type type;
128 union {
129 struct {
130 cass_int8_t value;
131 } tinyint;
132 struct {
133 cass_int16_t value;
134 } smallint;
135 struct {
136 cass_int64_t value;
137 } bigint;
138 struct {
139 cass_float_t value;
140 } floating;
141 struct {
142 mpz_t value;
143 } varint;
144 struct {
145 mpz_t value;
146 long scale;
147 } decimal;
148 } data;
149 PHP_DRIVER_END_OBJECT_TYPE(numeric)
150
151 PHP_DRIVER_BEGIN_OBJECT_TYPE(timestamp)
152 cass_int64_t timestamp;
153 PHP_DRIVER_END_OBJECT_TYPE(timestamp)
154
155 PHP_DRIVER_BEGIN_OBJECT_TYPE(date)
156 cass_uint32_t date;
157 PHP_DRIVER_END_OBJECT_TYPE(date)
158
159 PHP_DRIVER_BEGIN_OBJECT_TYPE(time)
160 cass_int64_t time;
161 PHP_DRIVER_END_OBJECT_TYPE(time)
162
163 PHP_DRIVER_BEGIN_OBJECT_TYPE(blob)
164 cass_byte_t *data;
165 size_t size;
166 PHP_DRIVER_END_OBJECT_TYPE(blob)
167
168 PHP_DRIVER_BEGIN_OBJECT_TYPE(uuid)
169 CassUuid uuid;
170 PHP_DRIVER_END_OBJECT_TYPE(uuid)
171
172 PHP_DRIVER_BEGIN_OBJECT_TYPE(inet)
173 CassInet inet;
174 PHP_DRIVER_END_OBJECT_TYPE(inet)
175
176 PHP_DRIVER_BEGIN_OBJECT_TYPE(duration)
177 cass_int32_t months;
178 cass_int32_t days;
179 cass_int64_t nanos;
180 PHP_DRIVER_END_OBJECT_TYPE(duration)
181
182 PHP_DRIVER_BEGIN_OBJECT_TYPE(collection)
183 php5to7_zval type;
184 HashTable values;
185 unsigned hashv;
186 int dirty;
187 PHP_DRIVER_END_OBJECT_TYPE(collection)
188
189 typedef struct php_driver_map_entry_ php_driver_map_entry;
190
191 PHP_DRIVER_BEGIN_OBJECT_TYPE(map)
192 php5to7_zval type;
193 php_driver_map_entry *entries;
194 unsigned hashv;
195 int dirty;
196 php_driver_map_entry *iter_curr;
197 php_driver_map_entry *iter_temp;
198 PHP_DRIVER_END_OBJECT_TYPE(map)
199
200 typedef struct php_driver_set_entry_ php_driver_set_entry;
201
202 PHP_DRIVER_BEGIN_OBJECT_TYPE(set)
203 php5to7_zval type;
204 php_driver_set_entry *entries;
205 unsigned hashv;
206 int dirty;
207 php_driver_set_entry *iter_curr;
208 php_driver_set_entry *iter_temp;
209 int iter_index;
210 PHP_DRIVER_END_OBJECT_TYPE(set)
211
212 PHP_DRIVER_BEGIN_OBJECT_TYPE(tuple)
213 php5to7_zval type;
214 HashTable values;
215 HashPosition pos;
216 unsigned hashv;
217 int dirty;
218 PHP_DRIVER_END_OBJECT_TYPE(tuple)
219
220 PHP_DRIVER_BEGIN_OBJECT_TYPE(user_type_value)
221 php5to7_zval type;
222 HashTable values;
223 HashPosition pos;
224 unsigned hashv;
225 int dirty;
226 PHP_DRIVER_END_OBJECT_TYPE(user_type_value)
227
228 PHP_DRIVER_BEGIN_OBJECT_TYPE(cluster)
229 cass_byte_t *data;
230 CassCluster *cluster;
231 long default_consistency;
232 int default_page_size;
233 php5to7_zval default_timeout;
234 cass_bool_t persist;
235 char *hash_key;
236 int hash_key_len;
237 PHP_DRIVER_END_OBJECT_TYPE(cluster)
238
239 typedef enum {
240 PHP_DRIVER_SIMPLE_STATEMENT,
241 PHP_DRIVER_PREPARED_STATEMENT,
242 PHP_DRIVER_BATCH_STATEMENT
243 } php_driver_statement_type;
244
PHP_DRIVER_BEGIN_OBJECT_TYPE(statement)245 PHP_DRIVER_BEGIN_OBJECT_TYPE(statement)
246 php_driver_statement_type type;
247 union {
248 struct {
249 char *cql;
250 } simple;
251 struct {
252 const CassPrepared *prepared;
253 } prepared;
254 struct {
255 CassBatchType type;
256 HashTable statements;
257 } batch;
258 } data;
259 PHP_DRIVER_END_OBJECT_TYPE(statement)
260
261 typedef struct {
262 php5to7_zval statement;
263 php5to7_zval arguments;
264 } php_driver_batch_statement_entry;
265
266 PHP_DRIVER_BEGIN_OBJECT_TYPE(execution_options)
267 long consistency;
268 long serial_consistency;
269 int page_size;
270 char *paging_state_token;
271 size_t paging_state_token_size;
272 php5to7_zval timeout;
273 php5to7_zval arguments;
274 php5to7_zval retry_policy;
275 cass_int64_t timestamp;
276 PHP_DRIVER_END_OBJECT_TYPE(execution_options)
277
278 typedef enum {
279 LOAD_BALANCING_DEFAULT = 0,
280 LOAD_BALANCING_ROUND_ROBIN,
281 LOAD_BALANCING_DC_AWARE_ROUND_ROBIN
282 } php_driver_load_balancing;
283
284 typedef void (*php_driver_free_function)(void *data);
285
286 typedef struct {
287 size_t count;
288 php_driver_free_function destruct;
289 void *data;
290 } php_driver_ref;
291
292 PHP_DRIVER_BEGIN_OBJECT_TYPE(rows)
293 php_driver_ref *statement;
294 php_driver_ref *session;
295 php5to7_zval rows;
296 php5to7_zval next_rows;
297 php_driver_ref *result;
298 php_driver_ref *next_result;
299 php5to7_zval future_next_page;
300 PHP_DRIVER_END_OBJECT_TYPE(rows)
301
302 PHP_DRIVER_BEGIN_OBJECT_TYPE(future_rows)
303 php_driver_ref *statement;
304 php_driver_ref *session;
305 php5to7_zval rows;
306 php_driver_ref *result;
307 CassFuture *future;
308 PHP_DRIVER_END_OBJECT_TYPE(future_rows)
309
310 PHP_DRIVER_BEGIN_OBJECT_TYPE(cluster_builder)
311 char *contact_points;
312 int port;
313 php_driver_load_balancing load_balancing_policy;
314 char *local_dc;
315 unsigned int used_hosts_per_remote_dc;
316 cass_bool_t allow_remote_dcs_for_local_cl;
317 cass_bool_t use_token_aware_routing;
318 char *username;
319 char *password;
320 unsigned int connect_timeout;
321 unsigned int request_timeout;
322 php5to7_zval ssl_options;
323 long default_consistency;
324 int default_page_size;
325 php5to7_zval default_timeout;
326 cass_bool_t persist;
327 int protocol_version;
328 int io_threads;
329 int core_connections_per_host;
330 int max_connections_per_host;
331 unsigned int reconnect_interval;
332 cass_bool_t enable_latency_aware_routing;
333 cass_bool_t enable_tcp_nodelay;
334 cass_bool_t enable_tcp_keepalive;
335 unsigned int tcp_keepalive_delay;
336 php5to7_zval retry_policy;
337 php5to7_zval timestamp_gen;
338 cass_bool_t enable_schema;
339 char *blacklist_hosts;
340 char *whitelist_hosts;
341 char *blacklist_dcs;
342 char *whitelist_dcs;
343 cass_bool_t enable_hostname_resolution;
344 cass_bool_t enable_randomized_contact_points;
345 unsigned int connection_heartbeat_interval;
346 PHP_DRIVER_END_OBJECT_TYPE(cluster_builder)
347
348 PHP_DRIVER_BEGIN_OBJECT_TYPE(future_prepared_statement)
349 CassFuture *future;
350 php5to7_zval prepared_statement;
351 PHP_DRIVER_END_OBJECT_TYPE(future_prepared_statement)
352
353 PHP_DRIVER_BEGIN_OBJECT_TYPE(future_value)
354 php5to7_zval value;
355 PHP_DRIVER_END_OBJECT_TYPE(future_value)
356
357 PHP_DRIVER_BEGIN_OBJECT_TYPE(future_close)
358 CassFuture *future;
359 PHP_DRIVER_END_OBJECT_TYPE(future_close)
360
361 PHP_DRIVER_BEGIN_OBJECT_TYPE(future_session)
362 CassFuture *future;
363 php_driver_ref *session;
364 php5to7_zval default_session;
365 cass_bool_t persist;
366 char *hash_key;
367 int hash_key_len;
368 char *exception_message;
369 CassError exception_code;
370 PHP_DRIVER_END_OBJECT_TYPE(future_session)
371
372 typedef struct {
373 CassFuture *future;
374 php_driver_ref *session;
375 } php_driver_psession;
376
377 PHP_DRIVER_BEGIN_OBJECT_TYPE(session)
378 php_driver_ref *session;
379 long default_consistency;
380 int default_page_size;
381 php5to7_zval default_timeout;
382 cass_bool_t persist;
383 PHP_DRIVER_END_OBJECT_TYPE(session)
384
385 PHP_DRIVER_BEGIN_OBJECT_TYPE(ssl)
386 CassSsl *ssl;
387 PHP_DRIVER_END_OBJECT_TYPE(ssl)
388
389 PHP_DRIVER_BEGIN_OBJECT_TYPE(ssl_builder)
390 int flags;
391 char **trusted_certs;
392 int trusted_certs_cnt;
393 char *client_cert;
394 char *private_key;
395 char *passphrase;
396 PHP_DRIVER_END_OBJECT_TYPE(ssl_builder)
397
398 PHP_DRIVER_BEGIN_OBJECT_TYPE(schema)
399 php_driver_ref *schema;
400 PHP_DRIVER_END_OBJECT_TYPE(schema)
401
402 PHP_DRIVER_BEGIN_OBJECT_TYPE(keyspace)
403 php_driver_ref *schema;
404 const CassKeyspaceMeta *meta;
405 PHP_DRIVER_END_OBJECT_TYPE(keyspace)
406
407 PHP_DRIVER_BEGIN_OBJECT_TYPE(table)
408 php5to7_zval name;
409 php5to7_zval options;
410 php5to7_zval partition_key;
411 php5to7_zval primary_key;
412 php5to7_zval clustering_key;
413 php5to7_zval clustering_order;
414 php_driver_ref *schema;
415 const CassTableMeta *meta;
416 PHP_DRIVER_END_OBJECT_TYPE(table)
417
418 PHP_DRIVER_BEGIN_OBJECT_TYPE(materialized_view)
419 php5to7_zval name;
420 php5to7_zval options;
421 php5to7_zval partition_key;
422 php5to7_zval primary_key;
423 php5to7_zval clustering_key;
424 php5to7_zval clustering_order;
425 php5to7_zval base_table;
426 php_driver_ref *schema;
427 const CassMaterializedViewMeta *meta;
428 PHP_DRIVER_END_OBJECT_TYPE(materialized_view)
429
430 PHP_DRIVER_BEGIN_OBJECT_TYPE(column)
431 php5to7_zval name;
432 php5to7_zval type;
433 int reversed;
434 int frozen;
435 php_driver_ref *schema;
436 const CassColumnMeta *meta;
437 PHP_DRIVER_END_OBJECT_TYPE(column)
438
439 PHP_DRIVER_BEGIN_OBJECT_TYPE(index)
440 php5to7_zval name;
441 php5to7_zval kind;
442 php5to7_zval target;
443 php5to7_zval options;
444 php_driver_ref *schema;
445 const CassIndexMeta *meta;
446 PHP_DRIVER_END_OBJECT_TYPE(index)
447
448 PHP_DRIVER_BEGIN_OBJECT_TYPE(function)
449 php5to7_zval simple_name;
450 php5to7_zval arguments;
451 php5to7_zval return_type;
452 php5to7_zval signature;
453 php5to7_zval language;
454 php5to7_zval body;
455 php_driver_ref *schema;
456 const CassFunctionMeta *meta;
457 PHP_DRIVER_END_OBJECT_TYPE(function)
458
459 PHP_DRIVER_BEGIN_OBJECT_TYPE(aggregate)
460 php5to7_zval simple_name;
461 php5to7_zval argument_types;
462 php5to7_zval state_function;
463 php5to7_zval final_function;
464 php5to7_zval initial_condition;
465 php5to7_zval state_type;
466 php5to7_zval return_type;
467 php5to7_zval signature;
468 php_driver_ref *schema;
469 const CassAggregateMeta *meta;
470 PHP_DRIVER_END_OBJECT_TYPE(aggregate)
471
472 PHP_DRIVER_BEGIN_OBJECT_TYPE(type)
473 CassValueType type;
474 CassDataType *data_type;
475 union {
476 struct {
477 php5to7_zval value_type;
478 } collection;
479 struct {
480 php5to7_zval value_type;
481 } set;
482 struct {
483 php5to7_zval key_type;
484 php5to7_zval value_type;
485 } map;
486 struct {
487 char *class_name;
488 } custom;
489 struct {
490 char *keyspace;
491 char *type_name;
492 HashTable types;
493 } udt;
494 struct {
495 HashTable types;
496 } tuple;
497 } data;
498 PHP_DRIVER_END_OBJECT_TYPE(type)
499
500 PHP_DRIVER_BEGIN_OBJECT_TYPE(retry_policy)
501 CassRetryPolicy *policy;
502 PHP_DRIVER_END_OBJECT_TYPE(retry_policy)
503
504 PHP_DRIVER_BEGIN_OBJECT_TYPE(timestamp_gen)
505 CassTimestampGen *gen;
506 PHP_DRIVER_END_OBJECT_TYPE(timestamp_gen)
507
508 typedef unsigned (*php_driver_value_hash_t)(zval *obj TSRMLS_DC);
509
510 typedef struct {
511 zend_object_handlers std;
512 php_driver_value_hash_t hash_value;
513 } php_driver_value_handlers;
514
515 extern PHP_DRIVER_API zend_class_entry *php_driver_value_ce;
516 extern PHP_DRIVER_API zend_class_entry *php_driver_numeric_ce;
517 extern PHP_DRIVER_API zend_class_entry *php_driver_bigint_ce;
518 extern PHP_DRIVER_API zend_class_entry *php_driver_smallint_ce;
519 extern PHP_DRIVER_API zend_class_entry *php_driver_tinyint_ce;
520 extern PHP_DRIVER_API zend_class_entry *php_driver_blob_ce;
521 extern PHP_DRIVER_API zend_class_entry *php_driver_decimal_ce;
522 extern PHP_DRIVER_API zend_class_entry *php_driver_float_ce;
523 extern PHP_DRIVER_API zend_class_entry *php_driver_inet_ce;
524 extern PHP_DRIVER_API zend_class_entry *php_driver_timestamp_ce;
525 extern PHP_DRIVER_API zend_class_entry *php_driver_date_ce;
526 extern PHP_DRIVER_API zend_class_entry *php_driver_time_ce;
527 extern PHP_DRIVER_API zend_class_entry *php_driver_uuid_interface_ce;
528 extern PHP_DRIVER_API zend_class_entry *php_driver_uuid_ce;
529 extern PHP_DRIVER_API zend_class_entry *php_driver_timeuuid_ce;
530 extern PHP_DRIVER_API zend_class_entry *php_driver_varint_ce;
531 extern PHP_DRIVER_API zend_class_entry *php_driver_custom_ce;
532 extern PHP_DRIVER_API zend_class_entry *php_driver_duration_ce;
533
534 extern PHP_DRIVER_API zend_class_entry *php_driver_set_ce;
535 extern PHP_DRIVER_API zend_class_entry *php_driver_map_ce;
536 extern PHP_DRIVER_API zend_class_entry *php_driver_collection_ce;
537 extern PHP_DRIVER_API zend_class_entry *php_driver_tuple_ce;
538 extern PHP_DRIVER_API zend_class_entry *php_driver_user_type_value_ce;
539
540 /* Exceptions */
541 void php_driver_define_Exception(TSRMLS_D);
542 void php_driver_define_InvalidArgumentException(TSRMLS_D);
543 void php_driver_define_DomainException(TSRMLS_D);
544 void php_driver_define_LogicException(TSRMLS_D);
545 void php_driver_define_RuntimeException(TSRMLS_D);
546 void php_driver_define_TimeoutException(TSRMLS_D);
547 void php_driver_define_ExecutionException(TSRMLS_D);
548 void php_driver_define_ReadTimeoutException(TSRMLS_D);
549 void php_driver_define_WriteTimeoutException(TSRMLS_D);
550 void php_driver_define_UnavailableException(TSRMLS_D);
551 void php_driver_define_TruncateException(TSRMLS_D);
552 void php_driver_define_ValidationException(TSRMLS_D);
553 void php_driver_define_InvalidQueryException(TSRMLS_D);
554 void php_driver_define_InvalidSyntaxException(TSRMLS_D);
555 void php_driver_define_UnauthorizedException(TSRMLS_D);
556 void php_driver_define_UnpreparedException(TSRMLS_D);
557 void php_driver_define_ConfigurationException(TSRMLS_D);
558 void php_driver_define_AlreadyExistsException(TSRMLS_D);
559 void php_driver_define_AuthenticationException(TSRMLS_D);
560 void php_driver_define_ProtocolException(TSRMLS_D);
561 void php_driver_define_ServerException(TSRMLS_D);
562 void php_driver_define_IsBootstrappingException(TSRMLS_D);
563 void php_driver_define_OverloadedException(TSRMLS_D);
564 void php_driver_define_DivideByZeroException(TSRMLS_D);
565 void php_driver_define_RangeException(TSRMLS_D);
566
567 /* Types */
568 void php_driver_define_Value(TSRMLS_D);
569 void php_driver_define_Numeric(TSRMLS_D);
570 void php_driver_define_Bigint(TSRMLS_D);
571 void php_driver_define_Smallint(TSRMLS_D);
572 void php_driver_define_Tinyint(TSRMLS_D);
573 void php_driver_define_Blob(TSRMLS_D);
574 void php_driver_define_Collection(TSRMLS_D);
575 void php_driver_define_Decimal(TSRMLS_D);
576 void php_driver_define_Float(TSRMLS_D);
577 void php_driver_define_Inet(TSRMLS_D);
578 void php_driver_define_Map(TSRMLS_D);
579 void php_driver_define_Set(TSRMLS_D);
580 void php_driver_define_Timestamp(TSRMLS_D);
581 void php_driver_define_Date(TSRMLS_D);
582 void php_driver_define_Time(TSRMLS_D);
583 void php_driver_define_Tuple(TSRMLS_D);
584 void php_driver_define_UserTypeValue(TSRMLS_D);
585 void php_driver_define_UuidInterface(TSRMLS_D);
586 void php_driver_define_Uuid(TSRMLS_D);
587 void php_driver_define_Timeuuid(TSRMLS_D);
588 void php_driver_define_Varint(TSRMLS_D);
589 void php_driver_define_Custom(TSRMLS_D);
590 void php_driver_define_Duration(TSRMLS_D);
591
592 /* Classes */
593 extern PHP_DRIVER_API zend_class_entry *php_driver_core_ce;
594 extern PHP_DRIVER_API zend_class_entry *php_driver_cluster_ce;
595 extern PHP_DRIVER_API zend_class_entry *php_driver_default_cluster_ce;
596 extern PHP_DRIVER_API zend_class_entry *php_driver_cluster_builder_ce;
597 extern PHP_DRIVER_API zend_class_entry *php_driver_default_cluster_builder_ce;
598 extern PHP_DRIVER_API zend_class_entry *php_driver_ssl_ce;
599 extern PHP_DRIVER_API zend_class_entry *php_driver_ssl_builder_ce;
600 extern PHP_DRIVER_API zend_class_entry *php_driver_future_ce;
601 extern PHP_DRIVER_API zend_class_entry *php_driver_future_prepared_statement_ce;
602 extern PHP_DRIVER_API zend_class_entry *php_driver_future_rows_ce;
603 extern PHP_DRIVER_API zend_class_entry *php_driver_future_session_ce;
604 extern PHP_DRIVER_API zend_class_entry *php_driver_future_value_ce;
605 extern PHP_DRIVER_API zend_class_entry *php_driver_future_close_ce;
606 extern PHP_DRIVER_API zend_class_entry *php_driver_session_ce;
607 extern PHP_DRIVER_API zend_class_entry *php_driver_default_session_ce;
608 extern PHP_DRIVER_API zend_class_entry *php_driver_exception_ce;
609 extern PHP_DRIVER_API zend_class_entry *php_driver_runtime_exception_ce;
610 extern PHP_DRIVER_API zend_class_entry *php_driver_timeout_exception_ce;
611 extern PHP_DRIVER_API zend_class_entry *php_driver_logic_exception_ce;
612 extern PHP_DRIVER_API zend_class_entry *php_driver_domain_exception_ce;
613 extern PHP_DRIVER_API zend_class_entry *php_driver_invalid_argument_exception_ce;
614 extern PHP_DRIVER_API zend_class_entry *php_driver_server_exception_ce;
615 extern PHP_DRIVER_API zend_class_entry *php_driver_overloaded_exception_ce;
616 extern PHP_DRIVER_API zend_class_entry *php_driver_is_bootstrapping_exception_ce;
617 extern PHP_DRIVER_API zend_class_entry *php_driver_execution_exception_ce;
618 extern PHP_DRIVER_API zend_class_entry *php_driver_truncate_exception_ce;
619 extern PHP_DRIVER_API zend_class_entry *php_driver_write_timeout_exception_ce;
620 extern PHP_DRIVER_API zend_class_entry *php_driver_read_timeout_exception_ce;
621 extern PHP_DRIVER_API zend_class_entry *php_driver_truncate_exception_ce;
622 extern PHP_DRIVER_API zend_class_entry *php_driver_unavailable_exception_ce;
623 extern PHP_DRIVER_API zend_class_entry *php_driver_validation_exception_ce;
624 extern PHP_DRIVER_API zend_class_entry *php_driver_invalid_syntax_exception_ce;
625 extern PHP_DRIVER_API zend_class_entry *php_driver_unauthorized_exception_ce;
626 extern PHP_DRIVER_API zend_class_entry *php_driver_invalid_query_exception_ce;
627 extern PHP_DRIVER_API zend_class_entry *php_driver_configuration_exception_ce;
628 extern PHP_DRIVER_API zend_class_entry *php_driver_already_exists_exception_ce;
629 extern PHP_DRIVER_API zend_class_entry *php_driver_unprepared_exception_ce;
630 extern PHP_DRIVER_API zend_class_entry *php_driver_protocol_exception_ce;
631 extern PHP_DRIVER_API zend_class_entry *php_driver_authentication_exception_ce;
632 extern PHP_DRIVER_API zend_class_entry *php_driver_divide_by_zero_exception_ce;
633 extern PHP_DRIVER_API zend_class_entry *php_driver_range_exception_ce;
634
635 extern PHP_DRIVER_API zend_class_entry *php_driver_statement_ce;
636 extern PHP_DRIVER_API zend_class_entry *php_driver_simple_statement_ce;
637 extern PHP_DRIVER_API zend_class_entry *php_driver_prepared_statement_ce;
638 extern PHP_DRIVER_API zend_class_entry *php_driver_batch_statement_ce;
639 extern PHP_DRIVER_API zend_class_entry *php_driver_execution_options_ce;
640 extern PHP_DRIVER_API zend_class_entry *php_driver_rows_ce;
641
642 void php_driver_define_Core(TSRMLS_D);
643 void php_driver_define_Cluster(TSRMLS_D);
644 void php_driver_define_ClusterBuilder(TSRMLS_D);
645 void php_driver_define_DefaultCluster(TSRMLS_D);
646 void php_driver_define_Future(TSRMLS_D);
647 void php_driver_define_FuturePreparedStatement(TSRMLS_D);
648 void php_driver_define_FutureRows(TSRMLS_D);
649 void php_driver_define_FutureSession(TSRMLS_D);
650 void php_driver_define_FutureValue(TSRMLS_D);
651 void php_driver_define_FutureClose(TSRMLS_D);
652 void php_driver_define_Session(TSRMLS_D);
653 void php_driver_define_DefaultSession(TSRMLS_D);
654 void php_driver_define_SSLOptions(TSRMLS_D);
655 void php_driver_define_SSLOptionsBuilder(TSRMLS_D);
656 void php_driver_define_Statement(TSRMLS_D);
657 void php_driver_define_SimpleStatement(TSRMLS_D);
658 void php_driver_define_PreparedStatement(TSRMLS_D);
659 void php_driver_define_BatchStatement(TSRMLS_D);
660 void php_driver_define_ExecutionOptions(TSRMLS_D);
661 void php_driver_define_Rows(TSRMLS_D);
662
663 extern PHP_DRIVER_API zend_class_entry *php_driver_schema_ce;
664 extern PHP_DRIVER_API zend_class_entry *php_driver_default_schema_ce;
665 extern PHP_DRIVER_API zend_class_entry *php_driver_keyspace_ce;
666 extern PHP_DRIVER_API zend_class_entry *php_driver_default_keyspace_ce;
667 extern PHP_DRIVER_API zend_class_entry *php_driver_table_ce;
668 extern PHP_DRIVER_API zend_class_entry *php_driver_default_table_ce;
669 extern PHP_DRIVER_API zend_class_entry *php_driver_column_ce;
670 extern PHP_DRIVER_API zend_class_entry *php_driver_default_column_ce;
671 extern PHP_DRIVER_API zend_class_entry *php_driver_index_ce;
672 extern PHP_DRIVER_API zend_class_entry *php_driver_default_index_ce;
673 extern PHP_DRIVER_API zend_class_entry *php_driver_materialized_view_ce;
674 extern PHP_DRIVER_API zend_class_entry *php_driver_default_materialized_view_ce;
675 extern PHP_DRIVER_API zend_class_entry *php_driver_function_ce;
676 extern PHP_DRIVER_API zend_class_entry *php_driver_default_function_ce;
677 extern PHP_DRIVER_API zend_class_entry *php_driver_aggregate_ce;
678 extern PHP_DRIVER_API zend_class_entry *php_driver_default_aggregate_ce;
679
680 void php_driver_define_Schema(TSRMLS_D);
681 void php_driver_define_DefaultSchema(TSRMLS_D);
682 void php_driver_define_Keyspace(TSRMLS_D);
683 void php_driver_define_DefaultKeyspace(TSRMLS_D);
684 void php_driver_define_Table(TSRMLS_D);
685 void php_driver_define_DefaultTable(TSRMLS_D);
686 void php_driver_define_Column(TSRMLS_D);
687 void php_driver_define_DefaultColumn(TSRMLS_D);
688 void php_driver_define_Index(TSRMLS_D);
689 void php_driver_define_DefaultIndex(TSRMLS_D);
690 void php_driver_define_MaterializedView(TSRMLS_D);
691 void php_driver_define_DefaultMaterializedView(TSRMLS_D);
692 void php_driver_define_Function(TSRMLS_D);
693 void php_driver_define_DefaultFunction(TSRMLS_D);
694 void php_driver_define_Aggregate(TSRMLS_D);
695 void php_driver_define_DefaultAggregate(TSRMLS_D);
696
697 extern PHP_DRIVER_API zend_class_entry *php_driver_type_ce;
698 extern PHP_DRIVER_API zend_class_entry *php_driver_type_scalar_ce;
699 extern PHP_DRIVER_API zend_class_entry *php_driver_type_collection_ce;
700 extern PHP_DRIVER_API zend_class_entry *php_driver_type_set_ce;
701 extern PHP_DRIVER_API zend_class_entry *php_driver_type_map_ce;
702 extern PHP_DRIVER_API zend_class_entry *php_driver_type_tuple_ce;
703 extern PHP_DRIVER_API zend_class_entry *php_driver_type_user_type_ce;
704 extern PHP_DRIVER_API zend_class_entry *php_driver_type_custom_ce;
705
706 void php_driver_define_Type(TSRMLS_D);
707 void php_driver_define_TypeScalar(TSRMLS_D);
708 void php_driver_define_TypeCollection(TSRMLS_D);
709 void php_driver_define_TypeSet(TSRMLS_D);
710 void php_driver_define_TypeMap(TSRMLS_D);
711 void php_driver_define_TypeTuple(TSRMLS_D);
712 void php_driver_define_TypeUserType(TSRMLS_D);
713 void php_driver_define_TypeCustom(TSRMLS_D);
714
715 extern PHP_DRIVER_API zend_class_entry *php_driver_retry_policy_ce;
716 extern PHP_DRIVER_API zend_class_entry *php_driver_retry_policy_default_ce;
717 extern PHP_DRIVER_API zend_class_entry *php_driver_retry_policy_downgrading_consistency_ce;
718 extern PHP_DRIVER_API zend_class_entry *php_driver_retry_policy_fallthrough_ce;
719 extern PHP_DRIVER_API zend_class_entry *php_driver_retry_policy_logging_ce;
720
721 void php_driver_define_RetryPolicy(TSRMLS_D);
722 void php_driver_define_RetryPolicyDefault(TSRMLS_D);
723 void php_driver_define_RetryPolicyDowngradingConsistency(TSRMLS_D);
724 void php_driver_define_RetryPolicyFallthrough(TSRMLS_D);
725 void php_driver_define_RetryPolicyLogging(TSRMLS_D);
726
727 extern PHP_DRIVER_API zend_class_entry *php_driver_timestamp_gen_ce;
728 extern PHP_DRIVER_API zend_class_entry *php_driver_timestamp_gen_monotonic_ce;
729 extern PHP_DRIVER_API zend_class_entry *php_driver_timestamp_gen_server_side_ce;
730
731 void php_driver_define_TimestampGenerator(TSRMLS_D);
732 void php_driver_define_TimestampGeneratorMonotonic(TSRMLS_D);
733 void php_driver_define_TimestampGeneratorServerSide(TSRMLS_D);
734
735 extern int php_le_php_driver_cluster();
736 extern int php_le_php_driver_session();
737
738 #endif /* PHP_DRIVER_TYPES_H */
739