> If you are saying that you plan to obtain the character pointer by
calling sqlite3_value_text, then pass that exact pointer to
sqlite3_result_text, then I would suggest you use sqlite3_result_value
instead

But sqlite3_result_value has no option to only set the first X bytes, so it
won't allow me to retain only part of the string.
Or is there a way to do this with sqlite3_result_value?

RBS

On Mon, Dec 14, 2015 at 9:00 PM, Igor Tandetnik <igor at tandetnik.org> wrote:

> On 12/14/2015 3:09 PM, Bart Smissaert wrote:
>
>> It could be either a pointer to sqlite3_value_text of sqlite3_value*
>>
>
> No it can't be. sqlite3_result_text takes a char*, not a sqlite3_value* or
> a const unsigned char*(*)(sqlite3_value*)
>
> If you are saying that you plan to obtain the character pointer by calling
> sqlite3_value_text, then pass that exact pointer to sqlite3_result_text,
> then I would suggest you use sqlite3_result_value instead: it takes
> sqlite3_value* directly. If you insist on round-tripping through
> sqlite3_value_text, then you must pass SQLITE_TRANSIENT for the last
> parameter - the pointer returned by sqlite3_value_text is only guaranteed
> to be valid until the custom function returns.
>
> or it could be a pointer to a locally declared variable
>>
>
> In this case, you would also use SQLITE_TRANSIENT.
>
> --
> Igor Tandetnik
>
> _______________________________________________
> sqlite-users mailing list
> sqlite-users at mailinglists.sqlite.org
> http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users
>

Reply via email to