--- dist/examples/standalone_example_docs2.cpp 2017-05-10 12:14:59.000000000 -0400 +++ macports/examples/standalone_example_docs2.cpp 2018-03-03 01:08:30.000000000 -0500 @@ -34,6 +34,7 @@ (and mysql_connection.h). This will reduce your build time! */ #include "mysql_connection.h" +#include "examples.h" #include #include @@ -43,8 +44,13 @@ using namespace std; -int main(void) +int main(int argc, const char **argv) { +static const string url(argc >= 2 ? argv[1] : EXAMPLE_HOST); +static const string user(argc >= 3 ? argv[2] : EXAMPLE_USER); +static const string pass(argc >= 4 ? argv[3] : EXAMPLE_PASS); +static const string database(argc >= 5 ? argv[4] : EXAMPLE_DB); + cout << endl; cout << "Let's have MySQL count from 10 to 1..." << endl; @@ -57,9 +63,9 @@ /* Create a connection */ driver = sql::mysql::get_driver_instance(); - con = driver->connect("tcp://127.0.0.1:3306", "root", "root"); + con = driver->connect(url, user, pass); /* Connect to the MySQL test database */ - con->setSchema("test"); + con->setSchema(database); stmt = con->createStatement(); stmt->execute("DROP TABLE IF EXISTS test");