List:MySQL++« Previous MessageNext Message »
From:mysql++ Date:October 10 2004 4:43pm
Subject:Query returns substrings and zero-ints
View as plain text  
I am moving my mysql++ cgis to a new fedora core 2 64bit server where I 
compiled and installed mysql++-1.7.17

I know about the new Row.lookup_by_name() but my problem is different. 
It does not matter if I use [int i] or lookup_by_name(char * i)... i 
mostly get substrings or zero for ints though the value in the database 
is surely different.

Examples:
string "Freelancer" becomes "Freel"
int 1 becomes 0
timestamp 20041010151621 becomes 20041
enum "read,write,search,delete" becomes "r"

only a few are correct and it is the same everytime I try it.

I wrote a small program to test it without everything else:

    Connection db;
    
db.connect(getoption("db","database").c_str(),getoption("db","host").c_str(),getoption("db","username").c_str(),getoption("db","password").c_str());


    Query query = db.query();
    query << "SELECT * from "<<argv[1]<<" LIMIT 10";
    Result result=query.store();
    Result::iterator iter;
    iter = result.begin();
    Row row=*iter;


        for (unsigned int i = 0; i < row.size(); i++) 
        {
            cout << (result.names(i).c_str()) << " = \""<<row[i]<<
"\" = 
\"" << row.lookup_by_name(result.names(i).c_str()) << "\"\n";
        }
Thread
Query returns substrings and zero-intsmysql++10 Oct
  • Re: Query returns substrings and zero-intsChris Frey10 Oct
    • Re: Query returns substrings and zero-intsTobias Bergmann11 Oct
      • Re: Query returns substrings and zero-intsChris Frey11 Oct
        • Re: Query returns substrings and zero-intsWarren Young11 Oct
          • Re: Query returns substrings and zero-intsTobias Bergmann21 Oct
            • Re: Query returns substrings and zero-intsWarren Young21 Oct