java - I have an error doing a select in SQLITE -


i'm trying @ onupgrade() in android java app:

try {     db.execsql("select fechacontrol parametres", null); } catch(exception e) {     e.printstacktrace();     db.execsql("alter table parametres add column fechacontrol bigint"); } 

my problem is, column fechacontrol exists, end in exception block, app crashes because of duplicated column name. doing wrong?

thanks all.

execsql(anything, null) throw illegalargumentexception due null bindargs. that's why end in catch. there execsql(string) overload executing sql without bindargs.

however, database upgrades should not done this. schema version number stored in database file , param in onupgrade(). use information deduce needs updated.


Comments

Popular posts from this blog

serialization - Convert Any type in scala to Array[Byte] and back -

matplotlib support failed in PyCharm on OSX -

python - Matplotlib: TypeError: 'AxesSubplot' object is not callable -