On Wed, Jan 20, 2010 at 6:13 AM, BareFeet <list....@tandb.com.au> wrote: > 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?
Does this help? pragma table_info([table-name]) The output looks easier to parse than the create-table statement. See http://www.sqlite.org/pragma.html#schema Stephan > > 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 > -- Stephan Wehner -> http://stephan.sugarmotor.org (blog and homepage) -> http://loggingit.com -> http://www.thrackle.org -> http://www.buckmaster.ca -> http://www.trafficlife.com -> http://stephansmap.org -- http://blog.stephansmap.org -> http://twitter.com/stephanwehner / @stephanwehner _______________________________________________ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users