List:MySQL++« Previous MessageNext Message »
From:Florian Feldbauer Date:October 25 2010 5:44pm
Subject:Problems with storein and template queries
View as plain text  
Hey,

I'm using mysql++ to get data from different tables.
Here is an extract of my code:

   vector<table1> rows1;
   vector<table2> rows2;

   // --- connect to database and create template query
   mysqlpp::Connection conn("database",0,"user","passwd",0);
   if (!conn.connected()){
     cerr << "Error: Could not connect to database" << endl;
     exit(1);
   }
   mysqlpp::Query query = conn.query("SELECT * FROM %1 WHERE col0 = %0q");
   query.parse();

   // --- get data from database
   query.storein(rows1, what1,"table1");
   query.storein(rows2, what2,"table2");

what1 and what2 are strings I get from commandline.
The code compiles w/o warnings or errors, but when I execute
the programm I get:
   terminate called after throwing an instance of 'mysqlpp::BadParamCount'
     what():  Not enough parameters to fill the template.
   Abort

Using the command
    cout << query.str(what1,"table1") << endl;
works fine. I see the correct query with both parameters on the std out.

Does anyone know what is going wrong here?

Best regards,
Florian
Thread
Problems with storein and template queriesFlorian Feldbauer25 Oct
  • Re: Problems with storein and template queriesWarren Young25 Oct
    • Re: Problems with storein and template queriesFlorian Feldbauer25 Oct
      • Re: Problems with storein and template queriesWarren Young26 Oct
        • Re: Problems with storein and template queriesFlorian Feldbauer26 Oct
          • Re: Problems with storein and template queriesWarren Young26 Oct
            • Re: Problems with storein and template queriesWarren Young26 Oct
              • Re: Problems with storein and template queriesFlorian Feldbauer27 Oct
                • Re: Problems with storein and template queriesWarren Young3 Nov
  • Re: Problems with storein and template queriesAdrian Cornish25 Oct
    • Re: Problems with storein and template queriesWarren Young25 Oct