mirror of
https://github.com/DBD-SQLite/DBD-SQLite
synced 2025-06-07 22:28:47 -04:00
DBD::SQLite: type casts can be done in the macros
This commit is contained in:
parent
90b890264c
commit
1de89394b9
1 changed files with 55 additions and 55 deletions
110
dbdimp.c
110
dbdimp.c
|
@ -6,8 +6,8 @@ DBISTATE_DECLARE;
|
|||
|
||||
#define SvPV_nolen_undef_ok(x) (SvOK(x) ? SvPV_nolen(x) : "undef")
|
||||
|
||||
#define sqlite_error(h,xxh,rc,what) _sqlite_error(aTHX_ __FILE__, __LINE__, h, xxh, rc, what)
|
||||
#define sqlite_trace(h,xxh,level,what) if ( DBIc_TRACE_LEVEL(xxh) >= level ) _sqlite_trace(aTHX_ __FILE__, __LINE__, h, xxh, what)
|
||||
#define sqlite_error(h,xxh,rc,what) _sqlite_error(aTHX_ __FILE__, __LINE__, h, (imp_xxh_t*)xxh, 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)
|
||||
|
||||
void
|
||||
sqlite_init(dbistate_t *dbistate)
|
||||
|
@ -48,11 +48,11 @@ sqlite_db_login(SV *dbh, imp_dbh_t *imp_dbh, char *dbname, char *user, char *pas
|
|||
int rc;
|
||||
char *errmsg = NULL;
|
||||
|
||||
sqlite_trace(dbh, (imp_xxh_t*)imp_dbh, 3, form("login '%s' (version %s)", dbname, sqlite3_version));
|
||||
sqlite_trace(dbh, imp_dbh, 3, form("login '%s' (version %s)", dbname, sqlite3_version));
|
||||
|
||||
rc = sqlite3_open(dbname, &(imp_dbh->db));
|
||||
if ( rc != SQLITE_OK ) {
|
||||
sqlite_error(dbh, (imp_xxh_t*)imp_dbh, rc, (char*)sqlite3_errmsg(imp_dbh->db));
|
||||
sqlite_error(dbh, imp_dbh, rc, (char*)sqlite3_errmsg(imp_dbh->db));
|
||||
if (imp_dbh->db) {
|
||||
/* close the handle anyway */
|
||||
sqlite3_close(imp_dbh->db);
|
||||
|
@ -73,7 +73,7 @@ sqlite_db_login(SV *dbh, imp_dbh_t *imp_dbh, char *dbname, char *user, char *pas
|
|||
rc = sqlite3_exec(imp_dbh->db, "PRAGMA empty_result_callbacks = ON", NULL, NULL, &errmsg);
|
||||
if ( rc != SQLITE_OK ) {
|
||||
/* warn("failed to set pragma: %s\n", errmsg); */
|
||||
sqlite_error(dbh, (imp_xxh_t*)imp_dbh, rc, errmsg);
|
||||
sqlite_error(dbh, imp_dbh, rc, errmsg);
|
||||
if (errmsg) sqlite3_free(errmsg);
|
||||
sqlite3_close(imp_dbh->db); /* we don't use this handle */
|
||||
return FALSE; /* -> undef in lib/DBD/SQLite.pm */
|
||||
|
@ -82,7 +82,7 @@ sqlite_db_login(SV *dbh, imp_dbh_t *imp_dbh, char *dbname, char *user, char *pas
|
|||
rc = sqlite3_exec(imp_dbh->db, "PRAGMA show_datatypes = ON", NULL, NULL, &errmsg);
|
||||
if ( rc != SQLITE_OK ) {
|
||||
/* warn("failed to set pragma: %s\n", errmsg); */
|
||||
sqlite_error(dbh, (imp_xxh_t*)imp_dbh, rc, errmsg);
|
||||
sqlite_error(dbh, imp_dbh, rc, errmsg);
|
||||
if (errmsg) sqlite3_free(errmsg);
|
||||
sqlite3_close(imp_dbh->db); /* we don't use this handle */
|
||||
return FALSE; /* -> undef in lib/DBD/SQLite.pm */
|
||||
|
@ -158,7 +158,7 @@ sqlite_db_disconnect(SV *dbh, imp_dbh_t *imp_dbh)
|
|||
** is not finished. We may need to wait for a while if
|
||||
** we get SQLITE_BUSY...
|
||||
*/
|
||||
sqlite_error(dbh, (imp_xxh_t*)imp_dbh, rc, (char*)sqlite3_errmsg(imp_dbh->db));
|
||||
sqlite_error(dbh, imp_dbh, rc, (char*)sqlite3_errmsg(imp_dbh->db));
|
||||
}
|
||||
}
|
||||
imp_dbh->db = NULL;
|
||||
|
@ -207,11 +207,11 @@ sqlite_db_rollback(SV *dbh, imp_dbh_t *imp_dbh)
|
|||
|
||||
if (!sqlite3_get_autocommit(imp_dbh->db)) {
|
||||
|
||||
sqlite_trace(dbh, (imp_xxh_t*)imp_dbh, 2, "ROLLBACK TRAN");
|
||||
sqlite_trace(dbh, imp_dbh, 2, "ROLLBACK TRAN");
|
||||
|
||||
rc = sqlite3_exec(imp_dbh->db, "ROLLBACK TRANSACTION", NULL, NULL, &errmsg);
|
||||
if (rc != SQLITE_OK) {
|
||||
sqlite_error(dbh, (imp_xxh_t*)imp_dbh, rc, errmsg);
|
||||
sqlite_error(dbh, imp_dbh, rc, errmsg);
|
||||
if (errmsg) sqlite3_free(errmsg);
|
||||
return FALSE; /* -> &sv_no in SQLite.xsi */
|
||||
}
|
||||
|
@ -238,11 +238,11 @@ sqlite_db_commit(SV *dbh, imp_dbh_t *imp_dbh)
|
|||
}
|
||||
|
||||
if (!sqlite3_get_autocommit(imp_dbh->db)) {
|
||||
sqlite_trace(dbh, (imp_xxh_t*)imp_dbh, 2, "COMMIT TRAN");
|
||||
sqlite_trace(dbh, imp_dbh, 2, "COMMIT TRAN");
|
||||
|
||||
rc = sqlite3_exec(imp_dbh->db, "COMMIT TRANSACTION", NULL, NULL, &errmsg);
|
||||
if (rc != SQLITE_OK) {
|
||||
sqlite_error(dbh, (imp_xxh_t*)imp_dbh, rc, errmsg);
|
||||
sqlite_error(dbh, imp_dbh, rc, errmsg);
|
||||
if (errmsg) sqlite3_free(errmsg);
|
||||
return FALSE; /* -> &sv_no in SQLite.xsi */
|
||||
}
|
||||
|
@ -274,16 +274,16 @@ sqlite_st_prepare(SV *sth, imp_sth_t *imp_sth, char *statement, SV *attribs)
|
|||
D_imp_dbh_from_sth;
|
||||
|
||||
if (!DBIc_ACTIVE(imp_dbh)) {
|
||||
sqlite_error(sth, (imp_xxh_t*)imp_sth, -2, "attempt to prepare on inactive database handle");
|
||||
sqlite_error(sth, imp_sth, -2, "attempt to prepare on inactive database handle");
|
||||
return FALSE; /* -> undef in lib/DBD/SQLite.pm */
|
||||
}
|
||||
|
||||
if (*statement == '\0') {
|
||||
sqlite_error(sth, (imp_xxh_t*)imp_sth, -2, "attempt to prepare empty statement");
|
||||
sqlite_error(sth, imp_sth, -2, "attempt to prepare empty statement");
|
||||
return FALSE; /* -> undef in lib/DBD/SQLite.pm */
|
||||
}
|
||||
|
||||
sqlite_trace(sth, (imp_xxh_t*)imp_sth, 2, form("prepare statement: %s", statement));
|
||||
sqlite_trace(sth, imp_sth, 2, form("prepare statement: %s", statement));
|
||||
imp_sth->nrow = -1;
|
||||
imp_sth->retval = SQLITE_OK;
|
||||
imp_sth->params = newAV();
|
||||
|
@ -291,11 +291,11 @@ sqlite_st_prepare(SV *sth, imp_sth_t *imp_sth, char *statement, SV *attribs)
|
|||
|
||||
rc = sqlite3_prepare_v2(imp_dbh->db, statement, -1, &(imp_sth->stmt), &extra);
|
||||
if (rc != SQLITE_OK) {
|
||||
sqlite_error(sth, (imp_xxh_t*)imp_sth, rc, (char*)sqlite3_errmsg(imp_dbh->db));
|
||||
sqlite_error(sth, imp_sth, rc, (char*)sqlite3_errmsg(imp_dbh->db));
|
||||
if (imp_sth->stmt) {
|
||||
rc = sqlite3_finalize(imp_sth->stmt);
|
||||
if (rc != SQLITE_OK) {
|
||||
sqlite_error(sth, (imp_xxh_t*)imp_sth, rc, (char*)sqlite3_errmsg(imp_dbh->db));
|
||||
sqlite_error(sth, imp_sth, rc, (char*)sqlite3_errmsg(imp_dbh->db));
|
||||
}
|
||||
}
|
||||
return FALSE; /* -> undef in lib/DBD/SQLite.pm */
|
||||
|
@ -322,19 +322,19 @@ sqlite_st_execute(SV *sth, imp_sth_t *imp_sth)
|
|||
int num_params = DBIc_NUM_PARAMS(imp_sth);
|
||||
int i;
|
||||
|
||||
sqlite_trace(sth, (imp_xxh_t*)imp_sth, 3, "execute");
|
||||
sqlite_trace(sth, imp_sth, 3, "execute");
|
||||
|
||||
if (!DBIc_ACTIVE(imp_dbh)) {
|
||||
sqlite_error(sth, (imp_xxh_t*)imp_sth, -2, "attempt to execute on inactive database handle");
|
||||
sqlite_error(sth, imp_sth, -2, "attempt to execute on inactive database handle");
|
||||
return -2; /* -> undef in SQLite.xsi */
|
||||
}
|
||||
|
||||
if (DBIc_ACTIVE(imp_sth)) {
|
||||
sqlite_trace(sth, (imp_xxh_t*)imp_sth, 3, "execute still active, reset");
|
||||
sqlite_trace(sth, imp_sth, 3, "execute still active, reset");
|
||||
imp_sth->retval = sqlite3_reset(imp_sth->stmt);
|
||||
if (imp_sth->retval != SQLITE_OK) {
|
||||
char *errmsg = (char*)sqlite3_errmsg(imp_dbh->db);
|
||||
sqlite_error(sth, (imp_xxh_t*)imp_sth, imp_sth->retval, errmsg);
|
||||
sqlite_error(sth, imp_sth, imp_sth->retval, errmsg);
|
||||
return -2; /* -> undef in SQLite.xsi */
|
||||
}
|
||||
}
|
||||
|
@ -344,11 +344,11 @@ sqlite_st_execute(SV *sth, imp_sth_t *imp_sth)
|
|||
SV *sql_type_sv = av_shift(imp_sth->params);
|
||||
int sql_type = SvIV(sql_type_sv);
|
||||
|
||||
sqlite_trace(sth, (imp_xxh_t*)imp_sth, 4, form("params left in 0x%p: %d", imp_sth->params, 1+av_len(imp_sth->params)));
|
||||
sqlite_trace(sth, (imp_xxh_t*)imp_sth, 4, form("bind %d type %d as %s", i, sql_type, SvPV_nolen_undef_ok(value)));
|
||||
sqlite_trace(sth, imp_sth, 4, form("params left in 0x%p: %d", imp_sth->params, 1+av_len(imp_sth->params)));
|
||||
sqlite_trace(sth, imp_sth, 4, form("bind %d type %d as %s", i, sql_type, SvPV_nolen_undef_ok(value)));
|
||||
|
||||
if (!SvOK(value)) {
|
||||
sqlite_trace(sth, (imp_xxh_t*)imp_sth, 5, "binding null");
|
||||
sqlite_trace(sth, imp_sth, 5, "binding null");
|
||||
rc = sqlite3_bind_null(imp_sth->stmt, i+1);
|
||||
}
|
||||
else if (sql_type >= SQL_NUMERIC && sql_type <= SQL_SMALLINT) {
|
||||
|
@ -399,16 +399,16 @@ sqlite_st_execute(SV *sth, imp_sth_t *imp_sth)
|
|||
}
|
||||
SvREFCNT_dec(sql_type_sv);
|
||||
if (rc != SQLITE_OK) {
|
||||
sqlite_error(sth, (imp_xxh_t*)imp_sth, rc, (char*)sqlite3_errmsg(imp_dbh->db));
|
||||
sqlite_error(sth, imp_sth, rc, (char*)sqlite3_errmsg(imp_dbh->db));
|
||||
return -4; /* -> undef in SQLite.xsi */
|
||||
}
|
||||
}
|
||||
|
||||
if ( (!DBIc_is(imp_dbh, DBIcf_AutoCommit)) && (sqlite3_get_autocommit(imp_dbh->db)) ) {
|
||||
sqlite_trace(sth, (imp_xxh_t*)imp_sth, 2, "BEGIN TRAN");
|
||||
sqlite_trace(sth, imp_sth, 2, "BEGIN TRAN");
|
||||
rc = sqlite3_exec(imp_dbh->db, "BEGIN TRANSACTION", NULL, NULL, &errmsg);
|
||||
if (rc != SQLITE_OK) {
|
||||
sqlite_error(sth, (imp_xxh_t*)imp_sth, rc, errmsg);
|
||||
sqlite_error(sth, imp_sth, rc, errmsg);
|
||||
if (errmsg) sqlite3_free(errmsg);
|
||||
return -2; /* -> undef in SQLite.xsi */
|
||||
}
|
||||
|
@ -416,15 +416,15 @@ sqlite_st_execute(SV *sth, imp_sth_t *imp_sth)
|
|||
|
||||
imp_sth->nrow = 0;
|
||||
|
||||
sqlite_trace(sth, (imp_xxh_t*)imp_sth, 3, form("Execute returned %d cols", DBIc_NUM_FIELDS(imp_sth)));
|
||||
sqlite_trace(sth, imp_sth, 3, form("Execute returned %d cols", DBIc_NUM_FIELDS(imp_sth)));
|
||||
if (DBIc_NUM_FIELDS(imp_sth) == 0) {
|
||||
while ((imp_sth->retval = sqlite3_step(imp_sth->stmt)) != SQLITE_DONE) {
|
||||
if (imp_sth->retval == SQLITE_ROW) {
|
||||
continue;
|
||||
}
|
||||
sqlite_error(sth, (imp_xxh_t*)imp_sth, imp_sth->retval, (char*)sqlite3_errmsg(imp_dbh->db));
|
||||
sqlite_error(sth, imp_sth, imp_sth->retval, (char*)sqlite3_errmsg(imp_dbh->db));
|
||||
if (sqlite3_reset(imp_sth->stmt) != SQLITE_OK) {
|
||||
sqlite_error(sth, (imp_xxh_t*)imp_sth, imp_sth->retval, (char*)sqlite3_errmsg(imp_dbh->db));
|
||||
sqlite_error(sth, imp_sth, imp_sth->retval, (char*)sqlite3_errmsg(imp_dbh->db));
|
||||
}
|
||||
return -5; /* -> undef in SQLite.xsi */
|
||||
}
|
||||
|
@ -441,11 +441,11 @@ sqlite_st_execute(SV *sth, imp_sth_t *imp_sth)
|
|||
switch (imp_sth->retval) {
|
||||
case SQLITE_ROW:
|
||||
case SQLITE_DONE: DBIc_ACTIVE_on(imp_sth);
|
||||
sqlite_trace(sth, (imp_xxh_t*)imp_sth, 5, form("exec ok - %d rows, %d cols", imp_sth->nrow, DBIc_NUM_FIELDS(imp_sth)));
|
||||
sqlite_trace(sth, imp_sth, 5, form("exec ok - %d rows, %d cols", imp_sth->nrow, DBIc_NUM_FIELDS(imp_sth)));
|
||||
return 0; /* -> '0E0' in SQLite.xsi */
|
||||
default: sqlite_error(sth, (imp_xxh_t*)imp_sth, imp_sth->retval, (char*)sqlite3_errmsg(imp_dbh->db));
|
||||
default: sqlite_error(sth, imp_sth, imp_sth->retval, (char*)sqlite3_errmsg(imp_dbh->db));
|
||||
if (sqlite3_reset(imp_sth->stmt) != SQLITE_OK) {
|
||||
sqlite_error(sth, (imp_xxh_t*)imp_sth, imp_sth->retval, (char*)sqlite3_errmsg(imp_dbh->db));
|
||||
sqlite_error(sth, imp_sth, imp_sth->retval, (char*)sqlite3_errmsg(imp_dbh->db));
|
||||
}
|
||||
imp_sth->stmt = NULL;
|
||||
return -6; /* -> undef in SQLite.xsi */
|
||||
|
@ -478,24 +478,24 @@ sqlite_bind_ph(SV *sth, imp_sth_t *imp_sth,
|
|||
pos = sqlite3_bind_parameter_index(imp_sth->stmt, paramstring);
|
||||
if (pos == 0) {
|
||||
char* const errmsg = form("Unknown named parameter: %s", paramstring);
|
||||
sqlite_error(sth, (imp_xxh_t*)imp_sth, -2, errmsg);
|
||||
sqlite_error(sth, imp_sth, -2, errmsg);
|
||||
return FALSE; /* -> &sv_no in SQLite.xsi */
|
||||
}
|
||||
pos = 2 * (pos - 1);
|
||||
}
|
||||
else {
|
||||
sqlite_error(sth, (imp_xxh_t*)imp_sth, -2, "<param> could not be coerced to a C string");
|
||||
sqlite_error(sth, imp_sth, -2, "<param> could not be coerced to a C string");
|
||||
return FALSE; /* -> &sv_no in SQLite.xsi */
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (is_inout) {
|
||||
sqlite_error(sth, (imp_xxh_t*)imp_sth, -2, "InOut bind params not implemented");
|
||||
sqlite_error(sth, imp_sth, -2, "InOut bind params not implemented");
|
||||
return FALSE; /* -> &sv_no in SQLite.xsi */
|
||||
}
|
||||
}
|
||||
pos = 2 * (SvIV(param) - 1);
|
||||
sqlite_trace(sth, (imp_xxh_t*)imp_sth, 3, form("bind into 0x%p: %d => %s (%d) pos %d",
|
||||
sqlite_trace(sth, imp_sth, 3, form("bind into 0x%p: %d => %s (%d) pos %d",
|
||||
imp_sth->params, SvIV(param), SvPV_nolen_undef_ok(value), sql_type, pos));
|
||||
av_store(imp_sth->params, pos, SvREFCNT_inc(value));
|
||||
av_store(imp_sth->params, pos+1, newSViv(sql_type));
|
||||
|
@ -526,7 +526,7 @@ sqlite_st_fetch(SV *sth, imp_sth_t *imp_sth)
|
|||
int chopBlanks = DBIc_is(imp_sth, DBIcf_ChopBlanks);
|
||||
int i;
|
||||
|
||||
sqlite_trace(sth, (imp_xxh_t*)imp_sth, 6, form("numFields == %d, nrow == %d", numFields, imp_sth->nrow));
|
||||
sqlite_trace(sth, imp_sth, 6, form("numFields == %d, nrow == %d", numFields, imp_sth->nrow));
|
||||
|
||||
if (!DBIc_ACTIVE(imp_sth)) {
|
||||
return Nullav;
|
||||
|
@ -539,7 +539,7 @@ sqlite_st_fetch(SV *sth, imp_sth_t *imp_sth)
|
|||
|
||||
if (imp_sth->retval != SQLITE_ROW) {
|
||||
/* error */
|
||||
sqlite_error(sth, (imp_xxh_t*)imp_sth, imp_sth->retval, (char*)sqlite3_errmsg(imp_dbh->db));
|
||||
sqlite_error(sth, imp_sth, imp_sth->retval, (char*)sqlite3_errmsg(imp_dbh->db));
|
||||
sqlite_st_finish(sth, imp_sth);
|
||||
return Nullav; /* -> undef in SQLite.xsi */
|
||||
}
|
||||
|
@ -632,7 +632,7 @@ sqlite_st_finish3(SV *sth, imp_sth_t *imp_sth, int is_destroy)
|
|||
if ((imp_sth->retval = sqlite3_reset(imp_sth->stmt)) != SQLITE_OK) {
|
||||
char *errmsg = (char*)sqlite3_errmsg(imp_dbh->db);
|
||||
/* warn("finalize failed! %s\n", errmsg); */
|
||||
sqlite_error(sth, (imp_xxh_t*)imp_sth, imp_sth->retval, errmsg);
|
||||
sqlite_error(sth, imp_sth, imp_sth->retval, errmsg);
|
||||
return FALSE; /* -> &sv_no (or void) in SQLite.xsi */
|
||||
}
|
||||
|
||||
|
@ -652,7 +652,7 @@ sqlite_st_destroy(SV *sth, imp_sth_t *imp_sth)
|
|||
/* finalize sth when active connection */
|
||||
rc = sqlite3_finalize(imp_sth->stmt);
|
||||
if (rc != SQLITE_OK) {
|
||||
sqlite_error(sth, (imp_xxh_t*)imp_sth, rc, (char*)sqlite3_errmsg(imp_dbh->db));
|
||||
sqlite_error(sth, imp_sth, rc, (char*)sqlite3_errmsg(imp_dbh->db));
|
||||
}
|
||||
}
|
||||
Safefree(imp_sth->statement);
|
||||
|
@ -680,10 +680,10 @@ sqlite_db_STORE_attrib(SV *dbh, imp_dbh_t *imp_dbh, SV *keysv, SV *valuesv)
|
|||
if (SvTRUE(valuesv)) {
|
||||
/* commit tran? */
|
||||
if ( (!DBIc_is(imp_dbh, DBIcf_AutoCommit)) && (!sqlite3_get_autocommit(imp_dbh->db)) ) {
|
||||
sqlite_trace(dbh, (imp_xxh_t*)imp_dbh, 2, "COMMIT TRAN");
|
||||
sqlite_trace(dbh, imp_dbh, 2, "COMMIT TRAN");
|
||||
rc = sqlite3_exec(imp_dbh->db, "COMMIT TRANSACTION", NULL, NULL, &errmsg);
|
||||
if (rc != SQLITE_OK) {
|
||||
sqlite_error(dbh, (imp_xxh_t*)imp_dbh, rc, errmsg);
|
||||
sqlite_error(dbh, imp_dbh, rc, errmsg);
|
||||
if (errmsg) sqlite3_free(errmsg);
|
||||
return TRUE; /* XXX: is this correct? */
|
||||
}
|
||||
|
@ -694,7 +694,7 @@ sqlite_db_STORE_attrib(SV *dbh, imp_dbh_t *imp_dbh, SV *keysv, SV *valuesv)
|
|||
}
|
||||
if (strEQ(key, "unicode")) {
|
||||
#if PERL_UNICODE_DOES_NOT_WORK_WELL
|
||||
sqlite_trace(dbh, (imp_xxh_t*)imp_dbh, 2, form("Unicode support is disabled for this version of perl."));
|
||||
sqlite_trace(dbh, imp_dbh, 2, form("Unicode support is disabled for this version of perl."));
|
||||
imp_dbh->unicode = 0;
|
||||
#else
|
||||
imp_dbh->unicode = !(! SvTRUE(valuesv));
|
||||
|
@ -715,7 +715,7 @@ sqlite_db_FETCH_attrib(SV *dbh, imp_dbh_t *imp_dbh, SV *keysv)
|
|||
}
|
||||
if (strEQ(key, "unicode")) {
|
||||
#if PERL_UNICODE_DOES_NOT_WORK_WELL
|
||||
sqlite_trace(dbh, (imp_xxh_t*)imp_dbh, 2, "Unicode support is disabled for this version of perl.");
|
||||
sqlite_trace(dbh, imp_dbh, 2, "Unicode support is disabled for this version of perl.");
|
||||
return newSViv(0);
|
||||
#else
|
||||
return newSViv(imp_dbh->unicode ? 1 : 0);
|
||||
|
@ -814,7 +814,7 @@ sqlite_st_FETCH_attrib(SV *sth, imp_sth_t *imp_sth, SV *keysv)
|
|||
int rc = sqlite3_table_column_metadata(imp_dbh->db, database, tablename, fieldname, &datatype, &collseq, ¬null, &primary, &autoinc);
|
||||
if (rc != SQLITE_OK) {
|
||||
char *errmsg = (char*)sqlite3_errmsg(imp_dbh->db);
|
||||
sqlite_error(sth, (imp_xxh_t*)imp_sth, rc, errmsg);
|
||||
sqlite_error(sth, imp_sth, rc, errmsg);
|
||||
av_store(av, n, newSViv(2)); /* SQL_NULLABLE_UNKNOWN */
|
||||
}
|
||||
else {
|
||||
|
@ -968,7 +968,7 @@ sqlite_db_create_function(pTHX_ SV *dbh, const char *name, int argc, SV *func)
|
|||
NULL, NULL );
|
||||
if ( rc != SQLITE_OK ) {
|
||||
char* const errmsg = form("sqlite_create_function failed with error %s", sqlite3_errmsg(imp_dbh->db));
|
||||
sqlite_error(dbh, (imp_xxh_t*)imp_dbh, rc, errmsg);
|
||||
sqlite_error(dbh, imp_dbh, rc, errmsg);
|
||||
return FALSE;
|
||||
}
|
||||
return TRUE;
|
||||
|
@ -983,7 +983,7 @@ sqlite_db_enable_load_extension(pTHX_ SV *dbh, int onoff)
|
|||
rc = sqlite3_enable_load_extension( imp_dbh->db, onoff );
|
||||
if ( rc != SQLITE_OK ) {
|
||||
char* const errmsg = form("sqlite_enable_load_extension failed with error %s", sqlite3_errmsg(imp_dbh->db));
|
||||
sqlite_error(dbh, (imp_xxh_t*)imp_dbh, rc, errmsg);
|
||||
sqlite_error(dbh, imp_dbh, rc, errmsg);
|
||||
return FALSE;
|
||||
}
|
||||
return TRUE;
|
||||
|
@ -1196,7 +1196,7 @@ sqlite_db_create_aggregate(pTHX_ SV *dbh, const char *name, int argc, SV *aggr_p
|
|||
|
||||
if ( rc != SQLITE_OK ) {
|
||||
char* const errmsg = form("sqlite_create_aggregate failed with error %s", sqlite3_errmsg(imp_dbh->db));
|
||||
sqlite_error(dbh, (imp_xxh_t*)imp_dbh, rc, errmsg);
|
||||
sqlite_error(dbh, imp_dbh, rc, errmsg);
|
||||
return FALSE;
|
||||
}
|
||||
return TRUE;
|
||||
|
@ -1280,12 +1280,12 @@ sqlite_db_create_collation(pTHX_ SV *dbh, const char *name, SV *func)
|
|||
/* Check that this is a proper collation function */
|
||||
rv = sqlite_db_collation_dispatcher(func_sv, 2, aa, 2, aa);
|
||||
if (rv != 0) {
|
||||
sqlite_trace(dbh, (imp_xxh_t*)imp_dbh, 2, form("improper collation function: %s(aa, aa) returns %d!", name, rv));
|
||||
sqlite_trace(dbh, imp_dbh, 2, form("improper collation function: %s(aa, aa) returns %d!", name, rv));
|
||||
}
|
||||
rv = sqlite_db_collation_dispatcher(func_sv, 2, aa, 2, zz);
|
||||
rv2 = sqlite_db_collation_dispatcher(func_sv, 2, zz, 2, aa);
|
||||
if (rv2 != (rv * -1)) {
|
||||
sqlite_trace(dbh, (imp_xxh_t*)imp_dbh, 2, form("improper collation function: '%s' is not symmetric", name));
|
||||
sqlite_trace(dbh, imp_dbh, 2, form("improper collation function: '%s' is not symmetric", name));
|
||||
}
|
||||
|
||||
/* Copy the func reference so that it can be deallocated at disconnect */
|
||||
|
@ -1302,7 +1302,7 @@ sqlite_db_create_collation(pTHX_ SV *dbh, const char *name, SV *func)
|
|||
if ( rv != SQLITE_OK )
|
||||
{
|
||||
char* const errmsg = form("sqlite_create_collation failed with error %s", sqlite3_errmsg(imp_dbh->db));
|
||||
sqlite_error(dbh, (imp_xxh_t*)imp_dbh, rv, errmsg);
|
||||
sqlite_error(dbh, imp_dbh, rv, errmsg);
|
||||
return FALSE;
|
||||
}
|
||||
return TRUE;
|
||||
|
@ -1588,7 +1588,7 @@ sqlite_db_backup_from_file(pTHX_ SV *dbh, char *filename)
|
|||
if ( rc != SQLITE_OK )
|
||||
{
|
||||
char* const errmsg = form("sqlite_backup_from_file failed with error %s", sqlite3_errmsg(imp_dbh->db));
|
||||
sqlite_error(dbh, (imp_xxh_t*)imp_dbh, rc, errmsg);
|
||||
sqlite_error(dbh, imp_dbh, rc, errmsg);
|
||||
if (pFrom)
|
||||
sqlite3_close(pFrom);
|
||||
return FALSE;
|
||||
|
@ -1605,7 +1605,7 @@ sqlite_db_backup_from_file(pTHX_ SV *dbh, char *filename)
|
|||
if ( rc != SQLITE_OK )
|
||||
{
|
||||
char* const errmsg = form("sqlite_backup_from_file failed with error %s", sqlite3_errmsg(imp_dbh->db));
|
||||
sqlite_error(dbh, (imp_xxh_t*)imp_dbh, rc, errmsg);
|
||||
sqlite_error(dbh, imp_dbh, rc, errmsg);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
@ -1630,7 +1630,7 @@ sqlite_db_backup_to_file(pTHX_ SV *dbh, char *filename)
|
|||
if ( rc != SQLITE_OK )
|
||||
{
|
||||
char* const errmsg = form("sqlite_backup_to_file failed with error %s", sqlite3_errmsg(imp_dbh->db));
|
||||
sqlite_error(dbh, (imp_xxh_t*)imp_dbh, rc, errmsg);
|
||||
sqlite_error(dbh, imp_dbh, rc, errmsg);
|
||||
if (pTo)
|
||||
sqlite3_close(pTo);
|
||||
return FALSE;
|
||||
|
@ -1647,7 +1647,7 @@ sqlite_db_backup_to_file(pTHX_ SV *dbh, char *filename)
|
|||
if ( rc != SQLITE_OK )
|
||||
{
|
||||
char* const errmsg = form("sqlite_backup_to_file failed with error %s", sqlite3_errmsg(imp_dbh->db));
|
||||
sqlite_error(dbh, (imp_xxh_t*)imp_dbh, rc, errmsg);
|
||||
sqlite_error(dbh, imp_dbh, rc, errmsg);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue