public class AnsiSqlGenerator extends Object implements ISqlGenerator
ISqlGenerator.ESqlError, ISqlGenerator.EStatementType| Modifier and Type | Field and Description |
|---|---|
static String |
ANSI_QUOTE |
static int |
BOOLEAN_FALSE |
static int |
BOOLEAN_TRUE |
static int |
MAX_STRING_LENGTH |
static String |
SQLTYPE_BOOLEAN |
static String |
SQLTYPE_BYTE |
static String |
SQLTYPE_CHAR |
static String |
SQLTYPE_DATE |
static String |
SQLTYPE_DOUBLE |
static String |
SQLTYPE_FLOAT |
static String |
SQLTYPE_INT |
static String |
SQLTYPE_LONG |
static String |
SQLTYPE_SHORT |
| Constructor and Description |
|---|
AnsiSqlGenerator() |
| Modifier and Type | Method and Description |
|---|---|
String |
createSql(ISqlGenerator.EStatementType eStatement,
Row aMeta,
IDBBackendQuery iQuery)
create a new SQL statement for the given set of parameters.
|
Object |
getValueFromResultSet(ResultSet aResult,
String sColumn,
Class<?> aType)
extract an entity member value from the given result set.
|
Long |
mapDate(Date aDate) |
Date |
mapDate(Long nDate)
maps the given date/time-stamp (as long ms from the beginning of the world)
to the corresponding Date object.
|
String |
mapJavaTypeToSqlType(Column aColumn)
map the given Java type of an entity member to the corresponding SQL type
to be used within SQL statements.
|
ISqlGenerator.ESqlError |
mapSqlExceptionToError(SQLException exSQL)
map the given SQL exception to an suitable error code.
|
void |
setValueOnPreparedStatement(PreparedStatement aSql,
int nIndex,
Class<?> aType,
Object aValue)
set the given value on the also given PreparedStatement.
|
public static final String ANSI_QUOTE
public static final int BOOLEAN_FALSE
public static final int BOOLEAN_TRUE
public static final int MAX_STRING_LENGTH
public static final String SQLTYPE_CHAR
public static final String SQLTYPE_BOOLEAN
public static final String SQLTYPE_BYTE
public static final String SQLTYPE_SHORT
public static final String SQLTYPE_INT
public static final String SQLTYPE_LONG
public static final String SQLTYPE_FLOAT
public static final String SQLTYPE_DOUBLE
public static final String SQLTYPE_DATE
public ISqlGenerator.ESqlError mapSqlExceptionToError(SQLException exSQL) throws Exception
ISqlGeneratormapSqlExceptionToError in interface ISqlGeneratorexSQL - [IN]
the SQL exception to be 'translated' here.Exceptionpublic String createSql(ISqlGenerator.EStatementType eStatement, Row aMeta, IDBBackendQuery iQuery) throws Exception
ISqlGeneratorcreateSql in interface ISqlGeneratoreStatement - [IN]
describe the requested SQL statement.aMeta - [IN]
all meta data describing the entity more in detail.iQuery - [IN, OPTIONAL]
describe a SQL query more in detail.
Can be null if no query is requested.Exceptionpublic String mapJavaTypeToSqlType(Column aColumn) throws Exception
ISqlGeneratormapJavaTypeToSqlType in interface ISqlGeneratoraColumn - [IN]
describe the entity member type.Exceptionpublic void setValueOnPreparedStatement(PreparedStatement aSql, int nIndex, Class<?> aType, Object aValue) throws Exception
ISqlGeneratorsetValueOnPreparedStatement in interface ISqlGeneratoraSql - [IN, OUT]
the prepared statement where the value must be set.nIndex - [IN]
the position of the place holder which must be replaced
within the prepared statement.aType - [IN]
the java type of the given value.aValue - [IN]
the value to be set on the prepared statement.Exceptionpublic Object getValueFromResultSet(ResultSet aResult, String sColumn, Class<?> aType) throws Exception
ISqlGeneratorgetValueFromResultSet in interface ISqlGeneratoraResult - [IN]
the result set where the value must be read from.sColumn - [IN]
the column where the value must be read from.aType - [IN]
the java type of this value so it's casted right.Exceptionpublic Date mapDate(Long nDate) throws Exception
nDate - [IN]
date/time stamp in ms from ...ExceptionCopyright © 2016 as-development.net. All rights reserved.