Need some tutorial on basic table creation through scripts

Hi Everybody,
Can i get some tutorials on creating table, fields, index, sequence through scripts? We were not able to get a standard tutorial with examples and syntax for this.

Thanks in advance.
 

TomBascom

Curmudgeon
That is because it isn't done through scripts.

These things are done by first using the data dictionary to define your tables and such and then creating a .df file.

You can use a scripts to dump the .df file:

Code:
#!/bin/sh
#
# $1 = db name
# $2 = .df file name

# if no .df file is specified assume that is is $1.df

DFNAME=${2-${1}}.df

mpro ${1} -p dumpdf.p -param "${DFNAME}"

/* dumpdf.p
 *
 * dump schema
 *
 * 08/05/02     tom     created
 *
 * August 5, 2002 */

define variable fname as character no-undo.

fname = session:parameter.

run prodict/dump_df.p ( "ALL", input fname, "" ).

quit.

... and to load the .df file.

Code:
#!/bin/sh
#
# $1 = db name
# $2 = .df file name

# if no .df file is specified assume that is is $1.df

DFNAME=${2-${1}}.df

# strip area assignments out of .df file

cat ${DFNAME} | grep -v " AREA " > ${DFNAME}.noarea

mpro ${1} -p loaddf.p -param "${DFNAME}"

/* loaddf.p
 *
 */

run prodict/load_df ( input session:parameter ).

quit.

You might want to get fancy and create an incremental .df file. To do that you connect two databases and select " Create Incremental .df File..." from the admin menu.

Fun fact -- if you go through the incremental .df process twice (with the order of the databases reversed the second time) you can create a "backout" .df file in case your update fails and you need to be able to remove your changes.
 
Top