File: defurne2.html

package info (click to toggle)
lg-issue36 2-4
  • links: PTS
  • area: main
  • in suites: woody
  • size: 2,920 kB
  • ctags: 242
  • sloc: makefile: 36; sh: 4
file content (250 lines) | stat: -rw-r--r-- 13,029 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
<!--startcut ==========================================================-->
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
<HTML>
<HEAD>
<title>Evaluating postgreSQL for a Production Environment LG #36</title>
   <META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1">
   <META NAME="GENERATOR" CONTENT="Mozilla/4.07 [en] (X11; I; Linux 2.0.35 i486) [Netscape]">
</HEAD>
<BODY BGCOLOR="#FFFFFF" TEXT="#000000" LINK="#0000FF" VLINK="#A000A0"
ALINK="#FF0000">
<!--endcut ============================================================-->

<H4>
"Linux Gazette...<I>making Linux just a little more fun!</I>"
</H4>

<P> <HR> <P> 
<!--===================================================================-->

<center>
<H1><font color="maroon">Evaluating postgreSQL for a Production Environment</font></H1>
<H4>By <a href="mailto:jurgen.defurne@scc.be">Jurgen Defurne</a></H4>
</center>
<P> <HR> <P>  

<H1>
Introduction</H1>
With the advent of relatively powerful, free and/or cheap software, I wanted
to see if I was able to create a production environment around Linux and
a DBMS. In the past I have worked with several DBMS products in several
environments. My goal was to evaluate the Linux/postgreSQL against the
several environments I am familiar with. Out of these environments I will
pick the aspects which I think are important in a production environment.
<H1>
Past production environments</H1>
I have worked in three stages of production environment. These were the
unconnected PC environment, the connected PC environment (file/print server
networking), and multi-user/multi-tasking environment (minicomputer). I
will introduce the several tools in order of this complexity.
<P>Some terms will need to be explicitly defined, because the xBase terminology
is sometimes confusing. The term 'database' here means the collection of
several related tables which are needed to store organised data. The term
'table' is used to define one collection of identical data, a set. This
is because in the original xBase languages, 'database' was used as to mean
'table'.
<H2>
FoxBase</H2>
Effectively being a much faster clone of dBase III, FoxBase contained the
minimum necessary to define the tables of a database and a programming
language which contained all necessary to write applications very quickly.
<P>A database consisted of several tables and their indexes. The association
of tables and their indexes must explicitly be done using commands.
<P>The programming language used is completely procedural. It contains
statements to create menu's, open and close tables, filter tables (querying),
insert, update and delete records, view records through screens and a browse
statement. Defining all these things in a program is quite straightforward.
Records are manipulated as program variables. All data is stored in ASCII
format.
<P>One special feature which originated in dBase, are 'macro's'. These
macro's are text strings, which could be compiled and interpreted at run-time.
This was a necessary feature, because most statements took string arguments
without quotes, e.g. OPEN MY_TABLE. If you wanted to define a statement
with a parameter, you could not directly refer to a variable. Trying to
execute OPEN ARG_TABLE, the program would search for the file 'ARG_TABL'.
To circumvent this problem you need to code the following :
<P><TT>&nbsp;&nbsp;&nbsp; ARG_TABLE = "MY_TABLE"<BR>
&nbsp;&nbsp;&nbsp; OPEN &amp;ARG_TABLE</TT>
<H2>
Clipper</H2>
Clipper originated as a dBase compiler, but added soon after powerful extensions
to the language. I have also worked with the Summer '87 and the 5.0 version.
At the database level, nothing changed very much from FoxBase, but at the
user interface level and the programming level, several advanced features
offered faster development turn-around times and advanced user interfacing.
The macro feature was still available, but Clipper expanded it through
code blocks. In the original implementation, a macro needed to be evaluated
every time it was used. In cases where macro's where used to filter data,
this amounted to waste of computing time. The introduction of the code
block made it possible to compile a macro just once and then use the compiled
version.
<P>Other features where the introduction of some object-oriented classes
for user interfacing, a powerful multi-dimensional array type, declarations
for static and local variables and a plethora of functions to manipulate
arrays and tables. The flipside of all this was that learning to effectively
use the language took some more time. I have two books about Clipper 5.0
and they are quite large.
<H2>
FoxPro 2.0</H2>
FoxPro was the successor of FoxBase. It added GUI-features to the text-interface,
making it possible to work with overlapping windows. FoxPro 2.0 also added
embedded SQL statements. It was only a subset with SELECT, INSERT, UPDATE
and DELETE, but this offered already a substantial advantage over the standard
query statements. It also offered a better integration between tables and
their indexes, and one of the most powerful query optimizers ever developed.
They also provided some development tools, of which the most important
where the screen development and the source documentation tools.
<P>Clipper and FoxPro made it also possible to program for networks and
thus enable multi-user database systems.
<H2>
WANG PACE</H2>
WANG PACE is a fully integrated DBMS development system which runs on the
WANG VS minicomputers. It offers an extended data dictionary with field-
and record-level validation, HL-language triggers and view-definitions.
All defined objects contain a version count. When an object is modified
and subsequent programs are not, then a runtime error is generated when
compiled versions don't match DD versions. It also offers a powerful screen
editor, a report editor and a query-by-example system. Access through COBOL,
COBOL85 or RPGII is available with a pre-processor which compiles embedded
statements into API-calls.
<H1>
Summary of important features</H1>
If I look in retrospect to these systems, what were the important features
which made programming more productive ? This reference must be made against
postgreSQL and the available libraries for interfacing to the back-end.
It must also be made from the point of the production programmer, who must
be able to write applications without being bothered by irrelevant details.
<UL>
<LI>
Field names translate to native variable names</LI>

<BR>Defining a field name for a table makes it available under the same
name to the program which can then use it as an ordinary, native variable.
<BR>&nbsp;
<LI>
Uniform memory allocation system</LI>

<BR>The xBase systems have a dynamic memory allocation scheme, which is
completely handled by the runtime library. COBOL is fully statically allocated.
In none of these languages the programmer needs to be concerned with tracking
allocated memory.
<BR>&nbsp;
<LI>
Direct update through the current record</LI>

<BR>The manipulated record is available to update the table through one
or another UPDATE statement.
<BR>&nbsp;
<LI>
Database statements have the same format as the application language</LI>

<BR>When programming in xBase, the statements to extract and manipulate
data from the database tables formed an integral part of the procedure
language.
<BR>In COBOL, the statements where embedded and processed by a preprocessor.
The syntax of the available statements was made to resemble COBOL syntax,
with its strong and weak points.
<BR>&nbsp;
<LI>
Simple definition and usage of screens</LI>

<BR>In xBase, there are simple yet powerful statements available for defining
screens. Screens are called through only one or two statements.
<BR>In WANG PACE, screens can only be defined through the screen editor.
There are three statements available : one to use menu's, one to process
one record in a cursor and an iterative version to process all records
in a cursor. Most screen processing is handled through the run-time libraries.</UL>

<H1>
Features available when installing postgreSQL</H1>
The four first features can be installed using the ecpg preprocessor. This
makes it possible to use native program variables, you don't have to worry
about memory allocation, because the run-time library takes care of it,
and updates can also take place using the selected program-variables.
<P>What is missing, is a special form of include statement. Now you need
to know which fields are in a table if you want to use a 'exec sql declare'
statement. It would be better if there was something like 'exec sql copy
fields from &lt;tablename>'. If the tabledefinition then changes, recompiling
the program will adjust to the new definitions.
<P>Using the pgaccess program (under X-windows) provides access to the
data dictionary in a more elegant manner.
<H1>
Summary</H1>
I started out to write a critique on postgreSQL because of the summary
documentation which is delivered in the package. This made it rather hard
to find and use all the components which provide additional functions.
<P>I started describing my experiences on other platforms to get an insight
in what a production environment should deliver to the programmer. Then
I started to look closely at the delivered documentation and to my surprise
all components that I needed where in fact in the package.
<P>The following critique still remains however. The documentation of the
package is too much fragmented, and most parts of the documentation are
centered around technical aspects which do not bother the production programmer.
This is understandable however. The documentation is written by the same
people that implement them. I know of my own experience that writing a
user manual is very hard and it is easy to get lost in the technical details
of the implementation that you know about.
<P>The following parts of postgreSQL are important for the production programmer,
and their documentation should be better integrated.
<UL>
<LI>
The psql processor</LI>

<P><BR>This is a nice tool to define all necessary objects in a database,
to get acquainted with SQL and to test ideas and verify joins and queries.
<LI>
The ecpg preprocessor</LI>

<P><BR>This is the main production tool to write applications which use
database manipulation statements. This capacity should probably be extended
to other languages too. Since all bindings from the selected cursor are
made to program variables, records can be processed without the hassle
of converting them from and to ASCII, and updates can be made through the
'exec sql update' statement.
<LI>
The pgaccess package</LI>

<P><BR>The pgaccess package provides access to all parts of the database
and offers the ability to design screens and reports. It is still in a
development phase. I hope it will be extended in the future, because the
basic idea is excellent and the first implementations are worthwile.</UL>
The libpq library is of no real value to a production programmer. It should
be mainly a tool to be used in implementing integrated environments and
database access languages. It could e.g. be used to create an xBase like
environment (for those who wish to use this).
<H1>
Further research</H1>
In the following weeks (months) I hope to setup a complete database system
over a network, with one server and several types of clients (workstation,
terminal, remote computer) through several interfaces (Ethernet, serial
connections). I will investigate the several platforms for application
development. I intend to have a closer look at the provided tools in the
postgreSQL package (developing a simple database for my strip book collection),
but I will also look at the possibilities that Java offers a development
platform with JDBC, screen design and application programming.
<P>One last note : for the moment I concentrate on using tools that I don't
need to pay for, because I need the money for my hardware platforms and
for my house. This does not mean that I am a die-hard 'software should
be gratis' advocate. A production environment favors to pay for software,
because then it knows that it has a complete tool with support and warranty
(horror stories about bad support not withstanding).

<!--===================================================================-->
<P> <hr> <P> 
<center><H5>Copyright &copy; 1999, Jurgen Defurne <BR> 
Published in Issue 36 of <i>Linux Gazette</i>, January 1999</H5></center>

<!--===================================================================-->
<P> <hr> <P> 
<A HREF="./lg_toc36.html"><IMG ALIGN=BOTTOM SRC="../gx/indexnew.gif" 
ALT="[ TABLE OF CONTENTS ]"></A>
<A HREF="../lg_frontpage.html"><IMG ALIGN=BOTTOM SRC="../gx/homenew.gif"
ALT="[ FRONT PAGE ]"></A>
<A HREF="./marsden.html"><IMG SRC="../gx/back2.gif"
ALT=" Back "></A>
<A HREF="./blair.html"><IMG SRC="../gx/fwd.gif" ALT=" Next "></A>
<P> <hr> <P> 
<!--startcut ==========================================================-->
</BODY>
</HTML>
<!--endcut ============================================================-->