sqlite3_open_v2 and sqlite3_prepare_v2 string lifetimes

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

sqlite3_open_v2 and sqlite3_prepare_v2 string lifetimes

Jesse Rittner
Is it safe to free the filename string immediately after calling
sqlite3_open_v2? What about the zSql string immediately after calling
sqlite3_prepare_v2? Will it ever cause any problems (like calling the
sqlite3_db_filename or sqlite3_sql methods)?



--
Sent from: http://sqlite.1065341.n5.nabble.com/
_______________________________________________
sqlite-users mailing list
[hidden email]
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users
Reply | Threaded
Open this post in threaded view
|

Re: sqlite3_open_v2 and sqlite3_prepare_v2 string lifetimes

Richard Hipp-3
On 1/5/19, Jesse Rittner <[hidden email]> wrote:
> Is it safe to free the filename string immediately after calling
> sqlite3_open_v2? What about the zSql string immediately after calling
> sqlite3_prepare_v2? Will it ever cause any problems (like calling the
> sqlite3_db_filename or sqlite3_sql methods)?

SQLite makes copies.  You can free strings after those routine return.

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