SQLite Table Exists
Peter Haworth
pete at lcsql.com
Tue May 5 10:41:56 EDT 2015
Hi Terry,
I'm curious as to why you need to do this. If you need to create the table
if it doesn't exist, you could CREATE TABLE IF NOT EXISTS.
Pete
lcSQL Software
On May 5, 2015 1:23 AM, "Terence Heaford" <t.heaford at icloud.com> wrote:
> Is there a LC function for checking if a table exists in an sqlite
> database or do I have to do something like this?
>
>
> function doesTableExist tTableName
> put replaceText(tTableName,"'","''") into tTableName
> put merge(“SELECT count() FROM sqlite_master WHERE type = 'table' AND
> name= '[[tTableName]]'") into tSQL
> put revDataFromQuery(tab, return, myDB, tSQL) into tCount
> if tCount = 1 then
> return true
> else
> return false
> end if
> end doesTableExist
>
>
> All the best
>
>
> Terry
> _______________________________________________
> use-livecode mailing list
> use-livecode at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your
> subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode
More information about the use-livecode
mailing list