Skip to Content.
Sympa Menu

freetds - [freetds] [ freetds-Patches-832242 ] Patch for FreeTDS without an ODBC driver manager

freetds AT lists.ibiblio.org

Subject: FreeTDS Development Group

List archive

Chronological Thread  
  • From: "SourceForge.net" <noreply AT sourceforge.net>
  • To: noreply AT sourceforge.net
  • Cc:
  • Subject: [freetds] [ freetds-Patches-832242 ] Patch for FreeTDS without an ODBC driver manager
  • Date: Sun, 02 Nov 2003 02:02:16 -0800

Patches item #832242, was opened at 2003-10-29 10:17
Message generated for change (Comment added) made by freddy77
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=407808&aid=832242&group_id=33106

Category: odbc
Group: None
>Status: Closed
>Resolution: Accepted
Priority: 5
Submitted By: David Fraser (djwfraser)
Assigned to: Nobody/Anonymous (nobody)
Summary: Patch for FreeTDS without an ODBC driver manager

Initial Comment:
As promised here are details of what needs done to get
FreeTDS ODBC working without a driver manager.

I leave it to the core-developers to review/critique/
complain/modify and hopefully accept the patch.

What it provides is mainly the following:
* Ability to make an ODBC driver standalone (i.e. with no
driver manager).
* Provides configure script option for this, which also
defines the existing TDS_NO_DM define, thus providing
a means to enable this existing code (put together by
Freddy & Steve Murphree) via configure.
* Allows unittests to build for this standalone driver
environment.
* Minor fixes to buglets that got in the way of the
above.

Pre-requisites
* The files sql.h, sqlext.h and sqltypes.h need to be
available. These can be taken from either the iODBC
or UnixODBC distributions. Either set of files work
equally well. I copy them into /usr/local/include, in my
setup. This directory is configurable - see next.

Code changes - the patch for this is attached and is
relatively trivial:
1) I changed configure.in, adding in a clause which
defines a "--with-odbc-nodm" option, much like
"--with-iodbc" or "--with-unixodbc". Indeed it rips of
the configure.in settings for these options, since I'm
not that familiar with configure scripts. As with these
options a directory is supplied as a parameter - such
as /usr/local. The include files (sql.h, sqlext.h etc)
are looked for in the "include" subdirectory below this
point (as with the iodbc and unixodbc options).

I'm open to renaming the option for aesthetic
reasons, and if anyone wants to alter my patch to
the configure script to allow the supplied parameter
to be the full include directory
- i.e. /usr/local/include and not just /usr/local, then
that's fine with me. On the other hand it would be
consistent with the --with-unixodbc and
--with-iodbc setup to leave it as I propose.

This new clause also defines TDS_NO_DM, when
--with-odbc-nodm is set. This is the define that
Freddy mailed me about, that adds extra driver
manager functionality in a DM-less scenario.

2) A complimentary change is required to
src/odbc/unittests/Makefile.am, to ensure the right
files are linked with the unittests. This fix also allows
iODBC to be built with the unittests (if so
configured): previously, -lodbc was hard-wired into
the makefile, whereas -liodbc is required for iODBC.

3) Changes are required to several include files to ensure
sql.h and sqlext.h are included for the DM-less case
(ifdef'd on TDS_NO_DM). These files are
include/tdsodbc.h, src/odbc/prepare_query.h and
src/odbc/odbc_util.h

4) There was an outstanding buglet in the code in
odbc.c at line 4601. Extra {}s were required around
the if body in order to get the code to compile.

5) I added an implementation of SQLCloseCursor ifdef'd
for TDS_NO_DM, to give the unittests a chance of
linking for this case. My one question here was
whether or not it is appropriate to change the
hstmt->cursor_state to closed. Not that I noticed
any problems with the code as it is.

So with these changes in place, the procedure to install
this is:

1) Ensure the sql header files are in place (see pre-
requisites above)
2) Get the FreeTDS code with patch applied.
3) Run autogen.sh --with-odbc-nodm=/usr/local
[--with-tdsver=7.0] (etc)
4) make
5) make install.

I also verified that the code still works when configured
with the iODBC and unixODBC driver managers,
using "configure" which was generated by
the above invocation of autogen.sh.

Unittest failure results are as follows for builds
configured with each of the given driver managers (in
my libiconv-less environment): (x/y) indicates x failed
out of y tests - so (0/y) is ideal.

TDS CTLIB DBLIB ODBC
unixODBC: 0/21 1/21 0/25 5/20* (3/20)
iODBC: 0/21 1/21 0/25 14/20
NO-DM: 0/21 1/21 0/25 7/20

Yes - it was probably pretty pointless testing TDS,
CTLIB and DBLIB multiple times, but I wanted to prove
that my configure.in/automake changes hadn't broken
these somehow.

The unixODBC ODBC figure drops to 3/20 when
ENABLE_DEVELOPING is defined. This trick can't be tried
with the no-DM code as there is a bug in the ODBC code
in this case which I reported earlier).
The failures for unixODBC are what Freddy sees, so
that's the baseline I'm working to.

I'm not sure what's up with iODBC, but that I got those
results on a clean build as well, so I'm not taking the rap
for that. :-) It's possibly down to my environment,
though the unittests had unixODBC specifics in the
makefile.

Ok - there are some failures for NO-DM over and above
unixODBC, but that's hardly surprising. Two-thirds of the
tests work, i.e. basic useful functionality does work for
the No DM case. It's a good start.

The attached patch was generated using 'cvs diff -u'.

Enjoy!


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

Comment By: Frediano Ziglio (freddy77)
Date: 2003-11-02 11:02

Message:
Logged In: YES
user_id=75766

Accepted and applied. Thanks for the patch!

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

You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=407808&aid=832242&group_id=33106



  • [freetds] [ freetds-Patches-832242 ] Patch for FreeTDS without an ODBC driver manager, SourceForge.net, 11/02/2003

Archive powered by MHonArc 2.6.24.

Top of Page