Created
June 9, 2013 14:22
-
-
Save nathancyam/5743730 to your computer and use it in GitHub Desktop.
GODDAMN SQLITE
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public Event createEvent(String location, String dateString, String timeString, String nameString){ | |
ContentValues values = new ContentValues(); | |
values.put(MySQLiteHelper.COLUMN_LOCATION, location); | |
values.put(MySQLiteHelper.COLUMN_DATE, dateString); | |
values.put(MySQLiteHelper.COLUMN_TIME, timeString); | |
values.put(MySQLiteHelper.COLUMN_NAME, nameString); | |
// This inserts the entry to the database | |
long insertId = database.insert(MySQLiteHelper.TABLE_EVENTS, null, values); | |
// This makes sure that the database points to the new product | |
Cursor cursor = database.query(MySQLiteHelper.TABLE_EVENTS, | |
allColumns, MySQLiteHelper.COLUMN_ID + " = " + insertId, null, | |
null, null, null); | |
cursor.moveToFirst(); | |
Event newEvent = cursorToEvent(cursor); | |
cursor.close(); | |
return newEvent; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment