List:MySQL++« Previous MessageNext Message »
From:Robert Mecklenburg Date:January 8 2007 6:10pm
Subject:Re: Query::str returns std::string containing null
View as plain text  
On Mon, 2007-01-08 at 10:43 -0700, Robert Mecklenburg wrote:
> [Query::str() is inserting a null byte in the result]

The problem appears slightly different than described above.  It appears 
that every time str() is called a new null byte is appended as shown by 
the following code:

    #include <mysql++.h>
    int
    main()
    {
        mysqlpp::Connection c("s5db", "192.168.1.126", "root",  "99TeraT@gz");
        mysqlpp::Query q = c.query();

        for (int i = 0; i < 10; ++i)
            std::cout << "preview length = " << q.preview().length() <<
std::endl;

        return 0;
    }

When run produces:

    preview length = 1
    preview length = 2
    preview length = 3
    preview length = 4
    preview length = 5
    preview length = 6
    preview length = 7
    preview length = 8
    preview length = 9
    preview length = 10

Thanks,
-- 
Robert

Thread
Query::str returns std::string containing nullRobert Mecklenburg8 Jan
  • Re: Query::str returns std::string containing nullRobert Mecklenburg8 Jan
  • Re: Query::str returns std::string containing nullWarren Young9 Jan