Scalable Database Server, HiRDB Version 8 Installation and Design Guide
This section describes creation of a UAP for the purpose of making retrievals from manual's SGML documents.
Shown as follows is the coding of a UAP that checks the section headings in the SGML documents in order to obtain the number of instances of the keyword plug-in; a file containing this coding is created under the name sample.ec:
#include <stdio.h>
main()
{
EXEC SQL BEGIN DECLARE SECTION;
char xuserid[31];
char xpasswd[31];
int total;
EXEC SQL END DECLARE SECTION;
printf("userid ?\n");
scanf("%30s",xuserid);
printf("passwd ?\n");
scanf("%30s",xpasswd);
printf("connect start,\n");
EXEC SQL CONNECT USER: xuserid USING: xpasswd;
printf("connected,\n")
EXEC SQL
SELECT COUNT(*) INTO: total
FROM manual WHERE contains(doc,'MAN[*[H2{"plug-in"}]]') IS TRUE;
printf("total --->%2d\n",total);
EXEC SQL DISCONNECT;
}
|
This section describes the preprocessing.
The SQL-embedded UAP source file cannot be compiled directly. The SQL preprocessor must be started in order to convert to a post source file.
Enter the following command, then press the Enter key:
pdcpp sample.ec
A post source file named sample.ec is created.
The sample.ec file created during preprocessing is used to compile and link the UAP. Enter the following command, then press the Enter key:
cc -o sample -I /opt/HiRDB_P/include sample.c -L /opt/HiRDB_P/client/lib -lzclt
A file named sample.out is created.
To execute UAP:
Simple installation is now complete.
All Rights Reserved. Copyright (C) 2007, Hitachi, Ltd.