At 14:37 -0800 12/7/02, Admin-Stress wrote:
Hi,
I wrote an application using mysql C API.
If I exit my application without closing database, will it be closed
You don't "close" a database. What do you mean? Do you mean close
the connection to the server? If so, exiting without closing is the
wrong thing to do. The server will notice eventually that the connection
is no longer active, but when the client closes it explicitly, that
frees up resources on the server more quickly.
automatically?
void error(int code) {
printf("error: %d\n", code);
exit(0);
}
int main() {
...
error(-255);
...
}
How to pass the mysql database connector to a function? is this correct? :
Normally you would pass a MYSQL* (a pointer) to the function, not a MYSQL.
Then you just pass the pointer to mysql_close().
void error(int code, MYSQL db) {
mysql_close(&db);
printf("error: %d\n", code);
exit(0);
}
Because I am not sure this will be correct ... should not it using pointer?
Thanks.
---------------------------------------------------------------------
Before posting, please check:
http://www.mysql.com/manual.php (the manual)
http://lists.mysql.com/ (the list archive)
To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php