public final class SQLUtils
extends java.lang.Object
Constructor and Description |
---|
SQLUtils() |
Modifier and Type | Method and Description |
---|---|
static boolean |
dbCheckStatus(java.sql.Connection sqlConnection,
java.lang.String query)
dbCheckStatus: this method check if they exist a status stored in the database,
or if the current status stored in the database has a manual order.
|
static void |
dbCleanStatus(java.sql.Connection sqlConnection)
dbCleanStatus: Clean the status truncating the database.
|
static void |
dbClose(java.sql.Connection conn)
dbClose: This method close the connection with the database.
|
static java.sql.Connection |
dbConnect(java.sql.Connection conn)
dbConnect: This method connect with the SQL database.
|
static void |
dbDisableManualOrder(java.sql.Connection sqlConnection,
ManualOrder order)
dbDisableManualOrder: disable the specified manual order.
|
static void |
dbInsertStatus(Client client,
java.sql.Connection sqlConnection)
dbStoreStatus: this method store the current status in the database.
|
static java.sql.ResultSet |
dbQuerySQL(java.sql.Connection conn,
java.lang.String SQL)
dbQuerySQL: this method execute a SQL query in the specified database connection.
|
static void |
dbStoreStatus(Client client,
java.sql.Connection sqlConnection)
dbStoreStatus: this method store the current status in the database.
|
static void |
dbStoreTemperature(Client client,
java.sql.Connection sqlConnection,
java.lang.String t1,
java.lang.String t2)
dbStoreTemperature: store the temperature values in the database.
|
static void |
dbUpdateStatus(Client client,
java.sql.Connection sqlConnection)
dbUpdateStatus: this method update the current status in the database.
|
static void |
dbUpdateStatus(java.sql.Connection sqlConnection,
java.lang.String strServer,
java.lang.String strDevice,
java.lang.String strOrder)
dbUpdateStatus: this method update the status row for the specified device of a specified server.
|
static java.sql.Timestamp |
getTimeStamp()
getTimeStamp: This method return the current timeStamp in SQL format.
|
java.sql.Timestamp |
getTimestamp(java.util.Date date)
getTimestamp: this method convert a Date() to SQL TimeStamp.
|
public static java.sql.Connection dbConnect(java.sql.Connection conn)
conn
- Connection with database.public static void dbClose(java.sql.Connection conn)
conn
- Established connection with database.public static java.sql.ResultSet dbQuerySQL(java.sql.Connection conn, java.lang.String SQL)
conn
- Established connection with database.SQL
- String with the SQL query to executepublic java.sql.Timestamp getTimestamp(java.util.Date date)
date
- date to convertpublic static void dbStoreStatus(Client client, java.sql.Connection sqlConnection)
client
- Object client to get the status.sqlConnection
- Established connection with database.public static void dbInsertStatus(Client client, java.sql.Connection sqlConnection)
client
- Object client with all information.sqlConnection
- Established connection with database.public static void dbUpdateStatus(Client client, java.sql.Connection sqlConnection)
client
- Object client with all information.sqlConnection
- Established connection with database.public static void dbUpdateStatus(java.sql.Connection sqlConnection, java.lang.String strServer, java.lang.String strDevice, java.lang.String strOrder)
sqlConnection
- Established connection with database.strServer
- Server name.strDevice
- Device name.strOrder
- Order to the device.public static boolean dbCheckStatus(java.sql.Connection sqlConnection, java.lang.String query)
sqlConnection
- Established connection with database.query
- SQL Query for check.public static void dbStoreTemperature(Client client, java.sql.Connection sqlConnection, java.lang.String t1, java.lang.String t2)
client
- Object client with all information.sqlConnection
- Established connection with database.t1
- Solar temperature.t2
- External temperature.public static void dbDisableManualOrder(java.sql.Connection sqlConnection, ManualOrder order)
sqlConnection
- Established connection with database.order
- Object with the manual order.public static void dbCleanStatus(java.sql.Connection sqlConnection)
sqlConnection
- Established connection with database.public static java.sql.Timestamp getTimeStamp()