public interface DBConnectionStrategy
Modifier and Type | Method and Description |
---|---|
int |
countRows(String tableName)
counts the rows of a given table
|
int[] |
countsRowsAndCols(String tableName)
counts rows and columns of a give database table
|
void |
createConnection(String url,
String user,
String pass)
creates a connection to a database driver
|
void |
createTable(String tableName,
Cell[][] cells)
creates a new table in the database
|
void |
deleteRows(String tableName,
String[] toDelete)
deletes rows from a database table
|
void |
disconnet()
closes connection from the database
|
String[][] |
getTableContent(String tableName)
returns the data of a given table
|
String[] |
getTableList(ArrayList list)
returns all the tables availabe int he database
|
void |
insertNewData(String tableName,
String[][] newData)
inserts a new row into a database table
|
String[][] |
queryTo2dArray(ArrayList array,
String[][] table)
converts database table-content stored in an array list to a 2D String array
|
ArrayList |
queryToArray()
saves the result of a SQL expression into an arraylist
|
ArrayList |
queryToArray(String tableName)
saves a SQL query in an ArrayList
|
void |
updateRow(String tableName,
String column,
String origin,
String destination)
updates a single row in a database table
|
void |
updateTable()
updates a given table
|
void createConnection(String url, String user, String pass) throws ClassNotFoundException, SQLException
url
- path to driveruser
- usernamepass
- passwordClassNotFoundException
SQLException
void createTable(String tableName, Cell[][] cells)
tableName
- table's namecells
- cells to be added to the tablevoid disconnet()
ArrayList queryToArray()
str
- SQL expressionString[] getTableList(ArrayList list)
String[][] getTableContent(String tableName)
void updateTable()
ArrayList queryToArray(String tableName) throws SQLException
expression
- sql expressionSQLException
int[] countsRowsAndCols(String tableName) throws SQLException
tableName
- table nameSQLException
int countRows(String tableName) throws SQLException
tableName
- SQLException
String[][] queryTo2dArray(ArrayList array, String[][] table)
array
- arralist with table-contenttable
- 2D arrayvoid updateRow(String tableName, String column, String origin, String destination)
tableName
- table's namecolumn
- table's columnorigin
- value to be finaldestination
- primary key in databasevoid insertNewData(String tableName, String[][] newData)
tableName
- database table namenewData
- 2D array with data to be added to the databasevoid deleteRows(String tableName, String[] toDelete)
tableName
- database table nametoDelete
- array with primary keys for deletion