Package org.dlese.dpc.services.mmd
Class DbConn
java.lang.Object
org.dlese.dpc.services.mmd.DbConn
Provides a DB Connection and some low level access methods.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidcloseDb()static Stringdbstring(double vv) static Stringdbstring(int vv) static Stringdbstring(long vv) static Stringstatic Stringstatic Stringdbstringcom(double vv) static Stringdbstringcom(int vv) static Stringdbstringcom(long vv) static Stringdbstringcom(String stg) static Stringdbstringcom(Timestamp ts) static Stringdbstringforce(String stg) static Stringdbstringforcecom(String stg) static Stringdbstringsub(String stg, boolean forceit) Creates a string suitable for MySQL commands, including escaped quotes and the surrounding single quotes.getDbString(String sqlstg) Retrieves a single String from the DB.Object[][]getDbTable(String sqlstg, String[] types, boolean allownull) Retrieves a table from the DB: each array row represents one DB row, and each array column represents a DB column.voidUpdates the DB.
-
Constructor Details
-
DbConn
- Throws:
MmdException
-
-
Method Details
-
closeDb
- Throws:
MmdException
-
getDbString
Retrieves a single String from the DB.- Parameters:
sqlstg- The SQL string used to query the DB.- Throws:
MmdException
-
updateDb
Updates the DB.- Parameters:
sqlstg- The SQL string to be used.- Throws:
MmdException
-
getDbTable
Retrieves a table from the DB: each array row represents one DB row, and each array column represents a DB column.- Parameters:
sqlstg- The SQL string used to query the DB.types- An array of the types of the returned columns. Valid values are:Specified type Returned java type "boolean" Boolean "date" Long (milliseconds since 1970) "double" Double "int" Integer "long" Long "string" String - Throws:
MmdException
-
dbstringcom
- Throws:
MmdException
-
dbstring
- Throws:
MmdException
-
dbstringcom
- Throws:
MmdException
-
dbstring
- Throws:
MmdException
-
dbstringcom
- Throws:
MmdException
-
dbstring
- Throws:
MmdException
-
dbstringcom
- Throws:
MmdException
-
dbstring
- Throws:
MmdException
-
dbstringcom
- Throws:
MmdException
-
dbstring
- Throws:
MmdException
-
dbstringforce
- Throws:
MmdException
-
dbstringforcecom
- Throws:
MmdException
-
dbstringsub
Creates a string suitable for MySQL commands, including escaped quotes and the surrounding single quotes. Throws MmdException if the input string contains an invalid char, unless forceit == true in which case invalid chars are ouput as format "0xabcd".- Throws:
MmdException
-