[svn:dbd-oracle] r14235 - dbd-oracle/branches/DRCP_1.25

[email protected]
Newsgroups perl.dbd.oracle.changes
Message-ID <[email protected]>
Author: byterock
Date: Thu Jul  8 04:58:55 2010
New Revision: 14235

Modified:
   dbd-oracle/branches/DRCP_1.25/Oracle.pm
   dbd-oracle/branches/DRCP_1.25/dbdimp.c
   dbd-oracle/branches/DRCP_1.25/dbdimp.h

Log:
Added in the other params for DRCP now time to test

Modified: dbd-oracle/branches/DRCP_1.25/Oracle.pm
==============================================================================
--- dbd-oracle/branches/DRCP_1.25/Oracle.pm	(original)
+++ dbd-oracle/branches/DRCP_1.25/Oracle.pm	Thu Jul  8 04:58:55 2010
@@ -247,6 +247,30 @@
 	# Call Oracle OCI logon func in Oracle.xs file
 	# and populate internal handle data.
 	
+	
+	if (exists $ENV{ORA_POOL_CLASS}) {
+	   $attr->{ora_pool_class} = $ENV{ORA_POOL_CLASS}
+	}
+	if($attr->{ora_pool_class}){
+	# if using ora_pool_class it cannot contain more than 1024 bytes 
+	# and cannot contain a *
+	   if (index($attr->{ora_pool_class},'*') !=-1){
+		croak("ora_pool_class cannot contain a '*'!");
+	   }
+	   if (length($attr->{ora_pool_class}) > 1024){
+		croak("ora_pool_class mut be less than 1024 characters!");
+	   }
+	}
+	if (exists $ENV{ORA_POOL_MIN}) {
+	   $attr->{ora_pool_min} = $ENV{ORA_POOL_MIN}
+	}
+	if (exists $ENV{ORA_POOL_MAX}) {
+	   $attr->{ora_pool_max} = $ENV{ORA_POOL_MAX}
+	}
+	if (exists $ENV{ORA_POOL_INCR}) {
+	   $attr->{ora_pool_incr} = $ENV{ORA_POOL_INCR}
+	}
+	
 	DBD::Oracle::db::_login($dbh, $dbname, $user, $auth, $attr)
 	    or return undef;
 

Modified: dbd-oracle/branches/DRCP_1.25/dbdimp.c
==============================================================================
--- dbd-oracle/branches/DRCP_1.25/dbdimp.c	(original)
+++ dbd-oracle/branches/DRCP_1.25/dbdimp.c	Thu Jul  8 04:58:55 2010
@@ -382,15 +382,31 @@
 	DBD_ATTRIB_GET_IV(attr, "ora_use_proc_connection", 23,
 			use_proc_connection_sv, use_proc_connection);
 #else /*CAN_USE_PRO_C*/
-    if (DBD_ATTRIB_TRUE(attr,"ora_use_proc_connection",23,svp))
-      	croak ("You can only use a ProC connection, if your DBD::Oracle was built with the -ProC on the Makefile.PL") ;
+	if (DBD_ATTRIB_TRUE(attr,"ora_use_proc_connection",23,svp))
+		croak ("You can only use a ProC connection, if your DBD::Oracle was built with the -ProC on the Makefile.PL") ;
 #endif /*CAN_USE_PRO_C*/
 
 #ifdef ORA_OCI_112
 	/*check to see if the user is connecting with DRCP */
-    if (DBD_ATTRIB_TRUE(attr,"ora_drcp",8,svp))
-        imp_dbh->using_drcp = 1;
-#endif
+	if (DBD_ATTRIB_TRUE(attr,"ora_drcp",8,svp))
+		imp_dbh->using_drcp = 1;
+
+	/* some connection pool atributes  */
+
+	if ((svp=DBD_ATTRIB_GET_SVP(attr, "ora_pool_class", 14)) && SvOK(*svp)) {
+		if (!SvPOK(*svp))
+			croak("ora_pool_class is not a string");
+		imp_dbh->pool_class = (text *) SvPV (*svp, svp_len );
+		imp_dbh->pool_classl= (ub4) svp_len;
+    }
+	if (DBD_ATTRIB_TRUE(attr,"ora_pool_min",12,svp))
+		DBD_ATTRIB_GET_IV( attr, "ora_pool_min",  12, svp, imp_dbh->pool_min);
+	if (DBD_ATTRIB_TRUE(attr,"ora_pool_max",12,svp))
+		DBD_ATTRIB_GET_IV( attr, "ora_pool_max",  12, svp, imp_dbh->pool_max);
+	if (DBD_ATTRIB_TRUE(attr,"ora_pool_incr",13,svp))
+		DBD_ATTRIB_GET_IV( attr, "ora_pool_incr",  13, svp, imp_dbh->pool_incr);
+#endif /*ORA_OCI_112*/
+
 	/* check to see if DBD_verbose or ora_verbose is set*/
 	if (DBD_ATTRIB_TRUE(attr,"dbd_verbose",11,svp))
 		DBD_ATTRIB_GET_IV(  attr, "dbd_verbose",  11, svp, dbd_verbose);
@@ -789,10 +805,15 @@
 
 #ifdef ORA_OCI_112
 
-
 				if (imp_dbh->using_drcp) { /* connect uisng a DRCP */
 					ub4   purity = OCI_ATTR_PURITY_SELF;
-
+					/* pool Default values */
+					if (!imp_dbh->pool_min )
+						imp_dbh->pool_min = 4;
+					if (!imp_dbh->pool_max )
+						imp_dbh->pool_max = 40;
+					if (!imp_dbh->pool_incr)
+						imp_dbh->pool_incr = 2;
 
 					OCIHandleAlloc_ok(imp_dbh->envhp, &imp_dbh->poolhp, OCI_HTYPE_SPOOL, status);
 
@@ -801,12 +822,12 @@
 							imp_dbh->poolhp,
 							(OraText **) &imp_dbh->pool_name,
 							(ub4 *) &imp_dbh->pool_namel,
-							dbname,
+							(OraText *) dbname,
 							strlen(dbname),
-							10,
-							100,
-							4,
-							uid,
+							imp_dbh->pool_min,
+							imp_dbh->pool_max,
+							imp_dbh->pool_incr,
+							(OraText *) uid,
 							strlen(uid),
 							pwd,
 							strlen(pwd),
@@ -827,6 +848,11 @@
 					OCIAttrSet_log_stat(imp_dbh->authp, (ub4) OCI_HTYPE_AUTHINFO,
 								&purity, (ub4) 0,(ub4) OCI_ATTR_PURITY, imp_dbh->errhp, status);
 
+					if (imp_dbh->pool_class) /*pool_class may ormay not be used */
+						OCIAttrSet_log_stat(imp_dbh->authp, (ub4) OCI_HTYPE_AUTHINFO,
+								(OraText *) imp_dbh->pool_class, (ub4) imp_dbh->pool_classl,
+								(ub4) OCI_ATTR_CONNECTION_CLASS, imp_dbh->errhp, status);
+
 					cred_type = ora_parse_uid(imp_dbh, &uid, &pwd);
 
 					OCISessionGet_log_stat(imp_dbh->envhp, imp_dbh->errhp, &imp_dbh->svchp, imp_dbh->authp,
@@ -1114,6 +1140,19 @@
 	else if (kl==8 && strEQ(key, "ora_drcp") ) {
 		imp_dbh->using_drcp = 1;
 	}
+	else if (kl==14 && strEQ(key, "ora_pool_class") ) {
+		imp_dbh->pool_class = (text *) SvPV (valuesv, vl );
+		imp_dbh->pool_classl= (ub4) vl;
+	}
+	else if (kl==12 && strEQ(key, "ora_pool_min") ) {
+		imp_dbh->pool_min = SvIV (valuesv);
+	}
+	else if (kl==12 && strEQ(key, "ora_pool_max") ) {
+		imp_dbh->pool_max = SvIV (valuesv);
+	}
+	else if (kl==13 && strEQ(key, "ora_pool_incr") ) {
+		imp_dbh->pool_incr = SvIV (valuesv);
+	}
 #endif
 	else if (kl==20 && strEQ(key, "ora_oci_success_warn") ) {
 		oci_warn = SvIV (valuesv);

Modified: dbd-oracle/branches/DRCP_1.25/dbdimp.h
==============================================================================
--- dbd-oracle/branches/DRCP_1.25/dbdimp.h	(original)
+++ dbd-oracle/branches/DRCP_1.25/dbdimp.h	Thu Jul  8 04:58:55 2010
@@ -45,6 +45,11 @@
 	text        *pool_name;
 	ub4			pool_namel;
 	bool		using_drcp;
+	text		*pool_class;
+	ub4			pool_classl;
+	ub4			pool_min;
+	ub4			pool_max;
+	ub4			pool_incr;
 #endif
 	int proc_handles;		   /* If true, srvhp, svchp, and authp handles
 								   are owned by ProC and must not be freed. */
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.