lucee.Componentcborm.sql.SQLHelper
Property Summary | ||||
---|---|---|---|---|
type | property | default | serializable | required |
boolean
|
formatSql
Format the SQL or not.
|
false
|
true
|
false
|
array
|
log
The log array.
|
true
|
false
|
|
boolean
|
returnExecutableSql
Bit to return the executable SQL or not.
|
false
|
true
|
false
|
Constructor Summary | |
---|---|
init(any criteriaBuilder, [boolean returnExecutableSql='false'], [boolean formatSql='false'])
Constructor. |
Method Summary | |
---|---|
string
|
applyFormatting(string sql)
Applies pretty formatting to a sql string. |
private array
|
bindLimitParameters(array positionalValues, boolean append, any selection)
Inserts parameter values into the running list based on the dialect of the database engine. |
boolean
|
canLogLimitOffset()
|
private array
|
convertToCFArray(any array)
Small utility method to convert weird arrays from Java methods into something CF understands. |
string
|
generateSQLAlias()
Generates a unique SQL Alias within the criteria query. |
private any
|
getCriteriaJoinWalker()
gets an instance of CriteriaJoinWalker, which can allow for translating criteria query into a sql string. |
private any
|
getCriteriaQueryTranslator()
gets an instance of CriteriaQueryTranslator, which can prepares criteria query for conversion to SQL. |
any
|
getDialect()
Retrieves the correct dialect of the database engine. |
private numeric
|
getFirstRow(any selection)
Gets the first row (or 0) for the current row selection. |
string
|
getFormatSql()
|
string
|
getLog()
|
private numeric
|
getMaxOrLimit(any selection)
Gets correct "limit" value for the current row selection. |
array
|
getPositionalSQLParameters()
Returns a formatted array of parameter value and types. |
any
|
getPositionalSQLParameterTypes(boolean simple='true')
Gets positional SQL parameter types from the criteria query. |
array
|
getPositionalSQLParameterValues()
Gets the positional SQL parameter values from the criteria query. |
any
|
getProjectedTypes()
Retrieves the projected types of the criteria query. |
string
|
getProjectionAlias()
Get the alias of the current projection. |
private any
|
getQueryParameters()
Gets currently applied query parameters for the query object. |
string
|
getReturnExecutableSql()
|
string
|
getRootSQLAlias()
Retrieves the "rooted" SQL alias for the criteria query. |
string
|
getSQL(boolean returnExecutableSql='[runtime expression]', boolean formatSql='[runtime expression]')
Returns the SQL string that will be prepared for the criteria object at the time of request. |
private boolean
|
hasMaxRows(any selection)
Determines whether the current row selection has a limit already applied. |
any
|
log(string label='Criteria')
Logs current state of criteria to internal tracking log. |
private string
|
replaceQueryParameters(string sql)
replace query parameter placeholders with their actual values (for detachedSQLProjection). |
any
|
setFormatSql(boolean formatSql)
|
any
|
setLog(array log)
|
any
|
setReturnExecutableSql(boolean returnExecutableSql)
|
private boolean
|
useLimit(any selection)
Determines whether the database engine allows for the use of "limit/offset" syntax. |
Methods inherited from class lucee.Component |
---|
None |
Constructor Detail |
---|
Constructor
criteriaBuilder
returnExecutableSql
formatSql
Property Detail |
---|
Format the SQL or not.
access
- publicrequired
- falsereturntype
- anyserializable
- trueThe log array
access
- publicrequired
- falsereturntype
- anyserializable
- trueBit to return the executable SQL or not
access
- publicrequired
- falsereturntype
- anyserializable
- trueMethod Detail |
---|
Applies pretty formatting to a sql string return string
sql
- {string} The SQL string to formatInserts parameter values into the running list based on the dialect of the database engine return Array
positionalValues
- {Array} The positional values for this queryappend
- {Boolean} Whether values are appended or prepended to the arrayselection
- {any} The current row selectionSmall utility method to convert weird arrays from Java methods into something CF understands return Array
array
- {Array} The array to convertGenerates a unique SQL Alias within the criteria query return string
gets an instance of CriteriaJoinWalker, which can allow for translating criteria query into a sql string returns CriteriaJoinWalker
gets an instance of CriteriaQueryTranslator, which can prepares criteria query for conversion to SQL returns CriteriaQueryTranslator
Retrieves the correct dialect of the database engine return any
Gets the first row (or 0) for the current row selection return Numeric
selection
- {any} The current row selectionGets correct "limit" value for the current row selection return Numeric
selection
- {any} The current row selectionReturns a formatted array of parameter value and types return array
Gets positional SQL parameter types from the criteria query return any
simple
- {Boolean} Whether to return a simply array or full objectsGets the positional SQL parameter values from the criteria query return array
Retrieves the projected types of the criteria query return string
Get the alias of the current projection return string
Gets currently applied query parameters for the query object return org.hibernate.engine.QueryParameters
Retrieves the "rooted" SQL alias for the criteria query return string
Returns the SQL string that will be prepared for the criteria object at the time of request return string
returnExecutableSql
- {Boolean} Whether or not to do query param replacements on returned SQL stringformatSql
- {Boolean} Whether to format the sqlDetermines whether the current row selection has a limit already applied return Boolean
selection
- {any} The current row selectionLogs current state of criteria to internal tracking log return void
label
- {string} The label for the log recordreplace query parameter placeholders with their actual values (for detachedSQLProjection) returns string
sql
- (string) The sql string to massageformatSql
log
returnExecutableSql
Determines whether the database engine allows for the use of "limit/offset" syntax return Boolean
selection
- {any} The current row selection