Mailing List
Home
Forum Home
MySQL General - General MySQL discussion
MySQL++ - Programming with the C++ API to MySQL
MaxDB - Everything about MaxDB, formerly known as SAP DB
ODBC - ODBC with the MySQL Connector/ODBC driver
MySQL on Win32 - Runing MySQL on Windows 9x/Me/NT/2000/XP
Java Help - Mostly related to the MySQL Connector/J driver
Perl - Perl support for MySQL with DBI and DBD::mysql
GUI - MySQL GUI Tools
Announcement
Subjects
Subject: mysql openssl Question
ERROR 1045: Access denied for user: 'root@localhost ' (Using
password: NO)
Update one field with more fields from another table
Subject: Getting Identity after INSERT
ERROR 2002: Can 't connect to local MySQL server through socket
mysql test 4 1 fails with the gis test
Subject: MySQL Cluster Software
Downgrade Mysql from 4 to 3 23
Mysql 4 0 Oracle Stored Procedure Trigger Conversion
Can 't access mysql after kernel upgrade
Executing MySQL Commands From Within C Program
Comparing and writing out BLOBS
Subject: Re: Preventing Duplicate Entries
FULLTEXT query format question
Strange behavior, Table Level Permission
Does the binary log enabling affect the MySQL performances?
mysql:it 's a db not a dbms how it 's possible?!
mysql have same function mthod as Oracle decode()
 
Weird query issue

Weird query issue

2007-12-03       - By Jim Wallace

 Back
Reply:     1     2  

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@(protected)]
> Sent: Sunday, December 02, 2007 3:34 PM
> To: plusplus@(protected)
> Subject: Weird query issue
>
> Here's my code:
>
> michael@(protected) 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@(protected) 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=jwallace@(protected)
>
>
>

--
MySQL++ Mailing List
For list archives: http://lists.mysql.com/plusplus
To unsubscribe:    http://lists.mysql.com/plusplus?unsub=mysql@(protected)