aboutsummaryrefslogtreecommitdiffstats
path: root/src/main/java/de/thedevstack/conversationsplus/persistance/db/access/AbstractDatabaseAccess.java
blob: 407859c74b74a3845a96838946e85748631be753 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
package de.thedevstack.conversationsplus.persistance.db.access;

import android.database.sqlite.SQLiteDatabase;

/**
 * Created by steckbrief on 24.08.2016.
 */
public abstract class AbstractDatabaseAccess {
    static void executeAlterStatements(SQLiteDatabase db, String... alterStatements) {
        for (String alterStatement : alterStatements) {
            db.execSQL(alterStatement);
        }
    }

    static void addNewColumns(SQLiteDatabase db, String tableName, String... columnDefinitions) {
        for (String columnDefinition : columnDefinitions) {
            String alterStatement = "ALTER TABLE " + tableName + " ADD COLUMN " + columnDefinition;
            db.execSQL(alterStatement);
        }
    }
}