On Tue, Sep 13, 2011 at 4:36 AM, Baruch Burstein <[email protected]>wrote:

> If I compile a SQL statement, can I immediately change that sql string?
> e.g., Is this allowed:
>
> sql = sqlite3_mprintf("select a from b where c = %Q;", d);
> sqlite3_prepare_v2(db, sql, -1, &stmt, 0);
> sqlite3_step(stmt);
> strcpy(a, (char *)sqlite3_column_text(stmt, 0));
> sqlite3_free(sql);   //   or   sql = "blah blah";
>

Yes.  sqlite3_prepare_v2() makes it's own copy of the original SQL.



> .
> .
> .
> sqlite3_step(stmt);
> strcpy(a, (char *)sqlite3_column_text(stmt, 0));
> .
> .
> .
> sqlite3_finalize(stmt);
> _______________________________________________
> sqlite-users mailing list
> [email protected]
> http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
>



-- 
D. Richard Hipp
[email protected]
_______________________________________________
sqlite-users mailing list
[email protected]
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to