Welcome, Guest
Username: Password: Remember me

TOPIC: MySQL triggers

MySQL triggers 29 Jul 2012 08:25 #2920

  • e-struct
  • e-struct's Avatar
  • Offline
  • Senior Member
  • Posts: 76
  • Thank you received: 4
  • Karma: 5
I would like to record automatically a datetime record in one of my SQL table when another field of the same table is changed by the front-end user.
I guess this is usually realized using SQL triggers.

1 => Where in j-cook interface can I define such triggers ?
2 => If it's not possible from the interface where should be the right place in the generated code to do it ?
Last Edit: 12 Aug 2012 08:49 by admin.
The administrator has disabled public write access.

Re: MySQL triggers 30 Jul 2012 16:57 #2928

  • admin
  • admin's Avatar
  • Offline
  • Administrator
  • Chef
  • Posts: 3711
  • Thank you received: 987
  • Karma: 140
You can use the 'Creation date' wizard.

If you want to use a different way :


MySQL has an issue here :
stackoverflow.com/questions/168736/how-d...ysql-datetime-column

You can realize it with two methods.


1st Method (Triggers)
TODO in :
sql/install.mysql.utf8.sql

Add the SQL instructions at the installation (like triggers)


2nd Method
TODO in :
tables/[myTable].php

in the check() function :

Test the value and if the value is empty, fill it with the current time (PHP call)
mktime()
or
www.php.net/manual/fr/function.date.php#...unction.date-seealso
Hope it helps
Coding is now a piece of cake
Last Edit: 30 Jul 2012 16:58 by admin.
The administrator has disabled public write access.
Time to create page: 0.054 seconds

Get Started