05-21-2007 07:33 AM
/* Typedefs */
typedef struct {
MYSQL mysql;
MYSQL_RES *query_results;
unsigned short int odbc_driver;
unsigned short int db_type;
} SQL_LV_REF;
MSEXPORT long sql_open(DB_LOGIN *login, unsigned long *db, long *driver, LStrHandle debug)
{
db_ref = (SQL_LV_REF *) malloc(sizeof(SQL_LV_REF));
*db = (unsigned long)db_ref;
if (mysql_query(&(db_ref->mysql), sql_query) != 0) {} //NOTE: mysql_query() is likely calling malloc()
/* Typedefs */In order to continue using an open connection, I need to have the first solution but when there's a choice, what's best? The programming is easier when the variables are local, but is that universally reentrant?
typedef struct {
MYSQL_RES *query_results;
unsigned short int odbc_driver;
unsigned short int db_type;
} SQL_LV_REF;
MSEXPORT long sql_open(DB_LOGIN *login, unsigned long *db, long *driver, LStrHandle debug)
{
MYSQL mysql;
db_ref = (SQL_LV_REF *) malloc(sizeof(SQL_LV_REF));
*db = (unsigned long)db_ref;
if (mysql_query(&mysql, sql_query) != 0) {}
05-22-2007 06:02 PM