public class SqlLiteManager
extends android.database.sqlite.SQLiteOpenHelper
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
KEY_ID |
Constructor and Description |
---|
SqlLiteManager(android.content.Context context,
java.lang.String name,
android.database.sqlite.SQLiteDatabase.CursorFactory factory,
int version)
Constractor of the SqlLiteMnanger
|
SqlLiteManager(android.content.Context cont,
java.lang.String dbname,
java.lang.String table)
Constractor of the SqlLiteMnanger
|
Modifier and Type | Method and Description |
---|---|
void |
addNewRecord(java.lang.String[] vals)
Creates a new non existing record on the table containing the given values
|
java.lang.Boolean |
CheckifRecordExist(java.lang.Object[] vals)
Checks if a record with the given values exists based on the primary keys.
|
void |
CreateorOpenDB(java.lang.String dbfilename,
java.lang.String tablename,
java.lang.String[] tcells)
Creates or Opens the Table from the given database
|
void |
CreateorOpenDB(java.lang.String dbfilename,
java.lang.String tablename,
java.lang.String[] tcells,
java.lang.Boolean dropexisting)
Creates or Opens the Table from the given database
|
void |
deleteRecord(int id)
Deletes the record with the given id
|
void |
deleteRecord(java.lang.String col,
java.lang.String val)
Deletes the record based on the value the given column has
|
android.database.Cursor |
findRecord(java.lang.String col,
java.lang.String val)
Gets the record which in the given column name has similar values like the given one.
|
android.database.Cursor |
getAllRecords()
Gets all the Records in the Table
|
android.database.Cursor |
getAllRecords(java.lang.String[] tcells)
all the Records in the Table with only the selected columns
|
android.database.Cursor |
getAllRecords(java.lang.String[] tcells,
java.lang.String orderby)
Gets all the Records in the Table with only the selected collumns and ordered by collumn
|
java.lang.String[] |
GetCells()
Gets the Cells of the table
|
java.lang.String[] |
getPrimaryKeys()
Gets the primary keys of the table
|
android.database.Cursor |
getRecord(java.lang.String col,
java.lang.String val)
Gets the record which in the given column name has the given value
|
int |
getRecordCount()
Count of Records in the table
|
void |
onCreate(android.database.sqlite.SQLiteDatabase db)
Executes the create table script , which creates the table
|
void |
onUpgrade(android.database.sqlite.SQLiteDatabase db,
int i,
int i2)
Drops the existing table and creates the newer version
|
void |
setCells(java.lang.String[] cells)
Sets the cells of the table
|
void |
setPrimaryKeys(java.lang.String[] keys)
sets the primary keys of the table except the _id one
|
int |
updateRecord(java.lang.String[] vals)
updates the record which contains the values of the given array based on the primary key
|
public static final java.lang.String KEY_ID
public SqlLiteManager(android.content.Context context, java.lang.String name, android.database.sqlite.SQLiteDatabase.CursorFactory factory, int version)
context
- name
- factory
- version
- public SqlLiteManager(android.content.Context cont, java.lang.String dbname, java.lang.String table)
cont
- dbname
- table
- public java.lang.String[] GetCells()
public void setCells(java.lang.String[] cells)
cells
- cells of the tablepublic java.lang.String[] getPrimaryKeys()
public void setPrimaryKeys(java.lang.String[] keys)
keys
- public void onCreate(android.database.sqlite.SQLiteDatabase db)
onCreate
in class android.database.sqlite.SQLiteOpenHelper
db
- public void onUpgrade(android.database.sqlite.SQLiteDatabase db, int i, int i2)
onUpgrade
in class android.database.sqlite.SQLiteOpenHelper
db
- i
- i2
- public void CreateorOpenDB(java.lang.String dbfilename, java.lang.String tablename, java.lang.String[] tcells)
dbfilename
- the name of the databasetablename
- Name of the tabletcells
- cells of the tablepublic void CreateorOpenDB(java.lang.String dbfilename, java.lang.String tablename, java.lang.String[] tcells, java.lang.Boolean dropexisting)
dbfilename
- the name of the databasetablename
- Name of the tabletcells
- cells of the tabledropexisting
- if true it drops the existing tablepublic java.lang.Boolean CheckifRecordExist(java.lang.Object[] vals)
vals
- array with the values of the rowpublic void addNewRecord(java.lang.String[] vals)
vals
- the array containing the values to be addedpublic android.database.Cursor getAllRecords()
public android.database.Cursor getAllRecords(java.lang.String[] tcells, java.lang.String orderby)
tcells
- selectted collumsorderby
- the collumn which they will by order bypublic android.database.Cursor getAllRecords(java.lang.String[] tcells)
tcells
- selected collumspublic int getRecordCount()
public int updateRecord(java.lang.String[] vals)
vals
- public void deleteRecord(int id)
id
- the id of the record to be deletedpublic void deleteRecord(java.lang.String col, java.lang.String val)
col
- the name of the collumn which must have the given valval
- the value that the selected column must have in order to be deleted.public android.database.Cursor findRecord(java.lang.String col, java.lang.String val)
col
- the name of the column which must have the given valueval
- the value that the selected column must have .public android.database.Cursor getRecord(java.lang.String col, java.lang.String val)
col
- the name of the column which must have the given valueval
- the value that the selected column must have .