www.digitalmars.com         C & C++   DMDScript  

digitalmars.D - Download link to the ODBC32 headers for D

reply David L. Davis <SpottedTiger yahoo.com> writes:
Download link to the ODBC32 headers I've converted to D, which include sql.d,
sqlext.d, sqltypes.d, sqlucode.d, and one example (sqltest.d); been working on
these babys for a month.

http://spottedtiger.tripod.com/D_Language/D_Support_Projects_XP.html

David L.

-------------------------------------------------------------------
"Dare to reach for the Stars...Dare to Dream, Build, and Achieve!"
Aug 13 2004
next sibling parent reply J C Calvarese <jcc7 cox.net> writes:
David L. Davis wrote:
 Download link to the ODBC32 headers I've converted to D, which include sql.d,
 sqlext.d, sqltypes.d, sqlucode.d, and one example (sqltest.d); been working on
 these babys for a month.
 
 http://spottedtiger.tripod.com/D_Language/D_Support_Projects_XP.html
 
 David L.
 
 -------------------------------------------------------------------
 "Dare to reach for the Stars...Dare to Dream, Build, and Achieve!"

Sounds great! I added this to: http://www.prowiki.org/wiki4d/wiki.cgi?DatabaseBindings -- Justin (a/k/a jcc7) http://jcc_7.tripod.com/d/
Aug 13 2004
parent David L. Davis <SpottedTiger yahoo.com> writes:
In article <cfk8f4$1pfl$1 digitaldaemon.com>, J C Calvarese says...
David L. Davis wrote:
 Download link to the ODBC32 headers I've converted to D, which include sql.d,
 sqlext.d, sqltypes.d, sqlucode.d, and one example (sqltest.d); been working on
 these babys for a month.
 
 http://spottedtiger.tripod.com/D_Language/D_Support_Projects_XP.html
 
 David L.
 
 -------------------------------------------------------------------
 "Dare to reach for the Stars...Dare to Dream, Build, and Achieve!"

Sounds great! I added this to: http://www.prowiki.org/wiki4d/wiki.cgi?DatabaseBindings -- Justin (a/k/a jcc7) http://jcc_7.tripod.com/d/

J C Calvarese: Thxs! It's nice to see that I have some support within this news group. :)) ------------------------------------------------------------------- "Dare to reach for the Stars...Dare to Dream, Build, and Achieve!"
Aug 14 2004
prev sibling parent reply J C Calvarese <jcc7 cox.net> writes:
David L. Davis wrote:
 Download link to the ODBC32 headers I've converted to D, which include sql.d,
 sqlext.d, sqltypes.d, sqlucode.d, and one example (sqltest.d); been working on
 these babys for a month.
 
 http://spottedtiger.tripod.com/D_Language/D_Support_Projects_XP.html
 
 David L.
 
 -------------------------------------------------------------------
 "Dare to reach for the Stars...Dare to Dream, Build, and Achieve!"

Okay, I've gotten around to looking at the ODBC32 headers. It looks good and complete, but there are some rough edges that I think need fixing. First off, I don't think you put your latest files in the archive you uploaded. The files didn't compile for me without some changes. Specifically: I think line 225 of sqlucode should be: SQLRETURN SQLSetConnectOptionW instead of: SQLRETURN SQL_API SQLSetConnectOptionW sqlucode.d(28): identifier 'SQLRETURN' is not defined Add "import std.c.windows.sqltypes;" to line 10 of sqlucode.d. I think I had to make another change, too, but I forgot to record it. In any case, I assume you've already fixed these problem, but accidently uploaded the old versions. Another issue is I think it's inconvenient to place some of the code in etc\c\windows and some of it in std\c\windows. Just put it all in etc\c\windows. If Walter wants to add it to Phobos, then it can all change to std\c\windows. I re-install DMD pretty often (usually whenever a new version is available) and I'd likely forget and delete the sql stuff along with everything else. Also, it'd be easier for people to use if the directory structure is saved in the .zip file. It'd be handy for the user if you'd include a batch file or makefile that compiles the code. Here's something I set up for the current module structure: [build.bat] echo off echo Compiling std.c.windows.sql*... cd std\c\windows dmd sql.d sqlext.d sqltypes.d sqlucode.d -c -I..\..\.. lib.exe -c ..\..\..\std_c_win_sql.lib sql.obj sqlext.obj sqltypes.obj sqlucode.obj cd ..\..\.. echo Compiling etc.c.windows.odbc32dll... cd etc\c\windows dmd odbc32dll.d -c -I..\..\.. rem lib.exe -c ..\..\..\etc_c_win_odbc.lib odbc32dll.obj cd ..\..\.. dmd sqltest.d etc\c\windows\odbc32dll.obj std_c_win_sql.lib sqltest.exe pause It shouldn't be necessary to add an entry in the ODBC Manager to access an .mdb file. I think it's called a "DNSless connection". I've done it before, but it's been a while. I'll try to add that capability to your test program to show you what I mean, but I haven't done it yet. Also, it'd be nice if the path to the odbc32.dll didn't have to be embedded in the file. That should be possible by using implib, but I realize that not everyone likes implib. At the very least, the program could guess better at where it is by looking for a registry entry or an environment setting. Not everyone has the .dll located at "C:\windows\system32\odbc32.dll". For example mine is at "H:\windows\system32\odbc32.dll". Also, Window9X users probably have it at "C:\windows\system\odbc32.dll". I hope my criticisms don't come off as harsh. They're meant to be contructive. I tend to be most critical with things that I'm most interested in. And some of these suggestions should be easy to implement if you agree with my reasoning. -- Justin (a/k/a jcc7) http://jcc_7.tripod.com/d/
Aug 15 2004
parent reply J C Calvarese <jcc7 cox.net> writes:
J C Calvarese wrote:
 It shouldn't be necessary to add an entry in the ODBC Manager to access 
 an .mdb file. I think it's called a "DNSless connection". I've done it 
 before, but it's been a while. I'll try to add that capability to your 
 test program to show you what I mean, but I haven't done it yet.

Ah, I meant "DSNless connection". It's like this... Using ODBC connection without specifying a DSN : Driver={Microsoft Access Driver (*.mdb)}; DBQ=c:\path\to\database.mdb http://www.stardeveloper.com/articles/display.html?article=2000120101&page=1 I still think it's possible, but I keep on getting errors trying to adapt your test program to use this. Hmmm... -- Justin (a/k/a jcc7) http://jcc_7.tripod.com/d/
Aug 15 2004
parent David L. Davis <SpottedTiger yahoo.com> writes:
In article <cforih$18s1$1 digitaldaemon.com>, J C Calvarese says...
J C Calvarese wrote:
 It shouldn't be necessary to add an entry in the ODBC Manager to access 
 an .mdb file. I think it's called a "DNSless connection". I've done it 
 before, but it's been a while. I'll try to add that capability to your 
 test program to show you what I mean, but I haven't done it yet.

Ah, I meant "DSNless connection". It's like this... Using ODBC connection without specifying a DSN : Driver={Microsoft Access Driver (*.mdb)}; DBQ=c:\path\to\database.mdb http://www.stardeveloper.com/articles/display.html?article=2000120101&page=1 I still think it's possible, but I keep on getting errors trying to adapt your test program to use this. Hmmm... -- Justin (a/k/a jcc7) http://jcc_7.tripod.com/d/

J C Calvarese: Thank you very much for your comments and corrections! I've updated the files and retested them...below are the comments from the readme file within the new zip file: ======================================================== ODBC32.DLL header files for "D" A special thanks to "J C Calvarese" from the "D" user's forum, for testing and pointing out a few problems that somehow got passed me. :( 1) Corrected errors that "J C Calvarese" had found. 2) I've put in the SQLDriverConnect() to do a DSN-Less Database connection, instesd of using SQLConnect(). 3) Added a few more comments into sqltest.d 4) Zipped everything with paths. 5) Modified "J C Calvarese" build.bat and rename it to build_sqltest.bat * Below is an example of the batch file in action: ------------------------------------------------ C:\dmd>build_sqltest.bat Compiling std.c.windows.sql*.d and odbc32dll.d ... Digital Mars Librarian Version 8.00n Copyright (C) Digital Mars 2000-2002 All Rights Reserved www.digitalmars.com Digital Mars Librarian complete. C:\dmd\bin\..\..\dm\bin\link.exe sqltest,,,std_c_win_sql.lib+user32+kernel32/noi; type in "sqltest" to run the program Press any key to continue . . . * An example of running the sqltest example program: ---------------------------------------------------- C:\dmd>sqltest Library "C:\windows\system32\odbc32.dll" loaded, ODBC32.DLL handle=9961472 Connected to the Database DSN-Less String="DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=C:\dmd\Demo.mdb" ODBC created DSN String="DBQ=C:\dmd\Demo.mdb;Driver={Microsoft Access Driver (*.mdb)};DriverId=25;FIL=MS Access;MaxBuffrSize=2048;PageTimeout=5;" Executing "CREATE TABLE NAMEID (ID INTEGER, NAME VARCHAR(50))" Table already exists...dropping it and then recreating it Inserting 1st row into the NAMEID table: id=500, name='Babbage' Inserting 2nd row into the NAMEID table: id=567, name='Jane' Selecting the 1st row: id=500, name='Babbage' Selecting the 2nd row: id=567, name='Jane' Disconnecting from the Database. Library "ODBC32.DLL" freed C:\dmd> 6) I still need to put in code that'll find the ODBC32.dll instead of hardcoding it ( yes, I know hardcoding is bad! :P ). ============================================== The updated file can be gotten at the same location: http://spottedtiger.tripod.com/D_Language/D_Support_Projects_XP.html Thxs again, David L. ------------------------------------------------------------------- "Dare to reach for the Stars...Dare to Dream, Build, and Achieve!"
Aug 15 2004