cupcakeys076
cupcakeys076

Reputation: 1

Should I make a new database manager file in each class that needs it or pass it in as a parameter?

I'm using SQliteOpenHelper and I have a database manager class:

companion object {
    private const val DATABASE_VERSION = 1
    private const val DATABASE_NAME = "Name.sqlite"

}

override fun onConfigure(db: SQLiteDatabase) {
    super.onConfigure(db)
    db.setForeignKeyConstraintsEnabled(true)
}

This handles creating the tables and making queries etc.

Do I make a new DatabaseManager object in my files, or should I pass in one from a different file when I can?

Upvotes: 0

Views: 19

Answers (0)

Related Questions