In fact,I need to pass variables to template query(counts changed
dynamically),so make a test to try to run following code,but got an
exception:Not enough parameters to fill the template.So can any guys
point out the issues for me?Thank you.
------------------------
try {
Query query = serverConn.query("INSERT INTO sync_status
VALUES(%0q,%1,%2q)");
query.parse();
SQLQueryParms sqp;
SQLTypeAdapter sta0("Alex Luya");
sqp<<sta0;
SQLTypeAdapter sta1(DateTime("2009-03-04 14:33:31"));
sqp<<sta1;
SQLTypeAdapter sta2("synchronizing");
sqp<<sta2;
SimpleResult res1 = query.execute(sqp);
}
catch (const mysqlpp::Exception& er) {
cerr << "synchronize-Exception: " << er.what() << endl;
}
------------------------
-- --------------------------------------------------------
-- Structure de la table `sync_status`
CREATE TABLE IF NOT EXISTS `sync_status` (
`sync_user` varchar(20) NOT NULL,
`start_time` datetime NOT NULL,
`status` varchar(13) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;