|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectslib.sml.smutils.SQLiteUtils
public class SQLiteUtils
Class used to process large SME results files through SQLlite databases Processed file must respect the following restrictions: - tab separated format - containing a header (first non-empty line which do not start with ! ). Use ! to prefix comment lines - the first two columns are dedicated to the name of the entity compared (the name of the corresponding columns will be set to "entity_A" and "entity_B") - the other columns are considered as double (decimal) results. The class can be used to : - create an SQLite database from an input file containing SME result a table will be create for each input file - merge two tables into a new database table - delete a specific table - copy a table from an SQLlite database to another - get information from a specific database or table Limits Note that SQLite implementation to not allow SELECT queries on databases containing tables with more than 500 columns. If such big table are processed a SQL_Exception will be throw.
Field Summary | |
---|---|
static int |
BATCH_LIMIT
|
static int |
BATCH_LIMIT_MATRIX_LINE
|
Constructor Summary | |
---|---|
SQLiteUtils()
|
Method Summary | |
---|---|
void |
copyTable(String db,
String table,
String newDB,
String tableNew)
Copy a table. |
void |
createTableDB(String filepath,
String db,
String tableName)
Create a SQLlite database from a tabular file. |
void |
dropColumns(String db,
String table,
Set<String> columnsToDrop)
Drop specified columns from the table |
void |
dropTable(String db,
String table)
Drop a table from a database |
void |
flushTableInFile(String sqlLiteDB,
String table,
String outfile)
Flush a table in a tabular file The first two columns are considered as literal, the others as Double values The number of tuples load into memory before flushing are governed by BATCH_LIMIT_MATRIX_LINE |
int |
getBATCH_LIMIT_MATRIX_LINE()
|
int |
getBATCH_LIMIT()
|
void |
getInfo(String db)
Return info a specified database |
void |
getInfo(String db,
String table)
Return info a specified table |
void |
mergeTables(String db_tAB,
String table_A,
String table_B,
String db_tmerge,
String table_merge)
Merge two tables of a same database into a new table located in another database. |
void |
mergeTables(String db_tA,
String table_A,
String db_tB,
String table_B,
String db_tmerge,
String table_merge)
Merge two tables into a new table. |
void |
renameTable(String db,
String table,
String newTableName)
Rename a table in a database. |
void |
setBATCH_LIMIT_MATRIX_LINE(int bATCH_LIMIT_MATRIX_LINE)
Mutator of the number of values stored by line. |
void |
setBATCH_LIMIT(int BATCH_LIMIT)
Setter of the number of value stored in memory. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static int BATCH_LIMIT
public static int BATCH_LIMIT_MATRIX_LINE
Constructor Detail |
---|
public SQLiteUtils()
Method Detail |
---|
public void createTableDB(String filepath, String db, String tableName) throws slib.utils.ex.SLIB_Ex_Critic
filepath
- the tabular file containing the resultsdb
- the name of the database to considertableName
- the name of the table where to flush the results
slib.utils.ex.SLIB_Ex_Critic
public void mergeTables(String db_tAB, String table_A, String table_B, String db_tmerge, String table_merge) throws slib.utils.ex.SLIB_Exception
db_tAB
- database of the tables to mergetable_A
- first table nametable_B
- second table namedb_tmerge
- database in which the merge table will be created
(different from db_tAB)table_merge
- the name of the new table
slib.utils.ex.SLIB_Exception
public void mergeTables(String db_tA, String table_A, String db_tB, String table_B, String db_tmerge, String table_merge) throws slib.utils.ex.SLIB_Ex_Critic
db_tA
- database of the first table to mergetable_A
- first table namedb_tB
- database of the second table to mergetable_B
- second table namedb_tmerge
- database in which the merge table will be createdtable_merge
- the name of the new table
slib.utils.ex.SLIB_Ex_Critic
public void flushTableInFile(String sqlLiteDB, String table, String outfile) throws slib.utils.ex.SLIB_Ex_Critic
sqlLiteDB
- the database containing the table to considertable
- the name of the tableoutfile
- the file in which the table will be flush
slib.utils.ex.SLIB_Ex_Critic
public void copyTable(String db, String table, String newDB, String tableNew) throws slib.utils.ex.SLIB_Ex_Critic
db
- the database containing the table to copytable
- the name of the tablenewDB
- the name of the database where the new table will be createdtableNew
-
slib.utils.ex.SLIB_Ex_Critic
public void dropColumns(String db, String table, Set<String> columnsToDrop) throws slib.utils.ex.SLIB_Ex_Critic
db
- the database containing the table to processtable
- the table to processcolumnsToDrop
- a list of strings corresponding to the columns to
delete
SQLlite do not support ALTER column, a temporal copy of the table is
performed during the process
slib.utils.ex.SLIB_Ex_Critic
public void dropTable(String db, String table) throws slib.utils.ex.SLIB_Ex_Critic
db
- the databasetable
- the name of table to drop
slib.utils.ex.SLIB_Ex_Critic
public void getInfo(String db) throws slib.utils.ex.SLIB_Ex_Critic
db
- the database
slib.utils.ex.SLIB_Ex_Critic
public void getInfo(String db, String table) throws slib.utils.ex.SLIB_Ex_Critic
db
- the databasetable
- the table
slib.utils.ex.SLIB_Ex_Critic
public void renameTable(String db, String table, String newTableName) throws slib.utils.ex.SLIB_Ex_Critic
db
- table
- newTableName
-
slib.utils.ex.SLIB_Ex_Critic
public int getBATCH_LIMIT()
public void setBATCH_LIMIT(int BATCH_LIMIT)
BATCH_LIMIT
- public int getBATCH_LIMIT_MATRIX_LINE()
public void setBATCH_LIMIT_MATRIX_LINE(int bATCH_LIMIT_MATRIX_LINE)
bATCH_LIMIT_MATRIX_LINE
-
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |