📄 ch66.htm
字号:
<META NAME="ROBOTS" CONTENT="NOINDEX, NOFOLLOW">
<SCRIPT>
<!--
function displayWindow(url, width, height) {
var Win = window.open(url,"displayWindow",'width=' + width +
',height=' + height + ',resizable=1,scrollbars=yes');
}
//-->
</SCRIPT>
</HEAD>
-->
<font face="Arial,Helvetica" size="-1" color="#006666">
<b>Linux</b></font><p>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
<UL>
<LI><A HREF="#Heading1">- 66 -</A>
<UL>
<LI><A HREF="#Heading2">Databases</A>
<UL>
<LI><A HREF="#Heading3">NOTE</A>
<LI><A HREF="#Heading4">What Is xBase?</A>
<LI><A HREF="#Heading5">What Is FlagShip?</A>
<LI><A HREF="#Heading6">NOTE</A>
<LI><A HREF="#Heading7">Installing FlagShip</A>
<UL>
<LI><A HREF="#Heading8">FIGURE 66.1.</A>
<LI><A HREF="#Heading9">FIGURE 66.2.</A>
</UL>
<LI><A HREF="#Heading10">Using FlagShip</A>
<UL>
<LI><A HREF="#Heading11">FIGURE 66.3.</A>
</UL>
<LI><A HREF="#Heading12">Porting Existing Applications</A>
<LI><A HREF="#Heading13">dbMan</A>
<LI><A HREF="#Heading14">NOTE</A>
<LI><A HREF="#Heading15">LINCKS</A>
<LI><A HREF="#Heading16">NOTE</A>
<LI><A HREF="#Heading17">Other Database Products</A>
<LI><A HREF="#Heading18">Summary</A>
</UL>
</UL>
</UL>
<P>
<HR SIZE="4">
<H2 ALIGN="CENTER"><A NAME="Heading1<FONT COLOR="#000077">- 66 -</FONT></H2>
<H2 ALIGN="CENTER"><A NAME="Heading2<FONT COLOR="#000077">Databases</FONT></H2>
<P>IN THIS CHAPTER</P>
<UL>
<LI>What Is xBase?
<P>
<LI>What Is FlagShip?
<P>
<LI>Installing FlagShip
<P>
<LI>Using FlagShip
<P>
<LI>Porting Existing Applications
<P>
<LI>dbMan
<P>
<LI>LINCKS
<P>
<LI>Other Database Products
</UL>
<P><BR>
This chapter covers some common database applications for Linux. The applications
we focus on primarily in this chapter are FlagShip and dbMan V. We also briefly look
at LINCKS, a free object-oriented database management system (DBMS) for Linux.</P>
<P>About a decade ago, there was only one database system in widespread use, Ashton-Tate's
dBASE. Before Windows came along, practically every database under DOS was written
in dBASE. As UNIX developed on the small platforms, ports of the dBASE system emerged
there too. Although the ownership of the dBASE package was transferred several times,
a Windows-based version didn't appear fast enough (and wasn't stable enough) to keep
the popularity of the dBASE system alive. Soon, other databases began to be used
in place of dBASE.</P>
<P>Along with the development of faster and more powerful versions of dBASE, several
companies introduced compatible products that extended the capabilities of the dBASE
language. These products, written to the dBASE language set, were generically called
xBase to show their ties to dBASE. A few of these xBase systems became very popular
with programmers, in particular Clipper, a dBASE-compatible language compiler that
accelerated the execution speed of dBASE applications enormously.</P>
<P>Although many programmers think of dBASE as a vintage database system now, there
are still thousands (if not millions) of applications that were written using that
relational database package. Many of these packages are still in use today, either
in the same format as originally developed or ported to newer xBase versions and
newer operating systems. Because it is unlikely that xBase languages and applications
will ever go away, it is perhaps no surprise that an xBase port for Linux was introduced.</P>
<P>The company that offers FlagShip, the dBASE- and Clipper-compatible database system,
offers versions for many operating systems, mostly UNIX based. Their Linux version
is a commercial product, selling for about $199 in the United States. However, several
FlagShip demo versions are available that expire after 10 or 30 days, allowing you
to see whether your existing dBASE or Clipper applications will run under Linux.
If they will, and if you want to move them over, you can then purchase a full copy
of FlagShip.
<DL>
<DT></DT>
</DL>
<DL>
<DD>
<HR>
<A NAME="Heading3<FONT COLOR="#000077"><B>NOTE:</B> </FONT>Because of copyright
restrictions, we could not get a demo version of FlagShip on the CD-ROM accompanying
this book. You can download the FlagShip demos from various Web sites, and you can
find them through a search engine such as AltaVista (<TT>http://www.altavista.digital.com</TT>)
or Yahoo! (<TT>http://www.yahoo.com</TT>), or directly from the vendor of FlagShip,
Multisoft Datentechnik Gmbh, at <TT>http://www.fship.com</TT>. There is also an FTP
server for the company at <TT>ftp://fship.com/pub/multisoft</TT>. The demo versions
are quite large (about 4.5MB), so if you want to try FlagShip, you might want to
find it on a sampler Linux CD-ROM to save connect time.
<HR>
</DL>
<H3 ALIGN="CENTER"><A NAME="Heading4<FONT COLOR="#000077">What Is xBase?</FONT></H3>
<P>xBase is a generic term for various implementations of what was originally the
dBASE programming language. The main players in the DOS version of this database
are FoxPro (now owned by Microsoft), dBASE V (now owned by Borland), and Clipper
(owned by Computer Associates).</P>
<P>xBase is a language that has statements normally found in programming languages,
such as <TT>IF</TT>, <TT>ELSE</TT>, <TT>ENDIF</TT>, and <TT>WHILE</TT>. The programming
language structure is designed for accessing records in databases and not for general-purpose
programming. For example, the <TT>GOTO</TT> statement in xBase refers to a record
in a database, not a location in the program code. xBase has some powerful statements
for processing files and getting data from forms and screens.</P>
<P>In addition, setting up relations between files is easy with xBase. The names
of all fields in a file, and their types and lengths, are recorded in the file header.
New fields can be added to a file without changing programs that use the file. The
scheme allows for having different, disjointed programs all accessing the database
file in their own way and all using the fields in the header.</P>
<P>The three major manufacturers of xBase databases have largely ignored Linux as
a platform for their products. What we have for Linux are FlagShip and dbMan (from
Versasoft Corporation). Both of these products run on several implementations of
UNIX.</P>
<P>Comparing the two products is like comparing apples and oranges. FlagShip is patterned
after Clipper Version 5. The dbMan package resembles dBASE III+ or FoxPlus. FlagShip,
like Clipper, is a compiler. dbMan is primarily an interpreter, although it is possible
to "compile" dbMan programs. FlagShip is also an object-oriented language,
which makes it philosophically different from dbMan, as well as from FoxPro and dBASE.
Clipper and FlagShip have several C-like features. Actually, the resemblance is a
plus for Linux users.</P>
<P>The target markets of the two products are also different. dbMan is targeted primarily
at individual users. If you want a program you can run on your desk to keep track
of time billed to clients or to maintain a phone list of customers or your sales
record, dbMan can do the job.</P>
<P>By contrast, FlagShip might be overkill for simple database operations such as
mailing or customer-tracking lists--in other words, for the casual user, not the
programmer. This is not to say that you cannot use it for simple applications, but
you might have to learn a bit of programming to really use FlagShip's powerful features.
FlagShip is more realistically aimed at people who want to develop or port software
packages. Traditionally, dBASE files always have separate data (<TT>.DBF</TT>) and
index files. The format of data files is pretty much uniform for all xBases. It is
hard to find two products that use the same index file formats, but you can use the
same <TT>.DBF</TT> files with both FlagShip and dbMan.
<H3 ALIGN="CENTER"><A NAME="Heading5<FONT COLOR="#000077">What Is FlagShip?</FONT></H3>
<P>FlagShip is a compiler, meaning it produces executable code with no intermediary
pseudo-code. There is no interpretive version of FlagShip, so you might need an interpreter
such as FoxPro or dBASE to develop complex applications. FlagShip was designed to
allow existing xBase applications to run without modification (or a minimum of modification,
in some cases, to correct filename problems) under Linux and other UNIX versions.
There are no runtime or user royalty fees, so after an application has been developed
and compiled, it can be distributed anywhere without royalties being paid to the
authors.
<DL>
<DT></DT>
</DL>
<DL>
<DD>
<HR>
<A NAME="Heading6<FONT COLOR="#000077"><B>NOTE: </B></FONT>Several documents
are available for FlagShip from FTP and Web sites. Take care to download the English
files, because most sites have both English and German documents available (the company
that offers FlagShip is based in Germany).
<HR>
</DL>
<P>FlagShip is fully compatible with dBASE and Clipper, as well as most other xBase
versions, such as Fox, FoxPlus, FoxPro, dbMan, and QuickSilver. It includes all the
really neat features of the xBase compatibles, such as these:
<UL>
<LI>Macro support
<P>
<LI>Arrays, objects, and code blocks
<P>
<LI>User-defined functions and user-defined commands
<P>
<LI>Index and array sorts
<P>
<LI>Compatibility with most xBase file formats, including <TT>.dbf</TT>, <TT>.dbt</TT>,
<TT>.mem</TT>, <TT>.lbl</TT>, <TT>.frm</TT>, and <TT>.fmt</TT>
<P>
<LI><BR>
A C API for interfacing C code and FlagShip code in one application
</UL>
<P>FlagShip has no equivalent of the dBASE dot prompt or interactive command interface
found in other xBase products. There is, however, a public-domain program called
dbu that provides the capability to create files and indexes; add, change, or locate
records; and browse files interactively. dbu is available from several sites on the
Web (use AltaVista or another search engine to locate current sites).</P>
<P>FlagShip uses the curses toolkit for its user interface. During installation,
you get a set of terminfo files specifically for FlagShip. When running a FlagShip
program in an xterm, you might get hieroglyphics rather than line-drawing characters.
Fiddling with the <TT>acsc</TT> parameter in the <TT>fslinxterm terminfo</TT> entry
might not help. Try using the vga font that comes with the DOSemu package.</P>
<P>FlagShip doesn't have a function specifically for managing pull-down menus. FlagShip
and Clipper programmers normally use <TT>@PROMPT/MENU TO</TT> statements to create
the horizontal menu, and use a function called <TT>ACHOICE()</TT> for the vertical
menus. You can set hot keys with the statement <TT>SET KEY keyid TO</TT> statement.
Normally, the statement would be a function invocation. Within this function, you
can call the function <TT>READVAR()</TT> to find out which field the cursor was in
when the key was pressed. An input field can be validated by the addition of the
<TT>VALID</TT> statement parameter to the <TT>@SAY/GET</TT> statement. Again, the
statement would normally be a function invocation. Within the function, the value
the user typed could be looked up in a database file.</P>
<P>FlagShip has functions for managing windows that work very nicely, but the functions
are not part of the basic package. You have to buy the FStools library. As the name
suggests, the FStools library is a clone of the Clipper Tools library. There are
also windowing functions in the NanForum library (containing mathematical and statistics
functions), which is public domain.</P>
<P>A key feature of FlagShip is the <TT>TBROWSE()</TT> object. You use this in place
of the <TT>BROWSE</TT> command that exists in other languages. If you don't have
any previous experience with object-oriented programming, setting up <TT>TBROWSE()</TT>
for the first time is not easy. The best course of action is to use the examples
and samples in the fsman pages. FlagShip is picky about reserved words. If you have
a filename such as browse, you are likely to run into problems running programs.
Keep a list of all the reserved words in FlagShip, and avoid using these as file
or program names. Check the list of reserved words in the fsman pages.</P>
<P>FlagShip programs can be attached to WWW pages. This makes it possible for Net
surfers to access and update databases. This feature, plus the capability to link
in your C and C++ programs, makes FlagShip a very powerful data management tool.</P>
<P>FlagShip has an online reference program called fsman. fsman contains the entire
FlagShip manual of more than 1000 pages. This means that you won't have thick manuals
all over your desk. The samples of code in the manual can be saved as text files
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -