I think you'd have to actually add your function into the SQLite source, and 
recompile.  My guess, not being a C guy, would be for you to have a look at the 
SQLite source (maybe in func.c?).  Since you already have a C function to do 
what you want, it seems pretty straightforward :-))

 -Clark

----- Original Message ----
From: Chase <[EMAIL PROTECTED]>
To: sqlite-users@sqlite.org
Sent: Monday, August 6, 2007 2:43:13 PM
Subject: Re: [sqlite] how to create C functions and refer to them in sql


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
> 
> -----------------------------------------------------------------------------
> To unsubscribe, send email to [EMAIL PROTECTED]
> -----------------------------------------------------------------------------
> 


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





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

Reply via email to