CREATE TABLE PROBLEM

Getting into LiveCode for iOS? Ask your questions here.

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
info26
Posts: 47
Joined: Tue May 17, 2011 10:14 am

CREATE TABLE PROBLEM

Post by info26 » Fri Jul 15, 2011 9:55 am

Hi all,

I have a problem with SQLLite when I create a table.

If my sql cod is

CREATE TABLE mytable field....

It works

If I write

CREATE TABLE IF NOT EXISTS mytable fields...

Non viene creata la tabella anche se non esiste.

There is another way to check also if the table exists, or something wrong?

Thank's

Jellicle
Posts: 453
Joined: Thu Feb 24, 2011 11:07 am

Re: CREATE TABLE PROBLEM

Post by Jellicle » Fri Jul 15, 2011 10:33 am

SELECT name FROM sqlite_master
WHERE type='table'
ORDER BY name;

sqlite_master is a default (but usually hidden) table in all sqlite databases, apparently.
14" MacBook Pro
Former LiveCode developer.
Now recovering.

Klaus
Posts: 14182
Joined: Sat Apr 08, 2006 8:41 am
Contact:

Re: CREATE TABLE PROBLEM

Post by Klaus » Fri Jul 15, 2011 11:51 am

Hi info26,

you can use the build-in function: revDatabaseTableNames(databaseID)
to get a list of ALL tables in a database and then check if your table name is in this list!


Best

Klaus

Jellicle
Posts: 453
Joined: Thu Feb 24, 2011 11:07 am

Re: CREATE TABLE PROBLEM

Post by Jellicle » Fri Jul 15, 2011 1:49 pm

Klaus wrote:Hi info26,
you can use the build-in function: revDatabaseTableNames(databaseID)
to get a list of ALL tables in a database and then check if your table name is in this list!
Even better solution :)

Gerry
14" MacBook Pro
Former LiveCode developer.
Now recovering.

info26
Posts: 47
Joined: Tue May 17, 2011 10:14 am

Re: CREATE TABLE PROBLEM

Post by info26 » Mon Jul 18, 2011 7:33 am

Than'k all

Mimmo

Post Reply