New topic: List of Fields
<http://forums.realsoftware.com/viewtopic.php?t=47796> Page 1 of 1 [ 4 posts ] Previous topic | Next topic Author Message TrakSoft Post subject: List of FieldsPosted: Sun May 05, 2013 11:28 am Joined: Tue Apr 12, 2011 6:32 am Posts: 9 It appears that doing a select on the sqlite_master table is an easier and faster way to check to see if a table exists rather than using the TableSchema function and looping through the table names. My question: Is there a better/faster way to see if a field exists in a table rather than using the FieldSchema function and looping through the column names? I am not aware of a SQLite system catalog table that contains the columns in tables. Thanks, Gary Top npalardy Post subject: Re: List of FieldsPosted: Sun May 05, 2013 11:53 am Real Software Engineer Joined: Sat Dec 24, 2005 8:18 pm Posts: 7821 Location: Canada, Alberta, Near Red Deer sqlite doesn't have a table that you can query for this information unfortunately _________________ Norman Palardy (Real Software) Top DaveS Post subject: Re: List of FieldsPosted: Sun May 05, 2013 2:09 pm Joined: Sun Aug 05, 2007 10:46 am Posts: 4845 Location: San Diego, CA You could do this... clunky but should work SQL=_ "SELECT count(*) as cnt "_ " FROM sqlite_master " + _ " WHERE type='table' " + _ " AND name='"+table_name+"' and sql like '%'"+field_name+"%'" Execute that string.... RS.FIELD("CNT") will be either zero or one _________________ Dave Sisemore iMac I7[2012], OSX Mountain Lion 10.8.3 RB2012r2.1 Note : I am not interested in any solutions that involve custom Plug-ins of any kind Top symbiount Post subject: Re: List of FieldsPosted: Sun May 05, 2013 3:06 pm Joined: Thu Oct 12, 2006 2:32 pm Posts: 31 You could also do a select on the column you're testing. If it doesn't exist it'll throw an error you can then handle. Top Display posts from previous: All posts1 day7 days2 weeks1 month3 months6 months1 year Sort by AuthorPost timeSubject AscendingDescending Page 1 of 1 [ 4 posts ] -- Over 1500 classes with 29000 functions in one REALbasic plug-in collection. The Monkeybread Software Realbasic Plugin v9.3. http://www.monkeybreadsoftware.de/realbasic/plugins.shtml [email protected]
