Type | Name | Description | Notes |
String | augmentedQuery | Contains the SQL SELECT statement that is the combination of the query and the queryConjunct properties. | read-only |
Boolean | autoCommit | Contains true if the SQL table is in auto-commit mode. In this mode, the SQL table commits the transaction immediately after any INSERT , UPDATE, or DELETE operations. When auto-commit is disabled, the user must commit the transaction explicitly when appropriate. Initially, this property is set to true .
Note that auto-commit must be disabled for the fetch policy to be "as needed". | |
Boolean | autoRefresh | Contains true if the SQL table is in auto-refresh mode. In this mode, any INSERT or UPDATE operation is immediately followed by a call to the refreshRow method. This is sometimes useful when the database contains triggers that can alter inserted or modified rows. Initially, this property is set to false . | |
IliTable | cache | Contains null if the IliSQLTable object manages its local row cache itself. Otherwise, this property contains another IliTable object (it may be an IliMemoryTable object, for instance) that should have the same number and type of columns as this IliSQLTable object. All local row cache management calls are redirected to the cache. Initially, this property is null . | |
Boolean | concurrencyControl | Contains true if concurrency control is enabled for the SQL table. When concurrency control is enabled, the updating and deletion of rows will succeed only if the rows concerned have not changed in the database since the last time they were fetched and stored in the local row cache. In other words, concurrency control obliges the SQL table to protect, after the fact, the work carried out through it from the work of other users on the database. Initially, this property is set to false .
For example, if you have an EMP(ID, NAME, SALARY) database table where ID is the primary key of the table. You also have an SQL table object that selects all columns from this table and you can edit the values through a table gadget. If you change the salary of an existing employee, the following can occur:
The parameters fetchedId , fetchedName, and fetchedSalary take the values that were initially obtained when the row was fetched.
As you can see, the second UPDATE statement above would fail if the salary of the employee has changed in the database since the row was fetched.
This technique is sometimes called "optimistic concurrency control". It is "optimistic" because it defers the locking of rows in the database until the update takes place. The advantage of this technique is that it maximizes the responsiveness of the database server and the degree of concurrency since it minimizes the number of row locks. The drawback is that the update can fail because of concurrent updates.
Another option is to set the concurrencyControl property to false and to use instead the refreshAndLockRow method to acquire a lock on the row in the database. This technique is known as "pessimistic concurrency control" because it acquires locks much earlier and the locks remain in place a longer period of time if the end user has to type the updates after the lock was obtained but before the update takes place.
The following diagram depicts the difference between concurrency control techniques. | |
Int | cursorBufferedRowsCount | Contains the number of buffered rows. The value of this property is assigned to the bufferedRowsCount of any SQL cursor used to select and fetch the result set of the SQL table object. (See IliSQLCursor::bufferedRowsCount for more information.) Note that this property bears no relationship with the local row cache of the SQL table. It refers to a lower level buffering mechanism. | |
IliFetchPolicy | fetchPolicy | Contains the fetch policy. Its string value can be either IliFP_AsNeeded or IliFP_Immediate.
A value of IliFP_AsNeeded means that the SQL table object only fetches rows from the database when necessary. A value of IliFP_Immediate means that all rows are fetched at select time. Initially, this property is set to IliFP_AsNeeded .
Note that if autoCommit is set to true , the fetch policy will be immediate whatever the value of the fetchPolicy property. This is because when you commit an SQL session all SQL cursors lose their context. If the fetch policy was "as needed", you would no longer be able to fetch the remaining rows. As a consequence, if you want to use an "as needed" fetch policy, you need to set both the fetchPolicy to IliFP_AsNeeded and autoCommit to false .
In addition, remember that as soon that you commit the SQL session of the SQL table either explicitly (by calling the commit method on the SQL session) or implicitly (for example, if the SQL session is shared among many SQL tables and at least one of these SQL tables has autoCommit set to true ), any rows to be fetched will not be fetched because at commit time the SQL sessions lose all fetch context. | |
Boolean | insertingNulls | Contains true if the SQL table null columns are included in the SQL INSERT statements that are used to insert rows. When null columns are included, any default values defined in the database will not be taken into account since a null is explicitly specified. Initially, this property is set to true .
For example, you have an EMP(ID, NAME, SALARY) database table where SALARY has a default value in the database. If you insert a row in this table without specifying the salary, the following can occur:
- But, if the
insertingNulls property is true , the SQL table will synthesize the following SQL INSERT statement:
INSERT INTO EMP(ID, NAME, SALARY)
VALUES(:id, :name, :salary)
| |
Boolean | noWaitOnLockRow | This property is only meaningful when the SQL session connects to an Oracle database server. In such cases, if this property is true, the SQL SELECT statements used to lock rows will include the NOWAIT clause. The effect will be that calls to refreshAndLockRow will immediately fail if the given row is locked by another session in the database, instead of waiting until the lock is released. This property is useful in implementing the "pessimistic concurrency control" policy. Initially, this property is false . | |
String | query | Contains the SQL SELECT statement that will be submitted to the database system the next time the select method is called. Note that the query property is combined with the queryConjunct property before it is sent to the database system. | |
String | queryConjunct | Contains a conditional expression (formulated using SQL syntax) that, if present, will be combined with the WHERE clause of the query using an AND logical operator just before the query is sent to the database system. | |
Int | rowsCountLimit | Contains the maximum number of rows that will be fetched and stored in the local row cache. When this limit is reached, no more rows will be fetched from the database and insertion through the SQL table will not be allowed. To obtain more rows, you need to increase the value of rowsCountLimit and then call the select method again. When this property is -1 , the number of fetched rows is unlimited. | |
IliSQLSession | sqlSession | Contains the SQL session object used to communicate with a relational database system. | |
Int | tableAliasCount | Contains the number of table aliases in the FROM clause. | read-only |
Boolean | usingBoundVariables | Contains true if the bind-vars mode of the SQL table is enabled. In this mode, any column values that need to be sent to the database are included in SQL statements in the form of bound variables instead of literally. This setting combined with dynamic-SQL mode (disabled) and insert-nulls mode (enabled), results in better performance at the database server side since SQL statements will tend to be identical. Initially, this property is set to true .
For example, you have an EMP(ID, NAME, SALARY). If you delete a row, then the following can occur:
| |
Boolean | usingDynamicSQL | Contains true if the SQL table is in dynamic-SQL mode. This mode affects the way SQL UPDATE statements are constructed when a row needs to be modified in the database. Such an UPDATE statement may set the values of all columns or it may only set those columns whose values have been changed. When dynamic-SQL mode is on, the amount of data exchanged with the database is reduced since not all column values need to be sent each time a row is updated.
Alternatively, when dynamic-SQL is disabled, the database server processing time may be reduced if the bind-vars mode is enabled. This is because the SQL UPDATE statements sent to the database are always identical and do not depend on which columns are updated or values are changed. In this way the database server can parse the SQL UPDATE only once instead of at each update. Initially, this property is set to true .
For example, you have an EMP(ID, NAME, SALARY). If you change the salary of an existing employee, the following can occur:
| |
Boolean | cancelAsyncCall() | Cancels any noncompleted asynchronous call currently in progress. Returns true if successful. | |
Boolean | continueAsyncCall() | If there is a noncompleted asynchronous call in progress, this method calls the asynchronous-enabled method that is not completed again. It returns true if the call is successful and false otherwise. The isAsyncCallCompleted method can then be called to check whether the call has completed. | |
IliSQLTableAlias | getTableAlias(String name) | Returns the table alias named name or null if no such alias exists in the FROM clause. The name of a table alias is usually the name of the corresponding database table, but it can be different if the same database table appears more than once in the FROM clause In such cases, the table alias may have an underscore and a number prepended. | |
IliSQLTableAlias | getTableAliasAt(Int idx) | Returns the table alias positioned at idx or null if idx < 0 or idx > = tableAliasCount . | |
Boolean | isAsyncCallCompleted() | Returns true if the last call to one of the asynchronous-enabled methods (select , fetchNext , and fetchAll ) has completed. If this method returns false , it is necessary to call the asynchronous-enabled method (with the same parameter values) periodically until the isAsyncCallCompleted method returns true . | |
Boolean | isInAsyncMode() | Returns true if the SQL table is in asynchronous mode. This occurs when the SQL session of the SQL table is itself in asynchronous mode. | |
Boolean | makeQuery() | Recomputes the SQL SELECT statement that will be submitted to the database server by the select method. Returns true if successful and false otherwise. | |
Boolean | refreshAndLockRow(Int rowno) | Re-reads the row positioned at rowno from the remote database. In addition, a lock on the row is acquired. This method returns true if successful.
If the concurrencyControl property is set to true , this method will only succeed if the remote row has not changed since the last time it was fetched. In other words, this method is sensitive to the value of the concurrencyControl property. This contrasts with the refreshRow method which is not sensitive to the concurrencyControl property.
The technique used to lock the row is as follows. An SQL SELECT statement that retrieves the row is sent to the database server. In addition, the FOR UPDATE clause is added to the SQL statement used to retrieve the row so that its underlying database row(s) is(are) locked in the database server.
Note that some database systems may impose restrictions on which SQL SELECT statements can use the FOR UPDATE keywords, particularly in the case where there is more than one table in the FROM section. In the case of SYBASE, the holdlock keyword is used instead of FOR UPDATE. | |
Boolean | refreshRow(Int rowno) | Re-reads the row positioned at rowno from the remote database. Returns true if successful.
This method is not sensitive to the value of the concurrencyControl property. In other words, it will attempt to re-read the remote row whether or not it has been changed by another user. | |