--- dist/examples/standalone_example_docs1.cpp 2017-05-10 12:14:59.000000000 -0400 +++ macports/examples/standalone_example_docs1.cpp 2018-03-03 01:05:56.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 @@ -42,8 +43,14 @@ 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 << "Running 'SELECT 'Hello World!' AS _message'..." << endl; @@ -55,9 +62,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(); res = stmt->executeQuery("SELECT 'Hello World!' AS _message");