Hi,

Currently, my program creates a new MYSQL object each time a connection is needed to save or load information from my MySQL database. Sometimes, this connection is created 10,000 or more times during one use of the program. I'm wondering if I reuse the connection (have a static MYSQL attribute on my database class object) if that would improve performance at all? This is what I'm thinking of doing:

class MyDatabase {
public:
// various constructors, destructor, and query functions...

private:
static MYSQL *mysql;
MYSQL_ROW row;
MYSQL_RES *result;
};

Then the object is created once for the database that I'm working with in the constructor for MyDatabase, and reused for subsequent queries.

Has anyone else tried this? Any other ways to do this? I'm using the C API and MySQL 3.23.48 on RedHat Linux 7.2.

Thanks,
Anna


---------------------------------------------------------------------
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

Reply via email to