Bind Parameters
Bind parameters are a database/JDBC feature to take advantage of database statement preparsing and optimization. Bind parameters are a mechanism for replacing constants in a SQL statement with replacement parameters at execution time. For example, the following WHERE clause expression uses the constant ’Engine’: WTPartMaster.name = ’Engine
This expression can be replaced with the following in the static SQL: WTPartMaster.name = ?
and the value ’Engine’ can be bound to the parameter ? at execution time.
On a subsequent execution, a new value, such as Cylinder, can be bound to that same parameter. If these two statements had used the constant value directly in the static SQL, each statement would have been parsed, optimized, and precompiled separately. When bind parameters are used, a single static SQL statement can be reused multiple times.
This bind parameter feature is implicitly supported when using the QuerySpec, SearchCondition, and other query classes. However, the bind parameters can also be explicitly accessed using the following APIs:
getBindParameterCount()
getBindParameterAt(int a_index)
setBindParameterAt(Object a_value, int a_index)
Isto foi útil?