Android Question read PRAGMA table_info

Alessandra Pellegri

Active Member
Licensed User
Longtime User
I should insert a column in a database if it doesn' exists.
I could do this:
Code: Copy
try
  ALTER TABLE myTable ADD COLUMN test BOOL;
catch
'Do nothing
end try

But I would like to use a more clean solution testing if the column already exists. But how could I read the PRAGMA table_info results ?

Thank you
 
you can do something like this:
Code: Copy
   Dim cur As ResultSet
    cur = aSQL.ExecQuery("PRAGMA table_info(mytable);")
    Do While cur.NextRow
      Log(cur.GetString("name"))
    Loop

The field "name" contains the column names
 
Upvote 0
Back
Top