A Alessandra Pellegri Active Member Licensed User Longtime User Mar 15, 2016 #1 I should insert a column in a database if it doesn' exists. I could do this: B4X: 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
I should insert a column in a database if it doesn' exists. I could do this: B4X: 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
eurojam Well-Known Member Licensed User Longtime User Mar 15, 2016 #3 you can do something like this: B4X: 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
you can do something like this: B4X: 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
A Alessandra Pellegri Active Member Licensed User Longtime User Mar 21, 2016 #4 @mc73 Thank you, I am testing it now @eurojam I think that it works just in IOS and not in Android Upvote 0