Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## com.knowgate.dataobjs
Class DBCommand

    java.lang.Object
      com.knowgate.dataobjs.DBCommand

    public class DBCommand

extends java.lang.Object

A wrapper for some common SQL command sequences

Constructor Summary
`DBCommand()`

Method Summary
`void` | `close()`
`static int` | `executeUpdate(java.sql.Connection oCon, java.lang.String sSQL)` Execute an INSERT or UPDATE statement
`static java.math.BigDecimal` | `queryBigDecimal(java.sql.Connection oCon, java.lang.String sSQL)` Execute a SQL query and get a BigDecimal value as result
`static int` | `queryCount(java.sql.Connection oCon, java.lang.String sColumn, java.lang.String sTable, java.lang.String sWhere)` Execute a SQL query to count occurences of rows matching a criteria
`static java.util.Date` | `queryDateTime(java.sql.Connection oCon, java.lang.String sSQL)` Execute a SQL query and get a BigDecimal value as result
`static boolean` | `queryExists(java.sql.Connection oCon, java.lang.String sTable, java.lang.String sWhere)`
`static java.lang.Integer` | `queryInt(java.sql.Connection oCon, java.lang.String sSQL)` Execute a SQL query and get an Integer value as result
`static java.lang.Object` | `queryMax(java.sql.Connection oCon, java.lang.String sColumn, java.lang.String sTable, java.lang.String sWhere)` Execute a SQL query to get the maximum value for a column
`static java.util.Date` | `queryMaxDate(java.sql.Connection oCon, java.lang.String sColumn, java.lang.String sTable, java.lang.String sWhere)` Execute a SQL query to get the maximum date value for a date column
`static java.lang.Integer` | `queryMaxInt(java.sql.Connection oCon, java.lang.String sColumn, java.lang.String sTable, java.lang.String sWhere)` Execute a SQL query to get the maximum value for a column of type INTEGER
`static java.lang.Object` | `queryMin(java.sql.Connection oCon, java.lang.String sColumn, java.lang.String sTable, java.lang.String sWhere)` Execute a SQL query to get the minimum value for a column
`static java.util.Date` | `queryMinDate(java.sql.Connection oCon, java.lang.String sColumn, java.lang.String sTable, java.lang.String sWhere)` Execute a SQL query to get the minimum value for a date column
`static java.lang.Integer` | `queryMinInt(java.sql.Connection oCon, java.lang.String sColumn, java.lang.String sTable, java.lang.String sWhere)` Execute a SQL query to get the maximum value for a column of type INTEGER
`java.sql.ResultSet` | `queryResultSet(java.sql.Connection oCon, java.lang.String sSQL)` Execute a SQL query and get a ResultSet
`static java.lang.Short` | `queryShort(java.sql.Connection oCon, java.lang.String sSQL)` Execute a SQL query and get a Short value as result
`static java.lang.String` | `queryStr(java.sql.Connection oCon, java.lang.String sSQL)` Execute a SQL query and get a String value as result
`static java.lang.String[]` | `queryStrs(java.sql.Connection oCon, java.lang.String sSQL)` Execute a SQL query and get an Array of Strings as result

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### DBCommand

    public DBCommand()

Method Detail

### close

    public void close()
               throws java.sql.SQLException

  Throws:
    `java.sql.SQLException`

### queryResultSet

    public java.sql.ResultSet queryResultSet(java.sql.Connection oCon,
                                             java.lang.String sSQL)
                                      throws java.sql.SQLException

  Execute a SQL query and get a ResultSet

  Parameters:
    `oCon` - Connection Open JDBC database connection
    `sSQL` - String Command to be executed
  Throws:
    `java.sql.SQLException`
  Since:
    4.0

### queryExists

    public static boolean queryExists(java.sql.Connection oCon,
                                      java.lang.String sTable,
                                      java.lang.String sWhere)
                               throws java.sql.SQLException

  Throws:
    `java.sql.SQLException`

### queryInt

    public static java.lang.Integer queryInt(java.sql.Connection oCon,
                                             java.lang.String sSQL)
                                      throws java.sql.SQLException,
                                             java.lang.NumberFormatException,
                                             java.lang.ClassCastException

  Execute a SQL query and get an Integer value as result

  Parameters:
    `oCon` - Connection Open JDBC database connection
    `sSQL` - String Command to be executed
  Returns:
    Integer Value of the first column selected by the query or null if no row was found or selected row was null
  Throws:
    `java.sql.SQLException`
    `java.lang.NumberFormatException`
    `java.lang.ClassCastException`

### queryShort

    public static java.lang.Short queryShort(java.sql.Connection oCon,
                                             java.lang.String sSQL)
                                      throws java.sql.SQLException,
                                             java.lang.NumberFormatException,
                                             java.lang.ClassCastException

  Execute a SQL query and get a Short value as result

  Parameters:
    `oCon` - Connection Open JDBC database connection
    `sSQL` - String Command to be executed
  Returns:
    Short Value of the first column selected by the query or null if no row was found or selected row was null
  Throws:
    `java.sql.SQLException`
    `java.lang.NumberFormatException`
    `java.lang.ClassCastException`
  Since:
    4.0

### queryStr

    public static java.lang.String queryStr(java.sql.Connection oCon,
                                            java.lang.String sSQL)
                                     throws java.sql.SQLException

  Execute a SQL query and get a String value as result

  Parameters:
    `oCon` - Connection Open JDBC database connection
    `sSQL` - String Command to be executed
  Returns:
    String Value of the first column selected by the query or null if no row was found or selected row was null
  Throws:
    `java.sql.SQLException`
    `java.lang.NumberFormatException`
    `java.lang.ClassCastException`

### queryStrs

    public static java.lang.String[] queryStrs(java.sql.Connection oCon,
                                               java.lang.String sSQL)
                                        throws java.sql.SQLException

  Execute a SQL query and get an Array of Strings as result

  Parameters:
    `oCon` - Connection Open JDBC database connection
    `sSQL` - String Command to be executed
  Returns:
    Array of Strings or null if no row was found
  Throws:
    `java.sql.SQLException`
    `java.lang.NumberFormatException`
    `java.lang.ClassCastException`

### queryBigDecimal

    public static java.math.BigDecimal queryBigDecimal(java.sql.Connection oCon,
                                                       java.lang.String sSQL)
                                                throws java.sql.SQLException,
                                                       java.lang.NumberFormatException,
                                                       java.lang.ClassCastException

  Execute a SQL query and get a BigDecimal value as result

  Parameters:
    `oCon` - Connection Open JDBC database connection
    `sSQL` - String Command to be executed
  Returns:
    String Value of the first column selected by the query or null if no row was found or selected row was null
  Throws:
    `java.sql.SQLException`
    `java.lang.NumberFormatException`
    `java.lang.ClassCastException`

### queryMax

    public static java.lang.Object queryMax(java.sql.Connection oCon,
                                            java.lang.String sColumn,
                                            java.lang.String sTable,
                                            java.lang.String sWhere)
                                     throws java.sql.SQLException

  Execute a SQL query to get the maximum value for a column

  Parameters:
    `oCon` - Connection Open JDBC database connection
    `sColumn` - Column Name
    `sTable` - Table Name
    `sWhere` - WHERE clause to restrict maximum search
  Returns:
    The maximum value found for the given restrictions or null if no maximum value was found
  Throws:
    `java.sql.SQLException`
  Since:
    4.0

### queryMin

    public static java.lang.Object queryMin(java.sql.Connection oCon,
                                            java.lang.String sColumn,
                                            java.lang.String sTable,
                                            java.lang.String sWhere)
                                     throws java.sql.SQLException

  Execute a SQL query to get the minimum value for a column

  Parameters:
    `oCon` - Connection Open JDBC database connection
    `sColumn` - Column Name
    `sTable` - Table Name
    `sWhere` - WHERE clause to restrict minimum search
  Returns:
    The minimum value found for the given restrictions or null if no minimum value was found
  Throws:
    `java.sql.SQLException`
  Since:
    4.0

### queryMaxDate

    public static java.util.Date queryMaxDate(java.sql.Connection oCon,
                                              java.lang.String sColumn,
                                              java.lang.String sTable,
                                              java.lang.String sWhere)
                                       throws java.sql.SQLException

  Execute a SQL query to get the maximum date value for a date column

  Parameters:
    `oCon` - Connection Open JDBC database connection
    `sColumn` - Column Name
    `sTable` - Table Name
    `sWhere` - WHERE clause to restrict maximum search
  Returns:
    The maximum date found for the given restrictions or null if no maximum date was found
  Throws:
    `java.sql.SQLException`
  Since:
    4.0

### queryMinDate

    public static java.util.Date queryMinDate(java.sql.Connection oCon,
                                              java.lang.String sColumn,
                                              java.lang.String sTable,
                                              java.lang.String sWhere)
                                       throws java.sql.SQLException

  Execute a SQL query to get the minimum value for a date column

  Parameters:
    `oCon` - Connection Open JDBC database connection
    `sColumn` - Column Name
    `sTable` - Table Name
    `sWhere` - WHERE clause to restrict minimum search
  Returns:
    The minimum date found for the given restrictions or null if no minimum date was found
  Throws:
    `java.sql.SQLException`
  Since:
    4.0

### queryMaxInt

    public static java.lang.Integer queryMaxInt(java.sql.Connection oCon,
                                                java.lang.String sColumn,
                                                java.lang.String sTable,
                                                java.lang.String sWhere)
                                         throws java.sql.SQLException,
                                                java.lang.NumberFormatException

  Execute a SQL query to get the maximum value for a column of type INTEGER

  Parameters:
    `oCon` - Connection Open JDBC database connection
    `sColumn` - Column Name
    `sTable` - Table Name
    `sWhere` - WHERE clause to restrict maximum search
  Returns:
    The maximum value found for the given restrictions or null if no maximum value was found
  Throws:
    `java.sql.SQLException`
    `java.lang.NumberFormatException`
  Since:
    4.0

### queryMinInt

    public static java.lang.Integer queryMinInt(java.sql.Connection oCon,
                                                java.lang.String sColumn,
                                                java.lang.String sTable,
                                                java.lang.String sWhere)
                                         throws java.sql.SQLException,
                                                java.lang.NumberFormatException

  Execute a SQL query to get the maximum value for a column of type INTEGER

  Parameters:
    `oCon` - Connection Open JDBC database connection
    `sColumn` - Column Name
    `sTable` - Table Name
    `sWhere` - WHERE clause to restrict maximum search
  Returns:
    The maximum value found for the given restrictions or null if no maximum value was found
  Throws:
    `java.sql.SQLException`
    `java.lang.NumberFormatException`
  Since:
    5.0

### queryCount

    public static int queryCount(java.sql.Connection oCon,
                                 java.lang.String sColumn,
                                 java.lang.String sTable,
                                 java.lang.String sWhere)
                          throws java.sql.SQLException

  Execute a SQL query to count occurences of rows matching a criteria

  Parameters:
    `oCon` - Connection Open JDBC database connection
    `sColumn` - Column Name
    `sTable` - Table Name
    `sWhere` - WHERE clause to restrict counting
  Returns:
    The count of rows matching the WHERE clause
  Throws:
    `java.sql.SQLException`
  Since:
    4.0

### queryDateTime

    public static java.util.Date queryDateTime(java.sql.Connection oCon,
                                               java.lang.String sSQL)
                                        throws java.sql.SQLException

  Execute a SQL query and get a BigDecimal value as result

  Parameters:
    `oCon` - Connection Open JDBC database connection
    `sSQL` - String Command to be executed
  Returns:
    String Value of the first column selected by the query or null if no row was found or selected row was null
  Throws:
    `java.sql.SQLException`
    `java.lang.NumberFormatException`
    `java.lang.ClassCastException`

### executeUpdate

    public static int executeUpdate(java.sql.Connection oCon,
                                    java.lang.String sSQL)
                             throws java.sql.SQLException

  Execute an INSERT or UPDATE statement

  Parameters:
    `oCon` - Connection Open JDBC database connection
    `sSQL` - String Command to be executed
  Returns:
    int Count of affected rows
  Throws:
    `java.sql.SQLException`

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD