Hi All,

This question seems to come up every now and then, but I've yet to see any 
solution. The best phrasing of the question I found was back in 2004:
http://www.mail-archive.com/sqlite-users@sqlite.org/msg02649.html

Is there any way to parse a create statement (eg create table, create view, 
create trigger) into its components?

Since SQLite does this internally using the Lemon parser, surely there's a 
simple way to get the parser results?

For example, given:

create table "People"
(       ID integer primary key
,       Name text collate nocase
,       "Family ID" integer
                references Family(ID)
)

break it up into something like:

table name: People

table columns:
 1:
    name: ID
    type: integer
    constraints:
      1:
         name:
         detail: primary key
 2:
    name: Name
    type: text
    constraints:
      1:
         name:
         detail: collate nocase
 3:
    name: Family ID
    type: integer
    constraints:
      1:
         name:
         detail: references Family(ID)
         foreign table: Family
         foreign column: ID

I'm writing in Objective-C, so anything accessible to it would be helpful.

Thanks,
Tom
BareFeet

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

Reply via email to