On 16 May 2011, at 7:18pm, Jay A. Kreibich wrote:

>  I think the bigger issue is that column rename requires full
>  understanding of the SQL statements stored in sqlite_master.  To
>  safely do a ALTER TABLE...RENAME COLUMN you have to understand the
>  context and parts of the CREATE TABLE statement (and triggers, and
>  indexes, and FKs of other tables).  This requires a close link between
>  the modification function, the parser, and the tokenizer.  You have to
>  scan the SQL statement and understand the different parts, and then
>  back-trace them to a specific character in the original statement,
>  so you know which substring to change.  While this is feasible, most
>  tokenizers and parsers are specifically designed to be abstract layers.

Yet strangely, the ability to obtain the statements used to create the schema 
is something I find very useful in quite a few utilities.  If you could depend 
on them being in a standard format they'd be even more useful.

MySQL has a way to obtain the data in statement form too.  Imagine a command 
like

SELECT AS INSERT COMMANDS * FROM myTable WHERE joinDate > '2001'

which returns one field of text per record, with each piece of text being the 
INSERT command required to reproduce it:

INSERT INTO myTable (id,name,address,joinDate) VALUES (123,'Fred Savage','12 
Rowantree Crescent','20020115')

It gives a great way to tokenise a record.

Simon.
_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to