List:MySQL++« Previous MessageNext Message »
From:Jim Wallace Date:March 6 2009 12:03pm
Subject:RE: How to pass SQLTypeAdapters to create a SQLQueryParms?
View as plain text  
I usually just pass the params in to execute.  Something like this is typical.

	Query query = serverConn.query();
	query << "INSERT INTO sync_status VALUES(%0q,%1q,%2q)";
	query.parse();

	SimpleResult res1 = query.execute("Alex Luya",NOW(),"synchronizing");


-----Original Message-----
From: Alex Luya [mailto:alex_luya@stripped] 
Sent: Friday, March 06, 2009 3:58 AM
To: MySQL++ Maillist
Subject: How to pass SQLTypeAdapters to create a SQLQueryParms?

Hello,I try to run following code,but get 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;


Thread
How to pass SQLTypeAdapters to create a SQLQueryParms?Alex Luya6 Mar
  • RE: How to pass SQLTypeAdapters to create a SQLQueryParms?Jim Wallace6 Mar
    • Re: How to pass SQLTypeAdapters to create a SQLQueryParms?Warren Young6 Mar
      • Re: How to pass SQLTypeAdapters to create a SQLQueryParms?Warren Young6 Mar
        • Re: How to pass SQLTypeAdapters to create a SQLQueryParms?Rick Gutleber6 Mar
          • Re: How to pass SQLTypeAdapters to create a SQLQueryParms?Warren Young6 Mar