dbdimp.h

filter: Statementstmt 0.0% 0 / 9 Branchbran n/a Conditioncond n/a MC/DCmcdc n/a Subroutinesub n/a Podpod n/a totaltotal 0.0% 0 / 9 CC 0 SCAR 0
CC
0
Cov
0%
CRAP 0
« blib/lib/DBD/SQLeet.pm ↑ Summary dbdimp_virtual_table.inc »
1  
2 #ifndef _DBDIMP_H
3 #define _DBDIMP_H 1
4  
5 #include "SQLeetXS.h"
6 #include "sqlite3.h"
7  
8 #define MY_CXT_KEY "DBD::SQLeet::_guts" XS_VERSION
9  
10 typedef struct {
11 int last_dbh_is_unicode;
12 } my_cxt_t;
13  
14 #define PERL_UNICODE_DOES_NOT_WORK_WELL \
15 (PERL_REVISION <= 5) && ((PERL_VERSION < 8) \
16 || (PERL_VERSION == 8 && PERL_SUBVERSION < 5))
17  
18 /* 30 second timeout by default */
19 #define SQL_TIMEOUT 30000
20  
21 #ifndef sqlite3_int64
22 #define sqlite3_int64 sqlite_int64
23 #endif
24  
25 /* A linked list of statements prepared by this module */
26 typedef struct stmt_list_s stmt_list_s;
27  
28 struct stmt_list_s {
29 sqlite3_stmt * stmt;
30 stmt_list_s * prev;
31 };
32  
33 /* Driver Handle */
34 struct imp_drh_st {
35 dbih_drc_t com;
36 /* sqlite specific bits */
37 };
38  
39 /* Database Handle */
40 struct imp_dbh_st {
41 dbih_dbc_t com;
42 /* sqlite specific bits */
43 sqlite3 *db;
44 bool unicode;
45 bool handle_binary_nulls;
46 int timeout;
47 AV *functions;
48 AV *aggregates;
49 SV *collation_needed_callback;
50 bool allow_multiple_statements;
51 bool use_immediate_transaction;
52 bool see_if_its_a_number;
53 int extended_result_codes;
54 stmt_list_s * stmt_list;
55 bool began_transaction;
56 };
57  
58 /* Statement Handle */
59 struct imp_sth_st {
60 dbih_stc_t com;
61 /* sqlite specific bits */
62 sqlite3_stmt *stmt;
63 /*
64 char **results;
65 char **coldata;
66 */
67 int retval;
68 int nrow;
69 AV *params;
70 AV *col_types;
71 const char *unprepared_statements;
72 };
73  
74 #define dbd_init sqlite_init
75 #define dbd_discon_all sqlite_discon_all
76 #define dbd_db_login6 sqlite_db_login6
77 #define dbd_db_commit sqlite_db_commit
78 #define dbd_db_rollback sqlite_db_rollback
79 #define dbd_db_disconnect sqlite_db_disconnect
80 #define dbd_db_destroy sqlite_db_destroy
81 #define dbd_db_STORE_attrib sqlite_db_STORE_attrib
82 #define dbd_db_FETCH_attrib sqlite_db_FETCH_attrib
83 #define dbd_db_last_insert_id sqlite_db_last_insert_id
84 #define dbd_st_prepare_sv sqlite_st_prepare_sv
85 #define dbd_st_rows sqlite_st_rows
86 #define dbd_st_execute sqlite_st_execute
87 #define dbd_st_fetch sqlite_st_fetch
88 #define dbd_st_finish3 sqlite_st_finish3
89 #define dbd_st_finish sqlite_st_finish
90 #define dbd_st_destroy sqlite_st_destroy
91 #define dbd_st_blob_read sqlite_st_blob_read
92 #define dbd_st_STORE_attrib sqlite_st_STORE_attrib
93 #define dbd_st_FETCH_attrib sqlite_st_FETCH_attrib
94 #define dbd_bind_ph sqlite_bind_ph
95 #define dbd_st_bind_col sqlite_bind_col
96  
97 typedef struct aggrInfo aggrInfo;
98 struct aggrInfo {
99 SV *aggr_inst;
100 SV *err;
101 int inited;
102 };
103  
104  
105 int sqlite_db_create_function(pTHX_ SV *dbh, const char *name, int argc, SV *func, int flags);
106  
107 #ifndef SQLITE_OMIT_LOAD_EXTENSION
108 int sqlite_db_enable_load_extension(pTHX_ SV *dbh, int onoff);
109 int sqlite_db_load_extension(pTHX_ SV *dbh, const char *file, const char *proc);
110 #endif
111  
112 int sqlite_db_create_aggregate(pTHX_ SV *dbh, const char *name, int argc, SV *aggr, int flags );
113 int sqlite_db_create_collation(pTHX_ SV *dbh, const char *name, SV *func);
114 int sqlite_db_progress_handler(pTHX_ SV *dbh, int n_opcodes, SV *handler);
115 int sqlite_bind_col( SV *sth, imp_sth_t *imp_sth, SV *col, SV *ref, IV sql_type, SV *attribs );
116 int sqlite_db_busy_timeout (pTHX_ SV *dbh, SV *timeout );
117 int sqlite_db_backup_from_file(pTHX_ SV *dbh, char *filename);
118 int sqlite_db_backup_to_file(pTHX_ SV *dbh, char *filename);
119 void sqlite_db_collation_needed(pTHX_ SV *dbh, SV *callback );
120 SV* sqlite_db_commit_hook( pTHX_ SV *dbh, SV *hook );
121 SV* sqlite_db_rollback_hook( pTHX_ SV *dbh, SV *hook );
122 SV* sqlite_db_update_hook( pTHX_ SV *dbh, SV *hook );
123 int sqlite_db_set_authorizer( pTHX_ SV *dbh, SV *authorizer );
124 AV* sqlite_compile_options();
125 int sqlite_db_trace(pTHX_ SV *dbh, SV *func);
126 int sqlite_db_profile(pTHX_ SV *dbh, SV *func);
127 HV* sqlite_db_table_column_metadata(pTHX_ SV *dbh, SV *dbname, SV *tablename, SV *columnname);
128 HV* _sqlite_db_status(pTHX_ SV *dbh, int reset);
129 SV* sqlite_db_filename(pTHX_ SV *dbh);
130 int sqlite_db_register_fts3_perl_tokenizer(pTHX_ SV *dbh);
131 HV* _sqlite_status(int reset);
132 HV* _sqlite_st_status(pTHX_ SV *sth, int reset);
133 int sqlite_db_create_module(pTHX_ SV *dbh, const char *name, const char *perl_class);
134 int sqlite_db_do_sv(SV *dbh, imp_dbh_t *imp_dbh, SV *sv_statement);
135 void init_cxt();
136  
137  
138 #ifdef SvUTF8_on
139  
140 static SV *
141 0 newUTF8SVpv(char *s, STRLEN len) {
142 dTHX;
143 register SV *sv;
144  
145 0 sv = newSVpv(s, len);
146 0 SvUTF8_on(sv);
147 0 return sv;
148 }
149  
150 static SV *
151 0 newUTF8SVpvn(char *s, STRLEN len) {
152 dTHX;
153 register SV *sv;
154  
155 0 sv = newSV(0);
156 0 sv_setpvn(sv, s, len);
157 0 SvUTF8_on(sv);
158 0 return sv;
159 }
160  
161 #else /* #ifdef SvUTF8_on */
162  
163 #define newUTF8SVpv newSVpv
164 #define newUTF8SVpvn newSVpvn
165 #define SvUTF8_on(a) (a)
166 #define SvUTF8_off(a) (a)
167 #define sv_utf8_upgrade(a) (a)
168  
169 #endif /* #ifdef SvUTF8_on */
170  
171 #ifdef _MSC_VER
172 # define atoll _atoi64
173 #endif
174  
175 #endif /* #ifndef _DBDIMP_H */
« blib/lib/DBD/SQLeet.pm ↑ Summary dbdimp_virtual_table.inc »