The Pointer you received calling sqlite3_value_test16() on the FIRST argument is not invalidated by calling the same function on the SECOND argument. Value conversions may (and do for specific calling sequences) happen only when calling a different sqlite3_value_x() function on the SAME argument.
No cleanup is required. This happens automagically when the value goes out of scope (for practical purposes, as soon as you return from your user defined function). Beware of dangling pointers. If you intend to save a pointer value (blob or string) you must copy it before returning. Gunter -----Urspr?ngliche Nachricht----- Von: sqlite-users-bounces at mailinglists.sqlite.org [mailto:sqlite-users-bounces at mailinglists.sqlite.org] Im Auftrag von David Lee Gesendet: Sonntag, 01. Mai 2016 04:56 An: sqlite-users at mailinglists.sqlite.org Betreff: [sqlite] Processing arguments in a user-defined function Hi, I am trying to implement a user-defined function (not aggregate function) that takes two arguments. SQLite version is 3.8.11.1 - (1) According to the paragraph near the bottom of this help page (https://www.sqlite.org/c3ref/value_blob.html) >> Please pay particular attention to the fact that the pointer returned from >> sqlite3_value_blob(), sqlite3_value_text(), or sqlite3_value_text16() can be >> invalidated by a subsequent call to sqlite3_value_bytes(), >> sqlite3_value_bytes16(), sqlite3_value_text(), or sqlite3_value_text16(). If I get a pointer to the first argument via sqlite3_value_text16(), and call it AGAIN to get a pointer to the second argument, does it mean the first pointer will be invalidated? (2) Is there a built-in cleanup functions that I have to call for these pointers? Thanks. David Lee. _______________________________________________ sqlite-users mailing list sqlite-users at mailinglists.sqlite.org http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users ___________________________________________ Gunter Hick Software Engineer Scientific Games International GmbH FN 157284 a, HG Wien Klitschgasse 2-4, A-1130 Vienna, Austria Tel: +43 1 80100 0 E-Mail: hick at scigames.at This communication (including any attachments) is intended for the use of the intended recipient(s) only and may contain information that is confidential, privileged or legally protected. Any unauthorized use or dissemination of this communication is strictly prohibited. If you have received this communication in error, please immediately notify the sender by return e-mail message and delete all copies of the original communication. Thank you for your cooperation.