net.rim.pushsdk.commons
Class PushSDKBaseDAO

java.lang.Object
  extended by org.springframework.dao.support.DaoSupport
      extended by org.springframework.jdbc.core.support.JdbcDaoSupport
          extended by net.rim.pushsdk.commons.PushSDKBaseDAO
All Implemented Interfaces:
org.springframework.beans.factory.InitializingBean
Direct Known Subclasses:
PushAppRDBMSDAOImpl, PushCountRDBMSDAOImpl, PushRequestDetailRDBMSDAOImpl, PushRequestRDBMSDAOImpl, PushStatsRDBMSDAOImpl, SubRDBMSDAOImpl

public class PushSDKBaseDAO
extends org.springframework.jdbc.core.support.JdbcDaoSupport

Base DAO for all other DAOs.

Provides some convenience methods such as to allow the DAOs to use Spring's SimpleJdbcTemplate to take advantage of Java 1.5 varargs and autoboxing and providing methods to escape SQL input parameters to SQL statements to prevent SQL injection attacks.

Author:
mdicesare

Field Summary
protected static String DATABASE_TZ
          The timezone to use for storing dates in the database.
 
Fields inherited from class org.springframework.dao.support.DaoSupport
logger
 
Constructor Summary
PushSDKBaseDAO()
           
 
Method Summary
static String encodeSQLText(String text)
          Encodes SQL text, replacing each single quote with two sequential single quotes.
static String encodeSQLText(String text, char escape)
          Encodes SQL text, replacing each single quote with two sequential single quotes.
static String encodeSQLText(String text, char escape, boolean escapeQuotes)
          Encodes SQL text.
protected  org.springframework.jdbc.core.simple.SimpleJdbcTemplate getSimpleJdbcTemplate()
          Wraps the base JdbcTemplate into a SimpleJdbcTemplate that will allow for Java 1.5 parameterized parameters.
 
Methods inherited from class org.springframework.jdbc.core.support.JdbcDaoSupport
checkDaoConfig, createJdbcTemplate, getConnection, getDataSource, getExceptionTranslator, getJdbcTemplate, initTemplateConfig, releaseConnection, setDataSource, setJdbcTemplate
 
Methods inherited from class org.springframework.dao.support.DaoSupport
afterPropertiesSet, initDao
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DATABASE_TZ

protected static final String DATABASE_TZ
The timezone to use for storing dates in the database.

See Also:
Constant Field Values
Constructor Detail

PushSDKBaseDAO

public PushSDKBaseDAO()
Method Detail

getSimpleJdbcTemplate

protected org.springframework.jdbc.core.simple.SimpleJdbcTemplate getSimpleJdbcTemplate()
Wraps the base JdbcTemplate into a SimpleJdbcTemplate that will allow for Java 1.5 parameterized parameters.

Returns:
a SimpleJdbcTemplate

encodeSQLText

public static String encodeSQLText(String text)
Encodes SQL text, replacing each single quote with two sequential single quotes.

Parameters:
text - SQL text to encode
Returns:
encoded SQL text, or null if text is null

encodeSQLText

public static String encodeSQLText(String text,
                                   char escape)
Encodes SQL text, replacing each single quote with two sequential single quotes.

Parameters:
text - SQL text to encode
escape - escape character to use to escape % and _
Returns:
encoded SQL text, or null if text is null

encodeSQLText

public static String encodeSQLText(String text,
                                   char escape,
                                   boolean escapeQuotes)
Encodes SQL text.

Parameters:
text - SQL text to encode
escape - escape character to use to escape % and _
escapeQuotes - whether or not to replace each single quote with two sequential single quotes
Returns:
encoded SQL text, or null if text is null


Copyright © 2011 Research In Motion. All Rights Reserved.