|
#include
#include
#include
#include
using namespace std;
const char * db_name = "mysql_cpp_data";
const char * host = "localhost";
const char * username = "root";
const char * password = "passwd";
struct stock {
int item;
int num;
float weight;
int price;
string sdate;
};
int main(int argc, char *argv[])
{
#if 1
try {
// Establish the connection to the database server.
mysqlpp::Connection con(mysqlpp::use_exceptions);
if (!con.connect(db_name, host, username, password)) {
return 1;
}
mysqlpp::Query query = con.query();
query |
|
|