| View previous topic :: View next topic |
| Author |
Message |
timinak General User

Joined: 03 Mar 2011 Posts: 28 Location: Palmer Alaska
|
Posted: Fri May 04, 2012 12:10 pm Post subject: Auto Update Field for Base? |
|
|
In MySQL I can have a column definition like this: | Code: |
modified | timestamp | NO | | CURRENT_TIMESTAMP | on update CURRENT_TIMESTAMP |
which ensures that when I change or add a record, that field will be automatically updated.
Can I have the same for Base?
URLs to other discussions or documentation is welcome.
thanks
tim _________________ Programmer 24 years. Linux, Mac
command-line. New to OO |
|
| Back to top |
|
 |
Billyray OOo Enthusiast


Joined: 06 Mar 2007 Posts: 144 Location: Lake Erie's Shore in Ohio
|
Posted: Fri May 04, 2012 12:55 pm Post subject: |
|
|
Base connects to MySql. _________________ Billyray
using:
Linux distro: Ubuntu 10.04 LTS, Lucid Lynx, OOo Base 3.3, connected to MySql database using Java jdbc (note: ONLY sun-java-6-1.6.0_22 jre works right), and converted from MS Access 2003. |
|
| Back to top |
|
 |
timinak General User

Joined: 03 Mar 2011 Posts: 28 Location: Palmer Alaska
|
Posted: Fri May 04, 2012 1:16 pm Post subject: |
|
|
| Billyray wrote: | | Base connects to MySql. |
I do not want to connect to MySQL. I want to define a field(column) that will automatically record when a row is changed or updated. The code was an example only.
thanks _________________ Programmer 24 years. Linux, Mac
command-line. New to OO |
|
| Back to top |
|
 |
timinak General User

Joined: 03 Mar 2011 Posts: 28 Location: Palmer Alaska
|
Posted: Fri May 04, 2012 5:00 pm Post subject: |
|
|
Seemed like my post needed clarification: The example code was from
MySQL, but was there only to illustrate my need. I have to use an odb format
without an external data source, thus MySQL is out. However, I don't have
and immediate need to implement this. I would imagine that there is an event-triggered
macro that would due the trick, and if I don't figure it out, I'm sure someone at
this forum can point it out for me. So.... No worries and no MySQL _________________ Programmer 24 years. Linux, Mac
command-line. New to OO |
|
| Back to top |
|
 |
dacm Super User


Joined: 07 Jan 2010 Posts: 734
|
Posted: Fri May 04, 2012 7:18 pm Post subject: Re: Auto Update Field for Base? |
|
|
| timinak wrote: | ...on update CURRENT_TIMESTAMP...which ensures that when I change or add a record, that field will be automatically updated.
Can I have the same for Base?
... I have to use an odb format without an external data source |
Hi Tim,
You can use a macro triggered by a Form event to update the timestamp each time the record is saved. You can optionally add the current user or initials to the macro. Otherwise, you could use a trigger in the back-end database engine to run an external Java stored procedure (ascii code file). Or upgrade to HSQLDB 2.x to use SQL procedures saved within the database. Or install and connect to MySQL on your desktop.
NOTE: Base creates an unstable all-in-one database file (.odb) as identified on the status bar by the phrase "embedded database." This configuration is not recommended for production use so at least store these crash-prone files in a Dropbox or other version-protected folder. _________________ Soli Deo gloria
Tutorial: avoiding data loss with Base + Migrating 'Embedded databases' |
|
| Back to top |
|
 |
timinak General User

Joined: 03 Mar 2011 Posts: 28 Location: Palmer Alaska
|
Posted: Sat May 05, 2012 7:37 am Post subject: |
|
|
Hi dacm:
Thank you for all of the detail. That is going to be very helpful. As to your comments
about an embedded database:
I made that decision because I wanted to set up a contacts database and them
transfer it to my wife's computer without issues of not finding the external data source.
FYI: Use to work in MS-Access all the time, now work with MySQL with web apps, but
am brand new to OOBase.
But I am not seeing "Embedded Database" on the title bar.
??
But I must have more coffee.
.... more coffee....
Is the absence of "Embedded Database" because I made the table from scratch
in Design View? Also, I created a form based on the table and the title bar includes
"Readonly", but I can add records.
cheers
tim _________________ Programmer 24 years. Linux, Mac
command-line. New to OO |
|
| Back to top |
|
 |
|