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

java - Jasper subreport showing only one entry from the JSON data source when embedded in the Title band -

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

SonarQube Plugin for Jenkins does not find SonarQube Scanner executable -