List:MySQL++« Previous MessageNext Message »
From:Adrian Cornish Date:September 8 2010 8:23pm
Subject:mysqlpp::sql_set and mysql_sql_set_null compiler errors
View as plain text  
Hi All,

I cannot compile even a simple example using sets? Can someone point
me at the obvious errors I must doing.

Using SVN At revision 2676.
gcc version 4.5.0 (GCC)

Looking at preprocessor output the begining of the struct defintion looks good
struct Foo
{
   mysqlpp::sql_int anumber;
   mysqlpp::sql_set set1;
   mysqlpp::sql_set_null set2;
   mysqlpp::sql_int another;
   Foo() : table_override_(0) { }
   Foo(const mysqlpp::Row& row);
   void set(const mysqlpp::Row &row);
   Foo(const mysqlpp::sql_int &p1) : anumber (p1), table_override_(0) {}

Looking at the function in question I can't see anything obviously wrong
void populate_Foo(Foo *s, const mysqlpp::Row &row)
{
   mysqlpp::NoExceptions ignore_schema_mismatches(row);
   s->anumber = row["anumber"].conv(mysqlpp::sql_int());
   s->set1 = row["set1"].conv(mysqlpp::sql_set());
   s->set2 = row["set2"].conv(mysqlpp::sql_set_null());
   s->another = row["another"].conv(mysqlpp::sql_int());
}

I dont understand why its trying to apply conversion.


Adrian

adrianc@dluadrianc:~> g++ foo.cc  -I /usr/local/include/mysql++/
`mysql_config --include`
In file included from /usr/local/include/mysql++/myset.h:34:0,
                 from foo.cc:2:
/usr/local/include/mysql++/mystring.h: In member function 'Type
mysqlpp::String::conv(Type) const [with Type = mysqlpp::Set<>]':
foo.cc:10:1:   instantiated from 'void populate_Foo(Foo*, const
mysqlpp::Row&) [with mysqlpp::sql_dummy_type dummy =
(mysqlpp::sql_dummy_type)0u]'
foo.cc:10:1:   instantiated from here
/usr/local/include/mysql++/mystring.h:304:48: error: invalid
conversion from 'long unsigned int' to 'const char*'
/usr/local/include/mysql++/mystring.h:304:48: error:   initializing
argument 1 of 'mysqlpp::Set<Container>::Set(const char*) [with
Container = std::set<std::basic_string<char> >]'
adrianc@dluadrianc:~> cat -n foo.cc
     1  #include <iostream>
     2  #include <myset.h>
     3  #include <mysql++.h>
     4  #include <ssqls.h>
     5
     6  sql_create_4(Foo, 1, 4,
     7     mysqlpp::sql_int, anumber,
     8     mysqlpp::sql_set, set1,
     9     mysqlpp::sql_set_null, set2,
    10     mysqlpp::sql_int, another)
    11
    12  int main(int argc, char *argv[])
    13  {
    14     return 0;
    15  }
    16
    17
Thread
mysqlpp::sql_set and mysql_sql_set_null compiler errorsAdrian Cornish8 Sep
  • Re: mysqlpp::sql_set and mysql_sql_set_null compiler errorsWarren Young8 Sep
    • Re: mysqlpp::sql_set and mysql_sql_set_null compiler errorsWarren Young8 Sep
      • Re: mysqlpp::sql_set and mysql_sql_set_null compiler errorsAdrian Cornish9 Sep