org.gcube.application.aquamaps.aquamapsportlet.servlet.db
Class DBSession

java.lang.Object
  extended by org.gcube.application.aquamaps.aquamapsportlet.servlet.db.DBSession

public class DBSession
extends Object

Author:
lucio

Field Summary
protected  Connection connection
           
 
Constructor Summary
DBSession(String scope)
           
 
Method Summary
 void close()
           
 void commit()
           
 void createIndex(String tableName, String columnName)
           
 void deleteColumn(String tableName, String columnName)
           
 int deleteOperation(String tableName, List<org.gcube.application.aquamaps.aquamapsservice.stubs.fw.model.Field> filters)
           
 void disableAutoCommit()
           
 void disableKeys(String tableName)
           
 void dropTable(String table)
           
 void enableKeys(String tableName)
           
 ResultSet executeFilteredQuery(List<org.gcube.application.aquamaps.aquamapsservice.stubs.fw.model.Field> filters, String table, String orderColumn, String orderMode)
           
 ResultSet executeQuery(String query)
          Deprecated. 
 int executeUpdate(String query)
          Deprecated. 
 PreparedStatement fillParameters(List<org.gcube.application.aquamaps.aquamapsservice.stubs.fw.model.Field> fields, int parameterOffset, PreparedStatement ps)
           
protected static String formDeletetQueryStringFromFields(List<org.gcube.application.aquamaps.aquamapsservice.stubs.fw.model.Field> filters, String table)
           
protected static String formSelectCountString(List<org.gcube.application.aquamaps.aquamapsservice.stubs.fw.model.Field> filters, String tableName)
           
protected static String formSelectQueryStringFromFields(List<org.gcube.application.aquamaps.aquamapsservice.stubs.fw.model.Field> filters, String table, String sortColumn, String sortDirection)
           
protected static String formUpdateQuery(List<org.gcube.application.aquamaps.aquamapsservice.stubs.fw.model.Field> toSet, List<org.gcube.application.aquamaps.aquamapsservice.stubs.fw.model.Field> keys, String tableName)
           
 Connection getConnection()
           
 int getCount(String tableName, List<org.gcube.application.aquamaps.aquamapsservice.stubs.fw.model.Field> filters)
           
protected  List<List<org.gcube.application.aquamaps.aquamapsservice.stubs.fw.model.Field>> getGeneratedKeys(PreparedStatement ps)
           
protected  PreparedStatement getPreparedStatementForCount(List<org.gcube.application.aquamaps.aquamapsservice.stubs.fw.model.Field> filters, String tableName)
           
 PreparedStatement getPreparedStatementForDelete(List<org.gcube.application.aquamaps.aquamapsservice.stubs.fw.model.Field> fields, String table)
           
 PreparedStatement getPreparedStatementForInsert(List<org.gcube.application.aquamaps.aquamapsservice.stubs.fw.model.Field> fields, String table)
           
 PreparedStatement getPreparedStatementForInsertFromSelect(List<org.gcube.application.aquamaps.aquamapsservice.stubs.fw.model.Field> fields, String destTable, String srcTable)
           
 PreparedStatement getPreparedStatementForQuery(List<org.gcube.application.aquamaps.aquamapsservice.stubs.fw.model.Field> filters, String table, String orderColumn, String orderDirection)
           
 PreparedStatement getPreparedStatementForUpdate(List<org.gcube.application.aquamaps.aquamapsservice.stubs.fw.model.Field> toSet, List<org.gcube.application.aquamaps.aquamapsservice.stubs.fw.model.Field> keys, String tableName)
           
 String getScope()
           
 int getTableCount(String tableName)
           
 List<List<org.gcube.application.aquamaps.aquamapsservice.stubs.fw.model.Field>> insertOperation(String tableName, List<List<org.gcube.application.aquamaps.aquamapsservice.stubs.fw.model.Field>> rows)
           
 PreparedStatement preparedStatement(String query)
          Deprecated. 
 List<List<String>> showTableMetadata(String tableName, String... whereClause)
           
 int updateOperation(String tableName, List<List<org.gcube.application.aquamaps.aquamapsservice.stubs.fw.model.Field>> keys, List<List<org.gcube.application.aquamaps.aquamapsservice.stubs.fw.model.Field>> rows)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

connection

protected Connection connection
Constructor Detail

DBSession

public DBSession(String scope)
          throws Exception
Throws:
Exception
Method Detail

getScope

public String getScope()

getConnection

public Connection getConnection()
Returns:
the connection

close

public void close()
           throws Exception
Throws:
Exception

disableAutoCommit

public void disableAutoCommit()
                       throws Exception
Throws:
Exception

commit

public void commit()
            throws Exception
Throws:
Exception

executeQuery

@Deprecated
public ResultSet executeQuery(String query)
                       throws Exception
Deprecated. 

Parameters:
query -
Throws:
Exception

disableKeys

public void disableKeys(String tableName)
                 throws Exception
Throws:
Exception

enableKeys

public void enableKeys(String tableName)
                throws Exception
Throws:
Exception

createIndex

public void createIndex(String tableName,
                        String columnName)
                 throws Exception
Throws:
Exception

deleteColumn

public void deleteColumn(String tableName,
                         String columnName)
                  throws Exception
Throws:
Exception

dropTable

public void dropTable(String table)
               throws Exception
Throws:
Exception

showTableMetadata

public List<List<String>> showTableMetadata(String tableName,
                                            String... whereClause)
                                     throws Exception
Throws:
Exception

getPreparedStatementForCount

protected PreparedStatement getPreparedStatementForCount(List<org.gcube.application.aquamaps.aquamapsservice.stubs.fw.model.Field> filters,
                                                         String tableName)
                                                  throws SQLException
Throws:
SQLException

getPreparedStatementForQuery

public PreparedStatement getPreparedStatementForQuery(List<org.gcube.application.aquamaps.aquamapsservice.stubs.fw.model.Field> filters,
                                                      String table,
                                                      String orderColumn,
                                                      String orderDirection)
                                               throws SQLException
Throws:
SQLException

getPreparedStatementForUpdate

public PreparedStatement getPreparedStatementForUpdate(List<org.gcube.application.aquamaps.aquamapsservice.stubs.fw.model.Field> toSet,
                                                       List<org.gcube.application.aquamaps.aquamapsservice.stubs.fw.model.Field> keys,
                                                       String tableName)
                                                throws SQLException
Throws:
SQLException

getPreparedStatementForInsertFromSelect

public PreparedStatement getPreparedStatementForInsertFromSelect(List<org.gcube.application.aquamaps.aquamapsservice.stubs.fw.model.Field> fields,
                                                                 String destTable,
                                                                 String srcTable)
                                                          throws Exception
Throws:
Exception

getPreparedStatementForInsert

public PreparedStatement getPreparedStatementForInsert(List<org.gcube.application.aquamaps.aquamapsservice.stubs.fw.model.Field> fields,
                                                       String table)
                                                throws Exception
Throws:
Exception

getPreparedStatementForDelete

public PreparedStatement getPreparedStatementForDelete(List<org.gcube.application.aquamaps.aquamapsservice.stubs.fw.model.Field> fields,
                                                       String table)
                                                throws Exception
Throws:
Exception

preparedStatement

@Deprecated
public PreparedStatement preparedStatement(String query)
                                    throws Exception
Deprecated. 

Throws:
Exception

fillParameters

public PreparedStatement fillParameters(List<org.gcube.application.aquamaps.aquamapsservice.stubs.fw.model.Field> fields,
                                        int parameterOffset,
                                        PreparedStatement ps)
                                 throws SQLException
Throws:
SQLException

insertOperation

public List<List<org.gcube.application.aquamaps.aquamapsservice.stubs.fw.model.Field>> insertOperation(String tableName,
                                                                                                       List<List<org.gcube.application.aquamaps.aquamapsservice.stubs.fw.model.Field>> rows)
                                                                                                throws Exception
Throws:
Exception

updateOperation

public int updateOperation(String tableName,
                           List<List<org.gcube.application.aquamaps.aquamapsservice.stubs.fw.model.Field>> keys,
                           List<List<org.gcube.application.aquamaps.aquamapsservice.stubs.fw.model.Field>> rows)
                    throws Exception
Throws:
Exception

executeFilteredQuery

public ResultSet executeFilteredQuery(List<org.gcube.application.aquamaps.aquamapsservice.stubs.fw.model.Field> filters,
                                      String table,
                                      String orderColumn,
                                      String orderMode)
                               throws Exception
Throws:
Exception

getCount

public int getCount(String tableName,
                    List<org.gcube.application.aquamaps.aquamapsservice.stubs.fw.model.Field> filters)
             throws Exception
Throws:
Exception

deleteOperation

public int deleteOperation(String tableName,
                           List<org.gcube.application.aquamaps.aquamapsservice.stubs.fw.model.Field> filters)
                    throws Exception
Throws:
Exception

getTableCount

public int getTableCount(String tableName)
                  throws Exception
Throws:
Exception

executeUpdate

@Deprecated
public int executeUpdate(String query)
                  throws Exception
Deprecated. 

Throws:
Exception

getGeneratedKeys

protected List<List<org.gcube.application.aquamaps.aquamapsservice.stubs.fw.model.Field>> getGeneratedKeys(PreparedStatement ps)
                                                                                                    throws SQLException
Throws:
SQLException

formSelectQueryStringFromFields

protected static String formSelectQueryStringFromFields(List<org.gcube.application.aquamaps.aquamapsservice.stubs.fw.model.Field> filters,
                                                        String table,
                                                        String sortColumn,
                                                        String sortDirection)

formSelectCountString

protected static String formSelectCountString(List<org.gcube.application.aquamaps.aquamapsservice.stubs.fw.model.Field> filters,
                                              String tableName)

formDeletetQueryStringFromFields

protected static String formDeletetQueryStringFromFields(List<org.gcube.application.aquamaps.aquamapsservice.stubs.fw.model.Field> filters,
                                                         String table)

formUpdateQuery

protected static String formUpdateQuery(List<org.gcube.application.aquamaps.aquamapsservice.stubs.fw.model.Field> toSet,
                                        List<org.gcube.application.aquamaps.aquamapsservice.stubs.fw.model.Field> keys,
                                        String tableName)


Copyright © 2013. All Rights Reserved.