> On Sep 14, 2017, at 8:19 AM, Igor Tandetnik <i...@tandetnik.org> wrote:
> 
> I'm pretty sure this calls string::operator+=(char), appending to the string 
> a character whose ASCII code happens to be char(data). Which is unlikely to 
> be what you had in mind. I suspect you get a warning from the compiler on 
> this line, about losing significant bits.

Somewhat off-topic, but stringstream is a much nicer way to build up a string 
in C++. Use the "<<" operator to append things to it, i.e. strings, characters, 
numbers, then call str() to convert it to a string.

        #include <sstream>

        std::stringstream s;
        s << "INSERT INTO " << table_name << " (" << data;
        // etc.
        s << ")";
        std::string str = s.str();

Also, as for invalid SQL: Use the `sqlite3` command-line tool to interactively 
experiment with SQL statements until you're familiar with them. Once you have a 
statement that does what you want. copy it out of the terminal and put it in 
your code.

—Jens
_______________________________________________
sqlite-users mailing list
sqlite-users@mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to