Author: wyoung
Date: Thu Mar 5 19:28:31 2009
New Revision: 2478
URL: http://svn.gna.org/viewcvs/mysqlpp?rev=2478&view=rev
Log:
Updated cpool example to use new command line mechanism.
Modified:
trunk/examples/cpool.cpp
Modified: trunk/examples/cpool.cpp
URL:
http://svn.gna.org/viewcvs/mysqlpp/trunk/examples/cpool.cpp?rev=2478&r1=2477&r2=2478&view=diff
==============================================================================
--- trunk/examples/cpool.cpp (original)
+++ trunk/examples/cpool.cpp Thu Mar 5 19:28:31 2009
@@ -44,13 +44,12 @@
{
public:
// The object's only constructor
- SimpleConnectionPool(const char* db, const char* server,
- const char* user, const char* password) :
+ SimpleConnectionPool(mysqlpp::examples::CommandLine& cl) :
conns_in_use_(0),
- db_(db ? db : ""),
- server_(server ? server : ""),
- user_(user ? user : ""),
- password_(password ? password : "")
+ db_(mysqlpp::examples::db_name),
+ server_(cl.server()),
+ user_(cl.user()),
+ password_(cl.pass())
{
}
@@ -185,8 +184,8 @@
{
#if defined(HAVE_THREADS)
// Get database access parameters from command line
- const char* db = 0, *server = 0, *user = 0, *pass = "";
- if (!parse_command_line(argc, argv, &db, &server, &user, &pass)) {
+ mysqlpp::examples::CommandLine cmdline(argc, argv);
+ if (!cmdline) {
return 1;
}
@@ -197,7 +196,7 @@
// latter check should never fail on Windows, but will fail on most
// other systems unless you take positive steps to build with thread
// awareness turned on. See README-*.txt for your platform.
- poolptr = new SimpleConnectionPool(db, server, user, pass);
+ poolptr = new SimpleConnectionPool(cmdline);
try {
mysqlpp::Connection* cp = poolptr->grab();
if (!cp->thread_aware()) {
_______________________________________________
Mysqlpp-commits mailing list
[email protected]
https://mail.gna.org/listinfo/mysqlpp-commits