ddlgen

Description

A Java-based tool that generates definitions for server- and database-level objects in Adaptive Server. ddlgen supports Adaptive Server version 11.9.2 and later.

The command-line version of ddlgen is located in $SYBASE/sybcent32 (%SYBASE%\Sybase Central 3.2 in Windows NT).

Syntax

ddlgen 
	-Ulogin
	-Ppassword
	-Shost_name : port_number
	[-Tobject_type]
	[-Nobject_name]
	[-Ddatabase_name]
	[-Xextended_object_type]
	[-Ooutput_file]
	[-Eerror_file]

Or

ddlgen -v

Parameters

-U login

specifies a login name, and is case-sensitive.

-P password

specifies your password.

-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.

NoteYou must use the -S option because ddlgen does not connect to a default server, and does not support interface files.

-Tobject_type

specifies the type of object you are creating. If you do not use -T, ddlgen creates a DDL for the default database of login. Table 6-3 lists object types for -T.

Table 6-3: Valid object types for the ddlgen -T option

Object type

Description

C

cache

D

default

DB

database

DBD

database device

DPD

dump device

EC

execution class

EG

engine group

GRP

group

I

index

L

login

P

stored procedure

R

rule

RO

role

RS

remote server

SGM

segment

TR

trigger

U

table

UDD

user-defined datatype

USR

user

V

view

XP

extended stored procedure

-Nobject_name

specifies the fully qualified name of the object you are creating, such as -Ndb_name.owner.table.index. The -N option:

Use -N% to generate a DDL for all items of a specific object type on your server.

-Ddatabase_name

specifies the name of the database for the object you specify in the -N option. The default is the user’s default database.

-Xextended_object_type

differentiates user tables (OU) from proxy tables (OD) when you specify a table as your object type (-TU). If object_type (-T) is U (table) and -X is not specified, ddlgen generates DDL for both user tables and proxy tables. To generate a DDL only for:

-Ooutput_file

specifies an output file for the generated DDL. If you do not specify -O, the DDL you create appears in a console window.

-Eerror_file

specifies a log file for recording errors. If you do not specify -E, the generated errors appear in a console window.

-v

displays the version and copyright message of ddlgen and returns to the operating system.

Examples

Example 1

Generates a DDL for a database called pubs2 running on a machine named HARBOR using port 1955:

ddlgen -Uroy -Proy123 -SHARBOR:1955 -TDB -Npubs2

If you do not specify a database_name, ddlgen generates a DDL for the default database of login:

ddlgen -Ulogin -Ppassword -Shost_name:portnumber

Example 2

Generates a DDL for an index called au_lname for the table authors, in the database pubs2 owned by dbo, on a machine named HARBOR using port 1955:

ddlgen -Uroy -Proy123 -SHARBOR:1955 -TI -Nauthors.pubs2.au_lname -Dpubs2

Alternatively, because ddlgen allows you to use a fully qualified name in the -N flag, you can omit the -Ddatabase_name and include the database name in the -N option:

ddlgen -Ulogin -Ppassword -Shost_name:portnumber 
	-TI -Ndatabasename.tableowner.tablename.indexname

If you use a fully qualified name, you may omit the -D option.

Example 3

Generates a DDL for all logins on a machine named HARBOR using port 1955:

ddlgen -Uroy -Proy123 -SHARBOR:1955 -TL -N%

NoteThe password in the DDL generated for all logins is “password”.

Alternatively, you can specify an individual login by using -Nusername instead of -N%.

Example 4

Generates a DDL for all rules associated with authors on a machine named HARBOR using port 1955:

DDLGen -Uroy -Proy123 -SHARBOR:1955 -TR -Nauthors.dbo.%

The % symbol tells DDLGen to create DDLs for all rules that exist on the server.

Example 5

Generates a DDL for a user table called publishers:

ddlgen -Uroy -Proy123 -SHARBOR:1955 -TU -Ndbo.publishers -Dpubs2 -XOU

The -XOU option in this example specifies that the table you are referring to (-TU) is a user table (OU). To generate a DDL for a proxy table, which uses the value OD, use -XOD instead.

Example 6

Generates a DDL for a user named Smith in the pubs2 database by using a fully qualified databasename.username format with the -N option:

ddlgen -Uroy -Proy123 -SHARBOR:1955 -TUSR -Npubs2.smith

Alternatively, you can use both the -N and -D options instead of using a fully qualified name in -N:

ddlgen -Ulogin -Ppassword -Shost_name:portnumber 
	-TUSR -Nusername -Ddbname

Usage