João Henrique Freitas writes:
 > Some questions;
 > - If  custom_function(myconn->connection) need more parameters (ex:.
 > for the function
 > dbi_driver_specific_function(dbi_conn_get_driver(conn),
 > "mysql_get_row")) like custom_function(myconn->connection,
 > command_sql) is possible too, ok?

This is supposed to work too. You'll just have to declare the function
pointer appropriately, e.g.like this:

int (*custom_function)(void*, int);

Using the void* pointer is a hack as your program usually does not
have database-specific types and structures available (this would
require including the client library header which we must not do). All
other (not database engine specific) arguments can be declared as
usual.


 > - In my code I have the follow structure
 > struct B_DB {
 >    BQUEUE bq;                         /* queue control */
 >    brwlock_t lock;                    /* transaction lock */
 >    dbi_conn *db;
 >    dbi_result *result;
 >    dbi_inst instance;
 > }
 > 
 > - How I can cast the follow:
 > 
 > dbi_conn_t *myconn = mdb->db;
 > 
 > Because in line 560 of test_dbi.c we have:
 > 
 > int test_custom_function(struct CONNINFO* ptr_cinfo, dbi_conn conn) {
 >   dbi_conn_t *myconn = conn;
 > 

If I understand correctly what you're trying to do here, you'll have
to change "dbi_conn *db" to "dbi_conn db". dbi_conn is
typedef'd as a pointer which we can cast to the explicit pointer
dbi_conn_t *myconn.

regards,
Markus

-- 
Markus Hoenicka
[EMAIL PROTECTED]
(Spam-protected email: replace the quadrupeds with "mhoenicka")
http://www.mhoenicka.de


-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
libdbi-users mailing list
libdbi-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/libdbi-users

Reply via email to