Author: byterock
Date: Mon Mar 17 14:16:31 2008
New Revision: 10931
Modified:
dbd-oracle/branches/scroll/Oracle.pm
dbd-oracle/branches/scroll/Oracle.xs
dbd-oracle/branches/scroll/dbdimp.h
dbd-oracle/branches/scroll/oci8.c
Log:
cleaning up a few more loose ends
new function ora_scroll_current_position but cannot seem to get it out yet as
well added
mp_sth->exe_mode!=OCI_STMT_SCROLLABLE_READONLY) then croak if one tries to use
the function without being in the right mode
Modified: dbd-oracle/branches/scroll/Oracle.pm
==============================================================================
--- dbd-oracle/branches/scroll/Oracle.pm (original)
+++ dbd-oracle/branches/scroll/Oracle.pm Mon Mar 17 14:16:31 2008
@@ -72,7 +72,7 @@
DBD::Oracle::db->install_method("ora_nls_parameters");
DBD::Oracle::db->install_method("ora_can_unicode");
DBD::Oracle::st->install_method("ora_fetch_scroll");
- DBD::Oracle::st->install_method("ora_scroll_row_count");
+ DBD::Oracle::st->install_method("ora_scroll_current_position");
$drh;
}
Modified: dbd-oracle/branches/scroll/Oracle.xs
==============================================================================
--- dbd-oracle/branches/scroll/Oracle.xs (original)
+++ dbd-oracle/branches/scroll/Oracle.xs Mon Mar 17 14:16:31 2008
@@ -97,22 +97,15 @@
void
-ora_scroll_row_count(sth)
+ora_scroll_current_position(sth)
SV * sth
PREINIT:
D_imp_sth(sth);
sword status;
CODE:
{
- ub4 row_count = 0;
- int cp;
- ub4 sz = sizeof(cp) ;
- OCIAttrGet_stmhp_stat(imp_sth, &cp, &sz, OCI_ATTR_CURRENT_POSITION,
status);
- PerlIO_printf(DBILOGFP, " cp=%d,status=%d\n",row_count,status);
- row_count=OCIAttrGet_stmhp_stat(imp_sth, &row_count, &sz,
OCI_ATTR_ROW_COUNT, status);
-
- PerlIO_printf(DBILOGFP, " row_count=%d,status=%d\n",row_count,status);
- XST_mIV(0, row_count);
+ PerlIO_printf(DBILOGFP, " fetch_position=%d\n",imp_sth->fetch_position);
+ XSRETURN_IV( imp_sth->fetch_position);
}
void
Modified: dbd-oracle/branches/scroll/dbdimp.h
==============================================================================
--- dbd-oracle/branches/scroll/dbdimp.h (original)
+++ dbd-oracle/branches/scroll/dbdimp.h Mon Mar 17 14:16:31 2008
@@ -104,6 +104,7 @@
/* fetch scrolling values */
int fetch_orient;
int fetch_offset;
+ int fetch_position;
};
#define IMP_STH_EXECUTING 0x0001
Modified: dbd-oracle/branches/scroll/oci8.c
==============================================================================
--- dbd-oracle/branches/scroll/oci8.c (original)
+++ dbd-oracle/branches/scroll/oci8.c Mon Mar 17 14:16:31 2008
@@ -255,7 +255,7 @@
dTHX;
D_imp_dbh_from_sth;
sword status = 0;
- ub4 ora_exe_mode = OCI_DEFAULT; /* default is OCI_DEFAULT*/
+ ub4 ora_exe_mode = OCI_DEFAULT; /* default is OCI_DEFAULT*/
ub4 oparse_lng = 1; /* auto v6 or v7 as suits db connected
to */
int ora_check_sql = 1; /* to force a describe to check SQL */
IV ora_placeholders = 1; /* find and handle placeholders */
@@ -285,7 +285,7 @@
}
imp_sth->auto_lob = 1;
-
+
if (attribs) {
SV **svp;
IV ora_auto_lob = 1;
@@ -296,12 +296,12 @@
/* ora_check_sql only works for selects owing to Oracle
behaviour */
DBD_ATTRIB_GET_IV( attribs, "ora_check_sql", 13, svp,
ora_check_sql);
DBD_ATTRIB_GET_IV( attribs, "ora_exe_mode", 12, svp,
ora_exe_mode);
- imp_sth->exe_mode = ora_exe_mode;
-
+ imp_sth->exe_mode = ora_exe_mode;
+
}
-
-
+
+
/* scan statement for '?', ':1' and/or ':foo' style placeholders
*/
if (ora_placeholders)
dbd_preparse(imp_sth, statement);
@@ -2381,10 +2381,13 @@
if (imp_sth->fetch_orient) {
int cp;
ub4 sz = sizeof(cp) ;
+ if (imp_sth->exe_mode!=OCI_STMT_SCROLLABLE_READONLY)
+ croak ("attempt to use a scrollable cursor
without first setting ora_exe_mode to OCI_STMT_SCROLLABLE_READONLY\n") ;
+
OCIStmtFetch_log_stat(imp_sth->stmhp, imp_sth->errhp,1,
imp_sth->fetch_orient,imp_sth->fetch_offset, status);
OCIAttrGet_stmhp_stat(imp_sth, &cp, &sz,
OCI_ATTR_CURRENT_POSITION, status);
PerlIO_printf(DBILOGFP, " OCI_ATTR_CURRENT_POSITION= %d
...\n", cp);
-
+
} else {
OCIStmtFetch_log_stat(imp_sth->stmhp, imp_sth->errhp,1,
(ub2)OCI_FETCH_NEXT, 0, status);