DBD-Unify
view release on metacpan or search on metacpan
to crash the test on DB failures.
0.05 - 23 Mar 2000, H.Merijn Brand
* Recognize strings w/ negative numbers in bind where !SvIOK (value)
In fact drop the SvIOK () check altogether and let SvIV () do the
job, including the warnings. I still want to be able to check the
value BEFORE the warning, but we'll see ...
* Index display in bind failure
0.04 - 15 Feb 2000, H.Merijn Brand
* Oops, forgot to close open cursor on re-execute
* Full implementation of positional parameters includes
Auto conversion from SvPV's (string) to SvIV's (numeric)
* Test includes positional inserts
* Test includes updates and positional updates
* Added $dbh->{DBDverbose} (see pod)
0.03 - 09 Feb 2000, H.Merijn Brand
* Changes to Makefile.PL to support AIX
* Forced prefer varargs over stdarg in dbdimp.ic :-(
* Implemented positional parameters :-)
int dbd_db_commit (SV *dbh, imp_dbh_t *imp_dbh) {
dTHX;
dbg (3, "DBD::Unify::db_commit\n");
unless (DBIc_ACTIVE (imp_dbh))
return (0);
change_offspring (dbh, imp_dbh);
/* Check for commit () being called whilst refs to cursors
* still exists. This needs some more thought.
*/
if (DBIc_ACTIVE_KIDS (imp_dbh) && DBIc_WARN (imp_dbh) && !PL_dirty) {
warn ("DBD::Unify::db_commit (%s) invalidates %d active cursor(s)",
SvPV_nolen (dbh), (int)DBIc_ACTIVE_KIDS (imp_dbh));
}
EXEC SQL
COMMIT WORK;
return (sqlError (dbh));
} /* dbd_db_commit */
int dbd_db_rollback (SV *dbh, imp_dbh_t *imp_dbh) {
dTHX;
dbg (3, "DBD::Unify::db_rollback\n");
unless (DBIc_ACTIVE (imp_dbh))
return (0);
change_offspring (dbh, imp_dbh);
/* Check for rollback () being called whilst refs to cursors
* still exists. See dbd_db_commit ()
*/
if (DBIc_ACTIVE_KIDS (imp_dbh) && DBIc_WARN (imp_dbh) && !PL_dirty) {
warn ("DBD::Unify::db_rollback (%s) invalidates %d active cursor(s)",
SvPV_nolen (dbh), (int)DBIc_ACTIVE_KIDS (imp_dbh));
}
EXEC SQL
ROLLBACK WORK;
return (sqlError (dbh));
} /* dbd_db_rollback */
int dbd_db_dict (SV *dbh, int reload) {
dTHX;
return (0);
change_offspring (dbh, imp_dbh);
if (imp_dbh->nchildren) {
if (imp_dbh->children) free ((void *)imp_dbh->children);
imp_dbh->children = (imp_sth_t **)0;
imp_dbh->nchildren = 0;
}
if (DBIc_ACTIVE_KIDS (imp_dbh) && DBIc_WARN (imp_dbh) && !PL_dirty) {
warn ("DBD::Unify::db_disconnect (%s) invalidates %d active cursor(s)",
SvPV_nolen (dbh), (int)DBIc_ACTIVE_KIDS (imp_dbh));
}
DBIc_ACTIVE_off (imp_dbh);
EXEC SQL
DISCONNECT;
dbg (4, " After disconn, sqlcode = %d\n", SQLCODE);
imp_dbh->id = 0;
/* We assume that disconnect will always work
}
st_dbg (3, imp_sth, "DBD::Unify::st_prepare %s (\"%s\")\n", u_sql_nm, statement);
dbd_st_diaper (imp_dbh, imp_sth);
DBIc_IMPSET_on (imp_sth);
EXEC SQL
ALLOCATE :c_sql_nm
CURSOR FOR :u_sql_nm;
if (SQLCODE == -2061) /* Cannot deallocate allocated cursor, so */
SQLCODE = 0; /* re-use it (it'll be the same context) */
st_dbg (4, imp_sth, " After allocate, sqlcode = %d\n", SQLCODE);
unless (sqlError (sth))
return (0);
imp_sth->stat |= ST_STAT_ALLOCC;
(void)strcpy (u_sql_st, statement);
EXEC SQL
PREPARE :u_sql_nm
FROM :u_sql_st;
AV *av;
SV *dbh = (SV *)DBIc_PARENT_H (imp_sth);
D_imp_dbh_from_sth;
unless (use_sth_id (dbh, imp_dbh->id, imp_sth->id))
return (NULL);
st_dbg (3, imp_sth, "DBD::Unify::st_fetch %s\n", u_sql_nm);
unless (DBIc_ACTIVE (imp_sth)) {
error (sth, -7, "fetch without open cursor");
return (NULL);
}
/* In the next E/SQL a statement like
* "select code from table where field SHLIKE 'v_ab*'"
* will dump core in sqldfch ()
* affirmed for 6.3AB and 6.3BE
*/
EXEC SQL
FETCH :c_sql_nm
lib/DBD/Unify.pm view on Meta::CPAN
$dbh->disconnect;
} # $dbh implicitly destroyed by end-of-scope
=item do
$dbh->do ($statement)
This is implemented as a call to 'EXECUTE IMMEDIATE' with all the
limitations that this implies.
=item commit and rollback invalidates open cursors
DBD::Unify does warn when a commit or rollback is issued on a $dbh
with open cursors.
Possibly a commit/rollback/disconnect should also undef the $sth's.
(This should probably be done in the DBI-layer as other drivers will
have the same problems).
After a commit or rollback the cursors are all ->finish'ed, i.e. they
are closed and the DBI/DBD will warn if an attempt is made to fetch
from them.
A future version of DBD::Unify might re-prepare the statement.
=back
=head2 Stuff implemented in perl
=over 2
( run in 0.257 second using v1.01-cache-2.11-cpan-4d50c553e7e )