Creating a Table using test.pl:
{
connect(0,"ORACLE:cbase/cbase@@CBASE25");
printf("Creating table test");
exec_sql("drop table test"); /* Drop old table */
exec_sql( "create table test ("
"structure number (9) not null,"
"sample number (3) not null,"
"sample_date date null,"
"smiles varchar2(2000) null,"
"mol_formula varchar2(50) null,"
"mol_weight number (8,2) null,"
"chem_name varchar2(80) null)"
);
}
Compiling and running test.pl from the Command Prompt:
C:\trim\prod>trimgen test.pl -a
TRIMgen - Code Generator/Compiler.
Version 4.0.1.6.4 - Production.
Copyright (c) 1989-1998, Trifox, Inc., California, USA.
All Rights Reserved Worldwide.
Generating: test.pl.............. Done.
C:\trim\prod>trimrunc test
TRIMrun - Runtime Executive.
Version 4.0.1.6.4 - Production.
Copyright (c) 1989-1998, Trifox, Inc., California, USA.
All Rights Reserved Worldwide.
Creating table test
C:\trim\prod>
Loading a Table using loadtest.pl
{
int x;
list CL,LL;
list_mod(CL,1,"test.dat test.err"); /*ascii source file */
list_mod(CL,1,"variable"); /* variable source file */
list_mod(CL,1,","^^" NULL"); /* comma delimiter */
list_mod(CL,1,"N 999999999"); /* structure field */
list_mod(CL,1,"N 999"); /* sample field */
list_mod(CL,1,"D "DD-MON-YY"); /* sample_date field */
list_mod(CL,1,"C"); /* SMILES field */
list_mod(CL,1,"C"); /* mol_formula field */
list_mod(CL,1,"N 99999999.99"); /* mol_weight field */
list_mod(CL,1,"C"); /* chem_name field */
LL = list_open(CL,1000);
printf("Connecting to Database: ");
/*connect(0,"ORACLE:cbase/cbase@@CBASE25");*/
connect(0,"net:cojo/iforgot@1958:208.209.42.35!/usr2/trim/bin/vtxhost.net,TRIM_HOME=/usr2/trim@@1958:192.0.2.10(cojo/iforgot)!/usr2/trim/bin/vtxhost.ora,ORACLE_HOME=/usr4/oracle,ORACLE_SID=A");
commit(update); /* set db into update mode */
#ifdef skip
printf("deleting all rows from targets table"); /* use this code to delete rows */
x=exec_sql("delete from targets table"); /* delete all records */
printf("deleted = "^^x^^" rows from targets table"); /* print rows deleted */
#endif
printf("Inserting rows");
x=exec_sql("insert into targets values(:1,:2,:3)",
LL);
commit();
}