Newbie: Test for MySQL connection

2002-04-18 Thread Fei Chen

Dear all,

I don't know where to look for this information... Couldn't find it in the
manual.

How do I test whether a connection has been established so I don't need to
open a new one again? e.g.

MYSQL tmp;

void f1(){
mysql_init(tmp);
mysql_real_connect(tmp,...)
}

void f2(){
 if(!connected(tmp)) do_error(connection not established);
...
}

I don't know what should go into the function connected() ...

Thanks for any tips,

fei



-
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




Re: Newbie: Test for MySQL connection

2002-04-18 Thread Hisseine Dj.

Try
shell cd YourMysqlInstallationDirectory
shell bin/safe_mysqld 
shell mysql -h host -u user -ppassword

Hisseine


- Original Message -
From: Fei Chen [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Thursday, April 18, 2002 10:36 AM
Subject: Newbie: Test for MySQL connection


 Dear all,

 I don't know where to look for this information... Couldn't find it in the
 manual.

 How do I test whether a connection has been established so I don't need to
 open a new one again? e.g.

 MYSQL tmp;

 void f1(){
 mysql_init(tmp);
 mysql_real_connect(tmp,...)
 }

 void f2(){
  if(!connected(tmp)) do_error(connection not established);
 ...
 }

 I don't know what should go into the function connected() ...

 Thanks for any tips,

 fei



 -
 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





-
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