|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES All Classes | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.wm.app.tn.db.SQLStatements
public class SQLStatements
Constructor Summary | |
---|---|
SQLStatements()
|
Method Summary | ||
---|---|---|
static
|
getPreparedStatementBindings(java.lang.String formattedSQLString,
java.util.Map<java.lang.String,T> mapIdentifierLiteralValues)
Prevents SQL injection - OTN-11596 Requires SQL argument to be formatted in a way Eg: SELECT PartName, MimeType, StorageType, ContentLength, Content, PartIndex, StorageRef FROM BizDocContent WHERE DocID = ? |
|
static java.lang.String |
getPureSQLString(java.lang.String formattedSQLString)
Prevents SQL injection - OTN-11596 |
|
static java.lang.String |
getSql(java.lang.String which)
Get a single SQL operation. |
|
static void |
init(boolean ifCacheStmts)
|
|
static void |
main(java.lang.String[] args)
|
|
static java.sql.PreparedStatement |
prepareStatement(java.sql.Connection conn,
java.lang.String which)
Prepare a statement. |
|
static void |
releaseStatement(java.sql.PreparedStatement stmt)
Release a previously prepared statement. |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public SQLStatements()
Method Detail |
---|
public static void init(boolean ifCacheStmts)
public static java.lang.String getSql(java.lang.String which) throws java.sql.SQLException
which
- the SQL operation to fetch (e.g. "bda.select.all")
java.sql.SQLException
- if the specified operation hasn't been defined, or the operations haven't been
read from diskpublic static java.sql.PreparedStatement prepareStatement(java.sql.Connection conn, java.lang.String which) throws java.sql.SQLException
conn
- the connection on which to prepare the statementwhich
- which SQL statement to prepare
java.sql.SQLException
- if the specified operation hasn't been defined, or the operations haven't been
read from diskpublic static void releaseStatement(java.sql.PreparedStatement stmt)
stmt
- the statement to close
java.sql.SQLException
- if an error happens on the closepublic static <T> java.util.Map<java.lang.Integer,T> getPreparedStatementBindings(java.lang.String formattedSQLString, java.util.Map<java.lang.String,T> mapIdentifierLiteralValues)
sqlStr
- SQL string statementmapIdentifierLiteralValues
- mapping between identifiers and values (maybe string values or arrays)
Example: Mappublic static java.lang.String getPureSQLString(java.lang.String formattedSQLString)
sqlStr
- formatted SQL string which cannot be used to prepare a statement because of "?" in it
Example: String sql = "SELECT PartName, MimeType, StorageType, ContentLength, Content, PartIndex, StorageRef FROM BizDocContent WHERE DocID = ?java.lang.Exception
public static void main(java.lang.String[] args) throws java.lang.Exception
java.lang.Exception
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES All Classes | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |