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/SQLite/VirtualTable.pm ↑ Summary constants.inc »
1  
2 #ifndef _DBDIMP_H
3 #define _DBDIMP_H 1
4  
5 #include "SQLiteXS.h"
6 #include "sqlite3.h"
7  
8 #define MY_CXT_KEY "DBD::SQLite::_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 bool prefer_numeric_type;
57 };
58  
59 /* Statement Handle */
60 struct imp_sth_st {
61 dbih_stc_t com;
62 /* sqlite specific bits */
63 sqlite3_stmt *stmt;
64 /*
65 char **results;
66 char **coldata;
67 */
68 int retval;
69 int nrow;
70 AV *params;
71 AV *col_types;
72 const char *unprepared_statements;
73 };
74  
75 #define dbd_init sqlite_init
76 #define dbd_discon_all sqlite_discon_all
77 #define dbd_db_login6 sqlite_db_login6
78 #define dbd_db_commit sqlite_db_commit
79 #define dbd_db_rollback sqlite_db_rollback
80 #define dbd_db_disconnect sqlite_db_disconnect
81 #define dbd_db_destroy sqlite_db_destroy
82 #define dbd_db_STORE_attrib sqlite_db_STORE_attrib
83 #define dbd_db_FETCH_attrib sqlite_db_FETCH_attrib
84 #define dbd_db_last_insert_id sqlite_db_last_insert_id
85 #define dbd_st_prepare_sv sqlite_st_prepare_sv
86 #define dbd_st_rows sqlite_st_rows
87 #define dbd_st_execute sqlite_st_execute
88 #define dbd_st_fetch sqlite_st_fetch
89 #define dbd_st_finish3 sqlite_st_finish3
90 #define dbd_st_finish sqlite_st_finish
91 #define dbd_st_destroy sqlite_st_destroy
92 #define dbd_st_blob_read sqlite_st_blob_read
93 #define dbd_st_STORE_attrib sqlite_st_STORE_attrib
94 #define dbd_st_FETCH_attrib sqlite_st_FETCH_attrib
95 #define dbd_bind_ph sqlite_bind_ph
96 #define dbd_st_bind_col sqlite_bind_col
97  
98 typedef struct aggrInfo aggrInfo;
99 struct aggrInfo {
100 SV *aggr_inst;
101 SV *err;
102 int inited;
103 };
104  
105  
106 int sqlite_db_create_function(pTHX_ SV *dbh, const char *name, int argc, SV *func, int flags);
107  
108 #ifndef SQLITE_OMIT_LOAD_EXTENSION
109 int sqlite_db_enable_load_extension(pTHX_ SV *dbh, int onoff);
110 int sqlite_db_load_extension(pTHX_ SV *dbh, const char *file, const char *proc);
111 #endif
112  
113 int sqlite_db_create_aggregate(pTHX_ SV *dbh, const char *name, int argc, SV *aggr, int flags );
114 int sqlite_db_create_collation(pTHX_ SV *dbh, const char *name, SV *func);
115 int sqlite_db_progress_handler(pTHX_ SV *dbh, int n_opcodes, SV *handler);
116 int sqlite_bind_col( SV *sth, imp_sth_t *imp_sth, SV *col, SV *ref, IV sql_type, SV *attribs );
117 int sqlite_db_busy_timeout (pTHX_ SV *dbh, SV *timeout );
118 int sqlite_db_backup_from_file(pTHX_ SV *dbh, char *filename);
119 int sqlite_db_backup_to_file(pTHX_ SV *dbh, char *filename);
120 int sqlite_db_backup_from_dbh(pTHX_ SV *dbh, SV *from);
121 int sqlite_db_backup_to_dbh(pTHX_ SV *dbh, SV *to);
122 void sqlite_db_collation_needed(pTHX_ SV *dbh, SV *callback );
123 SV* sqlite_db_commit_hook( pTHX_ SV *dbh, SV *hook );
124 SV* sqlite_db_rollback_hook( pTHX_ SV *dbh, SV *hook );
125 SV* sqlite_db_update_hook( pTHX_ SV *dbh, SV *hook );
126 int sqlite_db_set_authorizer( pTHX_ SV *dbh, SV *authorizer );
127 AV* sqlite_compile_options();
128 int sqlite_db_trace(pTHX_ SV *dbh, SV *func);
129 int sqlite_db_profile(pTHX_ SV *dbh, SV *func);
130 HV* sqlite_db_table_column_metadata(pTHX_ SV *dbh, SV *dbname, SV *tablename, SV *columnname);
131 HV* _sqlite_db_status(pTHX_ SV *dbh, int reset);
132 SV* sqlite_db_filename(pTHX_ SV *dbh);
133 int sqlite_db_register_fts3_perl_tokenizer(pTHX_ SV *dbh);
134 HV* _sqlite_status(int reset);
135 HV* _sqlite_st_status(pTHX_ SV *sth, int reset);
136 int sqlite_db_create_module(pTHX_ SV *dbh, const char *name, const char *perl_class);
137 int sqlite_db_limit(pTHX_ SV *dbh, int id, int new_value);
138 int sqlite_db_config(pTHX_ SV *dbh, int id, int new_value);
139 int sqlite_db_do_sv(SV *dbh, imp_dbh_t *imp_dbh, SV *sv_statement);
140 void init_cxt();
141  
142  
143 #ifdef SvUTF8_on
144  
145 static SV *
146 0 newUTF8SVpv(char *s, STRLEN len) {
147 dTHX;
148 register SV *sv;
149  
150 0 sv = newSVpv(s, len);
151 0 SvUTF8_on(sv);
152 0 return sv;
153 }
154  
155 static SV *
156 0 newUTF8SVpvn(char *s, STRLEN len) {
157 dTHX;
158 register SV *sv;
159  
160 0 sv = newSV(0);
161 0 sv_setpvn(sv, s, len);
162 0 SvUTF8_on(sv);
163 0 return sv;
164 }
165  
166 #else /* #ifdef SvUTF8_on */
167  
168 #define newUTF8SVpv newSVpv
169 #define newUTF8SVpvn newSVpvn
170 #define SvUTF8_on(a) (a)
171 #define SvUTF8_off(a) (a)
172 #define sv_utf8_upgrade(a) (a)
173  
174 #endif /* #ifdef SvUTF8_on */
175  
176 #ifdef _MSC_VER
177 # define atoll _atoi64
178 #endif
179  
180 #endif /* #ifndef _DBDIMP_H */
« blib/lib/DBD/SQLite/VirtualTable.pm ↑ Summary constants.inc »