[svn:DBD-Pg] r13152 - DBD-Pg/trunk

[email protected]
Newsgroups gmane.comp.db.postgresql.dbdpg.cvs
Message-ID <[email protected]>
Author: turnstep
Date: Sun Aug  2 14:45:20 2009
New Revision: 13152

Modified:
   DBD-Pg/trunk/dbdimp.c

Log:
Use PQexecPrepared, even if not placeholders.


Modified: DBD-Pg/trunk/dbdimp.c
==============================================================================
--- DBD-Pg/trunk/dbdimp.c	(original)
+++ DBD-Pg/trunk/dbdimp.c	Sun Aug  2 14:45:20 2009
@@ -1986,16 +1986,18 @@
 	if (TRACE7) {
 		TRC(DBILOGFP, "%sPlaceholder type: %d numsegs: %d numphs: %d\n",
 			THEADER, imp_sth->placeholder_type, imp_sth->numsegs, imp_sth->numphs);
-		TRC(DBILOGFP, "%sPlaceholder numbers, ph id, and segments:\n",
+		TRC(DBILOGFP, "%sPlaceholder numbers and segments:\n",
 			THEADER);
 		for (currseg=imp_sth->seg; NULL != currseg; currseg=currseg->nextseg) {
 			TRC(DBILOGFP, "%sPH: (%d) SEG: (%s)\n",
 				THEADER, currseg->placeholder, currseg->segment);
 		}
-		TRC(DBILOGFP, "%sPlaceholder number, fooname, id:\n", THEADER);
-		for (xlen=1,currph=imp_sth->ph; NULL != currph; currph=currph->nextph,xlen++) {
-			TRC(DBILOGFP, "%s#%d FOONAME: (%s)\n",
-				THEADER, (int)xlen, currph->fooname);
+		if (imp_sth->numphs) {
+			TRC(DBILOGFP, "%sPlaceholder number, fooname, id:\n", THEADER);
+			for (xlen=1,currph=imp_sth->ph; NULL != currph; currph=currph->nextph,xlen++) {
+				TRC(DBILOGFP, "%s#%d FOONAME: (%s)\n",
+					THEADER, (int)xlen, currph->fooname);
+			}
 		}
 	}
 
@@ -2976,10 +2978,10 @@
 	}
 	
 	/* We use the new server_side prepare style if:
-	   1. The statement is DML
+	   1. The statement is DML (DDL is not prepareable)
 	   2. The attribute "pg_direct" is false
 	   3. The attribute "pg_server_prepare" is not 0
-	   4. There is one or more placeholders (but "onetime" has not been set)
+	   4. The "onetime" attribute has not been set
 	   5. There are no DEFAULT or CURRENT values
 	   6a. The attribute "pg_server_prepare" is 1
 	   OR
@@ -3000,7 +3002,7 @@
 		&& 0 != imp_sth->server_prepare
 		&& !imp_sth->has_default
 		&& !imp_sth->has_current
-		&& (1 <= imp_sth->numphs && !imp_sth->onetime)
+		&& !imp_sth->onetime
 		&& (1 == imp_sth->server_prepare
 			|| (imp_sth->numbound == imp_sth->numphs))
 		){
@@ -3033,8 +3035,8 @@
 			}
 		}
 		
-		if (TRACE5) TRC(DBILOGFP, "%sRunning PQexecPrepared with (%s)\n",
-						THEADER, imp_sth->prepare_name);
+		if (TRACE5) TRC(DBILOGFP, "%sRunning PQexecPrepared with (%s) (%s)\n",
+						THEADER, imp_sth->prepare_name, imp_sth->PQvals);
 		if (TSQL) {
 			TRC(DBILOGFP, "EXECUTE %s (\n", imp_sth->prepare_name);
 			for (x=0,currph=imp_sth->ph; NULL != currph; currph=currph->nextph,x++) {
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.