Getting Started

Chapter Updated 8/14/03


Overview

Welcome to Xbase DBMS. Xbase DBMS is a collection of specifications, programs, utilities and a C++ class library for manipulating Xbase type datafiles and indices. Xbase has been developed and produced by several people from around the world via the internet.

The term Xbase is often used used to describe the format of the original DBase, Clipper and Foxbase (.DBF) files. Many vendors support the industry standard Xbase file format and are committed to this technology for many years to come, thus insuring continued support.

The original purpose of the Xbase library was to provide reliable and economical programming tools to programmers for reading, writing and updating DBF databases, indices and memo fields.



System Requirements

To use Xbase DBMS, the following items are needed:

A computer and C/C++ compiler.

The original source code is developed on a Linux platform with the GCC public domain C/C++ compiler.

Xbase DBMS has been successfully ported and runs on Linux, Sun Solaris, OpenVMS, FreeBSD, OS2 and DOS/Windows (Using the large memory model).

This software is not intended to be used on any system using an SCO operating system.


Classes and User Interface

There are six classes in the Xbase library which are available for use in a typical Xbase application program.


Xbase Classes - Version 1.8.0 and newer

ClassBasic DescriptionHow UsedOld Class
Name
xbXBaseBasic Xbase ClassEvery program gets one of theseXBASE
xbDbfDatabase and Field classNeed one of these for each open DBF fileDBF
xbNdxNdx index classNeed one of these for each open NDX indexNDX
xbNtxNtx index classNeed one of these for each open NTX index
xbStringString classUsed for handling strings
xbHtmlHtml generation classNeeded for creating HTML codeHTML


There are other classes used internally by these Xbase classes, but most application programs need not to be concerned with. These classes are xbStack - used for stack data structures, xbExpn - used for expression logic, and xbDate - used for date manipulation logic.


Portability, Type Defs and Structures

To effectively make the Xbase library as portable across platforms as possible, three things occured.

  • First, the software was developed to run and compile on either big endian or little endian computers and store all numeric data in little endian format.

  • Secondly, field types must be consistently defined in each environment. The types.h file defines the xbase data types. To modify the Xbase code base to function in a different (non ported to yet) environment, start by modifying the types.h file for your site and recompile.

  • Thirdly, support for unix automake and autoconf has been to provided support on a wide variety of unices.


    Field Types

    TypeDescription
    xbULongunsigned long int
    xbUShortunsigned short int
    xbShortshort int
    xbLonglong
    xbFloatfloat
    xbDoubledouble
    charchar
    voidvoid
    struct SCHEMAUsed for defining record structures


    Xbase was designed for portability utilizing standard ANSI-C compliant code. If you decide to write updates to the Xbase project, please try to keep your work to standard generic ANSI-C (no special DOS/WINDOWS Calls).


    Compilation Overview

    If you are building the sources on a Linux/Unix platform:

    Download the source
    ./configure
    make
    su
    make install
    exit



    Before compiling the library, you may need to modify the options for your environment. Do "./configure --help" for a list of the current options

    On my server, I had to:
  • Verify the library and associated links were copied from xbase/xbase/.libs into /usr/local/lib
  • Add /usr/local/lib is in /etc/ld.so.conf
  • execute program ldconfig as root to refresh the new libs

    Actual milage at your site may vary.


    Building a program with the Xbase library

    Create a directory for your project:

    cd /home/me
    mkdir MyProject
    cd MyProject
    vi MyProg.cpp

    To use the Xbase classes, include the following header file in the program:

    #include <xbase/xbase.h>

    For more details, check out the sample programs in the xbase/examples directory.


    Compiling and Linking Unix Application Program for v3.0 later

    The install script should have provided specific instructions for your environment on how to link with the xbase library.

    In the Linux environment, assuming that you are using shared libraries, and usr/local/lib has been added to the /etc/ld.so.conf file, and the ldconfig command was executed

    To Compile:
    g++ -c -Wall -I/usr/include -I/usr/src/linux/include-asm-i386 -I/usr/local/include -I/usr/local/xbase myprog.cpp

    To Link Edit:
    g++ -o myprog myprog.o libxbase.so


    Compiling an Application Program with Borland v4.5 C/C++compiler

    With Borland C compiler: bcc -Ic:\xbase\src myprog.cpp -Lc:\xbase\src\xbase.lib


    Getting the latest development version of XBase


    The Xbase project is in an ongoing state of development with new enhancements being added and bug fixes being applied as they are found and the package maintainers have time. There are several programmers from various parts of the world working on Xbase. If you would like to get the latest version of the Xbase library for your project, it is available on sourceforge.net.

    Notes about using the current development library

  • 1 - Library functions may or may not be documented
  • 2 - The library may or may not be stable. This is the development library and is being updated with current code changes. If you are using it, and it does not behave the way you think it should, you may want to drop a note to xdb-devel@lists.sourceforge.net This may sound a little unsettling, but the library is generally stable. It goes through periods of time where it is in a state of flux when major changes are occurring, but for the most part it is probably OK to use.
  • 3 - If you have changes to contribute to the library, mail your updates to xdb-devel@lists.sourceforge.net
    .

    System Limitations


    Maximum size of a database file is the size of LONG - 2,147,483,647 bytes
    Total number of fields in a database - 1024
    Total number of characters in all fields - 32767
    Maximum number of characters in a field - 254
    Total number of records in a file - 1 billion
    Maximum index key length - 100 bytes
    Maximum .DBT file memo block size - 32256
    Maximum expression result length - 100 bytes
    Maximum NDX index key length - 100 bytes




    Xbase Options - Unix Automake environment

    OPTIONDESCRIPTION
    --without-xbase-debugTurns off xbase debugging code
    --without-index-ndxTurns off NDX index options
    --without-index-ntxTurns off NTX index options
    --without-memo-fieldsTurns off memo fields
    --without-expressionsTurns off expression processing
    --without-ui-htmlTurns off HTML user interface class
    --without-xbase-lockingTurns off xbase locking
    --without-xbase-debugTurns off debug logic
    --without-exceptionsTurns on exception processing
    --with-castellanoTurn on castellano/spanish date options
    --without-realdeleteTurn off Xbase record deletion
    --without-xbase-filterTurn off Xbase filter logic


    Use these options on the command line when executing the ./configure command. Also, you can execute ./configure --help for a complete list of all unix configure options.

    Q Why turn any of thes options off?
    A Smaller library