noalyss-commit
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Noalyss-commit] [noalyss] 66/323: Database : add function is_prepare()


From: Dany De Bontridder
Subject: [Noalyss-commit] [noalyss] 66/323: Database : add function is_prepare() to check if pg_prepare has already run
Date: Wed, 14 Mar 2018 17:38:19 -0400 (EDT)

sparkyx pushed a commit to branch master
in repository noalyss.

commit 2e40252b7765b0095fba640f3951240870b6fc60
Author: Dany De Bontridder <address@hidden>
Date:   Sun Jan 21 13:56:31 2018 +0100

    Database : add function is_prepare() to check if pg_prepare has already run
---
 include/lib/database.class.php | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/include/lib/database.class.php b/include/lib/database.class.php
index 393b6dc..edddef6 100644
--- a/include/lib/database.class.php
+++ b/include/lib/database.class.php
@@ -1156,6 +1156,17 @@ class Database
                 $this->lo_unlink($a_lob[$i]['oid']);
         }
     }
+    /**
+     * Check if a prepared statement already exists or not
+     * @param string $query_name name of the prepared query
+     * @return boolean false is not yet prepared
+     */
+    function is_prepare($query_name)
+    {
+        $nb_prepared=$this->get_value("select count(*) from 
pg_prepared_statements where name=$1",[$query_name]);
+        if ( $nb_prepared==0)return FALSE;
+        return TRUE;
+    }
 
 }
 



reply via email to

[Prev in Thread] Current Thread [Next in Thread]