]> SAFE projects GIT repository - jmp/mailleur/commitdiff
Adding SQL drop result
authorJean-Marc Pigeon (Delson) <jmp@safe.ca>
Wed, 25 Jun 2025 11:34:57 +0000 (07:34 -0400)
committerJean-Marc Pigeon (Delson) <jmp@safe.ca>
Wed, 25 Jun 2025 11:34:57 +0000 (07:34 -0400)
lib/devsql.c
lib/unimar.c
lib/unimar.h
lib/unipos.c
lib/unipos.h

index c3aeb721457f2f22f5b777f9364f802371408cbc..34dc284b9afcec45794128d628028f57841853ed 100644 (file)
@@ -42,10 +42,26 @@ typedef struct  {
 /*      command.                                        */
 /*                                                      */
 /********************************************************/
-static SQLRES *dropresult(SQLRES *rs)
+static SQLRES *dropresult(SQLTYP *sql,SQLRES *rs)
 
 {
+#define OPEP    "devsql.c:dropresult,"
+
+switch(sql->sqldb) {
+  case db_postgres    :
+    rs=(SQLRES *)pos_dropresult((POSRES *)rs);
+    break;
+  case db_maria       :
+    rs=(SQLRES *)pos_dropresult((MARRES *)rs);
+    break;
+  default             :
+    (void) rou_alert(0,"%s Unexpected type='%d' (BUG!?)",
+                        OPEP,(int)sql->sqldb);
+    rs=(SQLRES *)0;
+    break;
+  }
 return rs;
+#undef  OPEP
 }
 /*
 \f
@@ -403,7 +419,7 @@ while (proceed==true) {
       if ((nbr=nbrtupple(sql,rs))>0) {
         (void) rou_alert(0,"%s jmpdbg NBR='%d'",OPEP,nbr);
         }
-      rs=dropresult(rs);
+      rs=dropresult(sql,rs);
       break;
     default     :
       proceed=false;
index cc0b807cfd6ea8988e8102bc53d034a6bf45c083..cff1460d901ed490f7112e368f1c7a0604e7ffd5 100644 (file)
@@ -153,6 +153,22 @@ return cleanstr;
 */
 /********************************************************/
 /*                                                     */
+/*      procedure to drop/free all result information   */
+/*                                                     */
+/********************************************************/
+PUBLIC MARRES *mar_dropresult(MARRES *rs)
+
+{
+#ifdef  DB_MYSQL
+(void) mysql_free_result((MYSQL_RES *)rs);
+#endif
+return (MARRES *)0;
+}
+/*
+\f
+*/
+/********************************************************/
+/*                                                     */
 /*     Procedure to extract data from the database.    */
 /*      Return POSRES status pointer (can be NULL is not*/
 /*      successfull.                                    */
index 9df6398791dceae0f532011cb9d08e73b76dc0a0..ecefce3a0385fc9cd2875c37cf469cc99ca0e932 100644 (file)
@@ -23,6 +23,9 @@ extern MARPTR *mar_closesql(MARPTR *marptr);
 //Procedure to detect and 'clean' any single quote within a string
 extern char *mar_cleanquote(char *sequence);
 
+//procedure to drop/free all result information
+extern MARRES *mar_dropresult(MARRES *rs);
+
 //procedure to extract data from database
 extern MARRES *mar_gettupple(MARPTR *marptr,char *command);
 
index 26a2aeadbd43f7ed6077d31afd0620561a2e55d8..8b25de65f1a53c60ff4c0fba2248a6f1d7f55300 100644 (file)
@@ -201,6 +201,22 @@ return cleanstr;
 */
 /********************************************************/
 /*                                                     */
+/*      procedure to drop/free all result information   */
+/*                                                     */
+/********************************************************/
+PUBLIC POSRES *pos_dropresult(POSRES *rs)
+
+{
+#ifdef  DB_POSTGRESQL
+(void) PQclear(rs);
+#endif
+return (POSRES *)0;
+}
+/*
+\f
+*/
+/********************************************************/
+/*                                                     */
 /*     Procedure to extract data from the database.    */
 /*      Return POSRES status pointer (can be NULL is not*/
 /*      successfull.                                    */
index 0113f9dadaa2633063722c394a71d9d629fca35a..e0a451270452b358ee7c043a9140b301e699207e 100644 (file)
@@ -23,6 +23,9 @@ extern POSPTR *pos_closesql(POSPTR *posptr);
 //Procedure to detect and 'clean' any single quote within a string
 extern char *pos_cleanquote(char *sequence);
 
+//procedure to drop/free all result information
+extern POSRES *pos_dropresult(POSRES *rs);
+
 //procedure to extract data from database
 extern POSRES *pos_gettupple(POSPTR *posptr,char *command);