From: Loïc Dardant Date: July 2 2008 9:56am Subject: Derive a structure and use it with storein List-Archive: http://lists.mysql.com/plusplus/7726 Message-Id: <2b029a380807020256t5ce89cd6o364df534591917fd@mail.gmail.com> MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_Part_1087_9016543.1214992605030" ------=_Part_1087_9016543.1214992605030 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline Hi ! I just want to add some functions to a SSQLS. So I've created a basic structure that map my sql table. Then I've created a class that derive from this structure. But when I use my class, I've got error during compilation (Visual Studio 2005, Xp). There is a problem in the function storein : c:\mysql++\include\query.h(752) : error C2440: '' : impossible to convert 'mysqlpp::Row' to 'User' I guess i've done something wrong, but i read the documentation, examples, the mailing list and the forums, and I can't find a solution. You can see the code below. Thanks /*****************/ /*File User.h : */ /*****************/ #if !defined(EXPAND_MY_SSQLS_STATICS) # define MYSQLPP_SSQLS_NO_STATICS #endif #if !defined(_USER_H) #define _USER_H #include #include namespace database { sql_create_3(User, 1, 3, mysqlpp::sql_varchar, name_user, mysqlpp::sql_varchar, threeg_id_user, mysqlpp::sql_int, num_user) } class User : public database::User { public: User(mysqlpp::sql_varchar a, mysqlpp::sql_varchar b, mysqlpp::sql_int c ); ~User(); void foo(); }; #endif //_USER_H /*******************/ /* File User.cpp */ /*******************/ #define EXPAND_MY_SSQLS_STATICS #include "User.h" User::User(mysqlpp::sql_varchar a, mysqlpp::sql_varchar b, mysqlpp::sql_int c) : database::User(a,b,c) {} User::~User() {} Uvoid User::foo() {} /*******************/ /* File main.cpp */ /*******************/ #include #include "User.h" using namespace std; int main(int argc, char*argv[]) { //let's go try { // Establish the connection to the database server. mysqlpp::Connection con(DATABASE, SERVER, USER, PASSWD); // Retrieve a subset of the stock table's columns, and store // the data in a vector of 'stock' SSQLS structures. See the // user manual for the consequences arising from this quiet // ability to store a subset of the table in the stock SSQLS. mysqlpp::Query query =3D con.query("select * from user"); vector res; query.storein(res); // Display the items cout << "We have:" << endl; vector::iterator it; for (it =3D res.begin(); it !=3D res.end(); ++it) { cout<num_user<<" "<name_user<