Hi,

The following details about text/blobs returns from scalar functions 
are unclear to me and I prefer doing things right.

a) is it allowable for a scalar function to modify (in place) an input 
argument
    and return a pointer to modified argument with 
sqlite3_result_text?  If yes,
    what should be the last parameter of sqlite3_result_text?
    (Surely, SQLITE_TRANSIENT would work)

b) same question for unmodified arguments: is it possible to avoid 
duplication
    of an argument if the function determines it is to be returned 
verbatim?
    As I read it the function to use is sqlite3_result_value but it 
duplicates.

c) is it true that the following return methods are both acceptable, 
with method
    2 being better by not forcing an immediate dupplication of the 
returned value
    and a byte count of the string?

   1)  [result r obtained from sqlite3_malloc]
       ...
       sqlite3_result_text(context, r, -1, SQLITE_TRANSIENT);
       sqlite3_free(r);
     }

   2)  [result r obtained from sqlite3_malloc]
       ...
       sqlite3_result_text(context, r, effective_byte_length, 
sqlite3_free);
     }


I currently avoid a) & b) and use c-2).  Is this the best way?

TIA



_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to