Oracle8(TM)
ConText(R) Cartridge Application Developer's Guide Release 2.0 A54630-01 |
|
This appendix describes how to use the ConText input/output utility. You use this utility in Windows 32-bit environments such as Windows NT and Windows 95.
The CTXIO32 utility enables you to move text from database to client-side files in a Windows 32-bit environment and vice-versa.
The CTXIO32 utility can be used to perform the following operations:
In addition, you can use the I/O utility to spawn an operating system command and to execute any PL/SQL or SQL*Plus that can be executed in an anonymous PL/SQL block.
These operations are performed in a sequence defined by a parameter file that you specify on the command line.
The CTXIO32 utility has the following command-line syntax:
ctxio32 [-w] [-p file] [-l file] [-d connect_string]
The file below is an example CTXIO32 parameter file.
The command to execute this parameter file is:
ctxio32 -v notepad -s -w -p pfile.txt -l log.txt -d ctxdemo/ctxdemo
# # CTXIO sample script # File : pfile.txt # # Script split into 2 # # 1) First section (#ReplaceAll) replaces all employees. # 2) Second section (#ReplaceSome) replaces some employees. # # The <QU> .. </QU> section asks a question and jumps to the relevant tag # <QU> Do you wish to replace ALL employees? #ReplaceAll #ReplaceSome </QU> # # ----------- This section replaces all current employees ----------- # #ReplaceAll <MESS>Drop employee table <SQL> DROP TABLE CTXIO_EMP </SQL> <MESS>Create employee table <SQL> CREATE TABLE CTXIO_EMP (EMPNO NUMBER, EMPNAME VARCHAR2(100), RESUME LONG) </SQL> <SQL> alter table ctxio_emp add constraint unique_ctxioemp unique(empno) </SQL> <MESS>Truncate employee table <SQL> truncate table CTXIO_EMP </SQL> <MESS>Loading ALL employees into database... # Use SaveDir so we can check search and replace has required affect <LOAD> CTXIO_EMP EMPNO(WHERE), EMPNAME, RESUME(ReadFromFile, Ignore "<Confidential>" "</Confidential>", Replace "brewing" "chemistry", Replace "Brewing" "Chemistry", SaveDir "temp") 1,"Joe Bloggs","jbloggs.htm" 2,"Ray Smith","rsmith.htm" 3,"Lisa Turner","lturner.htm" </LOAD> # Skip next bit which is for single update only <GOTO> #Common # # -------------- This section updates the resumes of some employees -------------- # #ReplaceSome <MESS>Replacing resumes in database... # Use SaveDir so we can check search and replace has required affect <LOAD> CTXIO_EMP (REPLACE) EMPNO(WHERE), EMPNAME, RESUME(ReadFromFile, Ignore "<Confidential>" "</Confidential>", Replace "brewing" "chemistry", Replace "Brewing" "Chemistry", SaveDir "temp") 2,"Ray Smith","rsmith.htm" </LOAD> # Load this resume without search and replace <PUT> jbloggs.htm ctxio_emp resume EMPNO=1 </PUT> # # ----------- This section common to both ----------- # #Common # Check Smith's CV was filtered and stored OK <GET> temp\rsmith.htm ctxio_emp resume EMPNO=2 </GET> # # ----------- Create OCO index ----------- # <MESS>Dropping policy and index (may produce errors but this is OK)... <SQL> begin ctxsys.ctx_ddl.drop_index('CTXIO_EMPRES'); end; </SQL> <SQL> begin ctxsys.ctx_ddl.drop_policy('CTXIO_EMPRES'); end; </SQL> <MESS>Creating policy on test table and creating index... <SQL> begin ctxsys.ctx_ddl.create_policy(policy_name=>'CTXIO_EMPRES', colspec=>'CTXIO_EMP.RESUME', textkey=>'EMPNO'); end; </SQL> <SQL> begin ctxsys.ctx_ddl.create_index('CTXIO_EMPRES'); end; </SQL> # # ----------- Do some OCO querying ----------- # <MESS>Create marked up table <SQL> drop table mutab </SQL> <SQL> create table mutab (id number, document long) </SQL> <MESS>Get highlights... <SQL> begin ctxsys.ctx_query.highlight(CSPEC=>'CTXIO_EMPRES', TEXTKEY=>2, query=>'chemistry,Chemistry', mutab=>'MUTAB', ID=>999,starttag=>'<EM>', endtag=>'</EM>'); end; </SQL> <MESS>Write marked up text to file... <GET> mudoc.htm mutab document id=999 </GET> # This views the marked-up resume in notepad #<EXE> #notepad mudoc.htm #</EXE> # This views the HTML resume in Netscape <EXE> <REG>HKEY_CLASSES_ROOT\NetscapeMarkup\shell\open\command,,"</REG> file:///mudoc.htm </EXE> #Finished
|
Copyright © 1997 Oracle Corporation. All Rights Reserved. |
|