home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
OS/2 Shareware BBS: 18 REXX
/
18-REXX.zip
/
SQLDPN.ZIP
/
SQLDPND.DOC
< prev
next >
Wrap
Text File
|
1991-06-27
|
2KB
|
51 lines
Unclassified
The SQLDPND PACKAGE contains a sample program for use with the OS/2
Extended Edition Database Manager. It takes as input a database name
and a single SQL SELECT statement, and then displays the dependencies
that pre-compiled statement has on objects in the database. are
This sample program is being distributed to software developers and
key customer accounts at the OS/2 Technical Update seminar.
Feel free to distribute it as you see fit.
This program shows what indices, if any, a SELECT statement is dependentr.
on, and thus can give you an idea if the optimizer has chosen to access
data through an index.
Note that database manager does not always go THROUGH an index even if
it is listed as a dependency. One example of such a situation would be:
Suppose you have the following statement:
SELECT DISTINCT EMPLOYEEID, NAME
FROM EMPLOYEE_TAB
If there is a unique index on the "EMPLOYEEID,NAME" key,
database manager doesn't have to sort the rows to find the distinct
values -- it can assume they're distinct because of the unique
index, and can still access the base table directly (which probably
would be more efficient in this situation, since all rows are
being selected).
-----------------------------------------------------------------------
The sample program name is SQLDPND.SQC
It prompts the user for a database name and then for a complete
SELECT statement.
It then precompiles the statement and queries the system table
SYSIBM.SYSPLANDEP, printing out the results.
A batch and link file is included to show how to precompile and
compile this application. You should precompile the program with
deferred bind. You do not need to bind SQLDPND to your database
since it binds itself to the database you specify. n
PRECOMPILE WITH DEFERRED BIND:
sqlprep sqldpnd.sqc dbname /B
cmp sqldpnd
lnk sqldpnd
...where 'dbname' is any database on your machine.