Author: byterock
Date: Fri May 7 09:24:26 2010
New Revision: 13963
Modified:
dbd-oracle/branches/oci_batch/Oracle.pm
dbd-oracle/branches/oci_batch/dbdimp.c
dbd-oracle/branches/oci_batch/dbdimp.h
dbd-oracle/branches/oci_batch/oci8.c
Log:
changes for this
Modified: dbd-oracle/branches/oci_batch/Oracle.pm
==============================================================================
--- dbd-oracle/branches/oci_batch/Oracle.pm (original)
+++ dbd-oracle/branches/oci_batch/Oracle.pm Fri May 7 09:24:26 2010
@@ -255,6 +255,9 @@
if ($ENV{ORA_DBD_NCS_BUFFER}){
$dbh->{'ora_ncs_buff_mtpl'}= $ENV{ORA_DBD_NCS_BUFFER};
}
+ if ($ENV{ORA_DBD_OCI_BATCH}){
+ $dbh->{'ora_oci_batch'}= $ENV{ORA_DBD_OCI_BATCH};
+ }
$dbh;
}
@@ -332,7 +335,8 @@
ora_verbose => undef,
ora_oci_success_warn => undef,
ora_objects => undef,
- ora_ncs_buff_mtpl => undef,
+ ora_ncs_buff_mtpl => undef,
+ ora_oci_batch => undef,
};
}
@@ -1020,11 +1024,21 @@
ora_row_cache_off => undef,
ora_prefetch_rows => undef,
ora_prefetch_memory => undef,
+ ora_clbk_lob => undef,
+ ora_piece_lob => undef,
+ ora_piece_size, => undef,
+ ora_exe_mode => undef,
+ ora_verbose => undef,
+ ora_oci_success_warn => undef,
+ ora_objects => undef,
+ ora_ncs_buff_mtpl => undef,
+ ora_oci_batch => undef,
};
}
}
+
1;
__END__
@@ -1476,6 +1490,20 @@
=head2 Connect Attributes
+
+=over 4
+
+=item ora_oci_batch
+
+For 11g users you may encounter an error while using the execute_array in that it does not
+return a full list of tuples. This seems to be a result in that a statment can only
+have 'LOG ERRORS' or 'SAVE EXCEPTIONS'set, By setting this flag to a value should stop this
+problem error.
+
+For convenience I have added support for a 'ORA_DBD_OCI_BATCH'
+environment variable that you can use at the OS level to set this
+value. It can also be set as an attribute on both the Connect and Prepare.
+
=over 4
=item ora_ncs_buff_mtpl
Modified: dbd-oracle/branches/oci_batch/dbdimp.c
==============================================================================
--- dbd-oracle/branches/oci_batch/dbdimp.c (original)
+++ dbd-oracle/branches/oci_batch/dbdimp.c Fri May 7 09:24:26 2010
@@ -45,7 +45,7 @@
int oci_warn = 0; /* show oci warnings */
int ora_objects = 0; /* get oracle embedded objects as instance of DBD::Oracle::Object */
int ora_ncs_buff_mtpl = 4; /* a mulitplyer for ncs clob buffers */
-
+int ora_oci_batch = 0; /* flag for batch mode stops 11g sort of bug*/
/* bitflag constants for figuring out how to handle utf8 for array binds */
#define ARRAY_BIND_NATIVE 0x01
#define ARRAY_BIND_UTF8 0x02
@@ -998,7 +998,10 @@
int on = SvTRUE(valuesv);
int cacheit = 1;
- if (kl==17 && strEQ(key, "ora_ncs_buff_mtpl") ) {
+ if (kl==13 && strEQ(key, "ora_oci_batch") ) {
+ ora_oci_batch = SvIV (valuesv);
+ }
+ else if (kl==17 && strEQ(key, "ora_ncs_buff_mtpl") ) {
ora_ncs_buff_mtpl = SvIV (valuesv);
}
else if (kl==20 && strEQ(key, "ora_oci_success_warn") ) {
@@ -1059,7 +1062,10 @@
/* AutoCommit FETCH via DBI */
- if (kl==18 && strEQ(key, "ora_ncs_buff_mtpl") ) {
+ if (kl==13 && strEQ(key, "ora_oci_batch") ) {
+ retsv = newSViv (ora_oci_batch);
+ }
+ else if (kl==17 && strEQ(key, "ora_ncs_buff_mtpl") ) {
retsv = newSViv (ora_ncs_buff_mtpl);
}
else if (kl==20 && strEQ(key, "ora_oci_success_warn")) {
@@ -3511,6 +3517,11 @@
imp_sth->rowwise = (columns_av == NULL);
oci_mode = OCI_BATCH_ERRORS;
+
+ /* for 11g which does not like the OCI_BATCH_ERRORS mode*/
+ if ( imp_sth->batch)
+ oci_mode = OCI_BATCH_MODE;
+
if(autocommit)
oci_mode |= OCI_COMMIT_ON_SUCCESS;
Modified: dbd-oracle/branches/oci_batch/dbdimp.h
==============================================================================
--- dbd-oracle/branches/oci_batch/dbdimp.h (original)
+++ dbd-oracle/branches/oci_batch/dbdimp.h Fri May 7 09:24:26 2010
@@ -72,6 +72,7 @@
OCIDescribe *dschp; /* oci describe handle */
int is_child; /* if this is child from a ref cursor or SP*/
ub2 stmt_type; /* OCIAttrGet OCI_ATTR_STMT_TYPE */
+ int batch; /* use OCI_BATCH_MODE on exe array */
U16 auto_lob; /* use auto lobs*/
int pers_lob; /*use dblink for lobs only for 10g Release 2. or later*/
int clbk_lob; /*use dblink for lobs only for 10g Release 2. or later*/
@@ -265,6 +266,7 @@
extern int oci_warn;
extern int ora_objects;
extern int ora_ncs_buff_mtpl;
+extern int ora_oci_batch;
extern ub2 charsetid;
extern ub2 ncharsetid;
Modified: dbd-oracle/branches/oci_batch/oci8.c
==============================================================================
--- dbd-oracle/branches/oci_batch/oci8.c (original)
+++ dbd-oracle/branches/oci_batch/oci8.c Fri May 7 09:24:26 2010
@@ -868,10 +868,11 @@
dTHX;
D_imp_dbh_from_sth;
sword status = 0;
- IV ora_piece_size = 0;
+ IV ora_piece_size = 0;
IV ora_pers_lob = 0;
- IV ora_piece_lob = 0;
+ IV ora_piece_lob = 0;
IV ora_clbk_lob = 0;
+ IV ora_oci_batch = 0; /* for problems in 11r using OCI_BATCH_ERRORS */
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 */
@@ -914,7 +915,9 @@
DBD_ATTRIB_GET_IV( attribs, "ora_clbk_lob", 12, svp, ora_clbk_lob);
DBD_ATTRIB_GET_IV( attribs, "ora_piece_lob", 13, svp, ora_piece_lob);
DBD_ATTRIB_GET_IV( attribs, "ora_piece_size", 14, svp, ora_piece_size);
+ DBD_ATTRIB_GET_IV( attribs, "ora_oci_batch", 13, svp, ora_oci_batch);
+ imp_sth->batch = (ora_oci_batch) ? 1 : 0;
imp_sth->auto_lob = (ora_auto_lob) ? 1 : 0;
imp_sth->pers_lob = (ora_pers_lob) ? 1 : 0;
imp_sth->clbk_lob = (ora_clbk_lob) ? 1 : 0;
@@ -932,7 +935,8 @@
DBD_ATTRIB_GET_IV( attribs, "ora_oci_success_warn", 20, svp, oci_warn);
DBD_ATTRIB_GET_IV( attribs, "ora_objects", 11, svp, ora_objects);
DBD_ATTRIB_GET_IV( attribs, "ora_ncs_buff_mtpl", 17, svp,ora_ncs_buff_mtpl);
- DBD_ATTRIB_GET_IV( attribs, "RowCacheSize",12,svp, imp_sth->RowCacheSize);
+ DBD_ATTRIB_GET_IV( attribs, "ora_oci_batch", 13, svp,ora_oci_batch);
+ DBD_ATTRIB_GET_IV( attribs, "RowCacheSize",12,svp, imp_sth->RowCacheSize);
if (!dbd_verbose)
DBD_ATTRIB_GET_IV( attribs, "dbd_verbose", 11, svp, dbd_verbose);
@@ -982,30 +986,7 @@
if (!dbd_describe(sth, imp_sth))
return 0;
}
-/* else {
- set initial cache size by memory
- [I'm not now sure why this is here - from a patch sometime ago - Tim]
- you are right Tim thre is no need to have this here so out it goes
- a very useless call to the server
- ub4 cache_mem;
- IV cache_mem_iv;
- D_imp_dbh_from_sth ;
- D_imp_drh_from_dbh ;
- if(SvOK(imp_drh->ora_cache_o)) cache_mem_iv = -SvIV(imp_drh -> ora_cache_o);
- else if (SvOK(imp_drh->ora_cache)) cache_mem_iv = -SvIV(imp_drh -> ora_cache);
- else cache_mem_iv = -imp_dbh->RowCacheSize;
- cache_mem = (cache_mem_iv <= 0) ? 10 * 1460 : cache_mem_iv;
- OCIAttrSet_log_stat(imp_sth->stmhp, OCI_HTYPE_STMT,
- &cache_mem, sizeof(cache_mem), OCI_ATTR_PREFETCH_MEMORY,
- imp_sth->errhp, status);
- if (status != OCI_SUCCESS) {
- oci_error(sth, imp_sth->errhp, status,
- "OCIAttrSet OCI_ATTR_PREFETCH_MEMORY");
- return 0;
- }
- }
-*/
return 1;
}
@@ -1441,7 +1422,7 @@
ub4 lobEmpty = 0;
if (phs->desc_h && phs->desc_t == OCI_DTYPE_LOB)
ora_free_templob(sth, imp_sth, (OCILobLocator*)phs->desc_h);
-
+
if (!phs->desc_h) {
++imp_sth->has_lobs;
phs->desc_t = OCI_DTYPE_LOB;
lmpx.com only provides a reader for public news (NNTP) servers. It is not
affiliated with the servers or forums shown here and is not responsible for
the content of articles, which is written by their respective authors.