Chase wrote:

okay, wait.... sorry.... wrong question.

here's the deal. i want this trigger to fire -- and insert valid guids into a table -- even outside the context of my app.

using sqlite3_create_function(), i can create a sort of temporary function that only works from with my app (or other running instances of my app), but i want it to fire even if someone opens the database file in some other 3rd-party editor and inserts/updates/deletes the table with the trigger.

well... it DOES fire, but when it does, it won't know what newuuid() means.

so i guess my question should be.... how to i **INSTALL/EMBED** my custom function **into** the database file.

- chase






On August 6, 2007, Eugene Wee wrote:

You are probably looking for sqlite3_create_function:
http://www.sqlite.org/capi3ref.html#sqlite3_create_function

Regards,
Eugene Wee

Chase wrote:


i need a trigger to create and insert a new guid into a table, but apparently there is no built-in function for creating guids in sqlite.

i can create the guid in C using uuid_generate() and then uuid_unparse() to get it into a string format.

but how can i call that c code from a trigger?

my understanding was that sqlite allows for user functions written in C and used from within your sql code, but i forget where i saw that and i'm so far unable to find in the docs where it shows how this is done.

anyone done this before?

- chase

You can make your new function permanent by modifying the Sqlite library to make it a standard Sqlite function. Use the examples in the source as a template. Note that your third party applications will have to be linked with your modified Sqlite library.

-----------------------------------------------------------------------------
To unsubscribe, send email to [EMAIL PROTECTED]
-----------------------------------------------------------------------------

Reply via email to