Ragtag SE Questions
Posted in 1999
Topics: SQL Development & Query Writing, Triggers, Constraints & Referential Integrity, Migration, Import/Export & Data Conversion
Thanks again to everyone for welcoming me to this list.
I had the following 'ragtag' questions related to Informix-SE:
*Informix's SE doesn't include a lowercase() procedure; how do I write
one? Is there any place I can download several useful Informix-SE
procedures all at once (eg, some sort of "utility pack" for
Informix-SE)?
*I have a table where a given column is "almost" unique-- the only
value that can be repeated is the null value. In other words, the
table can have arbitrarily many rows with that column set to null,
but, once those rows are removed, the column is unique for the
remaining rows. How do I implement this?
*Is there anyway to implement "invisible rows" in Informix-SE? These
are rows that wouldn't show up in SELECT statements unless
specifically requested. For example:
SELECT * FROM mytab;
would show the normal rows, while:
SELECT * FROM mytab INCLUDE INVISIBLE;
would show the normal rows PLUS the invisible rows. I think something
like this would be useful if you wanted to "delete" a row, but not
really delete it-- ie, be able to restore it if necessary. In other
words, something like:
INVISIBLIZE FROM mytab where x<15;
wouldn't actually delete the rows where x<15, it would just make them
invisible so that they wouldn't show up in normal SELECTs.
*Someone mentioned I could store "backup" copies of a given table at
various times using "schemas". How do I do this? What I'd really like
to do is have the table know how it looked before and after *every*
transaction. The only way I can think of doing this right now is to
write a TRIGGER that automatically does:
UNLOAD TO '/tmp/foo.tabname' SELECT * FROM tabname
[and even this isn't 100% accurate], and then does some sort of 'diff'
between this copy of '/tmp/foo.tabname' and the previously saved
one. That way, I'd have a list of 'patches' of how I got from the
original table to where I am today. But this seems horrendously ugly--
there must be a better way?
Appreciate any thoughts on my questions.
mathprof@bigfoot.com wrote:
[SNIP]
Obnoxio's answers to the snipped queries will suffice for me.
> *Someone mentioned I could store "backup" copies of a given table at
> various times using "schemas". How do I do this? What I'd really like
> to do is have the table know how it looked before and after *every*
> transaction. The only way I can think of doing this right now is to
> write a TRIGGER that automatically does:
HUH? Do you want to track the transactions against a table's data or
changes to it's structure? If the former you can use triggers to log
each transaction to an audit table which would contain the preimage for
deletes and updates and the postimage for inserts (and perhaps for
updates also) plus a transaction type indicator.
If the latter, there probably is no way beyond running dbschema, or
myschema.ec, periodically, perhaps from a cron, and stored any dbschema
output that differs from the newest prior one you have saved.
[SNIP]
Art S. Kagel