On Wed, 27 Jun 2007 20:42:18 -0400, you wrote:

>Hello all:
>    I was reading through a couple of sqlite tutorials and I noticed
>examples of timestamping database entries by using triggers.  I wanted
>to ask people's opinion about using triggers to timestamp records in a
>database.
>
>Which is 'better': using a trigger to timestamp records or explicity
>adding the timestamp in the sql statement?
>
>In my own analysis (brief < 5 min), I have thought of the following
>pro's and con's.
>
>1) Faster to do the timestamp in the sql statement, since it does not
>require activation of the trigger.
>2) Query looks 'cleaner', not having an explicit datetime() inside
>3) Can switch the timestamp between UTC and localtime by modifying the
>trigger as opposed to changing and recompiling the application.

4) Triggers can't be forgotten, so the stamping will be more
consistent, much like constraints.

As a side note, I seem to remember all sqlite timestamps within
a transaction have the same value: the time at BEGIN
TRANSACTION. To me that is the most important reason to have the
DBMS do the timestamping, not the host language.
-- 
  (  Kees Nuyt
  )
c[_]

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

Reply via email to