Best unofficial Apache Server developers community
Username
Forgot password?
Sign in with Twitter account
Sign in with Facebook account

Alternative for CREATE VIRTUAL TABLE IF NOT EXISTS

0

65 views

According to CREATE VIRTUAL TABLE syntax, IF NOT EXISTS clause is not available.

How should I handle the case when the virtual table already exists without using DROP TABLE IF EXISTS?

I want to use rtree and fts module.

asked February 15, 2011 9:05 pm CST
posted via StackOverflow

1 Answers

0
 

You can use

select DISTINCT tbl_name from sqlite_master where tbl_name = ?

Then bind the virtual table name to your statement and call sqlite3_step(). If you get SQLITE_ROW back, then your table exists. To be certain that it is a virtual table, check the type column for 'virtual'.

answered February 15, 2011 9:29 pm CST

Your answer

Join with account you already have


Sign in with Twitter account
Sign in with Facebook account
Sign in with Google Friend Connect

Preview
Similar questions
Check if table exists
February 3, 2011