[Home]

Summary:ASTERISK-02165: cdr_tds won't compile with older versions of FreeTDS
Reporter:sremington (sremington)Labels:
Date Opened:2004-07-31 23:56:57Date Closed:2008-01-15 15:05:06.000-0600
Priority:MinorRegression?No
Status:Closed/CompleteComponents:CDR/cdr_tds
Versions:Frequency of
Occurrence
Related
Issues:
Environment:Attachments:( 0) cdr_tds.patch
( 1) Makefile.patch
Description:I have version 0.61.2 of FreeTDS installed and got the following errors:

cdr_tds.c: In function `tds_log':
cdr_tds.c:159: too few arguments to function `tds_process_simple_query'
cdr_tds.c: In function `anti_injection':
cdr_tds.c:325: warning: suggest parentheses around assignment used as truth value
cdr_tds.c: In function `load_module':
cdr_tds.c:465: warning: implicit declaration of function `tds_set_client_charset'
cdr_tds.c:486: too few arguments to function `tds_process_simple_query'

Apearantly FreeTDS changed the API of the tds_process_simple_query() function somewhere between 0.61.2 and 0.62.4 (the latest stable version).

Here's the prototype for 0.61.2:
int tds_process_simple_query(TDSSOCKET * tds, TDS_INT * result_type);

And here's the prototype for 0.62.4:
int tds_process_simple_query(TDSSOCKET * tds);

Not sure if we just want to check for the FreeTDS version in the Makefile and conditionaly compile the cdr_tds module, or get fancier with some #ifdef's in the code to allow older versions to work too.
Comments:By: sremington (sremington) 2004-08-01 00:11:24

Or a note in the docs that you better be running version 0.xx.x or higher ;)
I will try and track down the exact version that the API changed tomorrow if needed.

By: sremington (sremington) 2004-08-01 16:32:56

Looks like >= 0.62 will work.

By: Olle Johansson (oej) 2004-08-08 15:28:17

Any patches that adds that information to the source, docs or a check in the makefile?

By: sremington (sremington) 2004-08-10 09:38:12

Uploaded a patch to check for the freeTDS version.

By: Mark Spencer (markster) 2004-08-11 23:36:51

I bow humbly to your Makefile, sed, and regexp foo.  Do you have a disclaimer on file already?  Also, have you considered using the version number to simply adjust the two calls in question to give them the correct parameters depending upon which version of tds is being linked against.  Thanks!

By: sremington (sremington) 2004-08-12 12:53:50

Yes. I sent one in about a month ago through snail mail.

That is a good idea. I will work on it and upload the fix when it is completed.

By: sremington (sremington) 2004-08-13 11:38:30

Uploaded an updated patch that does conditional compilation depending on the freeTDS version. Also found a call to tds_set_client_charset() that doesn't exist in older versions and placed an #ifndef guard around it.

By: Mark Spencer (markster) 2004-08-13 14:13:06

How about putting the version check in the C file, then no Makefile changes are necessary?

By: sremington (sremington) 2004-08-13 15:45:24

I'm sorry Mark, I'm probably just being a dunce, but I'm not quite sure what you mean. Wouldn't detecting the version be a configure/compile time option instead of a runtime option?

By: Mark Spencer (markster) 2004-08-13 16:41:50

This is very confusing... Looking at tds.h seems to suggest that there are definitions to make it possible but then i can't seem to really find anything but a version *string* which you can't use with #if, however I did a diff between the two versions of tds.h and think i've got something I can use, so please try latest CVS and let me know if that works.

By: sremington (sremington) 2004-08-14 00:43:19

All right, I follow you now. Your patch works great. Thanks for taking the time to work that out.

By: Mark Spencer (markster) 2004-08-14 13:55:06

Thank you for working on the patch in the first place!  My work was very simple in this case compared to yours!

By: Digium Subversion (svnbot) 2008-01-15 15:05:06.000-0600

Repository: asterisk
Revision: 3606

U   trunk/cdr/cdr_tds.c

------------------------------------------------------------------------
r3606 | markster | 2008-01-15 15:05:05 -0600 (Tue, 15 Jan 2008) | 2 lines

Build on older versions of TDS (bug ASTERISK-2165)

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

http://svn.digium.com/view/asterisk?view=rev&revision=3606