Android SqliteDatabase Command execMultipleSQL(SQLiteDatabase db, ArrayList sqlStatements)

Here you can find the source of execMultipleSQL(SQLiteDatabase db, ArrayList sqlStatements)

Description

Execute all of the SQL statements in the ArrayList.

Parameter

Parameter Description
db The database on which to execute the statements.
sqlStatements An array of SQL statements to execute.

Declaration

public static void execMultipleSQL(SQLiteDatabase db,
        ArrayList<String> sqlStatements) 

Method Source Code

//package com.java2s;

import java.util.ArrayList;

import android.database.sqlite.SQLiteDatabase;

public class Main {
    /**//from  w ww.j  ava 2 s. co m
     * Execute all of the SQL statements in the ArrayList<String>.
     * 
     * @param db
     *            The database on which to execute the statements.
     * @param sqlStatements
     *            An array of SQL statements to execute.
     */
    public static void execMultipleSQL(SQLiteDatabase db,
            ArrayList<String> sqlStatements) {
        for (String statement : sqlStatements) {
            if (statement.trim().length() > 0) {
                db.execSQL(statement);
            }
        }
    }
}

Related

  1. getColumns(SQLiteDatabase db, String tableName)
  2. dropAllViews(SQLiteDatabase sqlitedatabase)
  3. getRowsCount(SQLiteDatabase sqlitedatabase, String s, String s1, String as[])
  4. formatCalendarForSQLite(Calendar calendar)
  5. getCalendarFromSqlite(String dateString)