Drop Table
Support Forum for database administrators and web based access to important newsgroups related to databasesAuthor: timbo
Date: Mon Jan 16 13:57:42 2006
New Revision: 2421
Modified:
dbd-oracle/trunk/dbdimp.c
dbd-oracle/trunk/oci8.c
dbd-oracle/trunk/t/55nested.t
Log:
Tidy up row cache code.
Remove some unsed vars.
Modified: dbd-oracle/trunk/dbdimp.c
====================
====================
====================
================
==
--- dbd-oracle/trunk/dbdimp.c (original)
+++ dbd-oracle/trunk/dbdimp.c Mon Jan 16 13:57:42 2006
@@ -98,7 +98,6 @@ ora_env_var(char *name, char *buf, unsig
void
dbd_init(dbistate_t *dbistate)
{
- char *p;
DBIS = dbistate;
dbd_init_oci(dbistat
e);
}
@@ -272,8 +271,6 @@ dbd_db_login6(SV *dbh, imp_dbh_t *imp_db
if (shared_dbh_len == sizeof (imp_dbh_t)) {
/* initialize from shared data */
- int o = DBH_DUP_OFF ;
- int l = DBH_DUP_LEN ;
memcpy (((char *)imp_dbh) + DBH_DUP_OFF, ((char *)shared_dbh) + DBH_DUP_OFF,
DBH_DUP_LEN) ;
shared_dbh -> refcnt++ ;
imp_dbh -> shared_dbh_priv_sv = shared_dbh_priv_sv ;
Modified: dbd-oracle/trunk/oci8.c
====================
====================
====================
================
==
--- dbd-oracle/trunk/oci8.c (original)
+++ dbd-oracle/trunk/oci8.c Mon Jan 16 13:57:42 2006
@@ -648,10 +648,10 @@ fetch_func_rset(SV *sth, imp_fbh_t *fbh,
imp_sth_nested->stmt_type = OCI_STMT_SELECT;
DBIc_IMPSET_on(imp_s
th_nested);
-
DBIc_ACTIVE_on(imp_s
th_nested); /* So describe won't do an execute */
- if (!dbd_describe(dest_
sv, imp_sth_nested)) return 0;
+ if (!dbd_describe(dest_
sv, imp_sth_nested))
+ return 0;
}
return 1;
@@ -1141,11 +1141,12 @@ calc_cache_rows(int cache_rows, int num_
static int /* --- Setup the row cache for this sth --- */
- sth_set_row_cache(SV
*h, imp_sth_t *imp_sth, int max_cache_rows, int num_fi
elds, int est_width, int has_longs)
+sth_set_row_cache(S
V *h, imp_sth_t *imp_sth, int max_cache_rows, int num_fi
elds, int has_longs)
{
D_imp_dbh_from_sth;
D_imp_drh_from_dbh;
int num_errors = 0;
+ ub4 cache_mem, cache_rows;
sword status;
/* number of rows to cache */
@@ -1154,9 +1155,10 @@ sth_set_row_cache(SV
*h, imp_sth_t *imp_
else imp_sth->cache_rows = imp_dbh->RowCache
Size;
if (imp_sth->cache_rows >= 0) { /* set cache size by row count */
- ub4 cache_mem = 0; /* so memory isn't the limit */
- ub4 cache_rows = calc_cache_rows(imp_
sth->cache_rows,
- (int)num_fields, est_width, has_longs);
+ /* imp_sth->est_width needs to be set */
+ cache_mem = 0; /* so memory isn't the limit */
+ cache_rows = calc_cache_rows(imp_
sth->cache_rows,
+ (int)num_fields, imp_sth->est_width, has_longs);
if (max_cache_rows && cache_rows > max_cache_rows)
cache_rows = max_cache_rows;
imp_sth->cache_rows = cache_rows; /* record updated value */
@@ -1173,8 +1175,8 @@ sth_set_row_cache(SV
*h, imp_sth_t *imp_
}
}
else { /* set cache size by memory */
- ub4 cache_mem = -imp_sth->cache_rows; /* cache_mem always +ve here */
- ub4 cache_rows = 100000; /* set high so memory is the limit */
+ cache_mem = -imp_sth->cache_rows; /* cache_mem always +ve here */
+ cache_rows = 100000; /* set high so memory is the limit */
if (max_cache_rows && cache_rows > max_cache_rows) {
cache_rows = max_cache_rows;
imp_sth->cache_rows = cache_rows; /* record updated value only if max_cache_
rows */
@@ -1191,6 +1193,10 @@ sth_set_row_cache(SV
*h, imp_sth_t *imp_
++num_errors;
}
}
+ if (DBIS->debug >= 3)
+ PerlIO_printf(DBIL
OGFP,
+ " row cache OCI_ATTR_PREFETCH_RO
WS %lu, OCI_ATTR_PREFETCH_ME
MORY %l
u\n",
+ cache_rows, cache_mem);
return num_errors;
}
@@ -1434,7 +1440,7 @@ dbd_describe(SV *h, imp_sth_t *imp_sth)
sth_set_row_cache(h,
imp_sth,
(nested_cursors) ? imp_dbh->max_nested_cursors / nested_cursors : 0,
- (int)num_fields, est_width, has_longs
+ (int)num_fields, has_longs
);
imp_sth->long_readlen = long_readlen;
@@ -1475,7 +1481,7 @@ dbd_describe(SV *h, imp_sth_t *imp_sth)
if ( (fbh->dbtype == 1) && fbh->csform ) {
/* csform may be 0 when talking to Oracle 8.0 database */
if (DBIS->debug >= 3)
- PerlIO_printf(DBILOG
FP, " calling OCIAttrSet OCI_ATTR_CH
ARSET_FORM with csform=%d\n", fbh->csform );
+ PerlIO_printf(DBILOG
FP, " calling OCIAttrSet OCI_ATTR_CHA
RSET_FORM with csform=%d\n", fbh->csform );
OCIAttrSet_log_stat(
fbh->defnp, (ub4) OCI_HTYPE_DEFINE, (dvoid *) &fbh->csf
orm,
(ub4) 0, (ub4) OCI_ATTR_CHARSET_FOR
M, imp_sth->errhp, status );
if (status != OCI_SUCCESS) {
Modified: dbd-oracle/trunk/t/55nested.t
====================
====================
====================
================
==
--- dbd-oracle/trunk/t/55nested.t (original)
+++ dbd-oracle/trunk/t/55nested.t Mon Jan 16 13:57:42 2006
@@ -42,6 +42,7 @@ ok( 1,
FROM all_objects WHERE rownum <= 5
})
);
+#$outer->{TraceLevel} = 3;
ok( 2, $outer->{ora_types}[1] == ORA_RSET);
ok( 3, $outer->execute);
ok( 4, my @row1 = $outer->fetchrow_array);
Post Follow-up to this message
Show a Printable Version
Email This Page to Someone!
Receive updates to this thread