On 11-Aug-09, at 3:46 AM, Alan DeKok wrote:
Gabriel Blanchard wrote:
mmm never mind, I just looked up the old code for rlm_sql_freetds.c and does appear to be using an old API. So I'm assuming that if I code it against the new API and submit a patch it would be welcome?
Yes.
Well I just spent the entire day coding this module and I wasted about 90% of that time on FreeTDS getting stuck for ever it the query times out (I purposely made them timeout to test it). After looking at the source code of FreeTDS it turns out that the dbsettime() function that is supposed to set a timeout value for the dbsqlexec() function doesn't even work! So I figured out a work around, by using the dbsetinterrupt function to set a call back. It calls whatever pointer of a function defined by us about once a second. This function can then be used to cancel the query after a certain amount of time. So it turns out that the problem isn't really with unixODBC but rather FreeTDS itself...in a sense anyway. I also found that a lot of other projects that use FreeTDS have this exact same problem. All and all, the module I just coded works and is able to INSERT or UPDATE the database. I haven't implemented SELECTs yet. -Gabe