Re: DBD::Oracle DRCP_1.25

luben karavelov <[email protected]>
Newsgroups gmane.comp.lang.perl.modules.dbi.sybase.devel
Message-ID <[email protected]>
On  6.07.2010 14:36, John Scoles wrote:
> luben wrote:
>
> Gee didn't know anyone else was even interested in DRCP. good to see
> there is some interest
>
> Just to let you know that branch is in the very Beta stages so expect a
> few things to be missing

Yes, I know it is in beta. I was just intereseted.

> Ok would like to see the code for that/

I have attached the patch against DRCP branch

>> Finally, if this work is accepted I will add proper documentation for
>> the new attributes.
>>
> That would save me some trouble.
>
> Now I have a little favour to ask of you. Seems I am getting a problem
> with 31lob.t test 8 the sql "BEGIN ? := DBMS_LOB.GETLENGTH( ? ); END;";
> does not return the correct length when used with DRCP
>
> If you have half a moment and can take a look at that one that would be
> great.
>

Tomorrow I will send a patch for the documentation.

I am not experienced with perl driver hacking but I will take a look on 
the failing LOB test and try to figure what is going on.

Best regards
luben
connection_class.diff (text/plain, 3.8 KB)
Index: dbdimp.c
===================================================================
--- dbdimp.c	(revision 14227)
+++ dbdimp.c	(working copy)
@@ -388,8 +388,21 @@
 
 #ifdef ORA_OCI_112
 	/*check to see if the user is connecting with DRCP */
+    STRLEN  svp_len;
     if (DBD_ATTRIB_TRUE(attr,"ora_drcp",8,svp))
         imp_dbh->using_drcp = 1;
+    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
 	/* check to see if DBD_verbose or ora_verbose is set*/
 	if (DBD_ATTRIB_TRUE(attr,"dbd_verbose",11,svp))
@@ -793,6 +806,10 @@
 				if (imp_dbh->using_drcp) { /* connect uisng a DRCP */
 					ub4   purity = OCI_ATTR_PURITY_SELF;
 
+                    /* some 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,14 +818,14 @@
 							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,
+							(OraText *) pwd,
 							strlen(pwd),
 							status);
 
@@ -827,6 +844,10 @@
 					OCIAttrSet_log_stat(imp_dbh->authp, (ub4) OCI_HTYPE_AUTHINFO,
 								&purity, (ub4) 0,(ub4) OCI_ATTR_PURITY, imp_dbh->errhp, status);
 
+					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,
@@ -1103,6 +1124,7 @@
 {
 	dTHX;
 	STRLEN kl;
+    STRLEN vl;
 	char *key = SvPV(keysv,kl);
 	int on = SvTRUE(valuesv);
 	int cacheit = 1;
@@ -1114,6 +1136,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);
Index: dbdimp.h
===================================================================
--- dbdimp.h	(revision 14227)
+++ dbdimp.h	(working copy)
@@ -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.