[svn:dbd-oracle] r14663 - dbd-oracle/trunk
[email protected] Fri, 28 Jan 2011 21:25:46 -0800 (PST)
| Newsgroups | perl.dbd.oracle.changes |
|---|---|
| Message-ID | <[email protected]> |
Author: byterock
Date: Fri Jan 28 21:25:44 2011
New Revision: 14663
Modified:
dbd-oracle/trunk/Changes
dbd-oracle/trunk/Oracle.pm
dbd-oracle/trunk/dbdimp.c
dbd-oracle/trunk/dbdimp.h
dbd-oracle/trunk/oci8.c
Log:
Added in 4 new server side debug/trace attributs, ora_driver_name, ora_client_info, ora_session_user on the connction handle and ora_exe_action from John Scoles
Cleaned up the pod a little.
Modified: dbd-oracle/trunk/Changes
==============================================================================
--- dbd-oracle/trunk/Changes (original)
+++ dbd-oracle/trunk/Changes Fri Jan 28 21:25:44 2011
@@ -1,5 +1,7 @@
=head1 Changes in DBD-Oracle 1.28 (svn rev 14583)
+ Added in 4 new server side debug/trace attributs, ora_driver_name, ora_client_info, ora_session_user on the connction handle and ora_exe_action from John Scoles
+ Cleaned up the pod a little by John Scoles
Fix for function name length, Some function names are over 31char long which may cause problems for some OS/Compilers (VMS IA64 box.) from Jakob Snoer
Fix for OCIPing in case where a 10 client tries to ping a <10 DB from Tim Oertel
Fix for DBD-Oracle stored proc with array bug where second call array size is unchanged from Tim Oertel
@@ -10,7 +12,6 @@
Fix for support for objects on big endian platforms from Charles Jardine, John R Pierce
Fix for rt.cpan.org Ticket #=61225 Windows install (Stawberry Perl) fails on long path names from David Tulloh
Fix for rt.cpan.org Ticket #=rt64524 Memory Leak when Oracle connection fails by Martin J. Evans
- Add missing ora_drcp* values to dbh private_attribute_info by Martin J. Evans
Added all the missing ora_drcp values to dbh private_attribute_info by Martin J. Evans
Removed a load of attributes from sth private_attribute_info which are not handle attributes but attributes to bind_param/prepare by Martin J. Evans
Fix for rt.cpan.org Ticket #=64244 - don't bail out, skip tests we cannot connect by Martin J. Evans and John Scoles
@@ -22,7 +23,7 @@
=head1 Changes in DBD-Oracle 1.27 (svn rev 14583)
- This version removes PERL_POLLUTE and adds in PL_ where required so it will be fully compatible with Perl 5.13
+ This version removes 'PERL_POLLUTE' and adds in PL_ where required so it will be fully compatible with Perl 5.13
=head1 Changes in DBD-Oracle 1.26 (svn rev 14411)
Modified: dbd-oracle/trunk/Oracle.pm
==============================================================================
--- dbd-oracle/trunk/Oracle.pm (original)
+++ dbd-oracle/trunk/Oracle.pm Fri Jan 28 21:25:44 2011
@@ -274,12 +274,6 @@
DBD::Oracle::db::_login($dbh, $dbname, $user, $auth, $attr)
or return undef;
- if ($attr && $attr->{ora_module_name}) {
- eval {
- $dbh->do(q{BEGIN DBMS_APPLICATION_INFO.SET_MODULE(:1,NULL); END;},
- undef, $attr->{ora_module_name});
- };
- }
unless (length $user_only) {
$user_only = $dbh->selectrow_array(q{
SELECT SYS_CONTEXT('userenv','session_user') FROM DUAL
@@ -377,6 +371,9 @@
ora_drcp_incr => undef,
ora_oratab_orahome => undef,
ora_module_name => undef,
+ ora_driver_name => undef,
+ ora_client_info => undef,
+ ora_session_user => undef,
};
}
@@ -1120,18 +1117,23 @@
So to make a short story a little longer;
- 1) If you are using Oracle 7 or early 8 DB and you can manage to get a 9 client and you can use any DBD::Oracle version.
+ 1) If you are using Oracle 7 or early 8 DB and you can manage to get a 9 client and you can use
+ any DBD::Oracle version.
2) If you have to use an Oracle 7 client then DBD::Oracle 1.17 should work
- 3) Same thing for 8 up to R2, use 1.17, if you are lucky and have the right patch-set you might go with 1.18.
- 4) For 8iR3 you can use any of the DBD::Oracle versions up to 1.21. Again this depends on your patch-set, If you run into trouble go with 1.19
+ 3) Same thing for 8 up to R2, use 1.17, if you are lucky and have the right patch-set you might
+ go with 1.18.
+ 4) For 8iR3 you can use any of the DBD::Oracle versions up to 1.21. Again this depends on your
+ patch-set, If you run into trouble go with 1.19
5) After 9.2 you can use any version you want.
- 6) For you Luddites out there ORAPERL still works and is still included but not updated or supported anymore and will be removed in 1.27.
- 7) It seems that the 10g client can only connect to 9 and 11 DBs while the 9 can go back to 7 and even get to 10.
- I am not sure what the 11g client can connect to.
- 8) DBD::Oracle still has the code in place for ProC. But good luck trying to get it to work with any of the instant clients
- as Oracle no longer ships the correct .mk files. I was unable to get it to work with Oracle 11+ as it ships with only
- part of the full ProC install. You may have to get a full version of ProC from Oracle to get it to compile. It is also slated
- to be removed in 1.27
+ 6) For you Luddites out there ORAPERL still works and is still included but not updated or
+ supported anymore and will be removed in 1.29.
+ 7) It seems that the 10g client can only connect to 9 and 11 DBs while the 9 can go back to 7
+ and even get to 10. I am not sure what the 11g client can connect to.
+ 8) DBD::Oracle still has the code in place for ProC. But good luck trying to get it to work
+ with any of the instant clients as Oracle no longer ships the correct .mk files. I was
+ unable to get it to work with Oracle 11+ as it ships with only part of the full ProC install.
+ You may have to get a full version of ProC from Oracle to get it to compile. It is also
+ slated to be removed in 1.29
=head1 CONNECTING TO ORACLE
@@ -1654,6 +1656,36 @@
DBI->connect($dsn, $user, $passwd, { ora_module_name => $0 });
+=item ora_driver_name
+
+For 11g and later you can now set the name of the driver layer using OCI.
+PERL, PERL5, ApachePerl so on. Names starting with "ORA" are reserved. You
+can enter up to 8 characters. If none is enter then this will default to
+DBDOxxxx where xxxx is the current version number. This value can be
+retrieved on the server side using V$SESSION_CONNECT_INFO or
+GV$SESSION_CONNECT_INFO
+
+
+ DBI->connect($dsn, $user, $passwd, { ora_driver_name => 'ModPerl_1' });
+
+=item ora_client_info
+
+When passed in on the connection attribues it can specify any info you want
+onto the session up t0 64 bytes. This value can be
+retrieved on the server side using V$SESSION view.
+
+ DBI->connect($dsn, $user, $passwd, { ora_client_info => 'BigQuerry2' });
+
+=item ora_client_identifier
+
+When passed in on the connection attribues it specifies the user identifier
+in the session handle. Most useful for web app as it can pass in the seesion
+user name which might be different than the connection user name. Can be up
+to 64 bytes long do not to include the password for security reasons and the
+first character of the identifier should not be ':'.
+
+ DBI->connect($dsn, $user, $passwd, { ora_client_identifier => $some_web_user });
+
=item ora_dbh_share
Needs at least Perl 5.8.0 compiled with ithreads. Allows to share database
@@ -1841,7 +1873,7 @@
Set to false to disable processing of placeholders. Used mainly for loading a
PL/SQL package that has been I<wrapped> with Oracle's C<wrap> utility.
-=item ora_parse_lang
+=item ora_parse_lang--->depricated
Tells the connected database how to interpret the SQL statement.
If 1 (default), the native SQL version for the database is used.
@@ -1849,6 +1881,12 @@
2 (old V7), 7 (V7), and 8 (V8).
All other values have the same effect as 1.
+=item ora_exe_action
+
+You can set the name of the current execution action to anything you want up to 32byes.
+This value is reset to NULL after an exectue action is called.
+
+
=item ora_auto_lob
If true (the default), fetching retrieves the contents of the CLOB or
Modified: dbd-oracle/trunk/dbdimp.c
==============================================================================
--- dbd-oracle/trunk/dbdimp.c (original)
+++ dbd-oracle/trunk/dbdimp.c Fri Jan 28 21:25:44 2011
@@ -424,7 +424,6 @@
imp_dbh->using_drcp = 1;
/* some connection pool atributes */
-
if ((svp=DBD_ATTRIB_GET_SVP(attr, "ora_drcp_class", 14)) && SvOK(*svp)) {
STRLEN svp_len;
if (!SvPOK(*svp))
@@ -432,13 +431,44 @@
imp_dbh->pool_class = (text *) SvPV (*svp, svp_len );
imp_dbh->pool_classl= (ub4) svp_len;
}
- if (DBD_ATTRIB_TRUE(attr,"ora_drcp_min",12,svp))
+ if (DBD_ATTRIB_TRUE(attr,"ora_drcp_min",12,svp))
DBD_ATTRIB_GET_IV( attr, "ora_drcp_min", 12, svp, imp_dbh->pool_min);
if (DBD_ATTRIB_TRUE(attr,"ora_drcp_max",12,svp))
DBD_ATTRIB_GET_IV( attr, "ora_drcp_max", 12, svp, imp_dbh->pool_max);
if (DBD_ATTRIB_TRUE(attr,"ora_drcp_incr",13,svp))
DBD_ATTRIB_GET_IV( attr, "ora_drcp_incr", 13, svp, imp_dbh->pool_incr);
+
+
+ if ((svp=DBD_ATTRIB_GET_SVP(attr, "ora_driver_name", 15)) && SvOK(*svp)) {
+ STRLEN svp_len;
+ if (!SvPOK(*svp))
+ croak("ora_driver_name is not a string");
+ imp_dbh->driver_name = (text *) SvPV (*svp, svp_len );
+ imp_dbh->driver_namel= (ub4) svp_len;
+ }
#endif /*ORA_OCI_112*/
+
+ if ((svp=DBD_ATTRIB_GET_SVP(attr, "ora_module_name", 15)) && SvOK(*svp)) {
+ STRLEN svp_len;
+ if (!SvPOK(*svp))
+ croak("ora_module_name is not a string");
+ imp_dbh->module_name = (text *) SvPV (*svp, svp_len );
+ imp_dbh->module_namel= (ub4) svp_len;
+ }
+ if ((svp=DBD_ATTRIB_GET_SVP(attr, "ora_client_identifier", 21)) && SvOK(*svp)) {
+ STRLEN svp_len;
+ if (!SvPOK(*svp))
+ croak("ora_client_identifier is not a string");
+ imp_dbh->client_identifier = (text *) SvPV (*svp, svp_len );
+ imp_dbh->client_identifierl= (ub4) svp_len;
+ }
+ if ((svp=DBD_ATTRIB_GET_SVP(attr, "ora_client_info", 15)) && SvOK(*svp)) {
+ STRLEN svp_len;
+ if (!SvPOK(*svp))
+ croak("ora_client_info is not a string");
+ imp_dbh->client_info = (text *) SvPV (*svp, svp_len );
+ imp_dbh->client_infol= (ub4) svp_len;
+ }
imp_dbh->server_version = 0;
/* check to see if DBD_verbose or ora_verbose is set*/
if (DBD_ATTRIB_TRUE(attr,"dbd_verbose",11,svp))
@@ -952,8 +982,31 @@
OCIAttrSet_log_stat(imp_dbh->svchp, (ub4) OCI_HTYPE_SVCCTX,
imp_dbh->seshp, (ub4) 0,(ub4) OCI_ATTR_SESSION, imp_dbh->errhp, status);
#ifdef ORA_OCI_112
- }
+
+
+if (imp_dbh->driver_name){
+
+ OCIAttrSet_log_stat(imp_dbh->seshp,OCI_HTYPE_SESSION,imp_dbh->driver_name,imp_dbh->driver_namel,OCI_ATTR_DRIVER_NAME,imp_dbh->errhp, status);
+}
#endif
+
+
+if (imp_dbh->client_identifier){
+
+ OCIAttrSet_log_stat(imp_dbh->seshp,OCI_HTYPE_SESSION,imp_dbh->client_identifier,imp_dbh->client_identifierl,OCI_ATTR_CLIENT_IDENTIFIER,imp_dbh->errhp, status);
+
+}
+
+if (imp_dbh->module_name){
+
+ OCIAttrSet_log_stat(imp_dbh->seshp,OCI_HTYPE_SESSION,imp_dbh->client_info,imp_dbh->client_infol,OCI_ATTR_CLIENT_INFO,imp_dbh->errhp, status);
+
+}
+if (imp_dbh->module_name){
+
+ OCIAttrSet_log_stat(imp_dbh->seshp,OCI_HTYPE_SESSION,imp_dbh->module_name,imp_dbh->module_namel,OCI_ATTR_MODULE,imp_dbh->errhp, status);
+
+}
}
#if defined(CAN_USE_PRO_C)
@@ -986,6 +1039,7 @@
}
#endif
+
return 1;
}
@@ -1187,6 +1241,11 @@
ora_ncs_buff_mtpl = SvIV (valuesv);
}
#ifdef ORA_OCI_112
+ else if (kl==15 && strEQ(key, "ora_driver_name") ) {
+ STRLEN vl;
+ imp_dbh->driver_name = (text *) SvPV (valuesv, vl );
+ imp_dbh->driver_namel= (ub4) vl;
+ }
else if (kl==8 && strEQ(key, "ora_drcp") ) {
imp_dbh->using_drcp = 1;
}
@@ -1205,6 +1264,21 @@
imp_dbh->pool_incr = SvIV (valuesv);
}
#endif
+ else if (kl==21 && strEQ(key, "ora_client_identifier") ) {
+ STRLEN vl;
+ imp_dbh->client_identifier = (text *) SvPV (valuesv, vl );
+ imp_dbh->client_identifierl= (ub4) vl;
+ }
+ else if (kl==15 && strEQ(key, "ora_client_info") ) {
+ STRLEN vl;
+ imp_dbh->client_info = (text *) SvPV (valuesv, vl );
+ imp_dbh->client_infol= (ub4) vl;
+ }
+ else if (kl==15 && strEQ(key, "ora_module_name") ) {
+ STRLEN vl;
+ imp_dbh->module_name = (text *) SvPV (valuesv, vl );
+ imp_dbh->module_namel= (ub4) vl;
+ }
else if (kl==20 && strEQ(key, "ora_oci_success_warn") ) {
oci_warn = SvIV (valuesv);
}
@@ -1266,6 +1340,35 @@
if (kl==18 && strEQ(key, "ora_ncs_buff_mtpl") ) {
retsv = newSViv (ora_ncs_buff_mtpl);
}
+#ifdef ORA_OCI_112
+ else if (kl==15 && strEQ(key, "ora_driver_name") ) {
+ retsv = newSVpv((char *)imp_dbh->driver_name,0);
+ }
+ else if (kl==8 && strEQ(key, "ora_drcp") ) {
+ retsv = newSViv(imp_dbh->using_drcp);
+ }
+ else if (kl==14 && strEQ(key, "ora_drcp_class") ) {
+ retsv = newSV(imp_dbh->pool_class);
+ }
+ else if (kl==12 && strEQ(key, "ora_drcp_min") ) {
+ retsv = newSViv(imp_dbh->pool_min);
+ }
+ else if (kl==12 && strEQ(key, "ora_drcp_max") ) {
+ retsv = newSViv(imp_dbh->pool_max));
+ }
+ else if (kl==13 && strEQ(key, "ora_drcp_incr") ) {
+ retsv = newSViv(imp_dbh->pool_incr);
+ }
+#endif
+ else if (kl==21 && strEQ(key, "ora_client_identifier")) {
+ retsv = newSVpv((char *)imp_dbh->client_identifier,0);
+ }
+ else if (kl==15 && strEQ(key, "ora_client_info")) {
+ retsv = newSVpv((char *)imp_dbh->client_info,0);
+ }
+ else if (kl==15 && strEQ(key, "ora_module_name")) {
+ retsv = newSVpv((char *)imp_dbh->module_name,0);
+ }
else if (kl==20 && strEQ(key, "ora_oci_success_warn")) {
retsv = newSViv (oci_warn);
}
Modified: dbd-oracle/trunk/dbdimp.h
==============================================================================
--- dbd-oracle/trunk/dbdimp.h (original)
+++ dbd-oracle/trunk/dbdimp.h Fri Jan 28 21:25:44 2011
@@ -50,7 +50,15 @@
ub4 pool_min;
ub4 pool_max;
ub4 pool_incr;
+ text *driver_name;/*driver name user defined*/
+ ub4 driver_namel;
#endif
+ text *client_info; /*user defined*/
+ ub4 client_infol;
+ text *module_name; /*module user defined */
+ ub4 module_namel;
+ text *client_identifier; /*user defined*/
+ ub4 client_identifierl;
int proc_handles; /* If true, srvhp, svchp, and authp handles
are owned by ProC and must not be freed. */
int RowCacheSize; /* both of these are defined by DBI spec*/
Modified: dbd-oracle/trunk/oci8.c
==============================================================================
--- dbd-oracle/trunk/oci8.c (original)
+++ dbd-oracle/trunk/oci8.c Fri Jan 28 21:25:44 2011
@@ -940,13 +940,14 @@
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;
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 */
+ oratext * exe_action = "";
/* XXX we set ora_check_sql on for now to force setup of the */
/* row cache. Change later to set up row cache using just a */
/* a memory size, perhaps also default $RowCacheSize to a */
@@ -979,6 +980,9 @@
if (attribs) {
SV **svp;
IV ora_auto_lob = 1;
+ if (svp= DBD_ATTRIB_GET_SVP(attribs, "ora_exe_action", 14)){;
+ exe_action = (oratext*)SvPV_nolen(*svp);
+ }
DBD_ATTRIB_GET_IV( attribs, "ora_parse_lang", 14, svp, oparse_lng);
DBD_ATTRIB_GET_IV( attribs, "ora_placeholders", 16, svp, ora_placeholders);
DBD_ATTRIB_GET_IV( attribs, "ora_auto_lob", 12, svp, ora_auto_lob);
@@ -1029,6 +1033,13 @@
default: oparse_lng = OCI_NTV_SYNTAX; break;
}
+
+ if (exe_action){
+ OCIAttrSet_log_stat(imp_dbh->seshp,OCI_HTYPE_SESSION,exe_action,(ub4)strlen(exe_action),OCI_ATTR_ACTION,imp_dbh->errhp, status);
+ }
+ else {
+ OCIAttrSet_log_stat(imp_dbh->seshp,OCI_HTYPE_SESSION,NULL,0,OCI_ATTR_ACTION,imp_dbh->errhp, status);
+ }
OCIHandleAlloc_ok(imp_dbh->envhp, &imp_sth->stmhp, OCI_HTYPE_STMT, status);
OCIStmtPrepare_log_stat(imp_sth->stmhp, imp_sth->errhp,
(text*)imp_sth->statement, (ub4)strlen(imp_sth->statement),
@@ -1037,6 +1048,7 @@
if (status != OCI_SUCCESS) {
oci_error(sth, imp_sth->errhp, status, "OCIStmtPrepare");
OCIHandleFree_log_stat(imp_sth->stmhp, OCI_HTYPE_STMT, status);
+
return 0;
}