Hi Jim,

> hi-
>
> i was hoping to get a little feedback on an idea i had.
>
> the create table statement can get complex with its variable number
> field constraints and table constraints etc. etc.
> when i first tackled the problem i tried to parse it.  now i have a
> different idea.  what if i viewed the create table statement
> as a group of tables with records .  then when i am finished adding
> records to the structure db tables i could call
> a routine to write the create table statement based on the structure db
> database for that particular table.
>
> a problem i see with this design is someone with a table already
> designed would not want to use a program like this
> because they have all ready generated the table structure in
> sqlite_master.sql.
>
> i'll probably be the only user anyways.
>
> i thought i could use delphi personal edition and libsql to create an
> interface in this manner to insert,update,delete,select
> table structure data.
>
> is this a really bad idea?  i have to try something.  changing the
> structure is the worst part of my program :-(
>
> thanks,
> jim
>

If you go with this design, please make sure you include a unique
autoincrementing column which always increases as you insert rows.  To see
how, go to

http://www.sqlite.org/faq.html#q1

Then when you retrieve the rows to be created as columns, be sure to ORDER
BY this autoincrement field.

The reason is, the way I understand SQLite, if you delete a row with the
DELETE statement, the row will not actually be deleted, only marked as
deleted.  Then the next time you insert a row, the row may be reused.  At
least that's how I understand it... could somebody please correct me if
I'm wrong?

But, you see, if I am right, and you don't have an autoincrement field to
ORDER BY, then your columns may be inserted out of order, and thus
retrieved out of order, and so your table will have a different column
order when you inserted the rows representing the columns.

HTH

Cheers,

Ulrik

-- 
Ulrik Petersen, Denmark


Reply via email to