net.sqlind
Class SQLQueryMapper

java.lang.Object
  extended by net.sqlind.SQLQueryMapper

public class SQLQueryMapper
extends java.lang.Object

SQLind

Since:
2011
Version:
1.1.8
Author:
Rives Davy.

Nested Class Summary
protected static class SQLQueryMapper.Errors
           
 class SQLQueryMapper.GenericQueryHandler
          Handle a query execution context
 class SQLQueryMapper.InjectPoint
          Structure class to define an insert point in a query
static interface SQLQueryMapper.QueryBehavior
          Generic query result fetching interface
static interface SQLQueryMapper.SQLBeanAccess
           
 class SQLQueryMapper.SQLMapperException
          Generic exception throws by the API.
 class SQLQueryMapper.SQLQueryHandler
           
static interface SQLQueryMapper.SQLQueryTemplate
          Represents a SQL template definition
static interface SQLQueryMapper.Tracer
          Util interface to handle logging stream
 
Field Summary
protected static java.util.concurrent.ConcurrentHashMap<java.lang.String,SQLQueryMapper> instances
           
protected static org.apache.commons.logging.Log log
           
 
Constructor Summary
protected SQLQueryMapper()
           
protected SQLQueryMapper(java.lang.String file)
           
 
Method Summary
 void clearCache()
          Remove all entries from the LRU cache
protected static net.sqlind.SQLQueryMapper.Context getContext()
           
static SQLQueryMapper getInstance()
           
protected  java.lang.String getParamBindingString(java.lang.String paramId)
           
protected  SQLQueryMapper.SQLQueryTemplate getQuery(java.lang.String schema, java.lang.String id, java.lang.String... params)
           
 SQLQueryMapper.SQLQueryHandler getSQLQuery(java.lang.String file, java.lang.String schema, java.lang.String id, java.lang.String... params)
          Retrieve a given SQL query
 void setCacheSize(int numberOfQuery)
          Defines the LRU policy cache size
protected static java.lang.String shrinkSQL(java.lang.String queryStr, java.util.List<SQLQueryMapper.InjectPoint> ips)
           
protected  void tunePreparedStatement(java.sql.PreparedStatement ps)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

log

protected static org.apache.commons.logging.Log log

instances

protected static java.util.concurrent.ConcurrentHashMap<java.lang.String,SQLQueryMapper> instances
Constructor Detail

SQLQueryMapper

protected SQLQueryMapper(java.lang.String file)
                  throws SQLQueryMapper.SQLMapperException
Throws:
SQLQueryMapper.SQLMapperException

SQLQueryMapper

protected SQLQueryMapper()
Method Detail

setCacheSize

public void setCacheSize(int numberOfQuery)
Defines the LRU policy cache size

Parameters:
numberOfQuery -

clearCache

public void clearCache()
Remove all entries from the LRU cache


getInstance

public static SQLQueryMapper getInstance()
Returns:
the singleton manager instance of SQLQueryMapper

getSQLQuery

public SQLQueryMapper.SQLQueryHandler getSQLQuery(java.lang.String file,
                                                  java.lang.String schema,
                                                  java.lang.String id,
                                                  java.lang.String... params)
                                           throws SQLQueryMapper.SQLMapperException
Retrieve a given SQL query

Parameters:
file - the template file
id - the query id
params - optional sections id to enable
Returns:
SQLQuery object
Throws:
SQLQueryMapper.SQLMapperException

getContext

protected static net.sqlind.SQLQueryMapper.Context getContext()

shrinkSQL

protected static java.lang.String shrinkSQL(java.lang.String queryStr,
                                            java.util.List<SQLQueryMapper.InjectPoint> ips)

getQuery

protected SQLQueryMapper.SQLQueryTemplate getQuery(java.lang.String schema,
                                                   java.lang.String id,
                                                   java.lang.String... params)
                                            throws SQLQueryMapper.SQLMapperException
Throws:
SQLQueryMapper.SQLMapperException

getParamBindingString

protected java.lang.String getParamBindingString(java.lang.String paramId)

tunePreparedStatement

protected void tunePreparedStatement(java.sql.PreparedStatement ps)
                              throws java.sql.SQLException
Throws:
java.sql.SQLException


Copyright © 2014. All Rights Reserved.