borland Packages Class Hierarchy dx.sql.dataset Package
java.lang.Object +----com.borland.dx.dataset.Resolver +----com.borland.dx.sql.dataset.SQLResolver +----com.borland.dx.sql.dataset.QueryResolver
Constructors Properties Methods Event Listeners
Implements Designable, Serializable
The QueryResolver
component is the default Resolver
object of the Database
component. It encapsulates UpdateMode
behavior and uses SQL queries to resolve data changes to a server.
The database
property of this component must be set to the Database
component that this QueryResolver
is associated with. Otherwise, a DataSetException
is generated.
To make a query updatable:
updateMode
property is set to ALL_COLUMNS
(the default), set the
tableName
property of the QueryDataSet
QueryResolver
component has been specified and the updateMode
property is
set to KEY_COLUMNS
, set the rowId
property on the columns used as an index to the table.
When troubleshooting resolution problems, columns other than those with edited values may be causing problems. For instance, the problem might stem from columns which are included in the WHERE clause of the update query.
If you get a message that no rows were affected by the update query, check whether someone
meanwhile modified the original row. This would cause the WHERE clause to fail. Use the
DatSet.refetchRow()
method to get the original row from the server to determine if this is
the case.
JBuilder automatically recognizes read-only data such as calculated columns, and attempts to discover other non-updatable columns. Some JDBC drivers seem unaware that such columns are read-only. For this reason, you should set column properties to not resolvable. While this seems redundant, this can prove crucial to your application.
Columns of certain data types and fields which are calculated on the server could cause the comparison in the WHERE clause of the update query to fail. Conditions which might cause this include:
Column
is of imprecise data type (such as float or double)
Column
contains String data that is of fixed length; some drivers do not pad strings
with blanks, which leads to failures in comparison
Column
is calculated on the server, and successive calls to the saveChanges
method are made without an intervening refresh.
Possible solutions to the above types of problems are:
metaDataUpdate
property of the QueryDataSet
to MetaDataUpdate.NONE
and the searchable
property of the column in question to false so that the column is not
included in the WHERE clause of the update query. Note that you will have to set other properties as
well to make the query updatable.
QueryResolver
to your project and set the updateMode
property of this
component to KEY_COLUMNS
.
If your server returns an error other than a constraint or integrity violation, check whether your
driver supports prefixing field names with tables names, for example, testtable.column1. If not, set the
useTableName
property of the Database
component to false.
In 1-1 relationships, the QueryResolver
is able to resolve SQL queries that have more than one table reference. Metadata discovery detects which table each column belongs to and the default resolution order is set in
the resolveOrder
of the StorageDataSet
. When using 1-Many relationships, use a separate master detail DataSet
. For Many-1 relationships, use lookups.
The resolverQueryTimeout
property can help in situations where an application is trying to read a locked row.
public QueryResolver()Default constructor of a
QueryResolver
object.
public Database getDatabase() public void setDatabase(Database database)The
DataBase
object associated with the QueryResolver
. If not set, a DataSetException
is generated.
public final int getResolverQueryTimeout() public final void setResolverQueryTimeout(int seconds)Limits the number of seconds that the driver waits for a
Resolver's
insert/update/delete statement to execute. If the limit is exceeded, a DataSetException
is thrown. An SQLException
is thrown if a database-access error occurs.
The int
value in both setter and getter indicate the query time-out, in seconds. A value of zero indicates unlimited (no time-out).
public int getUpdateMode() public void setUpdateMode(int updateMode)Determines how updated rows in the local
DataSet
are identified with the corresponding rows of the server table. Valid values for this property are defined in the
UpdateMode
class.
public synchronized void close(StorageDataSet dataSet)Frees any system resources such as
Databases
, statements, and so on that are associated with the specified StorageDataSet
.
public void closeStatements(StorageDataSet dataSet)Frees any system resources used for statements associated with the specified
StorageDataSet
.
public void deleteRow(DataSet dataSet)Deletes the current row in the
DataSet
from the Database
.
public void insertRow(DataSet dataSet)Inserts the current row of the
DataSet
into the Database
specified in this
resolver's database
property.
public void updateRow(DataSet dataSet, ReadWriteRow oldDataRow)Updates the current row of the specified
DataSet
in the Database
.
public synchronized void addResolverListener(ResolverListener listener) public synchronized void removeResolverListener(ResolverListener listener)