[freetds] ODBC configuration dialog on Windows

ZIGLIO, Frediano, VF-IT Frediano.Ziglio at vodafone.com
Tue May 4 07:53:47 EDT 2004


> The attached archive contains new files and patches for adding setup
and
> login dialogs to the Windows version of the FreeTDS ODBC driver.  The
> patches are relative to version 0.63.dev.20040428.  The files in the
> archive are:
> 
> win32/msvc6/w32setup.c
>         The configuration dialog.  This also defines the ConfigDSN(),
>         ConfigDriver(), and ConfigTranslator() external symbols.  Only
>         ConfigDSN() does anything useful, though.
> 
> win32/msvc6/w32login.c
>         The login dialog.  It defines a get_login_info() function
which
>         displays the dialog.  THIS FUNCTION IS NOT DECLARED IN ANY
HEADER
>         FILE!  I wasn't sure which header it should be declared in.
The
>         code compiles and runs correctly without a declaration, but
you
>         can expect a warning where the src/odbc/odbc.c file calls it.
> 

I moved all files to win32 directory, renamed w32* files to win* files
(just to have future compatibility with win64)
I get some warnings for get_login_info() but it's not so bad...
I don't know if ConfigDriver implementation is right.

> win32/msvc6/setup.rc
> win32/msvc6/resource.h
>         A resource file, defining the layouts of the two dialogs.
> 
>         It also contains version numbers.  There are separate version
>         numbers for "file" and "product".  The ODBC manager displays
>         the "file" version number, so I suggest you change both of
>         them to always show the same number.  Note that there are
>         *TWO* locations (one as numbers, one as a string) for each
>         version number.  I hope you can think of a good way to
automate
>         updates; if not, then I suggest you change them to something
>         that's obviously wrong like all 0's.  Remember, when compiling
>         with MSVC you don't run "configure" so thats not a good place
>         to do it.  Maybe "make freetds-stable.tgz"?
> 
>         The same section also allows you to add copyright information,
>         some of which is displayed by the ODBC manager.  You might
want
>         to look it over.

A solution is to write a version.rc.in from which generate a version.rc
included from resource.rc. However I don't know what's the best way to
update build version automatically (last version number)...

> 
> win32/msvc6/installfreetds.bat
>         A simple batch file that installs the FreeTDS ODBC driver.
> 

Written also a NSIS installed (you can find it at win32/freets.nsi)

> win32/msvc6/FreeTDS.dsp
>         This REPLACES an existing file.  Patching doesn't seem to work
>         very well on this file.  I Added the new files to the project.
>         The new files are win32/msvc6/w32setup.c,
win32/msvc6/w32login.c,
>         win32/msvc6/setup.rc and win32/msvc6/resource.h, described
above.
> 
>         I also added the src/tds/md5.c and src/tds/net.c files, which
are
>         apparently new.
> 

I updated also dev-c++ project files.

> w32setup.patch
>         Patches for other files.  These are:
> 
>         win32/FreeTDS.def
>                 I added ConfigDSN, ConfigDriver, and ConfigTranslator
to
>                 the list of exported symbols.
> 
>         win32/initnet.c
>                 I added a global variable named "hinstFreeTDS" which
stores
>                 the handle of the driver's instance.  The dialogs need
>                 to know which instance they're supposed to run it.
>                 (Honestly, I don't quite understand what Microsoft is
>                 doing here, but this is what works.)
> 
>         src/odbc/odbc.c
>                 I added the a call to the new get_login_info()
function,
>                 protected by "#ifdef WIN32".  If you prefer to use
_MSC_VER
>                 you're welcome to change it.  That might be a good
idea if
>                 anybody is using a different compiler in Windows.
> 
>                 Also, I moved the odbc_parse_connect_string() call
from
>                 immediately after the get_login_info() call, to
immediately
>                 before it.  This allows the login dialog to display
the
>                 server name, and to have defaults for the user name
and
>                 password, if the DSN string contains "UID" and "PWD"
>                 attributes.
> 

I also updated a bit directory handling. Now configuration data for user
is stored in "Application Data" directory (usually "c:\Document and
Settings\username\Application Data" under w2k/xp/w2k3). Log is stored
correctly on desktop.
There are still some issue to solve
- I would remove authentication type, now obsoleted
- Address information is always stored in DSN entry, I would avoid this
and use DNS/WINS

freddy77



More information about the FreeTDS mailing list