Databases Reference
In-Depth Information
// fetch data using complex query
...
WSs.executeQuery ("UPDATE employees SET address = ?
WHERE first_name = ? and last_name = ? and ssn = ?
and address = ? and city = ? and state = ?
and zip = ?");
Many databases support pseudo-columns that are not explicitly defined by
the user in the table definition but are hidden columns in every table (for exam-
ple, ROWID for Oracle). Pseudo-columns often provide the fastest access to the
data. Because pseudo-columns aren't part of the explicit table definition, they're
not retrieved when getColumns() is called.
Performance Tip
Use the getBestRowIdentifier() method to determine the optimal set
of columns that uniquely identify a row to use in the WHERE clause for
updating data.
For example, to determine whether pseudo columns exist, use the following
code:
...
ResultSet WSrowid = WSdbmd.getBestRowIdentifier()
(... "employees", ...);
...
WSs.executeUpdate ("UPDATE employees SET ADDRESS = ?
WHERE ROWID = ?";
// fastest access to the data!
If your database doesn't contain pseudo-columns, the result set of
getBestRowIdentifier() consists of columns of the optimal unique index on
the specified table (if a unique index exists). Therefore, your application doesn't
need to call getIndexInfo() to find the smallest unique index.
Search WWH ::




Custom Search