tags:

views:

26

answers:

1
// todo: create the connection here

// Construct the query string.  You were already doing this in your code
std::ostringstream query_builder;
query_builder << "select pipe_id from pipe where version_id='" << id << "'";

// Convert the ostringstream to a string
std::string query_string = query_builder.str();

// Construct a query object with the query string
mysqlpp::Query query = connection.query(query_string);

// Perform the query
mysqlpp::StoreQueryResult result = query.store();
for(size_t i = 0; i < result.num_rows(); i++)
   std::cout << result[i]["version_id"] << result[i]["pipe_id"] << std::endl;

I am getting error

error: request for the member 'query' in connection which is non-class type '
MYSQL*'

at line 
**mysqlpp::Query query = connection.query(query_string);**
A: 

connection is a pointer; you need to use the -> operator:

connection->query(query_string)
James McNellis
no this also didn't worked
Judy
@sandeep: it addresses the immediate error above, after which there may well be further issues... you'd do better to document those so you can work towards a resolution rather than dismiss James' insight.
Tony