-
Notifications
You must be signed in to change notification settings - Fork 31
/
php_pdo_snowflake_int.h
105 lines (87 loc) · 3.6 KB
/
php_pdo_snowflake_int.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
/* Copyright (c) 2017-2019 Snowflake Computing Inc. All right reserved. */
#ifndef PHP_PDO_SNOWFLAKE_INT_H
#define PHP_PDO_SNOWFLAKE_INT_H
#include <snowflake/client.h>
#include <snowflake/logger.h>
#include "snowflake_paramstore.h"
/**
* PHP PDO Snowflake Driver name
*/
#define PHP_PDO_SNOWFLAKE_NAME "PDO"
#define PDO_LOG_INF(...) sf_log_info(PHP_PDO_SNOWFLAKE_NAME, __VA_ARGS__)
#define PDO_LOG_DBG(...) sf_log_debug(PHP_PDO_SNOWFLAKE_NAME, __VA_ARGS__)
#define PDO_LOG_ERR(...) sf_log_error(PHP_PDO_SNOWFLAKE_NAME, __VA_ARGS__)
#define PDO_LOG_ENTER(func_name) sf_log_trace(PHP_PDO_SNOWFLAKE_NAME, "Entering: %s", func_name)
#define PDO_LOG_RETURN(value) do { sf_log_trace(PHP_PDO_SNOWFLAKE_NAME, "Leaving: %d", value); return (value); } while (0)
/**
* Snowflake module global variables.
*/
ZEND_BEGIN_MODULE_GLOBALS(pdo_snowflake)
char *cacert; /* location of cacert.pem */
char *logdir; /* log directory */
char *loglevel; /* log level */
char *debug; /* debug flag. This dumps all logs on screen */
ZEND_END_MODULE_GLOBALS(pdo_snowflake)
ZEND_EXTERN_MODULE_GLOBALS(pdo_snowflake)
#if (PHP_VERSION_ID >= 70000)
# define PDO_SNOWFLAKE_G(v) ZEND_MODULE_GLOBALS_ACCESSOR(pdo_snowflake, v)
# if defined(ZTS) && defined(COMPILE_DL_PDO_SNOWFLAKE)
ZEND_TSRMLS_CACHE_EXTERN()
# endif
#else
typedef long zend_long;
#endif /* PHP_VERSION_ID */
typedef struct {
char *value;
size_t size;
} pdo_snowflake_string;
typedef struct {
SF_CONNECT *server;
char last_qid[SF_UUID4_LEN];
} pdo_snowflake_db_handle;
typedef struct {
pdo_snowflake_db_handle *H;
SF_STMT *stmt;
void *bound_params;
pdo_snowflake_string *bound_results;
} pdo_snowflake_stmt;
extern pdo_driver_t pdo_snowflake_driver;
extern struct pdo_stmt_methods snowflake_stmt_methods;
extern int
_pdo_snowflake_error(pdo_dbh_t *dbh, pdo_stmt_t *stmt, const char *file,
int line);
extern void *_pdo_snowflake_user_realloc(void* org_ptr, size_t new_size);
extern void *_pdo_snowflake_user_calloc(size_t nitems, size_t size);
extern void *_pdo_snowflake_user_malloc(size_t size);
extern void _pdo_snowflake_user_dealloc(void* ptr);
#define pdo_snowflake_error(d) _pdo_snowflake_error(d, NULL, __FILE__, __LINE__)
#define pdo_snowflake_error_stmt(s) _pdo_snowflake_error(s->dbh, s, __FILE__, __LINE__)
enum {
PDO_SNOWFLAKE_ATTR_SSL_CAPATH = PDO_ATTR_DRIVER_SPECIFIC,
PDO_SNOWFLAKE_ATTR_SSL_VERSION,
PDO_SNOWFLAKE_ATTR_SSL_VERIFY_CERTIFICATE_REVOCATION_STATUS,
PDO_SNOWFLAKE_ATTR_QUERY_ID
};
#define PDO_SNOWFLAKE_CONN_ATTR_HOST_IDX 0
#define PDO_SNOWFLAKE_CONN_ATTR_PORT_IDX 1
#define PDO_SNOWFLAKE_CONN_ATTR_ACCOUNT_IDX 2
#define PDO_SNOWFLAKE_CONN_ATTR_REGION_IDX 3
#define PDO_SNOWFLAKE_CONN_ATTR_DATABASE_IDX 4
#define PDO_SNOWFLAKE_CONN_ATTR_SCHEMA_IDX 5
#define PDO_SNOWFLAKE_CONN_ATTR_WAREHOUSE_IDX 6
#define PDO_SNOWFLAKE_CONN_ATTR_ROLE_IDX 7
#define PDO_SNOWFLAKE_CONN_ATTR_PROTOCOL_IDX 8
#define PDO_SNOWFLAKE_CONN_ATTR_INSECURE_MODE_IDX 9
#define PDO_SNOWFLAKE_CONN_ATTR_TIMEZONE_IDX 10
#define PDO_SNOWFLAKE_CONN_ATTR_APPLICATION_IDX 11
#define PDO_SNOWFLAKE_CONN_ATTR_AUTHENTICATOR_IDX 12
#define PDO_SNOWFLAKE_CONN_ATTR_PRIV_KEY_FILE_IDX 13
#define PDO_SNOWFLAKE_CONN_ATTR_PRIV_KEY_FILE_PWD_IDX 14
#define PDO_SNOWFLAKE_CONN_ATTR_PROXY_IDX 15
#define PDO_SNOWFLAKE_CONN_ATTR_NO_PROXY_IDX 16
#define PDO_SNOWFLAKE_CONN_ATTR_DISABLE_QUERY_CONTEXT_CACHE_IDX 17
#define PDO_SNOWFLAKE_CONN_ATTR_INCLUDE_RETRY_REASON_IDX 18
#define PDO_SNOWFLAKE_CONN_ATTR_LOGIN_TIMEOUT_IDX 19
#define PDO_SNOWFLAKE_CONN_ATTR_MAX_RETRIES_IDX 20
#define PDO_SNOWFLAKE_CONN_ATTR_RETRY_TIMEOUT_IDX 21
#endif /* PHP_PDO_SNOWFLAKE_INT_H */