Re: [PATCH] Stored Procedures support on dbpool_mssql

Alejandro Guerrieri <[email protected]>
Newsgroups gmane.comp.mobile.kannel.devel
Message-ID <[email protected]>
Commiting this slightly modified version that fixes a memory leak on  
each select as well.





Regards,
--
Alejandro Guerrieri
[email protected]



On 22/06/2009, at 9:46, Alexander Malysh wrote:

> Hi Alex,
>
> +1 from me, please commit...
>
> Thanks,
> Alex
>
> Am 21.06.2009 um 17:34 schrieb Alejandro Guerrieri:
>
>> This small patch fixes dbpool_mssql so stored procedures can be  
>> invoked with mssql_select and mssql_update (by using "EXEC  
>> <my_stored_procedure> <param1> <param2>...").
>>
>> It also displays the error number when an unkown result is  
>> encountered.
>>
>> <patch-mssql-status-result.patch>
>>
>>
>> Objections?
>> --
>> Alejandro Guerrieri
>> [email protected]
>>
>>
>>
>
patch-mssql-status-result_v1.patch (application/octet-stream, 1.2 KB)
Index: gwlib/dbpool_mssql.c
===================================================================
RCS file: /home/cvs/gateway/gwlib/dbpool_mssql.c,v
retrieving revision 1.1
diff -u -b -w -r1.1 dbpool_mssql.c
--- gwlib/dbpool_mssql.c	4 May 2009 21:35:53 -0000	1.1
+++ gwlib/dbpool_mssql.c	22 Jun 2009 08:14:58 -0000
@@ -260,16 +260,18 @@
                     *res = NULL;
                     return -1;
                 }
+                mssql_undef_coldata(columns);
                 break;
             case CS_CMD_SUCCEED:
             case CS_CMD_DONE:
+            case CS_STATUS_RESULT:
                 break;
             case CS_CMD_FAIL:
                 error(0, "select failed!");
                 return -1;
                 break;
             default:
-                error(0, "ct_result returned unexpected result type");
+                error(0, "ct_result returned unexpected result type: %d", res_type);
                 return -1;
                 break;
         }
@@ -303,6 +305,7 @@
         switch ((int) result_type) {
             case CS_CMD_SUCCEED:
             case CS_CMD_DONE:
+            case CS_STATUS_RESULT:
                 break;
             default:
                 mssql_checkerr(result_type);
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.