Instead of

exe_query(query.str());

try to do this:

size_t len = query.pcount();
exe_query(string(query.str(), len).c_str());

Stringstream never puts 0 byte at the end of the string.

Pavel

On Tue, May 26, 2009 at 12:12 PM, Enrico Piccinini
<[email protected]> wrote:
> Hy to all, I'm very new to database and sqlite.
>
> I'm writing a C++ code to execute some queries.
>
> A query of mine does a select with some inner join and a left join as
> reported here:
> //inline int getFunctList(const string& testName, vector<string>& result,
> int& nCol, int& nRow)
> //{
>
> [...]
> ostringstream query;
> //      query << "SELECT
> functs_tbl.Description,resources_tbl.Name,functs_tbl.FunctionalString FROM
> seq.test_list_tbl "
> //        "INNER JOIN seq.functs_tbl on functs_tbl.FN_ID=test_tbl.FN_ID "
> //        "INNER JOIN seq.test_tbl on test_tbl.TL_ID=test_list_tbl.TL_ID "
> //        "LEFT JOIN conf.resources_tbl ON
> resources_tbl.RS_ID=functs_tbl.RS_ID "
> //        "WHERE test_list_tbl.Name=\"" << testName << "\";" << ends;
> //exe_query(query.str());
> [...]
> //}
>
> "exe_quey" is a simple wrapper of sqlite3_get_table.
>
> The execution of this line code makes may program to crash.
>
> The same query with the same parameter (testName) executed from tcl command
> line works perfectly.
>
> I've also tried to execute this query with sqlite3_prepare, step_reset, but
> the problem is staing on.
>
> I hope that some one can give me some advice because about the solution of
> the problem.
>
> Thank you in advance.
> Enrico
> _______________________________________________
> sqlite-users mailing list
> [email protected]
> http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
>
_______________________________________________
sqlite-users mailing list
[email protected]
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to