DBD-SQLcipher
view release on metacpan or search on metacpan
#define PERL_NO_GET_CONTEXT
#define NEED_newSVpvn_flags
#define NEED_sv_2pvbyte
#include "SQLcipherXS.h"
START_MY_CXT;
DBISTATE_DECLARE;
#define SvPV_nolen_undef_ok(x) (SvOK(x) ? SvPV_nolen(x) : "undef")
/*-----------------------------------------------------*
* Debug Macros
*-----------------------------------------------------*/
#undef DBD_SQLITE_CROAK_DEBUG
#ifdef DBD_SQLITE_CROAK_DEBUG
#define croak_if_db_is_null() if (!imp_dbh->db) croak("imp_dbh->db is NULL at line %d in %s", __LINE__, __FILE__)
#define croak_if_stmt_is_null() if (!imp_sth->stmt) croak("imp_sth->stmt is NULL at line %d in %s", __LINE__, __FILE__)
#else
#define croak_if_db_is_null()
#define croak_if_stmt_is_null()
#endif
/*-----------------------------------------------------*
* Helper Methods
*-----------------------------------------------------*/
#define sqlite_error(h,rc,what) _sqlite_error(aTHX_ __FILE__, __LINE__, h, rc, what)
#define sqlite_trace(h,xxh,level,what) if ( DBIc_TRACE_LEVEL((imp_xxh_t*)xxh) >= level ) _sqlite_trace(aTHX_ __FILE__, __LINE__, h, (imp_xxh_t*)xxh, what)
#define sqlite_exec(h,sql) _sqlite_exec(aTHX_ h, imp_dbh->db, sql)
#define sqlite_open(dbname,db) _sqlite_open(aTHX_ dbh, dbname, db, 0, 0)
#define sqlite_open2(dbname,db,flags,extended) _sqlite_open(aTHX_ dbh, dbname, db, flags, extended)
#define _isspace(c) (c == ' ' || c == '\t' || c == '\n' || c == '\r' || c == '\v' || c == '\f')
#define _skip_whitespaces(sql) \
while ( _isspace(sql[0]) || (sql[0] == '-' && sql[1] == '-')) { \
if ( _isspace(sql[0]) ) { \
while ( _isspace(sql[0]) ) sql++; \
continue; \
} \
else if (sql[0] == '-') { \
while ( sql[0] != 0 && sql[0] != '\n' ) sql++; \
continue; \
} \
}
bool
_starts_with_begin(const char *sql) {
return (
(sql[0] == 'B' || sql[0] == 'b') &&
(sql[1] == 'E' || sql[1] == 'e') &&
(sql[2] == 'G' || sql[2] == 'g') &&
(sql[3] == 'I' || sql[3] == 'i') &&
(sql[4] == 'N' || sql[4] == 'n')
) ? TRUE : FALSE;
}
bool
_starts_with_commit(const char *sql) {
return (
((sql[0] == 'C' || sql[0] == 'c') &&
(sql[1] == 'O' || sql[1] == 'o') &&
(sql[2] == 'M' || sql[2] == 'm') &&
(sql[3] == 'M' || sql[3] == 'm') &&
(sql[4] == 'I' || sql[4] == 'i') &&
(sql[5] == 'T' || sql[5] == 't')) ||
((sql[0] == 'E' || sql[0] == 'e') &&
(sql[1] == 'N' || sql[1] == 'n') &&
(sql[2] == 'D' || sql[2] == 'd'))
) ? TRUE : FALSE;
( run in 0.381 second using v1.01-cache-2.11-cpan-bbe5e583499 )