You do it the same way you do in any C function.  You obtain a handle to the db 
connection (which is very conveniently passed to your UDF), you prepare and 
execute the sql statement, retrieve the results of that execution, compute your 
response, and return it from the UDF function.

---
The fact that there's a Highway to Hell but only a Stairway to Heaven says a 
lot about anticipated traffic volume.


>-----Original Message-----
>From: sqlite-users [mailto:sqlite-users-
>boun...@mailinglists.sqlite.org] On Behalf Of Arun - Siara Logics
>(cc)
>Sent: Monday, 18 February, 2019 03:06
>To: SQLite mailing list
>Subject: Re: [sqlite] Reading a table from inside a scalar function
>Importance: High
>
>> Yes it is possible, but then your UDF is unlikely to be
>*Deterministic*.
>By design, I intend to make sure that for any given input the
>function always returns the same value.
>If the dependent rows are missing or change over time, then it would
>be an error condition.
>
>What would be the recommended method ?   Is there an API to read a
>table row using RowID?  Or should I traverse the BTree pages using my
>own code? Thanks!
>
>
>_______________________________________________
>sqlite-users mailing list
>sqlite-users@mailinglists.sqlite.org
>http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users



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

Reply via email to