List:MySQL++« Previous MessageNext Message »
From:Jim Wallace Date:December 3 2007 12:42pm
Subject:RE: Weird query issue
View as plain text  
It's because Query has no default constructor.  Since you have a Query
member object and not constructing it in the member initialization list,
it's trying to construct it using a default constructor.  I'd only keep
the Connection as a member and use the rest as local.

> -----Original Message-----
> From: Michael Sullivan [mailto:michael@stripped] 
> Sent: Sunday, December 02, 2007 3:34 PM
> To: plusplus@stripped
> Subject: Weird query issue
> 
> Here's my code:
> 
> michael@camille ourrpg $ nl gameengine.h
>      1  #ifndef GAMEENGINE_H
>      2  #define GAMEENGINE_H
>      3
>      4  #include <mysql++.h>
>      5
>      6  using namespace mysqlpp;
>      7  class GameEngine
>      8  {
>      9     public:
>     10        GameEngine();
>     11        ~GameEngine();
>     12
>     13     private:
>     14        Connection con;
>     15        Query query;
>     16        Result res;
>     17        Row row;
>     18
>     19
>     20  };
>     21  #endif
> michael@camille ourrpg $ nl gameengine.cpp
>      1  #include <mysql++.h>
>      2  #include "gameengine.h"
>      3  #include <iostream>
>      4
>      5  GameEngine::GameEngine()
>      6  {
>      7     con = Connection(false);
>      8     con.connect("RPG", "localhost", "rpguser", "ourrpg");
>      9     query = con.query();
>     10  }
>     11
>     12  GameEngine::~GameEngine()
>     13  {
>     14  }
>     15
> 
> I'm getting these errors:
> 
> gameengine.cpp: In constructor 'GameEngine::GameEngine()':
> gameengine.cpp:5: error: no matching function for call to 
> 'mysqlpp::Query::Query()'
> /usr/local/include/mysql++/query.h:150: note: candidates are:
> mysqlpp::Query::Query(const mysqlpp::Query&)
> /usr/local/include/mysql++/query.h:141: note:
> mysqlpp::Query::Query(mysqlpp::Connection*, bool)
> 
> I took that query = con.query() directly from simple1.cpp,  
> (which built successfully), so why isn't it working here?
> 
> 
> -- 
> MySQL++ Mailing List
> For list archives: http://lists.mysql.com/plusplus
> To unsubscribe:    
> http://lists.mysql.com/plusplus?unsub=1
> 
> 
> 
Thread
Weird query issueMichael Sullivan2 Dec
  • RE: Weird query issueJim Wallace3 Dec