Author |
Topic: ODBC library (Read 1680 times) |
|
joecurtis
New Member
member is offline


Gender: 
Posts: 5
|
 |
Re: ODBC library
« Reply #2 on: Jan 6th, 2015, 3:11pm » |
|
I agree with what you are saying but these three sections of code:-
SYS "LoadLibrary", "ODBC32.DLL" TO odbc32% SYS "GetProcAddress", odbc32%, "SQLAllocHandle" TO `SQLAllocHandle` PRINT ~`SQLAllocHandle`
SYS `SQLAllocHandle`, "SQL_HANDLE_ENV", "SQL_NULL_HANDLE", ^env% PRINT env%
SYS "GetProcAddress", odbc32%, "SQLAllocEnv" TO `SQLAllocEnv` SYS `SQLAllocEnv`, ^env% PRINT env%
Give the following three results:-
68E9A575 0 35412224
So the second one returns 0, i.e. an error when I test for it. So I am at a loss to see where I am going wrong.
|
|
Logged
|
|
|
|
rtr2
Guest
|
 |
Re: ODBC library
« Reply #3 on: Jan 6th, 2015, 3:58pm » |
|
on Jan 6th, 2015, 3:11pm, joecurtis wrote:| So I am at a loss to see where I am going wrong. |
|
As I read the docs for SQLAllocHandle the first and second parameters aren't strings, as you are sending, but are numeric constants:
http://msdn.microsoft.com/en-us/library/ms712455.aspx
If I modify your code accordingly I get a non-zero response:
Code: REM!WC Windows Constants:
SQL_HANDLE_ENV = 1
SQL_NULL_HANDLE = 0
SYS "LoadLibrary", "ODBC32.DLL" TO odbc32%
SYS "GetProcAddress", odbc32%, "SQLAllocHandle" TO `SQLAllocHandle`
PRINT ~`SQLAllocHandle`
SYS `SQLAllocHandle`, SQL_HANDLE_ENV, SQL_NULL_HANDLE, ^env%
PRINT env%
SYS "GetProcAddress", odbc32%, "SQLAllocEnv" TO `SQLAllocEnv`
SYS `SQLAllocEnv`, ^env%
PRINT env% which gives:
6A7F552E 5779320 5779448
Richard.
|
|
Logged
|
|
|
|
joecurtis
New Member
member is offline


Gender: 
Posts: 5
|
 |
Re: ODBC library
« Reply #4 on: Jan 6th, 2015, 4:50pm » |
|
Many thanks for that Richard.
I find the MSDN documentation extreemly laberinthine when trying to work out the format of entries. Perhaps more exposure will improve my understanding.
Joe Curtis
|
|
Logged
|
|
|
|
joecurtis
New Member
member is offline


Gender: 
Posts: 5
|
 |
Re: ODBC library
« Reply #5 on: Jan 6th, 2015, 6:19pm » |
|
One final point, which might help other naive users like myself navigate the ODBC api labyrinth is the link between the api and the C++ sql.h library where all the SQL definitions are defined. Now I understand that it has all become much clearer.
|
|
Logged
|
|
|
|
rtr2
Guest
|
 |
Re: ODBC library
« Reply #6 on: Jul 9th, 2015, 5:44pm » |
|
on Jan 6th, 2015, 6:19pm, joecurtis wrote:| One final point, which might help other naive users like myself navigate the ODBC api labyrinth is the link between the api and the C++ sql.h library where all the SQL definitions are defined. |
|
Just to add that at least some of the SQL constant definitions are already included in the Windows Constants utility (slot 8 in the BB4W Utilities menu, usually) so it's not necessary to refer to SQL.H for these.
Richard.
|
|
Logged
|
|
|
|
rtr2
Guest
|
 |
Re: ODBC library
« Reply #8 on: Jul 10th, 2015, 5:23pm » |
|
on Jul 10th, 2015, 2:34pm, joecurtis wrote:| Thanks for that Richard - most useful. |
|
For your added information, I have counted them and the Windows Constant utility's database contains 1,600 constants starting SQL_ 
Richard.
|
|
Logged
|
|
|
|
|