public class ERXObjectBinding extends Object implements ERXSQLBinding
When using this class to model a binding, the EOF SQL generation layer will not be able to inspect the model and obtain the correct value types and conversions. A best guess will be made based on the class of the wrapped object. This class supports the five basic types EOF supports (String, BigDecimal, Number, NSData and NSTimestamp). Also, boolean values true and false are converted to "true" and "false" strings. If boolean representation is different on the database you are using (like integers) you have to handle it yourself by wrapping an object of the appropriate class.
A note about SQL generation: due to the internal architecture of database plugins,
this class will not be able to ask the plugin for an appropriate placeholder string
for the binding values. This won't matter for databases where the placeholder string
is "?". However, some databases, like PostgreSQL 7.4 and older, require the placeholder
string to contain the value type, like "?::varchar(1000)". Using this class may cause
problems and unexpected results on such databases. If that's the case, consider using
ERXKeyValueBinding
.
Constructor and Description |
---|
ERXObjectBinding(Object value)
Creates a new object binding wrapper for the given object.
|
Modifier and Type | Method and Description |
---|---|
String |
sqlStringForBindingOnExpression(EOSQLExpression expression)
Registers the binding on a given SQL expression, and obtains the
binding placeholder string for the binding value.
|
public ERXObjectBinding(Object value)
value must be an instance of the following classes (or any subsclass of these): String, BigDecimal, Number, NSData, NSTimestamp.
value
- Object to be wrappedpublic String sqlStringForBindingOnExpression(EOSQLExpression expression)
ERXSQLBinding
sqlStringForBindingOnExpression
in interface ERXSQLBinding
expression
- EOSQLExpression being builtCopyright © 2002 – 2024 Project Wonder.