Questions tagged [sqliteopenhelper]

SQLiteOpenHelper is a class from the Android SDK which can be used for easier handling of a SQLiteDatabase.

Using the SQLiteOpenHelper only requires implementing its two abstract methods(other methods for different events can be implemented if the user chooses) onCreate(used for initializing the database) and onUpgrade(used when the database is being changed). The Android system will call this methods according to the state of the database( not created/created/upgrading) and in return, it will offer the user a valid SQLiteDatabase reference with the methods getWritableDatabase() and/or getReadableDatabase(). More information can be found in the documentation for the SQLiteOpenHelper class.

801 questions
1
vote
1 answer

Android Sqlite Database db.exec() is returning syntax error in the SQL text

I am using SQLiteOpenHelper to create an SQLite DB for my Android app. When I run a function to update data in the database ( db.exec(....) ), I am getting a syntax error with the following message: E/SQLiteLog: (1) near "VARCHAR": syntax error in…
1
vote
2 answers

java.lang.OutOfMemoryError: [memory exhausted] while reading data from Sqlite Android

I have successfully saved my data in SQLite DB. But I am getting an error while reading data from my SQLite DB and then my app is crashing. error message 01-01 05:42:13.916 607-607/com.example.eyesaver I/dalvikvm: | sysTid=607 nice=0 sched=0/0…
Sachin Burdak
  • 337
  • 1
  • 3
  • 13
1
vote
1 answer

room/SQLite background scheduler/trigger that runs automatically

I've got a sample table: I have a Sample table which has a "creationDate" as an atribute. What I want is a way to increment(update) the "numOfTimesUpdated" attribute each 24h since the creationdate. so lets say "creationdate" is 01.01.2021 12:12 AM…
1
vote
1 answer

Room SELECT Query for 1-n hashmap relationship

I have the following ORM model: Basically I want to track all public facilities of a state. So I have 1-n Relationship with a public facility like e.g. school: public class StateWithFacilities { @Embedded State state; @Relation(entity…
1
vote
1 answer

Continuous Incrementing of Rows

I'm trying to build a Table of buttons in SQLite in android, everytime I open my app and looking at the DBBrowser the number of rows continuously incrementing, the total rows should be 47 //Menu.class conn = new SQLiteDatabase(this); …
1
vote
0 answers

Getting error when migrating to Room from SQLiteOpenHelper if table doesn't exist: Pre-packaged database has an invalid schema

So I am implementing Room in an app which uses SQLiteOpenHelper. I only want to migrate 1 of 15 tables over to Room. This works fine if the table already exists, I can use the same database name in Room and as long as the columns and column types…
axlrtr
  • 535
  • 6
  • 23
1
vote
0 answers

open attribute is not working for sqlite3dbm

I have to develop dbm module using sqlite. Hence I have imported sqlite3dbm with open attribute to create the new database. But it is saying "module 'sqlite3dbm' has no attribute 'open'". The code which i m trying to run is from internet. Is…
Bhagya
  • 31
  • 5
1
vote
1 answer

Print statements generated by Android SQLiteOpenHelper

I have an update statement that does not work properly and want to know how the final statement looks like. Is there a way to print out the statements generated by the Android SQLiteOpenHelper? So far I managed to get a hold of the unpopulated…
Philipp
  • 788
  • 1
  • 11
  • 23
1
vote
0 answers

Passing values to DabaseHelper

How can I pass values from a OnItemSelectedListener class (attached to a spinner) to a DatabaseHelper (SQLiteOpenHelper) class? I'm trying to use setters on DatabaseHelper but for some reason it's just not working.…
1
vote
1 answer

Inserting or Reading values in an SQLite database doesn't yield any results

Started with SQLite in Android this evening. Practiced all the code from the Google documentation but it's still going wrong and I can't figure out where I'm going wrong. Take a look and see if you can find out any…
Arpan Sircar
  • 545
  • 2
  • 4
  • 15
1
vote
1 answer

delete a row using column field name - SQlite (SQLiteOpenHelper Android)

I need to delete a row in database (SQLite) I am trying to delete a row using the file name. File is a field in the database column. public void deleteRow (String file){ SQLiteDatabase db = this.getWritableDatabase(); db.delete("checkList",…
1
vote
1 answer

Get result from second select query when first select query returns 0

I have following schema CREATE TABLE BookImage (Id UNSIGNED BIG INT, ImageId UNSIGNED BIG INT, IsDefault INT, PRIMARY KEY(Id, ImageId)); INSERT OR IGNORE INTO BookImage(Id,ImageId,IsDefault) VALUES (1,10,0); INSERT OR…
1
vote
0 answers

Does SQLite for Android support multithreading access?

When I try to access SQLite database in different threads in my Android app I get an error: W/SQLiteConnectionPool: The connection pool for database ' has been unable to grant a connection to thread 289045 Does somebody know if it is possible to…
E I
  • 501
  • 4
  • 13
1
vote
1 answer

Android Listview and Dialog wont display

**Good day everyone ... I badly need your help. Can I ask on why my listview doesnt display and also my alert dialog? here is my code I've already inserted table values in the sqlite database and Im confused on why nothing displays on my listview…
James1234
  • 111
  • 1
  • 1
  • 3
1
vote
1 answer

How to correctly and appropriately access the SQLite database form another thread - Android

Correct approach that should be taken to access a database. So I have read numerous forums on how to access the SQLite database (via SQLiteOpenHelper) - with different answers. Essentially, I have two problems (questions): Access write / or read…
Dan
  • 75
  • 6