
|
Technical Fact Sheet Dharma SQLtools
SQLtools/Interactive SQL
You can use interactive SQL to port SQL scripts to your database, generate formatted reports and develop administrative scripts.
Invoke the interactive SQL tool at the shell prompt by typing isql and a database name, as shown in the example below.
Interactive SQL includes an online help facility with syntax and descriptions of the supported statements.
$ isql sampledb
Dharma/ISQL Version 09.00.0000
Dharma Systems Inc (C) 1988-2003.
Dharma Computers Pvt Ltd (C) 1988-2003.
ISQL> CREATE TABLE TEST (C1 CHAR(30));
ISQL> INSERT INTO TEST VALUES(‘Dharma’);
1 record inserted.
ISQL> SELECT * FROM TEST;
C1
—
Dharma
1 record selected
SQLtools/Embedded SQL
The embedded SQL compiler lets you port applications from other DBMSs to your DBMS.
The precompiler processes C language program source files with embedded SQL statements. It converts the SQL statements to C language calls and invokes the C compiler to generate object or executable files.
Precede embedded SQL statements with EXEC SQL flags and terminate them with a semicolon (;). You can insert the SQL statements among C constructs, as shown in the program excerpt below.
EXEC SQL
SELECT 1
INTO :result
FROM systpe.syscalctable
WHERE :ship_date > SYSDATE
AND :ship_date < ADD_MONTHS (:order_date, 1) ;
if (sqlca.sqlcode == 0)
printf (“ship_date valid “) ;
else
if (sqlca.sqlcode == SQL_NOT_FOUND)
printf (“ship_date invalid “) ;
else
printf (“Error “) ;
SQLtools/dbload
The dbload utility loads records from an input data file
into your DBMS. The dbload utility reads the input data file and
processes its contents into data records that it loads into the
database. The format of the data file is specified by a record
description given in an input command file to dbload.
Dbload generates a log file with error messages and statistics,
and a badfile to hold any records that do not comply with
the format specified in the command file.
SQLtools/dbdump
The dbdump utility exports the contents of tables in your
DBMS. The format of the exported data is specified by the record
description given in an input command file to dbdump. The command
file specifies the data file, the format of data records, and
the destination (or source) database columns and tables for the
data.
SQLtools/dbschema
The dbschema utility generates schema definition information
for specified tables and views, or all the objects in your DBMS
.
Invoke dbschema at the shell prompt by typing dbschema.
The following example writes SQL statements to define and load
the table assignments in the database testdb to
the file assignments.sql:
$ dbschema -d -o assignments.sql -t assignments testdb
Dharma/DBSCHEMA Version 09.00.0000
Dharma Systems Inc (C) 1988-2003.
Dharma Computers Pvt Ltd (C) 1988-2003.
$ more assignments.sql
create table systpe.assignments (
c1 integer,
c2 integer,
c3 character
) pctfree 20;
insert into assignments values(1,100,'r');
$
|