Are All Your Tables Getting Logged?

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

Are All Your Tables Getting Logged?

4D Tech mailing list
Hey All,

I ran into an issue today where I was surprised (understatement) to
see some tables did not show up in my log file. It turns out the
little check box "Include in Log File" on the table definitions was
unchecked. (24 tables out of 229)

For those of you who use custom primary keys, it's an easy mistake to
make. Now-a-days when you create a new table in 4D, 4D automatically
assigns a primary key and turns on logging. The problem is, to change
the primary key format, you need to first drop the existing key which
turns the logging off. Just because you re-add your custom primary
key, the logging is not automatically turned back on - you have to
manually check the box - easy to forget.

When you have 200+ tables in your structure, clicking on each table to
find out where you forgot to turn logging back on is not practical.
Below is code based on an earlier post on the NUG from a thread
between Cannon and Arnaud (thanks to both of you for that). Running it
simply gives you an alert with all the tables that have Journaling
(logging) turned off.

ARRAY BOOLEAN($logged_ab;0)  //>>>this one
ARRAY LONGINT($table_al;0)
ARRAY TEXT($name_at;0)
Begin SQL
SELECT LOGGED, TABLE_NAME, TABLE_ID
FROM _USER_TABLES
INTO :$logged_ab, :$name_at, :$table_al;
End SQL

C_TEXT($NotLogged_vt)
C_LONGINT($x;$Size_vl)
$Size_vl:=Size of array($name_at)
For ($x;1;$Size_vl)
If (Not($logged_ab{$x}))
$NotLogged_vt:=$NotLogged_vt+"\r"+$name_at{$x}
End if

End for

ALERT($NotLogged_vt)

--
David Nasralla
Clean Air Engineering
**********************************************************************
4D Internet Users Group (4D iNUG)
FAQ:  http://lists.4d.com/faqnug.html
Archive:  http://lists.4d.com/archives.html
Options: http://lists.4d.com/mailman/options/4d_tech
Unsub:  mailto:[hidden email]
**********************************************************************