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

## game.gamestorage.texas.db
Class SQLHandler

    java.lang.Object
      game.gamestorage.texas.db.SQLHandler

    public class SQLHandler

extends java.lang.Object

This class handles the communication to the database offers different kinds of returnable datatypes

Author:
  Witthold/Korol

Field Summary
`private ConnectionManager` | `cm`

Constructor Summary
`SQLHandler()` Constructor default initializes ConnectionManager
`SQLHandler(java.lang.String driver, java.lang.String databaseUrl, java.lang.String username, java.lang.String password, int maxPoolSize)` Constructor with specific database params probably only need for test cases

Method Summary
`boolean` | `connectionSuccess()`
`private java.sql.Statement` | `getStatement(java.sql.Connection con)` getStatement:
`java.util.HashMap<java.lang.Integer,java.lang.String>` | `sqlGetHashMapIntString(java.lang.String sql)` sqlGetHashMapStringInt: SELECT
`java.util.HashMap<java.lang.String,java.lang.Integer>` | `sqlGetHashMapStringInt(java.lang.String sql)` sqlGetHashMapStringInt: SELECT
`int` | `sqlGetInt(java.lang.String sql)` sqlGetInt: SELECT
`java.util.ArrayList<int[]>` | `sqlGetIntArrayListMultiPerRow(java.lang.String sql, int numCols)` sqlGetIntArrayListMultiPerRow: SELECT
`int[][]` | `sqlGetIntArrayMultiPerRow(java.lang.String sql, int numCols)` sqlGetIntArrayMultiPerRow: SELECT
`int[]` | `sqlGetIntArrayOnePerRow(java.lang.String sql)` sqlGetIntArrayOnePerRow: SELECT
`java.util.ArrayList<long[]>` | `sqlGetLongArrayListMultiPerRow(java.lang.String sql, int numCols)` sqlGetLongArrayListMultiPerRow: SELECT
`long[]` | `sqlGetLongArrayOnePerRow(java.lang.String sql)` sqlGetIntArrayOnePerRow: SELECT
`java.sql.ResultSet` | `sqlGetResultSet(java.lang.String sql)` sqlGetResultSet: SELECT
`protected boolean` | `sqlSet(java.lang.String sql)` sqlSet: INSERT, UPDATE, DELETE
`protected int` | `sqlSetReturnID(java.lang.String sql)` sqlSetReturnID: INSERT, UPDATE, DELETE
`protected int[]` | `sqlSetReturnIDs(java.lang.String sql)` sqlSetReturnIDs: INSERT, UPDATE, DELETE

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

Field Detail

### cm

    private ConnectionManager cm

Constructor Detail

### SQLHandler

    public SQLHandler()

  Constructor default initializes ConnectionManager

### SQLHandler

    public SQLHandler(java.lang.String driver,
                      java.lang.String databaseUrl,
                      java.lang.String username,
                      java.lang.String password,
                      int maxPoolSize)

  Constructor with specific database params probably only need for test cases

  Parameters:
    `driver` - which dbc driver
    `databaseUrl` - -
    `username` - -
    `password` - -
    `maxPoolSize` - - how many db-connection should the ConnectionManager allocate

Method Detail

### sqlSet

    protected boolean sqlSet(java.lang.String sql)

  sqlSet:
  INSERT, UPDATE, DELETE

  Parameters:
    `sql` - query
  Returns:
    true, if writing to db succeeded

### sqlSetReturnIDs

    protected int[] sqlSetReturnIDs(java.lang.String sql)

  sqlSetReturnIDs:
  INSERT, UPDATE, DELETE

  Parameters:
    `sql` - query
  Returns:
    int[] of autogenerated IDs

### sqlSetReturnID

    protected int sqlSetReturnID(java.lang.String sql)

  sqlSetReturnID:
  INSERT, UPDATE, DELETE

  Parameters:
    `sql` - query
  Returns:
    int of autogenerated ID

### sqlGetResultSet

    public java.sql.ResultSet sqlGetResultSet(java.lang.String sql)

  sqlGetResultSet:
  SELECT

  Parameters:
    `sql` - query
  Returns:
    ResultSet

### sqlGetHashMapStringInt

    public java.util.HashMap<java.lang.String,java.lang.Integer> sqlGetHashMapStringInt(java.lang.String sql)

  sqlGetHashMapStringInt:
  SELECT

  Parameters:
    `sql` - query
  Returns:
    HashMap

### sqlGetHashMapIntString

    public java.util.HashMap<java.lang.Integer,java.lang.String> sqlGetHashMapIntString(java.lang.String sql)

  sqlGetHashMapStringInt:
  SELECT

  Parameters:
    `sql` - query
  Returns:
    HashMap

### sqlGetInt

    public int sqlGetInt(java.lang.String sql)

  sqlGetInt:
  SELECT

  Parameters:
    `sql` - query
  Returns:
    int result

### sqlGetIntArrayOnePerRow

    public int[] sqlGetIntArrayOnePerRow(java.lang.String sql)

  sqlGetIntArrayOnePerRow:
  SELECT

  Parameters:
    `sql` - query
  Returns:
    int[]: length = numRows

### sqlGetLongArrayOnePerRow

    public long[] sqlGetLongArrayOnePerRow(java.lang.String sql)

  sqlGetIntArrayOnePerRow:
  SELECT

  Parameters:
    `sql` - query
  Returns:
    int[]: length = numRows

### sqlGetIntArrayMultiPerRow

    public int[][] sqlGetIntArrayMultiPerRow(java.lang.String sql,
                                             int numCols)

  sqlGetIntArrayMultiPerRow:
  SELECT

  Parameters:
    `sql` - query
    `numCols` - length
  Returns:
    int[][]: lengths = numRows, numCols

### sqlGetIntArrayListMultiPerRow

    public java.util.ArrayList<int[]> sqlGetIntArrayListMultiPerRow(java.lang.String sql,
                                                                    int numCols)

  sqlGetIntArrayListMultiPerRow:
  SELECT

  Parameters:
    `sql` - query
    `numCols` - length
  Returns:
    ArrayList size = numRows with int[numCols]

### sqlGetLongArrayListMultiPerRow

    public java.util.ArrayList<long[]> sqlGetLongArrayListMultiPerRow(java.lang.String sql,
                                                                      int numCols)

  sqlGetLongArrayListMultiPerRow:
  SELECT

  Parameters:
    `sql` - query
    `numCols` - length
  Returns:
    ArrayList size = numRows with int[numCols]

### getStatement

    private java.sql.Statement getStatement(java.sql.Connection con)

  getStatement:

  Parameters:
    `con` -
  Returns:
    Statement for Connection

### connectionSuccess

    public boolean connectionSuccess()

  Returns:
    true, if there is at least one connection to the db

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