[freetds] Announcement: db-lib update

James K. Lowden jklowden at freetds.org
Sat Jan 31 14:58:45 EST 2009


Two changes coming to the db-lib API:

1.  Functional prototypes to use "const arg[]" instead of "char *"
wherever applicable.  

2.  Removal of all unimplemented functions from sybdb.h and libsybdb.  

The vendors -- each for their own reasons -- stopped updating db-lib years
ago.  Microsoft hasn't produced a new binary since 2000 and no longer
distributes even that.  

Meanwhile, the C standard and common practice has changed.  const was
added to the language and the C standard library is described in const
terms.  Old programs are unaffected, but new programs that adopt modern
practice encounter warnings/errors when passing a const string to a
stone-age function, e.g.:

	RETCODE dbrpcinit(DBPROCESS * dbproc, 
		char *rpcname, DBSMALLINT options);

which is now (in CVS HEAD):

	RETCODE dbrpcinit(DBPROCESS * dbproc, 
		const char rpcname[], DBSMALLINT options);

Not done, but under consideration, is to declare as "const DBPROCESS*"
those functions (e.g. dbconvert) that don't modify the DBPROCESS
structure. That would facilitate C++ wrapper library development.  Of
which there are many, I'm sure.  ;-)

On the second point, the FreeTDS db-lib declared (and sometimes defined)
78 functions that have no useful implementation.  I've never understood
why that was done; I don't see the point in helping something compile that
won't link, or linking something that will only come to tears when it
runs.  

Perhaps once upon a time programs linking to FreeTDS might have referenced
some functions that were rarely used, and linking to stub-functions
permitted them to partially run with FreeTDS.  Nowadays substantially all
the API has been implemented, and much of what remains has been scheduled
for "never".  

Consequently, I moved all such code inside conditional compilation.  If
you want it, define DBLIB_UNIMPLEMENTED.  

I did this as a favor to developers.  If your code fails to compile/link
without DBLIB_UNIMPLEMENTED, you know you're uing non-code and you now
have an opportunity to find it and strike it.  Or, you can modify your
Makefile and go on as before.  

Feedback welcome of course.  

--jkl




More information about the FreeTDS mailing list