|
From: Pat D. <cod...@ps...> - 2005-07-22 00:45:52
|
Greets,
Not sure which version you are using but my install has no such
constructor... only:
// default c'tor
Connection();
///The copy will share the underlying connection.
Connection(const Connection& src);
are available in Connection.h.
Other than that, there are a bunch of little issues in your example
(e.g. "const char dbV" is a constant *single* character where you're
actually looking for a pointer). Anyhow, here's how I've been doing it
normally:
=============================== snip =============================
#include <mysqlcppapi/Connection.h>
#include <string>
int main() {
mysqlcppapi::Connection con;
const std::string dbV("test"),
hostV("localhost"), userV("root"),
passwdV("somepassword");
// set up auth
con.set_Host(hostV);
con.set_User(userV);
con.set_Password(passwdV);
// actually connect
con.connect();
if (! con.is_connected())
{
// do something about it...
return 1;
}
// select the db
con.select_database(dbV);
// check if it worked, do stuff...
return 0;
}
=============================== snip =============================
HTH and regards,
--
Pat Deegan
http://www.psychogenic.com
|