[Kamailio-Devel] [ openser-Patches-2139104 ] Fetch support db_unixodbc

SourceForge.net noreply at sourceforge.net
Mon Oct 6 14:47:56 CEST 2008


Patches item #2139104, was opened at 2008-09-30 23:03
Message generated for change (Comment added) made by henningw
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=743022&aid=2139104&group_id=139143

Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: modules
Group: ver devel
Status: Open
Resolution: None
Priority: 5
Private: No
Submitted By: Jerome Martin (tramjoe)
Assigned to: Henning Westerholt (henningw)
Summary: Fetch support db_unixodbc

Initial Comment:
This patch implements fetch support for db_unixodbc.
It currently works for me with very large dialog tables (> 50 000 dialogs). Patch is against 1.4 rev 4989. 

Oh, BTW the tracker group 1.4.x does not exist for patches. Please add it :-)

I do not consider this patch production ready yet, but submit it for review regarding the following:

It seems that fetch support in db_mysql and db_postgresql supports the assumption in dialog module, and I guess other modules, that the row count is known before copying every row. This can NOT be assumed with db_unixodbc, for various reasons :

- unixodbc library has an SQLRowCount function that :
  . works with select only if the backend supports it. i.e. the TDS backend (MS-SQL) does NOT.
  . returns the row count for select only after fetching all rows

So the way my implementation works is by allowing an extra fetch call when there are no more rows to fetch and exit with success from that. It does work with dialog, but I have NOT tested this with other modules. Also, there might be implications here that I do not currently see, please comment.

Also, I'd appreciate if someone takes a look at malloc/free operations, I think I might have something leaking a bit currently.


----------------------------------------------------------------------

>Comment By: Henning Westerholt (henningw)
Date: 2008-10-06 12:47

Message:
Removing the static inline of some db_unixodbc code is not a problem. I
don't think that applying indention fixes to all modules is worth the
effort, don't want to break compatibility (e.g. for patches) because of
this reasons. Its fine to apply them to code that anyway gets changed, like
in this case. I'll wait then for your updated version.

----------------------------------------------------------------------

Comment By: Jerome Martin (tramjoe)
Date: 2008-10-06 12:01

Message:
Hi Henning,

Several things : 
1/ I will release a better version soon (like today I think), grouping the
fetch functionality in a single function in dbase.c at the cost of removing
the "static inline" of some backend functions. Also the previous patch has
a malloc issue and works only by coincidence with number of fetch lines
~>50 but not smaller ones. In fact I did not guarantee that the fetched
rows will be at the same memory address, so for big mallocs it is the case
most of the time, but not for smaller ones ... 
2/ If you like the indentation fixes I throwed in (indented line
continuation instead of aligned on the line start), then I could apply it
to the whole module codebase easily, this is part of my vim configuration
:-)


----------------------------------------------------------------------

Comment By: Henning Westerholt (henningw)
Date: 2008-10-06 11:48

Message:
Hi Jerome,

thanks for the patch. I've already integrated the indention fixes for the
functions with long parameter lists that you've suggested. I attached the
updated patch against the trunk, will take a closer look in the next days.


With regards to the differences in the fetch_result logic: Yes, i know the
actual way of doing this in the mysql and postgres modules is not that
really straight forward. In previous versions they used to differ more, i
needed to do a few compromises to get them to this state in order to be
able to benefit from the common DB core API.. I'll also do some tests with
the carrierroute and usrloc module.

Henning
File Added: fetch_support_db_unixodbc-2.patch

----------------------------------------------------------------------

Comment By: Klaus Darilion (klaus_darilion)
Date: 2008-10-01 12:30

Message:
added "ver 1.4.x" to the tracker

----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=743022&aid=2139104&group_id=139143



More information about the Devel mailing list