OSEC

Neohapsis is currently accepting applications for employment. For more information, please visit our website www.neohapsis.com or email hr@neohapsis.com
 
Re: How to call C API functions from MS Access ?

SGreenunimin.com
Date: Mon Oct 03 2005 - 10:25:39 CDT


"C.R. Vegelin" <vegelinfreeler.nl> wrote on 10/01/2005 03:51:41 AM:

> Hi List,
>
> I want to call the C API functions from Visual Basic in MS Access 2003.
> I assume that I have to use: "c:\Program Files\MySQL\MySQL Server 4.
> 1\Bin\LibMySQL.dll".
> In my code at module level I have included various code lines to
> declare entry-points, such as:
> Declare Function mysql_info Lib "c:\Program Files\MySQL\MySQL Server
> 4.1\Bin\LibMySQL.dll" ()
> Declare Function mysql_stat Lib "c:\Program Files\MySQL\MySQL Server
> 4.1\Bin\LibMySQL.dll" ()
>
> After making an ADODB.Connection and running a query succesfully, I
> want to call mysql_info().
> The syntax in C language for this function is: char *mysql_info(MYSQL
*mysql)
>
> My question: how to call mysql_info() from Visual Basic ?
> When I use: myString = mysql_info() it returns an empty string.
>
> My system includes: Windows XP, MySQL 4.1.13 and MyODBC 3.51.11.
>

To answer the question in your subject: you are already doing that
correctly. You have selected which library you want to use and are
declaring the entry points you want to use from that library. Good job.

To see the status of an ADODB connection, you have to use ADODB functions.
You cannot use the C API functions to check on the status of an ADODB
process (even if they are sharing the same DLL). That is because the
client library is thread-safe. Whatever you do in one instance of the
library is not apparent in any other instance. Any bleed-over from one
instance to another should be checked against the documentation and if the
two are not in agreement, report it as a bug.

If you want to use the C API, all of your database calls (including all of
your SQL execution) need to happen through the C API. If you want to use
the ADODB objects, you need to connect through ADODB through ODBC and stay
within that paradigm. You cannot mix or intermingle the two and expect it
to work. Sorry!

Shawn Green
Database Administrator
Unimin Corporation - Spruce Pine