Hello,
I want to create a c++ program to start different sql-scripts. But I get always the same failure, so I tried it like this:
sqlConnection->query("SET @tableName:='car.Position';");
if (mysqlpp::StoreQueryResult res = sqlConnection->query("SELECT COUNT(*) FROM @tableName;").store())
{
for (size_t i = 0; i < res.num_rows(); ++i)
{
cout << res[i][0] << endl;;
}
}
else
{
cerr << "DB connection failed: " << sqlConnection->error() << endl;
return false;
}
The background is that sometimes I working with the workbench and sometimes I want to worke with my one gui where I have buttons that runs diffent scripts (for a higher consistency I want to work with the same scripts).
But the "Set @tableName"-statement makes trouble. I think that mysql++ can't deal with this statment. Does anybody knows a methode to solve my problem?
Thanks in advance,
Franz
I want to create a c++ program to start different sql-scripts. But I get always the same failure, so I tried it like this:
sqlConnection->query("SET @tableName:='car.Position';");
if (mysqlpp::StoreQueryResult res = sqlConnection->query("SELECT COUNT(*) FROM @tableName;").store())
{
for (size_t i = 0; i < res.num_rows(); ++i)
{
cout << res[i][0] << endl;;
}
}
else
{
cerr << "DB connection failed: " << sqlConnection->error() << endl;
return false;
}
The background is that sometimes I working with the workbench and sometimes I want to worke with my one gui where I have buttons that runs diffent scripts (for a higher consistency I want to work with the same scripts).
But the "Set @tableName"-statement makes trouble. I think that mysql++ can't deal with this statment. Does anybody knows a methode to solve my problem?
Thanks in advance,
Franz