public class SQLManipulator extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
MYSQL_DRIVER |
Constructor and Description |
---|
SQLManipulator(java.lang.String dbHost,
java.lang.String dbName,
java.lang.String dbUser,
java.lang.String dbPassword) |
Modifier and Type | Method and Description |
---|---|
int |
deleteFromDB(java.lang.String table,
java.lang.String column,
java.lang.String value) |
void |
disconnect() |
java.sql.Connection |
getConnection() |
java.sql.Statement |
getStatement() |
int |
insertIntoDB(java.lang.String table,
java.lang.Object[] values)
Inserts a new entry in a databse table.
|
int |
insertIntoDB(java.lang.String table,
java.lang.String[] names,
java.lang.Object[] values)
Inserts a new entry in a database table
|
boolean |
isConntected() |
java.sql.ResultSet |
readFromDB(java.lang.String table,
int entryNo) |
java.sql.ResultSet |
readFromDB(java.lang.String returnColumn,
java.lang.String table,
int entryNo) |
java.sql.ResultSet |
readFromDB(java.lang.String table,
java.lang.String selectionColumn,
java.lang.String value) |
java.sql.ResultSet |
readFromDB(java.lang.String returnColumn,
java.lang.String table,
java.lang.String selectionColumn,
java.lang.String value) |
int |
updateDBEntry(java.lang.String table,
java.lang.String whereCond,
java.lang.String[] names,
java.lang.Object[] values)
Updates several columns in the specified database entries.
|
int |
updateDBEntry(java.lang.String table,
java.lang.String whereCond,
java.lang.String name,
java.lang.String value)
Updates one column in the specified database entries.
|
int |
updateDBEntry(java.lang.String table,
java.lang.String columnName,
java.lang.String columnValue,
java.lang.String[] names,
java.lang.Object[] values)
Updates several columns in the specified database entries.
|
int |
updateDBEntry(java.lang.String table,
java.lang.String columnName,
java.lang.String columnValue,
java.lang.String name,
java.lang.String value)
Updates one column in the specified database entries.
|
public static final java.lang.String MYSQL_DRIVER
public SQLManipulator(java.lang.String dbHost, java.lang.String dbName, java.lang.String dbUser, java.lang.String dbPassword)
public boolean isConntected()
public java.sql.Statement getStatement() throws java.sql.SQLException
java.sql.SQLException
public java.sql.Connection getConnection()
public void disconnect() throws java.sql.SQLException
java.sql.SQLException
public int insertIntoDB(java.lang.String table, java.lang.Object[] values) throws java.sql.SQLException
table
- the table to insert the new entryvalues
- the values of the entry (the values have to have the same order as
their columns have in the table)java.sql.SQLException
public int insertIntoDB(java.lang.String table, java.lang.String[] names, java.lang.Object[] values) throws java.sql.SQLException
table
- the table to insert the new entrynames
- the column namesvalues
- the values for the columnsjava.sql.SQLException
public int updateDBEntry(java.lang.String table, java.lang.String columnName, java.lang.String columnValue, java.lang.String name, java.lang.String value) throws java.sql.SQLException
table
- the table which contains the entrycolumnName
- the name of the column by which the entry shall be identifiedcolumnValue
- the value of the column by which the entry shall be identifiedname
- the name of the column which shall be updatedvalue
- the value which shall be placed in the specified columnjava.sql.SQLException
public int updateDBEntry(java.lang.String table, java.lang.String whereCond, java.lang.String name, java.lang.String value) throws java.sql.SQLException
table
- the table which contains the entrywhereCond
- the condition placed after the WHERE
-keyword in the SQL-queryname
- the name of the column which shall be updatedvalue
- the value which shall be placed in the specified columnjava.sql.SQLException
public int updateDBEntry(java.lang.String table, java.lang.String columnName, java.lang.String columnValue, java.lang.String[] names, java.lang.Object[] values) throws java.sql.SQLException
table
- the table which contains the entrycolumnName
- the name of the column by which the entry shall be identifiedcolumnValue
- the value of the column by which the entry shall be identifiednames
- a list of the names of the columns which shall be updatedvalues
- a list of the values which shall be placed in the specified columnsjava.sql.SQLException
public int updateDBEntry(java.lang.String table, java.lang.String whereCond, java.lang.String[] names, java.lang.Object[] values) throws java.sql.SQLException
table
- the table which contains the entrywhereCond
- the condition placed after the WHERE
-keyword in the SQL-querynames
- a list of the names of the columns which shall be updatedvalues
- a list of the values which shall be placed in the specified columnsjava.sql.SQLException
public int deleteFromDB(java.lang.String table, java.lang.String column, java.lang.String value) throws java.sql.SQLException
java.sql.SQLException
public java.sql.ResultSet readFromDB(java.lang.String table, java.lang.String selectionColumn, java.lang.String value) throws java.sql.SQLException
java.sql.SQLException
public java.sql.ResultSet readFromDB(java.lang.String returnColumn, java.lang.String table, java.lang.String selectionColumn, java.lang.String value) throws java.sql.SQLException
java.sql.SQLException
public java.sql.ResultSet readFromDB(java.lang.String table, int entryNo) throws java.sql.SQLException
java.sql.SQLException
public java.sql.ResultSet readFromDB(java.lang.String returnColumn, java.lang.String table, int entryNo) throws java.sql.SQLException
java.sql.SQLException