Roger Binns wrote:
<horrified expression>
You're altering tables you don't understand the structure of?
</horrified expression>


You missed his point.  When you use the steps in the FAQ to alter
a table, one of the steps involves deleting it.  When you do that
SQLite also deletes all existing triggers and indices on the
table.

Consequently one piece of code that is simple (alter table) suddenly has to be aware of a lot more other things. It
is all a simple matter of programming, but makes the code
more coupled, complex and brittle.



Before doing the "DELETE TABLE t1" you can run this query:

   SELECT sql FROM sqlite_master WHERE tbl_name!=name AND tbl_name='t1';

That query will give you the complete text of all CREATE INDEX
and CREATE TRIGGER statements associated with table t1.  Save
these results.  Then delete table t1 and recreate it in its
new form.  Then rerun the CREATE INDEX and CREATE TRIGGER
statements that you saved.  This will automatically recreate
all of your indices and triggers.


-- D. Richard Hipp -- [EMAIL PROTECTED] -- 704.948.4565



Reply via email to