Re: [sqlite] About triggers

2006-08-14 Thread drh
Galanos <[EMAIL PROTECTED]> wrote:
> 
> In a table I have 2 triggers (BEFORE INSERT). How do I know in which order 
> they are executed (which is first which is second)?
> 

You don't.  The order of arbitrary.
--
D. Richard Hipp   <[EMAIL PROTECTED]>


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



[sqlite] About triggers

2006-08-14 Thread Galanos
Hello,

In a table I have 2 triggers (BEFORE INSERT). How do I know in which order 
they are executed (which is first which is second)?

 

Thank you

Kostas



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



Re: [sqlite] About Triggers

2006-08-08 Thread Roberto

On 07/08/06, chetana bhargav <[EMAIL PROTECTED]> wrote:

  Can you elobarate more on this. ( For me if two threads register for the same 
trigger condition, with different callback functions, do both the functions get 
called)


The short answer to your question is no. (But I could be wrong) If I
remember  correctly, when Thread A and B both register a custom
function in a trigger, say for an update, Then when Thread A does an
update, only the trigger in Thread A will be 'notified'.


Re: [sqlite] About Triggers

2006-08-07 Thread Christian Smith

chetana bhargav uttered:


Hi,

 I have few questions regarding triggers,

 * If we want to have trigger for some condition and if multiple 
applications create a trigger for the same condition providing different 
C callback functions (which I guess is possible through 
sqlite3_create_function), will the trigger be fired to all the 
registered apps.



Triggers are created at the schema level. As such, they don't callback to 
through the C API other than by creating a trigger body to call your 
custom function. If a database has more than once trigger for an event, 
they will all get called AFAIK.


Make sure that any callback functions are registered in any threads that 
use the database. Callbacks are per-connection. Each thread will also get 
other threads' callbacks if registered, or an error is such a function is 
not defined. Make sure your callbacks are thread-safe!





 * Is it possible to get the rowid for which the trigger is fired,



The trigger will have OLD.rowid (delete, update) or NEW.rowid 
(update, insert) for the row triggering the trigger. The rowid can then be 
passed into your callback as an argument.



--
/"\
\ /ASCII RIBBON CAMPAIGN - AGAINST HTML MAIL
 X   - AGAINST MS ATTACHMENTS
/ \


Re: [sqlite] About Triggers

2006-08-07 Thread chetana bhargav
- Last time I tried, the triggers are triggered only for the calling
thread which registered the function.
   
  Can you elobarate more on this. ( For me if two threads register for the same 
trigger condition, with different callback functions, do both the functions get 
called)
   
  
  Cheers,
   
  Chetan


Roberto <[EMAIL PROTECTED]> wrote:
  - Last time I tried, the triggers are triggered only for the calling
thread which registered the function.
- When the trigger is fired, you can refer to any field in the table.
HTH.

On 07/08/06, chetana bhargav wrote:
> Hi,
>
> I have few questions regarding triggers,
>
> * If we want to have trigger for some condition and if multiple applications 
> create a trigger for the same condition providing different C callback 
> functions (which I guess is possible through sqlite3_create_function), will 
> the trigger be fired to all the registered apps.
>
> * Is it possible to get the rowid for which the trigger is fired,
>
>
> -
> See the all-new, redesigned Yahoo.com. Check it out.
>



-
Do you Yahoo!?
 Next-gen email? Have it all with the  all-new Yahoo! Mail Beta.

[sqlite] About Triggers

2006-08-07 Thread chetana bhargav
Hi,
   
  I have few questions regarding triggers,
   
  * If we want to have trigger for some condition and if multiple applications 
create a trigger for the same condition providing different C callback 
functions (which I guess is possible through sqlite3_create_function), will the 
trigger be fired to all the registered apps.
   
  * Is it possible to get the rowid for which the trigger is fired,


-
See the all-new, redesigned Yahoo.com.  Check it out.