[libdbd-pg-perl] 15/35: Use PQexec not PQexecParams if there are zero params!

Christoph Berg myon at debian.org
Wed Sep 27 17:41:03 UTC 2017


This is an automated email from the git hooks/post-receive script.

myon pushed a commit to branch master
in repository libdbd-pg-perl.

commit 4454f5ca4259112c6aca939d156402d9c612d5a7
Author: Greg Sabino Mullane <greg at endpoint.com>
Date:   Wed Sep 20 16:31:57 2017 -0400

    Use PQexec not PQexecParams if there are zero params!
---
 Changes  | 6 ++++++
 dbdimp.c | 8 +++++---
 2 files changed, 11 insertions(+), 3 deletions(-)

diff --git a/Changes b/Changes
index 3ec4e6f..585ee1e 100644
--- a/Changes
+++ b/Changes
@@ -1,12 +1,18 @@
 
+  - If no placeholders, use PQexec instead of PQexecParams
+    [Greg Sabino Mullane]
+
   - Fix running tests with non-UTF8 server_encoding
     [Dagfinn Ilmari Mannsåker]
     (Github issue #26)
+
   - Fix crash with missing client_encoding
     (Github issue #29)
     [David Christensen, reported by Marko Tiikkaja]
+
   - Fix crash with missing server_version
     [David Christensen]
+
   - Fix leak in ->state methods
     [Dagfinn Ilmari Mannsåker]
     (Github issue #30)
diff --git a/dbdimp.c b/dbdimp.c
index 5dff5e7..a2157e2 100644
--- a/dbdimp.c
+++ b/dbdimp.c
@@ -3301,18 +3301,20 @@ long dbd_st_execute (SV * sth, imp_sth_t * imp_sth)
 	/* Increment our count */
 	imp_sth->number_iterations++;
 
-	/* We must use PQexec if:
+	/* We use PQexec if:
 	   1. The statement is *not* DML (e.g. is DDL, which cannot be prepared)
 	   2. We have a DEFAULT parameter
 	   3. We have a CURRENT parameter
 	   4. pg_direct is true
-	   5. pg_server_prepare is false
-	   6. pg_server_prepare is 2, but all placeholders are not bound
+	   5. There are no placeholders
+	   6. pg_server_prepare is false
+	   7. pg_server_prepare is 2, but all placeholders are not bound
 	*/
 	if (!imp_sth->is_dml
 		|| imp_sth->has_default
 		|| imp_sth->has_current
 		|| imp_sth->direct
+		|| !imp_sth->numphs
 		|| !imp_sth->server_prepare
 		|| (2==imp_sth->server_prepare && imp_sth->numbound != imp_sth->numphs)
 		)

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-perl/packages/libdbd-pg-perl.git



More information about the Pkg-perl-cvs-commits mailing list