mysql_init(&m) deleting Variable values
I had a MySQL client working on Mac OS X for MySQL 4.x.x. I recently upgraded to MySQL 5 now my client stopped working. I started the long task of debugging the code, and reading through the docs.
I found that in my code, I set up some variables which contain the host,user,password,database,and sql statement. I check their values and indeed they are what I want.
MYSQL_RES *result;
MYSQL_ROW row;
MYSQL *connection, mysql;
int state;
if(CFArrayGetCount(params) < 7) return CFSTRRetain("false\rArrr, pirate! Too few params!"); //5 is the num of params expected.
CFStringRef dbServer = CFArrayGetValueAtIndex(params,0);
CFStringRef dbUser = CFArrayGetValueAtIndex(params,1);
CFStringRef dbUserPass = CFArrayGetValueAtIndex(params,2);
CFStringRef dbName = CFArrayGetValueAtIndex(params,3);
CFStringRef SQLStatement = CFArrayGetValueAtIndex(params,4);
int queryLen = CFStrLen(SQLStatement);
CFShow(CFStringCreateWithFormat(NULL,NULL,CFSTR("%d Length queryLen + 1"),queryLen));
CFMutableStringRef theData = CFStringCreateMutable(NULL,0);
char *cStrdbServer,*cStrdbUser,*cStrdbUserPass,*cStrdbName,*cStrSQLStatement;
cStrdbServer=ExportToC(dbServer);
cStrdbUser=ExportToC(dbUser);
cStrdbUserPass=ExportToC(dbUserPass);
cStrdbName=ExportToC(dbName);
cStrSQLStatement=ExportToC(SQLStatement);
CFShow(CFStringCreateWithFormat(NULL,NULL,CFSTR("%d Length queryLen + 2"),queryLen));
//Right here the above line prints to the console the value in queryLen which in my test is 23.
//I then preform mysql_init().
mysql_init(&mysql);
CFShow(CFStringCreateWithFormat(NULL,NULL,CFSTR("%d Length queryLen + 2.5"),queryLen));
// This is where the trouble begins. The above line prints 0 to the console.
What do I need to do to retain my variables? I checked the other variables I set up and the same holds true.
Why is mysql_init() removing my variable data? How can I avoid this?
Thanks,