ddlgen, the Java-based tool that generates definitions for server- and database-level objects in Adaptive Server, has expanded its list of filters to include indexes, triggers, and constraints out of table and database definitions in the DDL of database- as well as table-level objects. The valid filters are:
-F filters out indexes, triggers, and constraints out of table and database definitions in the DDL of table- and database-level objects. The valid filters are:
For tables – [ % | I | RI | KC | TR]
For databases – [ % | SGM | GRP | USR | R | D | UDD | U | V | P | XP | I | RI | KC | TR]
The filter options are:
Filter option |
Filters out: |
---|---|
% |
Everything, and retrieves the schema-only definition of a database or table. |
SGM |
Segments |
GRP |
Groups |
USR |
Users |
R |
Rules |
D |
Defaults |
UDD |
Uer-defined datatypes |
U |
User tables |
V |
Views |
P |
Stored procedures |
XP |
Extended stored procedures |
I |
Indexes |
RI |
Referential integrity constraints |
KC |
Primary- and unique-key constraints |
TR |
Triggers |
Generates DDL for the authors table in the pubs2 database, filtering for all indexes (I), and referential integrity constraints (RI), primary and unique key constraints (KC), and triggers (TR) from the DDL of a table:
ddlgen -Uroy -Proy123 -TU -Nauthors -Dpubs2 -F%
Alternatively, you can specify each of the filters individually:
ddlgen -Ulogin -Ppassword -TU -Ndbname.owner.table -FI,RI,KC,TR
When you use the -F parameter
to filter a table, then indexes, referential integrity, key constraints
and triggers automatically get filtered, as they are a subset of
table object.
The following generates the definition of table_name while filtering out foreign keys and primary-unique keys:
ddlgen -Ulogin -Ppassword -TU -Ntable_name -Ddbname -FRI,KC
Both of these generate foreign keys for a specified user in the entire database:
ddlgen -Ulogin -Ppassword -TRI -N%.%.% -Ddbname
Or:
ddlgen -Ulogin -Ppassword -TRI -Ndbname%.%.%
Both of these generate DDL for the primary and unique keys of all the tables in a database that begin with “PK”:
ddlgen -Ulogin -Ppassword -TKC -Ndbname.%.%.PK%
Or:
ddlgen -Ulogin -Ppassword -TKC -N%.%.PK% -Ddbname
Although you can normally generate all indexes only
for a table, the -T object type parameter
with the RI and KC value allows
you to generate foreign keys as well as primary and unique keys
for an entire database.
The following generates schema-only definition of a database:
ddlgen -Ulogin -Ppassword -Sserver:port -TDB -Ndbname -F%
Alternatively, you can specify each of the filters individually:
ddlgen -Ulogin -Ppassword -Sserver:port -TDB -Ndbname -FSGM,GRP,USR,R,D,UDD,V,P,XP,I,RI,KC,TR
The following generates the database DDL skipping the compiled object:
ddlgen -Ulogin -Ppassword -Sserver:port -TDB -Ndbname -FTR,D,XP,V,R
The following generates database definition without a table definition:
ddlgen -Ulogin -Ppassword -Sserver:port -TDB -Ndbname -FU
Servers The existing description of the -S parameter in ddlgen is:
-Shost_name : port_number
specifies the host name or IP address of Adaptive Server, as well as its port number. Separate host_name and port_number with a colon, without spaces before or after it.
You must use the -S option
because ddlgen does not connect to a default
server.
The updated description is as follows:
-Sserver – specifies the name of the Adaptive Server. ddlgen looks this name up in the interfaces file or LDAP configuration file. If you specify:
-S [host_name:port_number] – ddlgen uses the host_name and port_number provided, and neither interfaces nor LDAP configuration files are read or parsed.
-S[server] -I – ddlgen parses the interfaces file specified at the user location for the server name (see the -I parameter description for more information).
-S[server] – without specifying an interfaces file, ddlgen:
Tries to read the LDAP configuration file from the standard location.
If the LDAP file does not exist, or exists but does not contain an Adaptive Server entry, then the interfaces file is parsed at its standard location for the server name.
If the LDAP file exists, then ddlgen uses it to search the server name. The interfaces file is not parsed, and the LDAP configuration file is parsed.
Separate host_name and port_number with a colon, without spaces before or after it.
You must use the -S option
because ddlgen does not connect to a default
server.
Interfaces files -I – specifies the interfaces file name, and corresponds to $SYBASE/interfaces for UNIX, and %SYBASE%\ini\sql.ini for Windows. Use this optional parameter with -S.
Indexes You can now run the ddlgen utility for all indexes of all tables in a database in the following command:
ddlgen -Ulogin -Ppassword -Sserver:port -TI -Ndbname.%.%.%
For example, this generates DDL for all indexes for all tables in the pubs2 database:
ddlgen -Usa -P -SHARBOR:1955 -TI -Npubs2.%.%.%
Copyright © 2005. Sybase Inc. All rights reserved. |
![]() |