mysql
Class StaticSql

java.lang.Object
  extended by util.PropertyContainer
      extended by util.PropertyResources
          extended by util.PropertyBundles
              extended by mysql.StaticSql
All Implemented Interfaces:
Cloneable, ExitCleaning, Initializable, LocalizedSupplying, PropertySupplying, ResourceSupplying

public class StaticSql
extends PropertyBundles
implements ExitCleaning

A class that provides data base access to a postgres or any other sql database. It provides only generic functionality, like loading the JDBC bridge, opening the connection and executing basic statements. Differently to #GenericSql, this class is static in the sense that it allows different user to maintain their connections during the entire life-time of the virtual machine. Each user has an open connection in a static lookup table. There is a single living instance of this group, whose properties are searched in the following way, search stop at first match:

The properties than are used to open a database connection for the default user, if any. New users must first register with username and password, otherwise a connection exception is thrown.

See Also:
GenericSql

Nested Class Summary
private static class StaticSql.ReconnectTask
          A reconnect task first deletes any pending statements and then tries to reopen it in its run method.
static class StaticSql.ResultMetaData
          Tries to collect meta-data on the result set of a given table.
 
Nested classes/interfaces inherited from class util.PropertyResources
PropertyResources.URLResource
 
Field Summary
private static BufferedWriter batch
          The single living instance.
private static Map<String,Connection> db
          The connection to the database, per user one connection.
private static String DEFBRIDGE
          The default JDBC-postgres bridge class.
private static String DEFCONNECT
          The default driver-specific connection string.
static DateFormat DEFDATEFORMAT
          The default date format for sql date and time objects witrhout ms.
static DateFormat DEFMSFORMAT
          The default date format for sql date and time objects.
private static long DEFRECONNECT
          If zero, reconnecting is not allowed.
private static boolean DEFTRUEREAD
          Default writing to db.
private static boolean DEFTRUEWRITE
          Default writing to db.
static String FLOAT4
          If you try to create a real[], use this in the connection.
static String KEY_BATCHFILE
          If this file is given, all commands are also writtn to batch file.
static String KEY_BRIDGE
          The class name of the JDBC-postgres bridge.
static String KEY_CONNECT
          The driver-specific connection string.
static String KEY_DATEFORMAT
          The date formatter to use.
static String KEY_FAILINSERT
          On true write, if writing fails, we write to this file.
static String KEY_PASSWORD
          The password used for identifying the user.
static String KEY_RECONNECT
          If the connection dies, this is the scheduling retry time.
static String KEY_TRUEREAD
          For debugging purposes this may be false.
static String KEY_TRUEWRITE
          For debugging purposes this may be false.
static String KEY_USERNAME
          The user name to identify the class on the database.
private static boolean LOADED
          If true, bridge is loaded.
private static Map<String,String> pwd
          All valid passwords.
private static Timer reopen
          A timer used to schedule re-open tries.
private static Map<String,Date> retry
          The lookup for for the reconnections.
private static StaticSql run
          The single living instance.
static String SCAN
          The resource name psql.static.conf.
private static String testcatalog
           
static Calendar UTC
          The default calendar to use with time zone UTC.
 
Fields inherited from class util.PropertyBundles
KEY_LOCALECOUNTRY, KEY_LOCALELANGUAGE, KEY_RESOURCEBUNDLES
 
Fields inherited from class util.PropertyResources
KEY_NOINITONCREATE, localurl, locate, POSTFIX_DIR, POSTFIX_EXT, POSTFIX_FILE, POSTFIX_LIST, POSTFIX_URL, urlset
 
Fields inherited from class util.PropertyContainer
KEY_LISTSEPARATOR, KEY_MAPKEYVALUECHAR, KEY_MAPSEPARATOR
 
Fields inherited from interface util.ResourceSupplying
KEY_URLRESOURCES, KEY_URLUSECONFIG, KEY_URLUSECURRENT, KEY_URLUSEHOME
 
Fields inherited from interface util.PropertySupplying
CONFIG, KEY_CLASS
 
Constructor Summary
protected StaticSql(Map<String,String> prop)
          Constructs a new sql-db access object.
 
Method Summary
private static double calc(String what, String whom, String expression, String from, String where)
          Returns a result set.
static boolean canRead()
          If true, we can read to the database.
static boolean canReconnect()
          Returns true if reconnections can be tried.
static boolean canWrite()
          If true, we can write to the database.
private static boolean checkRun()
           
private static void closeConnections()
          Closes all connections and deletes the connected users.
private static String columnNameWrap(String hasup)
          Could you believe that upper case column names are allowed in SQL, but if put on the query and not protected by double quotes, they are converted to lower case letters and than the lookup fails with 'no such column'? What sounds like a bad joke is realized in SQL.
static double count(String whom, String expression, String from, String where)
          Returns a result set.
protected static void createDefault()
           
protected static void createInstance(Map<String,String> nondefault)
           
protected static Statement createStatement()
          Creates the executable statement for the default user
protected static Statement createStatement(String isnull)
          Creates a statement for a certain user.
protected static String defaultUser(String isnull)
          If argument is null or empty, return the default user name, otherwise return the argument.
static int delete(String whom, String table, String where)
          Delets row from a database.
static int executeUpdate(String whom, String table, String set, String where)
          Dangerous method to directly update entries in a table.
 void exit()
          Closes the database without throwing an exception.
protected static Connection getConnection(String user)
          Returns the connection for a specified user.
private static String getDatabaseEntry(String key, Object val)
          Formats the argument to allow it to be entered into a normal database.
static String getMetaInfo(ResultSet rs)
          Retrieves meta info on a non-null result set.
static Map<String,String> getRuntimeProperties()
          Returns the properties of the single run-time instance.
 void init()
          Initializes the sensor-data to SQL-DB access.
static boolean insert(Map<String,Object> data, String table)
          Inserts new data into the database for the default user.
static boolean insert(String whom, Map<String,Object> data, String table)
          Inserts new data into the database.
static boolean isDebug()
          Returns true if we are in debug mode either for read or write.
static boolean isFullDebug()
          Returns true if we are in debug mode in both for read or write.
static boolean isReadDebug()
          Returns true if we are in debug mode for read.
static boolean isReady()
          Test if data can be writtn to the database using the insert(java.util.Map, java.lang.String), replace(java.lang.String, java.lang.String, java.util.Map, java.lang.String) or retrieve(java.util.Collection, java.lang.String, java.lang.String) method.
static boolean isReady(String isnull)
          Test if data can be writtn to the database using the insert(java.util.Map, java.lang.String), replace(java.lang.String, java.lang.String, java.util.Map, java.lang.String) or retrieve(java.util.Collection, java.lang.String, java.lang.String) method.
static boolean isWriteDebug()
          Returns true if we are in debug mode for write.
static ResultSet join(String user, Collection<String> fields, String[] tables, String[] keys, String where)
          Returns the result of a database join, meaning that at least two tables are joined together.
static Connection openUser(String username, String password)
          Opens the sensor database.
static PreparedStatement prepareInsert(String whom, String table, List<String> fields)
          Returns a prepared statement for inserting data.
static PreparedStatement prepareUpdate(String whom, String table, List<String> cols, String where)
          Returns a prepared statement for updating data.
static PreparedStatement prepareUpdate(String whom, String table, String set, String where)
          Returns a prepared statement for updating data.
static void reconnect(String user, String passwd)
          Tries to reconnect using a timer task.
private static void reconnect(String user, String password, long redo)
          Tries to reconnect by permanently trying to open the stated user connection.
static boolean replace(String whom, String table, Map<String,Object> data, String where)
          Replaces data in the database.
static ResultSet retrieve(Collection<String> fields, String from, String where)
          Returns the result of a database query.
static ResultSet retrieve(Collection<String> fields, String from, String where, String order)
          Returns the result of a database query.
static ResultSet retrieve(String whom, Collection<String> fields, String from, String where)
          Returns a result set.
static ResultSet retrieve(String whom, Collection<String> fields, String from, String where, String order)
          Returns a result set.
static ResultSet retrieve(String whom, Collection<String> fields, String from, String where, String order, int limit)
          Returns a result set.
static ResultSet retrieve(String whom, Map<String,String> asfield, String from, String where, String order, int limit)
          Returns a result set.
static Map<String,Object> retrievePrimary(String whom, Collection<String> fields, String from, String where)
          Tries to retrieve all entries in a single result set.
static double sum(String whom, String expression, String from, String where)
          Returns a result set.
static Map<String,Object> toMap(ResultSet rs)
          Maps a result set into a java map by querying all column names and puting the result set get object as the values into it.
 
Methods inherited from class util.PropertyBundles
clone, getLocalized, getLocalized, getLocalizedString, getLocalizedString, loadResource
 
Methods inherited from class util.PropertyResources
createFrom, createFrom, createFrom, getApplet, getAsResources, getLocalClassLoader, getPropertiesToKey, getPropertiesToKey, getResource, getResourceAsStream, getResourceFromKey, getResources, keyCreate, keyCreate, reload, setApplet
 
Methods inherited from class util.PropertyContainer
augment, augment, augment, defaultBoolean, defaultChar, defaultDouble, defaultFloat, defaultInt, defaultLong, defaultObject, defaultObject, defaultProperties, defaultProperty, getAsBoolean, getAsChar, getAsDouble, getAsEnums, getAsFloat, getAsInt, getAsList, getAsLong, getAsMap, getAsMap, getAsObject, getAsObject, getProperties, getProperty, has, isNew, parseObject, reload, removeProperty, rescanned, setObject, setProperties, setProperty, stringProperties, toString
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface util.ResourceSupplying
getResource, getResourceAsStream, getResources
 
Methods inherited from interface util.PropertySupplying
defaultBoolean, defaultChar, defaultDouble, defaultFloat, defaultInt, defaultLong, defaultObject, defaultObject, defaultProperties, defaultProperty, getAsBoolean, getAsChar, getAsDouble, getAsFloat, getAsInt, getAsList, getAsLong, getAsMap, getAsObject, getAsObject, getProperties, getProperty, has, parseObject, removeProperty, setObject, setProperty, stringProperties
 

Field Detail

SCAN

public static final String SCAN
The resource name psql.static.conf.

See Also:
Constant Field Values

KEY_BRIDGE

public static final String KEY_BRIDGE
The class name of the JDBC-postgres bridge.

See Also:
Constant Field Values

KEY_CONNECT

public static final String KEY_CONNECT
The driver-specific connection string.

See Also:
Constant Field Values

KEY_USERNAME

public static final String KEY_USERNAME
The user name to identify the class on the database.

See Also:
Constant Field Values

KEY_PASSWORD

public static final String KEY_PASSWORD
The password used for identifying the user. Not encrypted.

See Also:
Constant Field Values

KEY_DATEFORMAT

public static final String KEY_DATEFORMAT
The date formatter to use.

See Also:
Constant Field Values

KEY_TRUEREAD

public static final String KEY_TRUEREAD
For debugging purposes this may be false. Then, no db-update is done.

See Also:
Constant Field Values

KEY_TRUEWRITE

public static final String KEY_TRUEWRITE
For debugging purposes this may be false. Then, no db-update is done.

See Also:
Constant Field Values

KEY_FAILINSERT

public static final String KEY_FAILINSERT
On true write, if writing fails, we write to this file.

See Also:
Constant Field Values

KEY_BATCHFILE

public static final String KEY_BATCHFILE
If this file is given, all commands are also writtn to batch file.

See Also:
Constant Field Values

KEY_RECONNECT

public static final String KEY_RECONNECT
If the connection dies, this is the scheduling retry time.

See Also:
Constant Field Values

FLOAT4

public static final String FLOAT4
If you try to create a real[], use this in the connection.

See Also:
Constant Field Values

DEFMSFORMAT

public static final DateFormat DEFMSFORMAT
The default date format for sql date and time objects.


DEFDATEFORMAT

public static final DateFormat DEFDATEFORMAT
The default date format for sql date and time objects witrhout ms.


UTC

public static final Calendar UTC
The default calendar to use with time zone UTC.


DEFBRIDGE

private static final String DEFBRIDGE
The default JDBC-postgres bridge class. Loaded once, never used.

See Also:
Constant Field Values

DEFCONNECT

private static final String DEFCONNECT
The default driver-specific connection string.

See Also:
Constant Field Values

DEFTRUEWRITE

private static final boolean DEFTRUEWRITE
Default writing to db.

See Also:
Constant Field Values

DEFTRUEREAD

private static final boolean DEFTRUEREAD
Default writing to db.

See Also:
Constant Field Values

DEFRECONNECT

private static final long DEFRECONNECT
If zero, reconnecting is not allowed.

See Also:
Constant Field Values

db

private static Map<String,Connection> db
The connection to the database, per user one connection.


pwd

private static Map<String,String> pwd
All valid passwords.


retry

private static Map<String,Date> retry
The lookup for for the reconnections.


run

private static StaticSql run
The single living instance.


batch

private static BufferedWriter batch
The single living instance.


LOADED

private static boolean LOADED
If true, bridge is loaded.


reopen

private static transient Timer reopen
A timer used to schedule re-open tries.


testcatalog

private static String testcatalog
Constructor Detail

StaticSql

protected StaticSql(Map<String,String> prop)
Constructs a new sql-db access object. All keys present have default values. The database connection is opened when the first call to the init() method occurs.

Method Detail

createDefault

protected static final void createDefault()

createInstance

protected static final void createInstance(Map<String,String> nondefault)

checkRun

private static boolean checkRun()

init

public void init()
Initializes the sensor-data to SQL-DB access. On a first call to this method, the JDBC-driver class, KEY_BRIDGE, is loaded.

Specified by:
init in interface Initializable
Overrides:
init in class PropertyResources

exit

public void exit()
Closes the database without throwing an exception.

Specified by:
exit in interface ExitCleaning

canReconnect

public static boolean canReconnect()
Returns true if reconnections can be tried.


reconnect

public static void reconnect(String user,
                             String passwd)
Tries to reconnect using a timer task.


closeConnections

private static void closeConnections()
                              throws SQLException
Closes all connections and deletes the connected users.

Throws:
SQLException

openUser

public static Connection openUser(String username,
                                  String password)
                           throws SQLException
Opens the sensor database. The connection is established and the executable statement is constructed.

Throws:
SQLException

createStatement

protected static Statement createStatement()
                                    throws SQLException,
                                           ConnectException
Creates the executable statement for the default user

Throws:
SQLException
ConnectException

createStatement

protected static Statement createStatement(String isnull)
                                    throws SQLException,
                                           ConnectException
Creates a statement for a certain user. If the user has no connection, a ConnectException is thrown.

Throws:
SQLException
ConnectException

isDebug

public static boolean isDebug()
Returns true if we are in debug mode either for read or write.


isFullDebug

public static boolean isFullDebug()
Returns true if we are in debug mode in both for read or write.


isReadDebug

public static boolean isReadDebug()
Returns true if we are in debug mode for read.


isWriteDebug

public static boolean isWriteDebug()
Returns true if we are in debug mode for write.


getRuntimeProperties

public static Map<String,String> getRuntimeProperties()
Returns the properties of the single run-time instance.


isReady

public static boolean isReady()
Test if data can be writtn to the database using the insert(java.util.Map, java.lang.String), replace(java.lang.String, java.lang.String, java.util.Map, java.lang.String) or retrieve(java.util.Collection, java.lang.String, java.lang.String) method. This method checks if we have a non-null connection db and a non-null statement #execute.


isReady

public static boolean isReady(String isnull)
Test if data can be writtn to the database using the insert(java.util.Map, java.lang.String), replace(java.lang.String, java.lang.String, java.util.Map, java.lang.String) or retrieve(java.util.Collection, java.lang.String, java.lang.String) method. This method checks if we have a non-null connection db and a non-null statement #execute.


insert

public static boolean insert(Map<String,Object> data,
                             String table)
                      throws SQLException,
                             ConnectException
Inserts new data into the database for the default user. The string that is executed reads as
 INSERT INTO {table} ({field1}, {field2},...) 
        VALUES({num1}, '{string2}',...)
 
The user supplied map are the fields as keys and their values. The values should currently only consist of object of types String, Numbers, or Dates. String are converted to be embraced with single quotes ('), Date objects are converted into strings using the KEY_DATEFORMAT format. Numbers are simply converted into strings.

Throws:
SQLException
ConnectException

insert

public static boolean insert(String whom,
                             Map<String,Object> data,
                             String table)
                      throws SQLException,
                             ConnectException
Inserts new data into the database. The string that is executed reads as
 INSERT INTO {table} ({field1}, {field2},...) 
        VALUES({num1}, '{string2}',...)
 
The user supplied map are the fields as keys and their values. The values should currently only consist of object convertable to Strings, Numbers, or Dates. String are converted to be embraced with single quotes ('), Date objects are converted into strings using the KEY_DATEFORMAT format. Numbers are simply converted into strings.

Unthinkably so, upper-case column names are only supported if put in double quotes, so instead of writing INSERT INTO table (A,B,C..., you have to write INSERT INTO table ("A","B","C".... Lol.

Throws:
SQLException
ConnectException

replace

public static boolean replace(String whom,
                              String table,
                              Map<String,Object> data,
                              String where)
                       throws SQLException,
                              ConnectException
Replaces data in the database. The table used is defined in the underlying properties. The string that is executed reads as
 UPDATE {table} SET {field1}={num1}, {field2}='{string2}',...
 
The user supplied lists are the field list and the values list. The values should consist of object of types String, Numbers, or Dates. String are converted to be embraced with single quotes ('), Date objects are converted into strings using the KEY_DATEFORMAT format. Numbers are simply converted into strings. Note that it is the users responsibility to ensure proper ordering in the list, as no further type checks are done, only the run-time types of the values are used.

Parameters:
fields - A list of strings giving the field names in the database
values - A list of objects that are the correspondend values to the fields in the parameter above.
where - The identification which sets should be affected, without the leading WHERE.
Throws:
SQLException
ConnectException

prepareInsert

public static PreparedStatement prepareInsert(String whom,
                                              String table,
                                              List<String> fields)
                                       throws SQLException,
                                              ConnectException
Returns a prepared statement for inserting data. This can be used for data types that can hardly be expressed as strings. The fields are defined here as a list, as entering the value into the prepared statement happens with setter methods using an integer index, which starts at '1'.

Throws:
SQLException
ConnectException

prepareUpdate

public static PreparedStatement prepareUpdate(String whom,
                                              String table,
                                              List<String> cols,
                                              String where)
                                       throws SQLException,
                                              ConnectException
Returns a prepared statement for updating data. This can be used for data types that can hardly be expressed as strings. The fields are defined here as a list, as entering the value into the prepared statement happens with setter methods using an integer index, which starts at '1'.

Throws:
SQLException
ConnectException

prepareUpdate

public static PreparedStatement prepareUpdate(String whom,
                                              String table,
                                              String set,
                                              String where)
                                       throws SQLException,
                                              ConnectException
Returns a prepared statement for updating data. This can be used for data types that can hardly be expressed as strings. The fields are defined here as a list, as entering the value into the prepared statement happens with setter methods using an integer index, which starts at '1'.The set string follows column1=?, column2=?,...

Throws:
SQLException
ConnectException

executeUpdate

public static int executeUpdate(String whom,
                                String table,
                                String set,
                                String where)
                         throws SQLException,
                                ConnectException
Dangerous method to directly update entries in a table. Does not cross-check if the set and where clauses are meaningful, thus use with care.

This method execute an update reading as (arg replaced by their value) UPDATE table SET set WHERE where, thus set must be in the form of column1=value1,column2=value2....

Parameters:
whom - The user name. Only allowed if this connection is open.
table - The name of the table
set - in the form of column1=value1,column2=value2,etc.
where - The essential where clause.
Returns:
The number of updated rows.
Throws:
SQLException
ConnectException

getConnection

protected static Connection getConnection(String user)
Returns the connection for a specified user.


delete

public static int delete(String whom,
                         String table,
                         String where)
                  throws SQLException,
                         ConnectException
Delets row from a database.

Throws:
SQLException
ConnectException

retrievePrimary

public static Map<String,Object> retrievePrimary(String whom,
                                                 Collection<String> fields,
                                                 String from,
                                                 String where)
                                          throws SQLException,
                                                 ConnectException
Tries to retrieve all entries in a single result set. This can be used on queries on primary keys. If the fields object is null, all entries are returned.

Returns:
A maping of column names to their values as objects, or null if no such entry exists.
Throws:
IllegalArguementException - If more than a single entry was detected.
SQLException
ConnectException

retrieve

public static ResultSet retrieve(Collection<String> fields,
                                 String from,
                                 String where)
                          throws SQLException,
                                 ConnectException
Returns the result of a database query. The field names supplied in the first name are replaced with an asterisk if the list is null or empty. The where clause should contain all necessary information, without the leading WHERE.

Parameters:
fields - A list of fields to retrieve or null, if all fields are needed.
where - The WHERE clause without the leading WHERE or null
Throws:
SQLException
ConnectException

retrieve

public static ResultSet retrieve(Collection<String> fields,
                                 String from,
                                 String where,
                                 String order)
                          throws SQLException,
                                 ConnectException
Returns the result of a database query. The field names supplied in the first name are replaced with an asterisk if the list is null or empty. The where clause should contain all necessary information, without the leading WHERE.

Parameters:
fields - A list of fields to retrieve or null, if all fields are needed.
where - The WHERE clause without the leading WHERE or null
Throws:
SQLException
ConnectException

retrieve

public static ResultSet retrieve(String whom,
                                 Collection<String> fields,
                                 String from,
                                 String where)
                          throws SQLException,
                                 ConnectException
Returns a result set. This method is used by simple retrieval as well as in joins.

Throws:
SQLException
ConnectException

retrieve

public static ResultSet retrieve(String whom,
                                 Collection<String> fields,
                                 String from,
                                 String where,
                                 String order)
                          throws SQLException,
                                 ConnectException
Returns a result set. This method is used by simple retrieval as well as in joins.

Throws:
SQLException
ConnectException

retrieve

public static ResultSet retrieve(String whom,
                                 Collection<String> fields,
                                 String from,
                                 String where,
                                 String order,
                                 int limit)
                          throws SQLException,
                                 ConnectException
Returns a result set. This method is used by simple retrieval as well as in joins.

Throws:
SQLException
ConnectException

retrieve

public static ResultSet retrieve(String whom,
                                 Map<String,String> asfield,
                                 String from,
                                 String where,
                                 String order,
                                 int limit)
                          throws SQLException,
                                 ConnectException
Returns a result set. This method is used by simple retrieval as well as in joins. Note that we can account for proper wrapping of upper case columns name, but if used in where clause, the user must supply these.

Parameters:
asfield - A list of fields to retrieve or null for all columns.
where - The WHERE clause without the leading WHERE or null.
order - order result by this column, '-' infront for descending.
limit - Limit to this number, zero or negativ for unlimitted.
Throws:
SQLException
ConnectException

toMap

public static Map<String,Object> toMap(ResultSet rs)
                                throws SQLException
Maps a result set into a java map by querying all column names and puting the result set get object as the values into it. Does not advance result set row.

Throws:
SQLException

columnNameWrap

private static final String columnNameWrap(String hasup)
Could you believe that upper case column names are allowed in SQL, but if put on the query and not protected by double quotes, they are converted to lower case letters and than the lookup fails with 'no such column'? What sounds like a bad joke is realized in SQL. But we are not outsmarted. This methods protects any column name that has non-lower case letters in it by wrapping it into "".


sum

public static double sum(String whom,
                         String expression,
                         String from,
                         String where)
                  throws SQLException,
                         ConnectException
Returns a result set. This method is used by summing requests.

Throws:
SQLException
ConnectException

count

public static double count(String whom,
                           String expression,
                           String from,
                           String where)
                    throws SQLException,
                           ConnectException
Returns a result set. This method is used by summing requests.

Throws:
SQLException
ConnectException

calc

private static double calc(String what,
                           String whom,
                           String expression,
                           String from,
                           String where)
                    throws SQLException,
                           ConnectException
Returns a result set. This method is used by summing requests.

Throws:
SQLException
ConnectException

join

public static ResultSet join(String user,
                             Collection<String> fields,
                             String[] tables,
                             String[] keys,
                             String where)
                      throws SQLException,
                             ConnectException
Returns the result of a database join, meaning that at least two tables are joined together. The user has to supply a correct list of field to retrieve, a where clause that contains the principal where clause and the fields that are used in the join as well as the table names. The method keeps track of a correct joint on the joint columns, otherwise it simple executes a retrieve(java.util.Collection, java.lang.String, java.lang.String).

Parameters:
fields - A list of fields to retrieve or null, if all fields are needed.
tables - The names of the tables to join.
keys - The column names used on joins.
where - The WHERE clause without the leading WHERE, but correctly column-added
Throws:
SQLException
ConnectException

getMetaInfo

public static String getMetaInfo(ResultSet rs)
Retrieves meta info on a non-null result set.


canWrite

public static boolean canWrite()
If true, we can write to the database.


canRead

public static boolean canRead()
If true, we can read to the database.


defaultUser

protected static String defaultUser(String isnull)
If argument is null or empty, return the default user name, otherwise return the argument.


getDatabaseEntry

private static String getDatabaseEntry(String key,
                                       Object val)
Formats the argument to allow it to be entered into a normal database. Right now, the following objects are recognized:


reconnect

private static void reconnect(String user,
                              String password,
                              long redo)
Tries to reconnect by permanently trying to open the stated user connection.