Kbase 15484: How to build ESQL Dyndemo UNIX large model
Autor |
  Progress Software Corporation - Progress |
Acesso |
  Público |
Publicação |
  5/10/1998 |
|
How to build ESQL Dyndemo UNIX large model
The purpose of this document is to lead you
through the steps needed to create a dyndemo
executible for testing purposes (large client).
What is Progress ESQL?
----------------------
Progress provides a way for users to access a
Progress database from a C application. This is
done by embedding SQL statements into the C program
(hence ESQL). You can embed static SQL statements
or dynamic SQL statements into the C application.
What is Static ESQL?
--------------------
Static ESQL provides a basic syntax for specifying
Progress/SQL statements directly in your C language
code. You can use Static ESQL when you know the exact
contents of your SQL statements at compile time.
For example:
EXEC SQL select name from customer.
NOTE: the EXEC SQL is the syntax that is required
before each embedded SQL statment. The SQL Pre-
processor recognizes these and substitutes them
with code that the C compiler can understand.
What is Dynamic ESQL?
--------------------
Dynamic ESQL includes additional statements and C data
structures for feeding run-time SQL statements to Progress
and returning results to your application. You must
use Dynamic ESQL when your application cannot determine
the contents of its SQL statements until run time.
For example, you may want the user to be allowed to
choose which fields and tables they want to query
and so you will have to build the SQL statements on
the fly in your C language application. An example
of a dynamic ESQL application is provided by
Progress. It is referred to as the DYNDEMO application.
How to build DYNDEMO ESQL application in version 7 (UNIX)
---------------------------------------------------------
(large client)
1. In your Progress version 7 environment, be sure that
$PROLOAD is set to the $DLC/probuild directory.
2. copy $PROLOAD/esqlc/dyndemo.cc into your working directory
3. Run the preprocessor on dyndemo.cc in the following way:
sqlcpp dyndemo.cc
NOTE: this preprocesses the EXEC SQL statements and converts
them into something the C compiler can handle. SQLCPP produces
a dyndemo.c file.
4. Now compile the dyndemo.c file in the following way:
cc -c -I$PROLOAD/esqlc dyndemo.c
Note: The C compiler will produce dyndemo.o (object code)
5. Now you need to link dyndemo.o with the ESQL and C libraries to
create a C language executable program. To do this you must first
build a link script using a tool that Progress provides to do this.
The tool is called Probuild.
6. Run probuild in the following way:
probuild
Probuild will lead you through a series of choices that you
can make to build a C application (and other things). For more
information on using Probuild see the Progress System
Administration Guide. The choices you need to create the dyndemo
application are as follows:
A)At the Progress EUC dialog box, press f1 to continue without
entering a directory name. This will create the link script in your
working directory. If you want to create it somewhere else, enter
a directory name and press continue.
B)At Product List dialog box, move the cursor down to highlight
ESQL/C Large client (full). Now press tab until you reach the
CONTINUE button and press ENTER. This will create a large client
application vs. the small client application. For more infomration
on the distinction between the two, read chapter 1 of the
Embedded SQL Guide and Reference.
C)At the Link Script/executable names dialog box, press f1 to
take the defaults (link script name: ldesqlc and executable
name: fullesql) or you can change the names of the link script
that is to be generated. You can also change the name of your
C application's name in the dialog box.
D)At the Configurable Elements dialog box, press f1 to take
the defaults.
E)At the Object files dialog box, enter the name of the object
file that you want to include in the application. In this case it
is dyndemo.o. Enter it and press f1.
F)At this point, the link script is being generated. You will
end up back at the Product List dialog box. Hit f4 twice to
quit out of Probuild.
7. Now look in your working directory. You should have a ldesqlc
link script (or whatever name you chose if you did not take
the default). Run ldesqlc simply by typing at the prompt:
ldesqlc
8. When ldesqlc is finished there should be a C executable
in your working directory. It will be called fullesql
unless you changed the name of it during probuild.
9. Now you have the dyndemo application (named fullesql)
that you can run by typing:
fullesql sports -1
10. Since dyndemo is an example application of dynamic
ESQL, you will be able to type in any query you
want and dyndemo will process it. When you first
run it you will be given a list of 'legal' sql commands
that you can enter.
Try out something such as:
select name, address from customer.
OR
select order\-date from order.
OR
quit
Progress Software Technical Support Note # 15484