Example usage for android.database.sqlite SQLiteDatabase insert

List of usage examples for android.database.sqlite SQLiteDatabase insert

Introduction

In this page you can find the example usage for android.database.sqlite SQLiteDatabase insert.

Prototype

public long insert(String table, String nullColumnHack, ContentValues values) 

Source Link

Document

Convenience method for inserting a row into the database.

Usage

From source file:Main.java

private static void insertStartTimeDrumlins(SQLiteDatabase db, String startStopName, String startTime) {
    ContentValues routevalues = new ContentValues();
    routevalues.put("START_STOPNAME_DRUMLINS", startStopName);
    routevalues.put("START_TIME_SU_DRUMLINS", startTime);

    db.insert("FROMSU_DRUMLINS", null, routevalues);
}

From source file:Main.java

private static void insertSounds(SQLiteDatabase db, String name, String quote, int sound_id_1) {
    ContentValues soundValues = new ContentValues();
    soundValues.put("pNAME", name);
    soundValues.put("QUOTE", quote);
    soundValues.put("SOUND_ID_1", sound_id_1);
    db.insert("SOUNDS", null, soundValues);
}

From source file:Main.java

public static void insertStudent(final SQLiteDatabase database, final String id, final String name) {
    final ContentValues courseValues;

    courseValues = new ContentValues();
    courseValues.put(STUDENT_NUMBER, id);
    courseValues.put(STUDENT_NAME, name);
    database.insert(STUDENT_TABLE, null, courseValues);
}

From source file:Main.java

private static void insertDrink(SQLiteDatabase db, String name, String description, int resourceId) {
    ContentValues drinkValues = new ContentValues();
    drinkValues.put("NAME", name);
    drinkValues.put("DESCRIPTION", description);
    drinkValues.put("IMAGE_RESOURCE_ID", resourceId);
    db.insert("DRINK", null, drinkValues);
}

From source file:Main.java

public static void insertStudentCourse(final SQLiteDatabase database, final String id,
        final String courseName) {
    final ContentValues courseValues;

    courseValues = new ContentValues();
    courseValues.put(STUDENT_NUMBER, id);
    courseValues.put(COURSE_NAME, courseName);
    database.insert(STU_COUR_TABLE, null, courseValues);
}

From source file:Main.java

private static void insertDrink(SQLiteDatabase db, String name, String description, int resourceID) {

    ContentValues drinkValues = new ContentValues();

    drinkValues.put("NAME", name);
    drinkValues.put("DESCRIPTION", description);
    drinkValues.put("IMAGE_RESOURCE_ID", resourceID);

    db.insert("DRINK", null, drinkValues);

}

From source file:Main.java

private static void insertDrink(SQLiteDatabase db, String name, String description, int resourceId) {
    ContentValues drinkValues = new ContentValues();
    drinkValues.put("NAME", name);
    drinkValues.put("DESCRIPTION", description);
    drinkValues.put("IMAGE_RESOURCE_ID", resourceId);
    ;/*from  www  . j  ava 2 s .  c  o m*/
    db.insert("DRINK", null, drinkValues);
}

From source file:uk.ac.horizon.ubihelper.service.PeersOpenHelper.java

public static long addPeerInfo(SQLiteDatabase database, PeerInfo pi) {
    pi._id = database.insert(PEER_TABLE_NAME, null, getContentValues(pi));
    if (pi._id == (-1)) {
        Log.e(TAG, "Error adding PeerInfo " + pi.id);
    }//w ww .  ja v a  2 s . c o m
    return pi._id;
}

From source file:Main.java

private static void insert(SQLiteDatabase db, String tableName, String name, String description,
        int resourceId) {
    ContentValues values = new ContentValues();
    values.put("NAME", name);
    values.put("DESCRIPTION", description);
    values.put("IMAGE_RESOURCE_ID", resourceId);
    db.insert(tableName, null, values);
}

From source file:Main.java

private static void insertToSUJames(SQLiteDatabase db, String startStopName, String toStopName, int timeGap) {
    ContentValues routevalues = new ContentValues();
    routevalues.put("START_STOP_JAMES_TO_SU", startStopName);
    routevalues.put("TO_STOP", toStopName);
    routevalues.put("TIME_GAP", timeGap);
    db.insert("TOSUROUTE_JAMES", null, routevalues);

}