Package org.apache.ofbiz.entity.jdbc
Class SqlJdbcUtil
- java.lang.Object
-
- org.apache.ofbiz.entity.jdbc.SqlJdbcUtil
-
public final class SqlJdbcUtil extends java.lang.Object
GenericDAO Utility methods for general tasks
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.String
module
-
Method Summary
All Methods Static Methods Concrete Methods Deprecated Methods Modifier and Type Method Description static void
addValue(java.lang.StringBuffer buffer, ModelField field, java.lang.Object value, java.util.List<EntityConditionParam> params)
static void
addValue(java.lang.StringBuilder buffer, ModelField field, java.lang.Object value, java.util.List<EntityConditionParam> params)
static void
addValueSingle(java.lang.StringBuffer buffer, ModelField field, java.lang.Object value, java.util.List<EntityConditionParam> params)
static void
addValueSingle(java.lang.StringBuilder buffer, ModelField field, java.lang.Object value, java.util.List<EntityConditionParam> params)
static java.lang.String
filterColName(java.lang.String colName)
static int
getType(java.lang.String fieldType)
static void
getValue(java.sql.ResultSet rs, int ind, ModelField curField, GenericEntity entity, ModelFieldTypeReader modelFieldTypeReader)
static java.lang.String
makeFromClause(ModelEntity modelEntity, ModelFieldTypeReader modelFieldTypeReader, Datasource datasourceInfo)
Makes the FROM clause and when necessary the JOIN clause(s) as wellstatic java.lang.String
makeOrderByClause(ModelEntity modelEntity, java.util.List<java.lang.String> orderBy, boolean includeTablenamePrefix, Datasource datasourceInfo)
static java.lang.String
makeOrderByClause(ModelEntity modelEntity, java.util.List<java.lang.String> orderBy, Datasource datasourceInfo)
static java.lang.String
makeViewTable(ModelEntity modelEntity, ModelFieldTypeReader modelFieldTypeReader, Datasource datasourceInfo)
static java.lang.String
makeViewWhereClause(ModelEntity modelEntity, java.lang.String joinStyle)
static java.lang.String
makeWhereClause(ModelEntity modelEntity, java.util.List<ModelField> modelFields, java.util.Map<java.lang.String,java.lang.Object> fields, java.lang.String operator, java.lang.String joinStyle)
static java.lang.StringBuilder
makeWhereStringFromFields(java.lang.StringBuilder sb, java.util.List<ModelField> modelFields, java.util.Map<java.lang.String,java.lang.Object> fields, java.lang.String operator)
static java.lang.StringBuilder
makeWhereStringFromFields(java.lang.StringBuilder sb, java.util.List<ModelField> modelFields, java.util.Map<java.lang.String,java.lang.Object> fields, java.lang.String operator, java.util.List<EntityConditionParam> entityConditionParams)
Makes a WHERE clause String with "<col name>=?" if not null or "<col name> IS null" if null, all AND separatedstatic java.lang.String
makeWhereStringFromFields(java.util.List<ModelField> modelFields, java.util.Map<java.lang.String,java.lang.Object> fields, java.lang.String operator)
Deprecated.static java.lang.String
makeWhereStringFromFields(java.util.List<ModelField> modelFields, java.util.Map<java.lang.String,java.lang.Object> fields, java.lang.String operator, java.util.List<EntityConditionParam> entityConditionParams)
Deprecated.static void
setPkValues(SQLProcessor sqlP, ModelEntity modelEntity, GenericEntity entity, ModelFieldTypeReader modelFieldTypeReader)
Get all primary keys from the model entity and bind their values to the an SQL statement (SQL-Processor)static <T> void
setValue(SQLProcessor sqlP, ModelField modelField, java.lang.String entityName, java.lang.Object fieldValue, ModelFieldTypeReader modelFieldTypeReader)
static void
setValue(SQLProcessor sqlP, ModelField modelField, GenericEntity entity, ModelFieldTypeReader modelFieldTypeReader)
static void
setValues(SQLProcessor sqlP, java.util.List<ModelField> list, GenericEntity entity, ModelFieldTypeReader modelFieldTypeReader)
The elements (ModelFields) of the list are bound to an SQL statement (SQL-Processor)static void
setValuesWhereClause(SQLProcessor sqlP, java.util.List<ModelField> list, GenericValue dummyValue, ModelFieldTypeReader modelFieldTypeReader)
The elements (ModelFields) of the list are bound to an SQL statement (SQL-Processor), but values must not be null.
-
-
-
Method Detail
-
makeFromClause
public static java.lang.String makeFromClause(ModelEntity modelEntity, ModelFieldTypeReader modelFieldTypeReader, Datasource datasourceInfo) throws GenericEntityException
Makes the FROM clause and when necessary the JOIN clause(s) as well- Throws:
GenericEntityException
-
makeWhereStringFromFields
@Deprecated public static java.lang.String makeWhereStringFromFields(java.util.List<ModelField> modelFields, java.util.Map<java.lang.String,java.lang.Object> fields, java.lang.String operator)
Deprecated.Makes a WHERE clause String with "<col name>=?" if not null or "<col name> IS null" if null, all AND separated
-
makeWhereStringFromFields
public static java.lang.StringBuilder makeWhereStringFromFields(java.lang.StringBuilder sb, java.util.List<ModelField> modelFields, java.util.Map<java.lang.String,java.lang.Object> fields, java.lang.String operator)
-
makeWhereStringFromFields
@Deprecated public static java.lang.String makeWhereStringFromFields(java.util.List<ModelField> modelFields, java.util.Map<java.lang.String,java.lang.Object> fields, java.lang.String operator, java.util.List<EntityConditionParam> entityConditionParams)
Deprecated.Makes a WHERE clause String with "<col name>=?" if not null or "<col name> IS null" if null, all AND separated
-
makeWhereStringFromFields
public static java.lang.StringBuilder makeWhereStringFromFields(java.lang.StringBuilder sb, java.util.List<ModelField> modelFields, java.util.Map<java.lang.String,java.lang.Object> fields, java.lang.String operator, java.util.List<EntityConditionParam> entityConditionParams)
Makes a WHERE clause String with "<col name>=?" if not null or "<col name> IS null" if null, all AND separated
-
makeWhereClause
public static java.lang.String makeWhereClause(ModelEntity modelEntity, java.util.List<ModelField> modelFields, java.util.Map<java.lang.String,java.lang.Object> fields, java.lang.String operator, java.lang.String joinStyle) throws GenericEntityException
- Throws:
GenericEntityException
-
makeViewWhereClause
public static java.lang.String makeViewWhereClause(ModelEntity modelEntity, java.lang.String joinStyle) throws GenericEntityException
- Throws:
GenericEntityException
-
makeOrderByClause
public static java.lang.String makeOrderByClause(ModelEntity modelEntity, java.util.List<java.lang.String> orderBy, Datasource datasourceInfo) throws GenericModelException
- Throws:
GenericModelException
-
makeOrderByClause
public static java.lang.String makeOrderByClause(ModelEntity modelEntity, java.util.List<java.lang.String> orderBy, boolean includeTablenamePrefix, Datasource datasourceInfo) throws GenericModelException
- Throws:
GenericModelException
-
makeViewTable
public static java.lang.String makeViewTable(ModelEntity modelEntity, ModelFieldTypeReader modelFieldTypeReader, Datasource datasourceInfo) throws GenericEntityException
- Throws:
GenericEntityException
-
filterColName
public static java.lang.String filterColName(java.lang.String colName)
-
setValues
public static void setValues(SQLProcessor sqlP, java.util.List<ModelField> list, GenericEntity entity, ModelFieldTypeReader modelFieldTypeReader) throws GenericEntityException
The elements (ModelFields) of the list are bound to an SQL statement (SQL-Processor)- Parameters:
sqlP
-list
-entity
-- Throws:
GenericEntityException
-
setValuesWhereClause
public static void setValuesWhereClause(SQLProcessor sqlP, java.util.List<ModelField> list, GenericValue dummyValue, ModelFieldTypeReader modelFieldTypeReader) throws GenericEntityException
The elements (ModelFields) of the list are bound to an SQL statement (SQL-Processor), but values must not be null.- Parameters:
sqlP
-list
-dummyValue
-modelFieldTypeReader
-- Throws:
GenericEntityException
-
setPkValues
public static void setPkValues(SQLProcessor sqlP, ModelEntity modelEntity, GenericEntity entity, ModelFieldTypeReader modelFieldTypeReader) throws GenericEntityException
Get all primary keys from the model entity and bind their values to the an SQL statement (SQL-Processor)- Parameters:
sqlP
-modelEntity
-entity
-modelFieldTypeReader
-- Throws:
GenericEntityException
-
getValue
public static void getValue(java.sql.ResultSet rs, int ind, ModelField curField, GenericEntity entity, ModelFieldTypeReader modelFieldTypeReader) throws GenericEntityException
- Throws:
GenericEntityException
-
setValue
public static void setValue(SQLProcessor sqlP, ModelField modelField, GenericEntity entity, ModelFieldTypeReader modelFieldTypeReader) throws GenericEntityException
- Throws:
GenericEntityException
-
setValue
public static <T> void setValue(SQLProcessor sqlP, ModelField modelField, java.lang.String entityName, java.lang.Object fieldValue, ModelFieldTypeReader modelFieldTypeReader) throws GenericEntityException
- Throws:
GenericEntityException
-
getType
public static int getType(java.lang.String fieldType) throws GenericNotImplementedException
- Throws:
GenericNotImplementedException
-
addValueSingle
public static void addValueSingle(java.lang.StringBuffer buffer, ModelField field, java.lang.Object value, java.util.List<EntityConditionParam> params)
-
addValueSingle
public static void addValueSingle(java.lang.StringBuilder buffer, ModelField field, java.lang.Object value, java.util.List<EntityConditionParam> params)
-
addValue
public static void addValue(java.lang.StringBuffer buffer, ModelField field, java.lang.Object value, java.util.List<EntityConditionParam> params)
-
addValue
public static void addValue(java.lang.StringBuilder buffer, ModelField field, java.lang.Object value, java.util.List<EntityConditionParam> params)
-
-