From 4875a3dd9b183dcd2256e2abfc4ccf7484c233b4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rg=20Frings-F=C3=BCrst?= Date: Wed, 7 Dec 2022 13:17:14 +0100 Subject: New upstream version 4.0.2 --- html/Makefile.am | 34 ---- html/Makefile.in | 254 ------------------------- html/Xb2cpp.htm | 81 -------- html/copying.lib | 443 ------------------------------------------- html/index.htm | 39 ---- html/xba1.htm | 65 ------- html/xba2.htm | 110 ----------- html/xbapps.htm | 39 ---- html/xbase.jpg | Bin 6421 -> 0 bytes html/xbbib.htm | 63 ------- html/xbc1.htm | 232 ----------------------- html/xbc11.htm | 40 ---- html/xbc12.htm | 566 ------------------------------------------------------- html/xbc13.htm | 470 --------------------------------------------- html/xbc14.htm | 200 -------------------- html/xbc15.htm | 338 --------------------------------- html/xbc16.htm | 202 -------------------- html/xbc17.htm | 352 ---------------------------------- html/xbc18.htm | 261 ------------------------- html/xbc2.htm | 276 --------------------------- html/xbc3.htm | 91 --------- html/xbc4.htm | 151 --------------- html/xbc5.htm | 156 --------------- html/xbc6.htm | 150 --------------- html/xbc7.htm | 176 ----------------- html/xbc8.htm | 130 ------------- html/xblock.htm | 281 --------------------------- 27 files changed, 5200 deletions(-) delete mode 100755 html/Makefile.am delete mode 100755 html/Makefile.in delete mode 100755 html/Xb2cpp.htm delete mode 100755 html/copying.lib delete mode 100755 html/index.htm delete mode 100755 html/xba1.htm delete mode 100755 html/xba2.htm delete mode 100755 html/xbapps.htm delete mode 100755 html/xbase.jpg delete mode 100755 html/xbbib.htm delete mode 100755 html/xbc1.htm delete mode 100755 html/xbc11.htm delete mode 100755 html/xbc12.htm delete mode 100755 html/xbc13.htm delete mode 100755 html/xbc14.htm delete mode 100755 html/xbc15.htm delete mode 100755 html/xbc16.htm delete mode 100755 html/xbc17.htm delete mode 100755 html/xbc18.htm delete mode 100755 html/xbc2.htm delete mode 100755 html/xbc3.htm delete mode 100755 html/xbc4.htm delete mode 100755 html/xbc5.htm delete mode 100755 html/xbc6.htm delete mode 100755 html/xbc7.htm delete mode 100755 html/xbc8.htm delete mode 100755 html/xblock.htm (limited to 'html') diff --git a/html/Makefile.am b/html/Makefile.am deleted file mode 100755 index 62aaa21..0000000 --- a/html/Makefile.am +++ /dev/null @@ -1,34 +0,0 @@ -## Process this file with automake to produce Makefile.in -## -# This file is part of the XBase libraries -# Copyright (C) 1998,1999 Vitaly Fedrushkov - -# This library is free software; you can redistribute it and/or -# modify it under the terms of the GNU Library General Public -# License as published by the Free Software Foundation; either -# version 2 of the License, or (at your option) any later version. - -# This library is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# Library General Public License for more details. - -# You should have received a copy of the GNU Library General Public -# License along with this library; see the file COPYING.LIB. If not, -# write to the Free Software Foundation, Inc., or see -# http://www.gnu.org/. - -EXTRA_DIST = COPYING.LIB Xb2cpp.htm xbase.jpg index.htm xba1.htm \ - xba2.htm xbapps.htm xbbib.htm xbc1.htm xbc2.htm xbc3.htm \ - xbc4.htm xbc12.htm xbc13.htm xbc14.htm xbc15.htm xbc16.htm \ - xbc17.htm xbc18.htm xbc2.htm xbc3.htm xbc4.htm xbc5.htm xbc6.htm \ - xbc7.htm xbc8.htm xblock.htm xbc11.htm - -## Uncomment these to have docs installed by `make install`: - -## htmldir = $(prefix)/doc/$(PACKAGE)-$(VERSION)/html -## html_DATA = $(EXTRA_DIST) - -MAINTAINERCLEANFILES = Makefile.in - -CLEANFILES = *.bak Makefile.in \ No newline at end of file diff --git a/html/Makefile.in b/html/Makefile.in deleted file mode 100755 index 2902a47..0000000 --- a/html/Makefile.in +++ /dev/null @@ -1,254 +0,0 @@ -# Makefile.in generated by automake 1.6.3 from Makefile.am. -# @configure_input@ - -# Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002 -# Free Software Foundation, Inc. -# This Makefile.in is free software; the Free Software Foundation -# gives unlimited permission to copy and/or distribute it, -# with or without modifications, as long as this notice is preserved. - -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY, to the extent permitted by law; without -# even the implied warranty of MERCHANTABILITY or FITNESS FOR A -# PARTICULAR PURPOSE. - -@SET_MAKE@ - -# This file is part of the XBase libraries -# Copyright (C) 1998,1999 Vitaly Fedrushkov - -# This library is free software; you can redistribute it and/or -# modify it under the terms of the GNU Library General Public -# License as published by the Free Software Foundation; either -# version 2 of the License, or (at your option) any later version. - -# This library is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# Library General Public License for more details. - -# You should have received a copy of the GNU Library General Public -# License along with this library; see the file COPYING.LIB. If not, -# write to the Free Software Foundation, Inc., or see -# http://www.gnu.org/. -SHELL = @SHELL@ - -srcdir = @srcdir@ -top_srcdir = @top_srcdir@ -VPATH = @srcdir@ -prefix = @prefix@ -exec_prefix = @exec_prefix@ - -bindir = @bindir@ -sbindir = @sbindir@ -libexecdir = @libexecdir@ -datadir = @datadir@ -sysconfdir = @sysconfdir@ -sharedstatedir = @sharedstatedir@ -localstatedir = @localstatedir@ -libdir = @libdir@ -infodir = @infodir@ -mandir = @mandir@ -includedir = @includedir@ -oldincludedir = /usr/include -pkgdatadir = $(datadir)/@PACKAGE@ -pkglibdir = $(libdir)/@PACKAGE@ -pkgincludedir = $(includedir)/@PACKAGE@ -top_builddir = .. - -ACLOCAL = @ACLOCAL@ -AUTOCONF = @AUTOCONF@ -AUTOMAKE = @AUTOMAKE@ -AUTOHEADER = @AUTOHEADER@ - -am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd -INSTALL = @INSTALL@ -INSTALL_PROGRAM = @INSTALL_PROGRAM@ -INSTALL_DATA = @INSTALL_DATA@ -install_sh_DATA = $(install_sh) -c -m 644 -install_sh_PROGRAM = $(install_sh) -c -install_sh_SCRIPT = $(install_sh) -c -INSTALL_SCRIPT = @INSTALL_SCRIPT@ -INSTALL_HEADER = $(INSTALL_DATA) -transform = @program_transform_name@ -NORMAL_INSTALL = : -PRE_INSTALL = : -POST_INSTALL = : -NORMAL_UNINSTALL = : -PRE_UNINSTALL = : -POST_UNINSTALL = : -host_alias = @host_alias@ -host_triplet = @host@ - -EXEEXT = @EXEEXT@ -OBJEXT = @OBJEXT@ -PATH_SEPARATOR = @PATH_SEPARATOR@ -AMTAR = @AMTAR@ -AS = @AS@ -AWK = @AWK@ -CC = @CC@ -CXX = @CXX@ -DEPDIR = @DEPDIR@ -DLLTOOL = @DLLTOOL@ -ECHO = @ECHO@ -GXXVER = @GXXVER@ -INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ -LIBTOOL = @LIBTOOL@ -LN_S = @LN_S@ -OBJDUMP = @OBJDUMP@ -PACKAGE = @PACKAGE@ -RANLIB = @RANLIB@ -RELEASE = @RELEASE@ -RHREL = @RHREL@ -STRIP = @STRIP@ -VERSION = @VERSION@ -XSUBDIRS = @XSUBDIRS@ -am__include = @am__include@ -am__quote = @am__quote@ -doxygen = @doxygen@ -install_sh = @install_sh@ -topdir = @topdir@ - -EXTRA_DIST = COPYING.LIB Xb2cpp.htm xbase.jpg index.htm xba1.htm \ - xba2.htm xbapps.htm xbbib.htm xbc1.htm xbc2.htm xbc3.htm \ - xbc4.htm xbc12.htm xbc13.htm xbc14.htm xbc15.htm xbc16.htm \ - xbc17.htm xbc18.htm xbc2.htm xbc3.htm xbc4.htm xbc5.htm xbc6.htm \ - xbc7.htm xbc8.htm xblock.htm xbc11.htm - - -MAINTAINERCLEANFILES = Makefile.in - -CLEANFILES = *.bak Makefile.in -subdir = html -mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs -CONFIG_HEADER = $(top_builddir)/xbase64/xbconfig.h -CONFIG_CLEAN_FILES = -DIST_SOURCES = -DIST_COMMON = COPYING.LIB Makefile.am Makefile.in -all: all-am - -.SUFFIXES: -$(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4) - cd $(top_srcdir) && \ - $(AUTOMAKE) --gnu html/Makefile -Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status - cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe) - -mostlyclean-libtool: - -rm -f *.lo - -clean-libtool: - -rm -rf .libs _libs - -distclean-libtool: - -rm -f libtool -uninstall-info-am: -tags: TAGS -TAGS: - -DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) - -top_distdir = .. -distdir = $(top_distdir)/$(PACKAGE)-$(VERSION) - -distdir: $(DISTFILES) - @list='$(DISTFILES)'; for file in $$list; do \ - if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ - dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ - if test "$$dir" != "$$file" && test "$$dir" != "."; then \ - dir="/$$dir"; \ - $(mkinstalldirs) "$(distdir)$$dir"; \ - else \ - dir=''; \ - fi; \ - if test -d $$d/$$file; then \ - if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ - cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ - fi; \ - cp -pR $$d/$$file $(distdir)$$dir || exit 1; \ - else \ - test -f $(distdir)/$$file \ - || cp -p $$d/$$file $(distdir)/$$file \ - || exit 1; \ - fi; \ - done -check-am: all-am -check: check-am -all-am: Makefile - -installdirs: - -install: install-am -install-exec: install-exec-am -install-data: install-data-am -uninstall: uninstall-am - -install-am: all-am - @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am - -installcheck: installcheck-am -install-strip: - $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ - INSTALL_STRIP_FLAG=-s \ - `test -z '$(STRIP)' || \ - echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install -mostlyclean-generic: - -clean-generic: - -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES) - -distclean-generic: - -rm -f Makefile $(CONFIG_CLEAN_FILES) - -maintainer-clean-generic: - @echo "This command is intended for maintainers to use" - @echo "it deletes files that may require special tools to rebuild." - -test -z "$(MAINTAINERCLEANFILES)" || rm -f $(MAINTAINERCLEANFILES) -clean: clean-am - -clean-am: clean-generic clean-libtool mostlyclean-am - -distclean: distclean-am - -distclean-am: clean-am distclean-generic distclean-libtool - -dvi: dvi-am - -dvi-am: - -info: info-am - -info-am: - -install-data-am: - -install-exec-am: - -install-info: install-info-am - -install-man: - -installcheck-am: - -maintainer-clean: maintainer-clean-am - -maintainer-clean-am: distclean-am maintainer-clean-generic - -mostlyclean: mostlyclean-am - -mostlyclean-am: mostlyclean-generic mostlyclean-libtool - -uninstall-am: uninstall-info-am - -.PHONY: all all-am check check-am clean clean-generic clean-libtool \ - distclean distclean-generic distclean-libtool distdir dvi \ - dvi-am info info-am install install-am install-data \ - install-data-am install-exec install-exec-am install-info \ - install-info-am install-man install-strip installcheck \ - installcheck-am installdirs maintainer-clean \ - maintainer-clean-generic mostlyclean mostlyclean-generic \ - mostlyclean-libtool uninstall uninstall-am uninstall-info-am - -# Tell versions [3.59,3.63) of GNU make to not export all variables. -# Otherwise a system limit (for SysV at least) may be exceeded. -.NOEXPORT: diff --git a/html/Xb2cpp.htm b/html/Xb2cpp.htm deleted file mode 100755 index aa9d532..0000000 --- a/html/Xb2cpp.htm +++ /dev/null @@ -1,81 +0,0 @@ - - -Xbase to Xbase DBMS C++ Converter - - - -

Xbase to Xbase DBMS C++ Converter

- -

Program Xb2cpp.pl V0.1 26-11-98

-

Author

-Hubertus Kehl, kehl@informatik.tu-muenchen.de, kehlh@hotmail.com -
Please send suggestions, bug reports, patches, etc. one of these email -adresses. -

Language

-

Perl 5.0

-

Purpose

-

Convert Dbase, Clipper, FOXPRO Source Code to XBASE C++ Code for use with -XBASE DBMS Library

-

Output

-

.cpp File and .h File

-

Arguments

-

1st arg = filename

-

Remarks

-

The script tries to keep track of the databases used in different workareas. -But the flow through your program cannot be determined, so in some cases -you have to help the script a bit by giving additional info.

-

Three special comments have been designed to add this info:

-
* XB2CPP(SelectedArea)
-or  * XB2CPP(SelectedArea,Workarea1,Alias1,Wa2,Al2...)
-or  * XB2CPP(SelA,WA1,Al1[Total1, Active1],Wa2, Al2[Tot2,Act2])
-

e.g. * XB2CPP(3,3,ZP,2,PL) will inform the script for example at the beginning -of a PROCEDURE that a database with Alias ZP is opened in workarea 3 and -a database with alias PL is opened in workarea2 and when calling this procedure -always workarea 3 is selected.

-

The third alternative of this statement makes it possible to define -the number of open indices and which one is the active index, as given -by a previous SET INDEX TO or USE and SET ORDER TO statements. The script -cannot know, which procedures, statements have been executed before and -opened indices.... So * XB2CPP(2,2,ZP[2,1]) will inform the script about -an open database alias ZP in workarea 2 which is currently selected and -has two open indices where the first one is the active one.

-

Hints

- -
    -
  1. Always give an ALIAS in USE-Statements this is needed for generation -of the Database Classnames
  2. -
  3. Give the above described additional infos where necessary.
  4. -
  5. Use ALIASes in Expressions with database fields, this helps the script -in knowing where database references are.
  6. -
  7. Replace the XXX in PutXXXField or GetXXXField manually the script is -not able to determine variable or field types. The code for getting a Textfield -(GetField) must also be corrected. Xbase DBMS Syntax requires the buffer -as second parameter, the string will not be returned ! You may use a C++ -String wrapper for this job.
  8. -
  9. PROCEDURES that will operate on two different databases where some statements -are used for both cannot be converted The script needs to know everytime -on which database the statements are operating. Either duplicate such procedures, -(one for each database), or write a generic C++ routine with pointers to -databases.
  10. -
  11. Don't assume any compilable or even working C++ source code as output. -The ambigous DBASE language, which lacks type and variable definitions -is one reason for this. This script only will help you for about 10-30% -of the conversion. The rest (which remained uppercase) has to be done manually -:)
  12. -
- -

Copyright

-

This program is free software; you can redistribute it and/or modify it -under the terms of the GNU General Public License as published by the Free -Software Foundation (version 2 of the License)

- -

This program is distributed in the hope that it will be useful, but -WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY -or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License -for more details.

-
-
-Hubertus Kehl,29-11-1998 -
- - diff --git a/html/copying.lib b/html/copying.lib deleted file mode 100755 index e3df74a..0000000 --- a/html/copying.lib +++ /dev/null @@ -1,443 +0,0 @@ -NOTE! The LGPL below is copyrighted by the Free Software Foundation, but -the instance of code that it refers to (the XBase libraries) are copyrighted -by the authors who actually wrote it. - ---------------------------------------------------------------------------- - GNU LIBRARY GENERAL PUBLIC LICENSE - Version 2, June 1991 - - Copyright (C) 1991 Free Software Foundation, Inc. - 59 Temple Place - Suite 330 - Boston, MA 02111-1307, USA. - Everyone is permitted to copy and distribute verbatim copies - of this license document, but changing it is not allowed. - -[This is the first released version of the library GPL. It is - numbered 2 because it goes with version 2 of the ordinary GPL.] - - Preamble - - The licenses for most software are designed to take away your -freedom to share and change it. By contrast, the GNU General Public -Licenses are intended to guarantee your freedom to share and change -free software--to make sure the software is free for all its users. - - This license, the Library General Public License, applies to some -specially designated Free Software Foundation software, and to any -other libraries whose authors decide to use it. You can use it for -your libraries, too. - - When we speak of free software, we are referring to freedom, not -price. Our General Public Licenses are designed to make sure that you -have the freedom to distribute copies of free software (and charge for -this service if you wish), that you receive source code or can get it -if you want it, that you can change the software or use pieces of it -in new free programs; and that you know you can do these things. - - To protect your rights, we need to make restrictions that forbid -anyone to deny you these rights or to ask you to surrender the rights. -These restrictions translate to certain responsibilities for you if -you distribute copies of the library, or if you modify it. - - For example, if you distribute copies of the library, whether gratis -or for a fee, you must give the recipients all the rights that we gave -you. You must make sure that they, too, receive or can get the source -code. If you link a program with the library, you must provide -complete object files to the recipients so that they can relink them -with the library, after making changes to the library and recompiling -it. And you must show them these terms so they know their rights. - - Our method of protecting your rights has two steps: (1) copyright -the library, and (2) offer you this license which gives you legal -permission to copy, distribute and/or modify the library. - - Also, for each distributor's protection, we want to make certain -that everyone understands that there is no warranty for this free -library. If the library is modified by someone else and passed on, we -want its recipients to know that what they have is not the original -version, so that any problems introduced by others will not reflect on -the original authors' reputations. - - Finally, any free program is threatened constantly by software -patents. We wish to avoid the danger that companies distributing free -software will individually obtain patent licenses, thus in effect -transforming the program into proprietary software. To prevent this, -we have made it clear that any patent must be licensed for everyone's -free use or not licensed at all. - - Most GNU software, including some libraries, is covered by the ordinary -GNU General Public License, which was designed for utility programs. This -license, the GNU Library General Public License, applies to certain -designated libraries. This license is quite different from the ordinary -one; be sure to read it in full, and don't assume that anything in it is -the same as in the ordinary license. - - The reason we have a separate public license for some libraries is that -they blur the distinction we usually make between modifying or adding to a -program and simply using it. Linking a program with a library, without -changing the library, is in some sense simply using the library, and is -analogous to running a utility program or application program. However, in -a textual and legal sense, the linked executable is a combined work, a -derivative of the original library, and the ordinary General Public License -treats it as such. - - Because of this blurred distinction, using the ordinary General -Public License for libraries did not effectively promote software -sharing, because most developers did not use the libraries. We -concluded that weaker conditions might promote sharing better. - - However, unrestricted linking of non-free programs would deprive the -users of those programs of all benefit from the free status of the -libraries themselves. This Library General Public License is intended to -permit developers of non-free programs to use free libraries, while -preserving your freedom as a user of such programs to change the free -libraries that are incorporated in them. (We have not seen how to achieve -this as regards changes in header files, but we have achieved it as regards -changes in the actual functions of the Library.) The hope is that this -will lead to faster development of free libraries. - - The precise terms and conditions for copying, distribution and -modification follow. Pay close attention to the difference between a -"work based on the library" and a "work that uses the library". The -former contains code derived from the library, while the latter only -works together with the library. - - Note that it is possible for a library to be covered by the ordinary -General Public License rather than by this special one. - - GNU LIBRARY GENERAL PUBLIC LICENSE - TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION - - 0. This License Agreement applies to any software library which -contains a notice placed by the copyright holder or other authorized -party saying it may be distributed under the terms of this Library -General Public License (also called "this License"). Each licensee is -addressed as "you". - - A "library" means a collection of software functions and/or data -prepared so as to be conveniently linked with application programs -(which use some of those functions and data) to form executables. - - The "Library", below, refers to any such software library or work -which has been distributed under these terms. A "work based on the -Library" means either the Library or any derivative work under -copyright law: that is to say, a work containing the Library or a -portion of it, either verbatim or with modifications and/or translated -straightforwardly into another language. (Hereinafter, translation is -included without limitation in the term "modification".) - - "Source code" for a work means the preferred form of the work for -making modifications to it. For a library, complete source code means -all the source code for all modules it contains, plus any associated -interface definition files, plus the scripts used to control compilation -and installation of the library. - - Activities other than copying, distribution and modification are not -covered by this License; they are outside its scope. The act of -running a program using the Library is not restricted, and output from -such a program is covered only if its contents constitute a work based -on the Library (independent of the use of the Library in a tool for -writing it). Whether that is true depends on what the Library does -and what the program that uses the Library does. - - 1. You may copy and distribute verbatim copies of the Library's -complete source code as you receive it, in any medium, provided that -you conspicuously and appropriately publish on each copy an -appropriate copyright notice and disclaimer of warranty; keep intact -all the notices that refer to this License and to the absence of any -warranty; and distribute a copy of this License along with the -Library. - - You may charge a fee for the physical act of transferring a copy, -and you may at your option offer warranty protection in exchange for a -fee. - - 2. You may modify your copy or copies of the Library or any portion -of it, thus forming a work based on the Library, and copy and -distribute such modifications or work under the terms of Section 1 -above, provided that you also meet all of these conditions: - - a) The modified work must itself be a software library. - - b) You must cause the files modified to carry prominent notices - stating that you changed the files and the date of any change. - - c) You must cause the whole of the work to be licensed at no - charge to all third parties under the terms of this License. - - d) If a facility in the modified Library refers to a function or a - table of data to be supplied by an application program that uses - the facility, other than as an argument passed when the facility - is invoked, then you must make a good faith effort to ensure that, - in the event an application does not supply such function or - table, the facility still operates, and performs whatever part of - its purpose remains meaningful. - - (For example, a function in a library to compute square roots has - a purpose that is entirely well-defined independent of the - application. Therefore, Subsection 2d requires that any - application-supplied function or table used by this function must - be optional: if the application does not supply it, the square - root function must still compute square roots.) - -These requirements apply to the modified work as a whole. If -identifiable sections of that work are not derived from the Library, -and can be reasonably considered independent and separate works in -themselves, then this License, and its terms, do not apply to those -sections when you distribute them as separate works. But when you -distribute the same sections as part of a whole which is a work based -on the Library, the distribution of the whole must be on the terms of -this License, whose permissions for other licensees extend to the -entire whole, and thus to each and every part regardless of who wrote -it. - -Thus, it is not the intent of this section to claim rights or contest -your rights to work written entirely by you; rather, the intent is to -exercise the right to control the distribution of derivative or -collective works based on the Library. - -In addition, mere aggregation of another work not based on the Library -with the Library (or with a work based on the Library) on a volume of -a storage or distribution medium does not bring the other work under -the scope of this License. - - 3. You may opt to apply the terms of the ordinary GNU General Public -License instead of this License to a given copy of the Library. To do -this, you must alter all the notices that refer to this License, so -that they refer to the ordinary GNU General Public License, version 2, -instead of to this License. (If a newer version than version 2 of the -ordinary GNU General Public License has appeared, then you can specify -that version instead if you wish.) Do not make any other change in -these notices. - - Once this change is made in a given copy, it is irreversible for -that copy, so the ordinary GNU General Public License applies to all -subsequent copies and derivative works made from that copy. - - This option is useful when you wish to copy part of the code of -the Library into a program that is not a library. - - 4. You may copy and distribute the Library (or a portion or -derivative of it, under Section 2) in object code or executable form -under the terms of Sections 1 and 2 above provided that you accompany -it with the complete corresponding machine-readable source code, which -must be distributed under the terms of Sections 1 and 2 above on a -medium customarily used for software interchange. - - If distribution of object code is made by offering access to copy -from a designated place, then offering equivalent access to copy the -source code from the same place satisfies the requirement to -distribute the source code, even though third parties are not -compelled to copy the source along with the object code. - - 5. A program that contains no derivative of any portion of the -Library, but is designed to work with the Library by being compiled or -linked with it, is called a "work that uses the Library". Such a -work, in isolation, is not a derivative work of the Library, and -therefore falls outside the scope of this License. - - However, linking a "work that uses the Library" with the Library -creates an executable that is a derivative of the Library (because it -contains portions of the Library), rather than a "work that uses the -library". The executable is therefore covered by this License. -Section 6 states terms for distribution of such executables. - - When a "work that uses the Library" uses material from a header file -that is part of the Library, the object code for the work may be a -derivative work of the Library even though the source code is not. -Whether this is true is especially significant if the work can be -linked without the Library, or if the work is itself a library. The -threshold for this to be true is not precisely defined by law. - - If such an object file uses only numerical parameters, data -structure layouts and accessors, and small macros and small inline -functions (ten lines or less in length), then the use of the object -file is unrestricted, regardless of whether it is legally a derivative -work. (Executables containing this object code plus portions of the -Library will still fall under Section 6.) - - Otherwise, if the work is a derivative of the Library, you may -distribute the object code for the work under the terms of Section 6. -Any executables containing that work also fall under Section 6, -whether or not they are linked directly with the Library itself. - - 6. As an exception to the Sections above, you may also compile or -link a "work that uses the Library" with the Library to produce a -work containing portions of the Library, and distribute that work -under terms of your choice, provided that the terms permit -modification of the work for the customer's own use and reverse -engineering for debugging such modifications. - - You must give prominent notice with each copy of the work that the -Library is used in it and that the Library and its use are covered by -this License. You must supply a copy of this License. If the work -during execution displays copyright notices, you must include the -copyright notice for the Library among them, as well as a reference -directing the user to the copy of this License. Also, you must do one -of these things: - - a) Accompany the work with the complete corresponding - machine-readable source code for the Library including whatever - changes were used in the work (which must be distributed under - Sections 1 and 2 above); and, if the work is an executable linked - with the Library, with the complete machine-readable "work that - uses the Library", as object code and/or source code, so that the - user can modify the Library and then relink to produce a modified - executable containing the modified Library. (It is understood - that the user who changes the contents of definitions files in the - Library will not necessarily be able to recompile the application - to use the modified definitions.) - - b) Accompany the work with a written offer, valid for at - least three years, to give the same user the materials - specified in Subsection 6a, above, for a charge no more - than the cost of performing this distribution. - - c) If distribution of the work is made by offering access to copy - from a designated place, offer equivalent access to copy the above - specified materials from the same place. - - d) Verify that the user has already received a copy of these - materials or that you have already sent this user a copy. - - For an executable, the required form of the "work that uses the -Library" must include any data and utility programs needed for -reproducing the executable from it. However, as a special exception, -the source code distributed need not include anything that is normally -distributed (in either source or binary form) with the major -components (compiler, kernel, and so on) of the operating system on -which the executable runs, unless that component itself accompanies -the executable. - - It may happen that this requirement contradicts the license -restrictions of other proprietary libraries that do not normally -accompany the operating system. Such a contradiction means you cannot -use both them and the Library together in an executable that you -distribute. - - 7. You may place library facilities that are a work based on the -Library side-by-side in a single library together with other library -facilities not covered by this License, and distribute such a combined -library, provided that the separate distribution of the work based on -the Library and of the other library facilities is otherwise -permitted, and provided that you do these two things: - - a) Accompany the combined library with a copy of the same work - based on the Library, uncombined with any other library - facilities. This must be distributed under the terms of the - Sections above. - - b) Give prominent notice with the combined library of the fact - that part of it is a work based on the Library, and explaining - where to find the accompanying uncombined form of the same work. - - 8. You may not copy, modify, sublicense, link with, or distribute -the Library except as expressly provided under this License. Any -attempt otherwise to copy, modify, sublicense, link with, or -distribute the Library is void, and will automatically terminate your -rights under this License. However, parties who have received copies, -or rights, from you under this License will not have their licenses -terminated so long as such parties remain in full compliance. - - 9. You are not required to accept this License, since you have not -signed it. However, nothing else grants you permission to modify or -distribute the Library or its derivative works. These actions are -prohibited by law if you do not accept this License. Therefore, by -modifying or distributing the Library (or any work based on the -Library), you indicate your acceptance of this License to do so, and -all its terms and conditions for copying, distributing or modifying -the Library or works based on it. - - 10. Each time you redistribute the Library (or any work based on the -Library), the recipient automatically receives a license from the -original licensor to copy, distribute, link with or modify the Library -subject to these terms and conditions. You may not impose any further -restrictions on the recipients' exercise of the rights granted herein. -You are not responsible for enforcing compliance by third parties to -this License. - - 11. If, as a consequence of a court judgment or allegation of patent -infringement or for any other reason (not limited to patent issues), -conditions are imposed on you (whether by court order, agreement or -otherwise) that contradict the conditions of this License, they do not -excuse you from the conditions of this License. If you cannot -distribute so as to satisfy simultaneously your obligations under this -License and any other pertinent obligations, then as a consequence you -may not distribute the Library at all. For example, if a patent -license would not permit royalty-free redistribution of the Library by -all those who receive copies directly or indirectly through you, then -the only way you could satisfy both it and this License would be to -refrain entirely from distribution of the Library. - -If any portion of this section is held invalid or unenforceable under any -particular circumstance, the balance of the section is intended to apply, -and the section as a whole is intended to apply in other circumstances. - -It is not the purpose of this section to induce you to infringe any -patents or other property right claims or to contest validity of any -such claims; this section has the sole purpose of protecting the -integrity of the free software distribution system which is -implemented by public license practices. Many people have made -generous contributions to the wide range of software distributed -through that system in reliance on consistent application of that -system; it is up to the author/donor to decide if he or she is willing -to distribute software through any other system and a licensee cannot -impose that choice. - -This section is intended to make thoroughly clear what is believed to -be a consequence of the rest of this License. - - 12. If the distribution and/or use of the Library is restricted in -certain countries either by patents or by copyrighted interfaces, the -original copyright holder who places the Library under this License may add -an explicit geographical distribution limitation excluding those countries, -so that distribution is permitted only in or among countries not thus -excluded. In such case, this License incorporates the limitation as if -written in the body of this License. - - 13. The Free Software Foundation may publish revised and/or new -versions of the Library General Public License from time to time. -Such new versions will be similar in spirit to the present version, -but may differ in detail to address new problems or concerns. - -Each version is given a distinguishing version number. If the Library -specifies a version number of this License which applies to it and -"any later version", you have the option of following the terms and -conditions either of that version or of any later version published by -the Free Software Foundation. If the Library does not specify a -license version number, you may choose any version ever published by -the Free Software Foundation. - - 14. If you wish to incorporate parts of the Library into other free -programs whose distribution conditions are incompatible with these, -write to the author to ask for permission. For software which is -copyrighted by the Free Software Foundation, write to the Free -Software Foundation; we sometimes make exceptions for this. Our -decision will be guided by the two goals of preserving the free status -of all derivatives of our free software and of promoting the sharing -and reuse of software generally. - - NO WARRANTY - - 15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO -WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW. -EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR -OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY -KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE -IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE -LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME -THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. - - 16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN -WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY -AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU -FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR -CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE -LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING -RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A -FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF -SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH -DAMAGES. - - END OF TERMS AND CONDITIONS diff --git a/html/index.htm b/html/index.htm deleted file mode 100755 index 2825ac4..0000000 --- a/html/index.htm +++ /dev/null @@ -1,39 +0,0 @@ - -Xbase DBMS Documentation Table of Contents - -

Xbase DBMS
-Last Updated 3/19/04
Version 3.0

-

Documentation Table Of Contents

-

Section 1 - Xbase Concepts

-

-Chapter 1 - Getting Started
-Chapter 2 - Database Overview
-Chapter 3 - Fields and Strings
-Chapter 4 - Date Processing
-Chapter 5 - Expression Handling
-Chapter 6 - NDX (DBase) Indices
-Chapter 7 - NTX (Clipper) Indices
-Chapter 8 - Record and File Locking
-

-

Section 2 - Using the Library

-

-Chapter 11 - Library Options and Methods
-Chapter 12 - Database Methods
-Chapter 13 - Field Methods
-Chapter 14 - String Methods
-Chapter 15 - Date Methods
-Chapter 16 - Expression Reference
-Chapter 17 - Index Methods
-Chapter 18 - Locking Methods
-

-

Section 3 - Appendices

-

-Appendix A - Return Codes and Exception Processing
-Appendix B - Quick Reference
-Appendix C - GPL Library License
-Appendix D - Bibliography
-Appendix F - Xbase DBMS Perl conversion program
-

-



- - diff --git a/html/xba1.htm b/html/xba1.htm deleted file mode 100755 index 7125e79..0000000 --- a/html/xba1.htm +++ /dev/null @@ -1,65 +0,0 @@ - - -Xbase DBMS Appendix A - -

Xbase Return Codes

-

Page Updated 2/19/04


- - -Beginning with release 3.0 exception processing has been removed from the -library. There were reports that it was not 100% working, so I trimmed the -library back to working code. If there are any volunteers to re-install the -exception processing, AND test it, let me know. Thanks - Gary - -It is generally a good idea to check the method return codes to verify an -error hasn't occured. Most Xbase DBMS methods return a SHORT return code -value which corresponds to a value in this table.

- - - - -

Xbase Return Codes

NumberErrorDescriptionType -
0XB_NO_ERRORSuccessGeneral -
100XB_XBASE_EOFEnd of fileDatabase
Index -
102XB_NO_MEMORYError when allocating memoryGeneral -
103XB_FILE_EXISTSFile Already ExistsDatabase -
104XB_OPEN_ERRORError when opening fileDatabase -
105XB_WRITE_ERRORError occured when writing to fileDatabase
Index -
106XB_UNKNOWN_FIELD_TYPEField was not one of:
-XB_CHAR_FLD
XB_FLOAT_FLD
XB_NUMERIC_FLD
XB_DATE_FLD
-XB_LOGICAL_FLD or XB_MEMO_FLD
Field -
107XB_ALREADY_OPENCan't open the same file twiceDatabase
Index -
108XB_NOT_XBASECan't open non X-Base file with
- X-Base routines
Database -
109XB_INVALID_RECORDNot a valid recordDatabase -
110XB_INVALID_OPTIONNot a valid optionGeneral -
112XB_SEEK_ERRORCould not position in fileDatabase
Index -
114XB_NOT_FOUNDRecord for key not foundIndex -
116XB_INVALID_KEYInvalid key argument givenIndex -
118XB_KEY_NOT_UNIQUETrying to add a duplicate key for an unique indexIndex -
119XB_INVALID_KEY_EXPRESSIONAn invalid key expression givenIndex -
121XB_INVALID_KEY_TYPEInvalid Key TypeIndex -
122XB_INVALID_NODE_NOInternal index error, notify tech supportIndex -
123XB_NODE_FULLInternal index error, notify tech supportIndex -
124XB_INVALID_FIELDNOAttempt to access invalid field numberField -
125XB_INVALID_DATAInvalid data encounteredField -
126XB_NOT_LEAFNODEInternal index error, notify tech supportIndex -
127XB_LOCK_FAILEDLock function failed
See errno for detail -
Lock -
128XB_CLOSE_ERRORError closing fileDatabase
Index -
129XB_INVALID_SCHEMAError with schema definition, check decimal pointsDatabase -
130XB_INVALID_NAMEInvalid database nameMemo -
131XB_INVALID_BLOCK_SIZEBlock size is invalid, must be increment of 512Memo -
132XB_INVALID_BLOCK_NOInvalid block number usedMemo -
133XB_NOT_MEMO_FIELDNot a memo fieldMemo -
134XB_NO_MEMO_DATANo memo dataMemo -
135XB_EXP_SYNTAX_ERRORExpression syntax errorExpression -
136XB_PARSE_ERRORParse error in expressionExpression -
137XB_NO_DATANo data for expressionExpression -
140XB_INVALID_FIELDInvalid field in expressionExpression -
141XB_INSUFFICIENT_PARMSInsufficient paramaters for functionExpression -
142XB_INVALID_FUNCTIONInvalid function encounteredExpression -



-



- - diff --git a/html/xba2.htm b/html/xba2.htm deleted file mode 100755 index 4a39d3c..0000000 --- a/html/xba2.htm +++ /dev/null @@ -1,110 +0,0 @@ - - -Xbase DBMS Appendix B - -

Xbase DBMS Quick Reference

-

Page Updated 2/19/04


- - - - -

Xbase Quick Reference Method List

xbShort rc xbDbf::AppendRecord() -
void xbDbf::AutoLockOff() -
void xbDbf::AutoLockOn() -
xbShort rc xbDbf::BlankRecord() -
xbLong cs xbDbf::CalcCheckSum() -
xbShort rc xbDbf::CloseDatabase() -
xbShort rc xbDbf::CopyDbfStructure( char * NewFileName, xbShort Overlay ) -
xbShort rc xbDbf::CreateDatabase( char * FileName, xbSchema * RecordLayout, xbShort Overlay ) -
xbULong RecNo xbDbf::CurrentRecNo() -
xbShort rc xbDbf::DeleteAllRecords() -
xbShort rc xbDbf::DeleteRecord() -
xbShort rc xbDbf::DumpHeader( xbShort Option ) -
xbShort rc xbDbf::DumpRecord( xbULong RecNo ) -
xbShort rc xbDbf::ExclusiveLock( xbShort WaitOption ) -
xbShort rc xbDbf::ExclusiveUnlock() -
xbLong NoOfFields xbDbf::FieldCount() -
xbLong RecNo xbDbf::GetCurRecNo() -
xbDouble Val xbDbf::GetDoubleField( char * FieldName) -
xbDouble Val xbDbf::GetDoubleField( xbShort FieldNo ) -
xbShort rc xbDbf::GetField( xbShort FieldNo, char * FieldName ) -
xbShort DecimalCount xbDbf::GetFieldDecimal( xbShort FieldNo ) -
xbShort FieldLen xbDbf::GetFieldLen( xbShort FieldNo ) -
char * FieldName xbDbf::GetFieldName( xbShort FieldNo ) -
xbShort FieldNo xbDbf::GetFieldNo( char * FieldName ) -
char Type xbDbf::GetFieldType( xbShort FieldNo ) -
xbShort rc xbDbf::GetFirstRecord() -
xbFloat FloatVal xbDbf::GetFloatField( char * FieldName ) -
xbFloat FloatVal xbDbf::GetFloatField( xbShort FieldNo ) -
xbShort rc xbDbf::GetLastRecord() -
xbShort Val xbDbf::GetLogicalField( char * FieldName ) -
xbShort Val xbDbf::GetLogicalField( xbShort FieldNo ) -
xbLong LongVal xbDbf::GetLongField( char * FieldName ) -
xbLong LongVal xbDbf::GetLongField( xbShort FieldNo ) -
xbShort rc xbDbf::GetMemoField( xbShort FieldNo, xbLong len, char * Buf ) -
xbShort rc xbDbf::GetMemoFieldLen( xbShort FieldNo ) -
xbShort rc xbDbf::GetNextRecord() -
xbShort rc xbDbf::GetPrevRecord() -
xbShort rc xbDbf::GetRecord( xbLong RecNo ) -
char * BufPtr xbDbf::GetRecordBuf() -
xbShort rc xbDbf::LockDatabase( xbShort WaitOption, xbShort LockType, xbLong RecNo ) -
xbShort rc xbDbf::MemoFieldExists( xbShort FieldNo ) -
xbShort rc xbDbf::MemoFieldsPresent() -
xbLong RecCnt xbDbf::NoOfRecords() -
xbShort rc xbDbf::OpenDatabase( char * FileName ) -
xbShort rc xbDbf::PackDatabase( xbShort WaitOption ) -
xbShort rc xbDbf::PutDoubleField( char * FieldName,xbDouble DoubleValue ) -
xbShort rc xbDbf::PutDoubleField( xbShort FieldNo,xbDouble DoubleValue ) -
xbShort rc xbDbf::PutField( xbShort FieldNo, char * Buf ) -
xbShort rc xbDbf::PutFloatField( char * FieldName, xbFloat FloatValue ) -
xbShort rc xbDbf::PutFloatField( xbShort FieldNo, xbFloat FloatValue ) -
xbShort rc xbDbf::PutLongField( char * FieldName, xbLong LongValue ) -
xbShort rc xbDbf::PutLongField( xbShort FieldNo, xbLong LongValue ) -
xbShort rc xbDbf::PutRecord( xbLong RecNo ) -
xbShort rc xbDbf::RebuildAllIndices() -
xbShort rc xbDbf::RecordDeleted() -
xbShort rc xbDbf::SetVersion( xbShort Version ) -
xbShort rc xbDbf::UndeleteAllRecords() -
xbShort rc xbDbf::UndeleteRecord() -
xbShort rc xbDbf::UpdateMemoData( xbShort FieldNo, xbLong len, char * Buf, xbShort LockOption ) -
xbShort rc xbDbf::ValidLogicalData( xbShort FieldNo ) -
xbShort rc xbDbf::ValidNumericData( xbShort FieldNo ) - - -
char * Day xbXBase::CharDayOf( char * Date8 ) -
char * Month xbXBase::CharMonthOf( char * Date8 ) -
xbShort rc xbXBase::DateIsValid( char * Date8 ) -
xbShort Day xbXBase::DayOf( xbShort Format, char * Date8 ) -
char * Date xbXBase::FormatDate( char * Format, char * Date8 ) -
xbString & Result xbXBase::GetStringResult() -
xbDouble * Result xbXBase::GetDoubleResult() -
XB_EXPRESSION * Exp xbXBase::GetExpressionHandle() -
char Type xbXBase::GetExpressionResultType( XB_EXPRESSION * ) -
xbLong * result xbXBase::GetIntResult() -
xbShort rc xbXBase::IsLeapYear( char * Date8 ) -
xbLong JulVal xbXBase::JulianDays( char * Date8 ) -
char * Date8 xbXBase::JulToDate8( xbLong JulVal ) -
xbLong JulVal xbXBase::LastDayOfMonth( char * Date8 ) -
xbShort Month xbXBase::MonthOf( char * Date8 ) -
xbShort rc xbXBase::ParseExpression( char * exp, xbDbf * d ) -
xbShort rc xbXBase::ProcessExpression( XB_EXPRESSION * ) -
char * Date8 xbXBase::Sysdate() -
xbShort Year xbXBase::YearOf( char * Date8 ) - -
xbShort rc xbNdx::CheckNdxIntegrity( xbShort Option ) -
xbShort rc xbNdx::CloseIndex() -
xbShort rc xbNdx::CreateIndex( char * IndexName, char * KeyExpression, xbShort Unique, xbShort Overlay ) -
xbShort rc xbNdx::FindKey( char * SearchValue ) -
xbShort rc xbNdx::FindKey( xbDouble SearchValue ) -
xbShort rc xbNdx::GetFirstKey() -
xbShort rc xbNdx::GetLastKey() -
xbShort rc xbNdx::GetNextKey() -
xbShort rc xbNdx::GetPrevKey() -
xbShort rc xbNdx::KeyExists( char * SearchValue ) -
xbShort rc xbNdx::KeyExists( xbDouble SearchValue ) -
xbShort rc xbNdx::LockIndex( xbShort WaitOption, xbShort LockType ) -
xbShort rc xbNdx::OpenIndex( char * IndexName ) -
xbShort rc xbNdx::ReIndex() -
-


-



diff --git a/html/xbapps.htm b/html/xbapps.htm deleted file mode 100755 index 7a87d02..0000000 --- a/html/xbapps.htm +++ /dev/null @@ -1,39 +0,0 @@ - - -Xbase DBMS Sample Application - -

Sample Programs

-

Page Updated 2/12/04




-Sample Xbase DBMS programs are located in the xbase/samples and xbase/bin -directories.

-
- - - -

X-Base Sample Programs

ProgramProgram Description -
checkndxThis program checks an NDX file -
copydbfThis program copies a DBF file structure -
dbfxtrctExtract data from dbf file and load into -
dbfutil1Menu program for executing Xbase functions -
deletallThis program marks all records in a DBF file for deletion -
dumpdbtDebug memo files -
dumphdrThis program opens an Xbase file and prints its header -
dumprecsThis program dumps records for an X-Base file -
exfilterExpression filter test program -
packdbfThis program packs a database file -
reindexThis program rebuilds an index -
sample1This program creates an Xbase file MYFILE.DBF -
sample2This program populates file MYFILE.DBF created by program sample1 -
sample3This program lists MYFILE.DBF data populated by program sample2 -
sample4This program deletes records, undeletes records, locks and packs datafile MYFILE.DBF -
sample5This program demonstrates NDX class usage -
testdateThis program tests the Xbase date methods -
undelallThis program undeletes all deleted records in a dbf file -
zapThis program removes all records from a DBF file - comma delimitedoutput file suitable for input into an awk or perl script -
-P

-
-



- - diff --git a/html/xbase.jpg b/html/xbase.jpg deleted file mode 100755 index 5070fcb..0000000 Binary files a/html/xbase.jpg and /dev/null differ diff --git a/html/xbbib.htm b/html/xbbib.htm deleted file mode 100755 index 70e4e82..0000000 --- a/html/xbbib.htm +++ /dev/null @@ -1,63 +0,0 @@ - - -Xbase DBMS Bibliography - -

Xbase DBMS Bibliography

-

Page Updated 2/1/99


- -Bachman, Erik
-Xbase File Format Description / Erik Bachman, Roskilde, Denmark: Clickety -Click Software, 1996-1998, 44 pages

- -Loomis, Mary:
-The Database Book, Macmillan Publishing Company, 1987, New York, New York: -ISBN 0-02-371760-2

- -Dorfman, Len:
-Building C Libraries, Windcrest, 1990, Blue Ridge Summit, PA: -ISBN 0-8306-3418-5

- -Eckel, Bruce:
-Using C++, Osborne, McGraw-Hill, 1990, Berkeley, CA: -ISBN 0-07-881522-3

- -Aho, Alfred: Hopcroft, John: Ullman, Jeffrey:
-Data Structures and Algorithms, Addison-Wesley Publishing, 1983, -Reading Massachusetts: ISBN 0-201-00023-7

- -Stevens, Al:
-C Database Development, MIS Press, 1991, Portland Oregon: -ISBN 1-55828-136-3

- -Pressman, Roger:
-Software Engineering: A Practitioner's Approach, McGraw-Hill, 1982, -New York ISBN 0-07-050781-3

- -Chou, George Tsu-der:
-2nd Edition dBase III Plus Handbook: Que Corporation, 1986, -Indianapolis, Indiana ISBN 0-88022-269-7

- -Krumm, Rob:
-Understanding and Using dBase II & III, Brady Communications Company, Inc, -1985, Bowie MD ISBN 0-89303-917-9

- -Hursch, Jack: Hursch, Carulyn:
-dBase IV Essentials, Windcrest, 1988, Blue Ridge Summit, PA -ISBN 0-8306-9616-4

- -Borland:
-Turbo C++, Programmer's Guide, Borland International, 1990, -Scotts Valley CA

- -Borland:
-Turbo C++, Library Reference, Borland International 1990, -Scotts Valley CA

- -The Draft Standard C++ Library by P.J. Plauger, Prentice Hall, New Jersey, -1995.

- -H.M Dietel/P.J. Deitel: C++ How To Program, Prentice Hall, Englewod Cliffs, -New Jersey 07632

- - - diff --git a/html/xbc1.htm b/html/xbc1.htm deleted file mode 100755 index 72c9904..0000000 --- a/html/xbc1.htm +++ /dev/null @@ -1,232 +0,0 @@ - - -Xbase DBMS Chapter 1 - - -

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


    - - -



    - - diff --git a/html/xbc11.htm b/html/xbc11.htm deleted file mode 100755 index 9af3860..0000000 --- a/html/xbc11.htm +++ /dev/null @@ -1,40 +0,0 @@ - - -Xbase DBMS Chapter 11 - -

    Library Options and Methods

    -

    Chapter Updated 2/1/99


    -
    - - - -

    xbXbase Class Methods

    MethodDescription -
    void xbXBase::DisplayError(xbShort ErrorNumber)Display error text -
    char * xbXbase::GetDefaultDateFormat()Return the default date format -
    void xbXBase::SetDefaultDateFormat(char * Format)Set the default date format -
    -

    -
    -

    Method Definitions

    -
    -

    Method void xbXbase::DisplayError( xbShort ErrorNo )


    -This method prints a text description of an error code. -

    Example Code Snipit:

    - - -xbShort rc; -rc = d.SomeXbaseFunction(...); -if( rc < 0 ) - x.DisplayError( rc ); -else - DoSomethingUsefull(); - -
    -

    Method char * xbXBase::GetDefaultDateFormat( void )
    -Method void xbXBase::SetDefaultDateFormat( char * NewDateFormat )


    -These methods are used for retrieving and setting the default date format -which is used by expression function DTOC. -


    -



    - - diff --git a/html/xbc12.htm b/html/xbc12.htm deleted file mode 100755 index af33408..0000000 --- a/html/xbc12.htm +++ /dev/null @@ -1,566 +0,0 @@ - - -Xbase DBMS Chapter 12 - -

    Database Methods

    -

    Chapter Updated 1/30/99


    -
    -This chapter lists the database methods and provides links to examples of how -to use them.


    - - - -

    Xbase Database Method List

    MethodDescription -
    xbShort rc AppendRecord()Append a new record to the end of an open database -
    void AutoLockOn()Turns on automatic record locking (see locking chapter) -
    void AutoLockOff()Turns off automatic record locking (see locking chapter) -
    void BlankRecord()Fill the current record buffer with blanks -
    xbLong csum CalcCheckSum()Calculate checksum on a data record -
    xbShort rc CloseDatabase()Close an open database -
    xbShort rc CopyDbfStructure(
    char * NewFileName,
    - xbShort OverlaySwitch )
    Copies the structure of a xbDbf file to a new file -
    xbShort rc CreateDatabase(
    char * FileName, - XbSchema *s, xbShort OverlaySwitch )
    Close an open database -
    xbULong CurrentRecNo()Returns the current record number -
    xbShort rc DeleteAllRecords()Mark all records for deletion -
    xbShort rc DeleteRecord()Mark a record for deletion -
    xbShort rc DumpHeader(xbShort option)Display information about a .DBF file header -
    xbShort rc DumpRecord(
    xbULong RecNo)
    Dump a record for a database -
    xbLong cnt FieldCount()Returns number of fields in database -
    xbLong recno GetCurRecNo()Returns current record number -
    xbShort rc GetFirstRecord()Get the first record in the database -
    xbShort rc GetLastRecord()Get the last record in the database -
    xbShort rc GetNextRecord()Get the next record in the database -
    xbShort rc GetPrevRecord()Get the previous record in the database -
    xbShort rc GetRecord(xbLong RecNo)Get a record by record number from an open database -
    char * buf GetRecordBuf()Returns a pointer to the record buffer -
    xbLong RecCnt NoOfRecords()Returns the number of records in an open database -
    xbShort rc OpenDatabase(char * FileName)Open an existing database -
    xbShort rc PackDatabase(
    xbShort WaitOption)
    Compress file and remove deleted records -
    xbShort rc PutRecord(xbULong RecNo)Put a record in an open database -
    xbShort rc RebuildAllIndices()Rebuilds all open indices -
    xbShort dflag RecordDeleted()Determine if a record has been deleted -
    xbShort version SetVersion(xbShort Ver)Set version to xbase III+ or IV style xbDbf files -
    xbShort rc UndeleteAllRecords()Unmark all deleted records -
    xbShort rc UndeleteRecord()Unmark a deleted record -
    xbShort rc Zap(xbShort WaitOption)Deletes all records from a database -
    -


    -

    Method Definitions

    -
    -

    Method xbShort xbDbf::AppendRecord( void )


    -This method appends the contents of the database record buffer to the end of -the .DBF file and updates the date and number of records in the header of the -datafile.

    -This method also updates any open indexes associated with the database.

    - -
    - -

    Method Return Codes

    Return CodeDescription -
    XB_LOCK_FAILEDWrite lock not successful -
    XB_NO_ERRORIf there is no error -
    XB_WRITE_ERRORUnsuccessful write operation -
    -

    Example Program:

    -See program sample2.cpp for an example -of how to use this method. -
    -

    Method xbShort xbDbf::BlankRecord( void )


    -This method overlays the database record buffer with space (0x20) -CHARacters. This method is useful for initializing the record buffer.
    -

    Example Program:

    -See program sample2.cpp for an example of -how to use this method. -
    - -

    Method xbLong xbDbf::CalcCheckSum( void )


    -This method calculates the checksum of a database record. -
    - -

    Method xbShort xbDbf::CloseDatabase( void )


    -This method closes an Xbase (.DBF) file -which was previously opened by CreateDatabase or OpenDatabase -and frees any previously allocated memory which is no LONGer needed.

    -This method automatically closes any open indexes associated with the -database before closing the database.

    - -
    - -

    Method Return Codes

    Return CodeDescription -
    XB_NO_ERRORIf there is no error -
    XB_NOT_OPENIf there is no error -
    -

    Example Program:

    -See program sample2.cpp for an example -of how to use this method. -
    - - -

    Method xbShort xbDbf::CopyDbfStructure( char *NewFileName, xbShort OverLay )


    -This method copies the structure of an Xbase (.DBF) file to file NewFileName. -If there are memo fields, they are included. -

    -The OverLay switch is -used to determine what to do if a xbDbf file with the same name -already exists. If OverLay is set to XB_OVERLAY and the file exists, -the file is overwritten, otherwise an error is returned.

    -Overlay Switch is:
    -
  • XB_OVERLAY = Overlay file if it exists
    -
  • XB_DONTOVERLAY = Return with error if file exists

    - - -
    - -

    Method Return Codes

    Return CodeDescription -
    XB_NO_ERRORIf there is no error -
    XB_FILE_EXISTSIf a file exists and OverLay switch = FALSE -
    XB_OPEN_ERRORCouldn't open the file -
    XB_NO_MEMORYMemory allocation error -
    XB_WRITE_ERRORCouldn't write to disk -
    XB_SEEK_ERRORSeek routine error -
    -

    Example Program:

    -See program copydbf.cpp for an example -of how to use this method. -
    - - -

    Method: xbShort xbDbf::CreateDatabase( char *FileName, - xbSchema *s, xbShort OverLay )


    -This method creates an Xbase (.DBF) file with the name -of FileName and builds the header record with the format as -defined in the xbSchema parameter. The OverLay switch is -used to determine what to do if a xbDbf file with the same name -already exists. If OverLay is set to XB_OVERLAY and the file exists, -the file is overwritten, otherwise an error is returned.

    -Overlay Switch is:
    -
  • XB_OVERLAY = Overlay file if it exists
    -
  • XB_DONTOVERLAY = Return with error if file exists

    -xbSchema has the following format:
    - -xbSchema MyRecordSchema[] = -{ - { FieldName, Type, FieldLength, NoOfDecimals }, - { FieldName2, Type, FieldLength, NoOfDecimals }, - ... - { "",0,0,0 } -}; - -Where:
    -
  • FieldName is the name of the data field.
    -
  • Type

    -

    Version 1.7.4 and greater:

    -XB_CHAR_FLD or C
    -XB_DATE_FLD or D
    -XB_LOGICAL_FLD or L
    -XB_MEMO_FLD or M
    -XB_FLOAT_FLD or F
    -XB_NUMERIC_FLD or N

    -
  • FieldLength is the length of the field.
    -
  • NoOfDecimals is the number of decimals for NUMERIC fields.
    -
    -The record buffer is automatically set to spaces when this method is called. -

    - -
    - -

    Method Return Codes

    Return CodeDescription -
    XB_NO_ERRORIf there is no error -
    XB_FILE_EXISTSIf a file exists and OverLay switch = FALSE -
    XB_OPEN_ERRORCouldn't open the file -
    XB_NO_MEMORYMemory allocation error -
    XB_WRITE_ERRORCouldn't write to disk -
    -

    Example Program:

    -See program sample1.cpp for an example -of how to use this method. -
    -

    Method xbULong xbDbf::CurrentRecNo( void )


    -This method returns the current record number.

    -

    Example Program:

    -See program dumprecs.cpp for an example -of how to use this method. - -
    -

    Method xbShort xbDbf::DeleteAllRecords( void )


    -This method marks all unmarked records in the database for deletion.

    - -
    - -

    Method Return Codes

    Return CodeDescription -
    XB_NO_ERRORNo error encountered -
    XB_INVALID_RECORDCould not mark record -
    XB_NOT_OPENIf the file is not open -
    XB_SEEK_ERRORSeek routine error -
    XB_WRITE_ERRORWrite routine error -
    -

    Example Program:

    -See program deletall.cpp for an example -of how to use this method. - -
    -

    Method xbShort xbDbf::DeleteRecord( void )


    -This method marks the current record for deletion in the database.

    - -
    - -

    Method Return Codes

    Return CodeDescription -
    XB_NO_ERRORNo error encountered -
    XB_INVALID_RECORDCould not mark record -
    -

    Example Program:

    -See program sample4.cpp for an example -of how to use this method. - -
    -

    Method xbShort xbDbf::DumpHeader( xbShort Option )


    -This method displays information about a .DBF file header to stdout. -This method is only available if the DEBUG option is turned on in the -options.h file

    - -
    - -

    Method Options

    OptionAction -
    1Print Header Only -
    2Field Data Only -
    3Header and Field Data -
    -
    - -
    - -

    Method Return Codes

    Return CodeDescription -
    XB_INVALID_OPTIONOption must be 1,2 or 3 -
    XB_NOT_OPENFile is not open -
    XB_NO_ERRORNo error encountered -
    -
    -

    Example Program:

    -See program dumphdr.cpp for an -example of how to use this method. - -
    -

    Method xbShort xbDbf::DumpRecord( xbULong RecNo )


    -This method dumps record RecNo for the database to stdout.

    - -
    - -

    Method Return Codes

    Return CodeDescription -
    XB_NO_ERRORNo error encountered -
    XB_INVALID_RECORDInvalid record for RecNo parameter -
    -

    Example Program:

    -See program dumprecs.cpp for an -example of how to use this method. -
    -

    Method xbLong xbDbf::FieldCount( void )


    -This method returns the number of fields defined in the database. -

    -
    -

    Method xbLong xbDbf::GetCurRecNo( void )


    -This method returns the current record number of the record in the record buffer. -

    -

    Example Program:

    -See program sample3.cpp for an -example of how to use this method. -
    -

    Method xbShort xbDbf::GetFirstRecord( void )


    -This method loads the first record of the file into the record buffer.

    - -
    - -

    Method Return Codes

    Return CodeDescription -
    XB_NO_ERRORIf there is no error -
    XB_INVALID_RECORDInvalid record number -
    XB_LOCK_FAILEDUnsuccessful lock operation -
    XB_NOT_OPENIf the file is not open -
    XB_SEEK_ERRORSeek routine error -
    XB_WRITE_ERRORWrite routine error -
    -

    Example Program:

    - -See program sample3.cpp for an -example of how to use this method. -
    -

    Method xbShort xbDbf::GetLastRecord( void )


    - -This method loads the last record of the file into the record buffer.

    - - -
    - -

    Method Return Codes

    Return CodeDescription -
    XB_LOCK_FAILEDRead lock not successful -
    XB_NO_ERRORIf there is no error -
    XB_EOFAt end of file -
    XB_NOT_OPENIf the file is not open -
    XB_INVALID_RECORDInvalid record number -
    XB_SEEK_ERRORSeek routine error -
    XB_WRITE_ERRORWrite routine error -
    - -

    Example Program:

    - -See program sample3.cpp for an example -of how to use this method. -
    -

    Method xbShort xbDbf::GetNextRecord( void )


    - -This method loads the next record of the file into the record buffer.

    - - -
    - -

    Method Return Codes

    Return CodeDescription -
    XB_LOCK_FAILEDRead lock not successful -
    XB_NO_ERRORIf there is no error -
    XB_EOFAt end of file -
    XB_NOT_OPENIf the file is not open -
    XB_INVALID_RECORDInvalid record number -
    XB_SEEK_ERRORSeek routine error -
    XB_WRITE_ERRORWrite routine error -
    - - -

    Example Program:

    - -See program sample3.cpp for an -example of how to use this method. -
    -

    Method xbShort xbDbf::GetPrevRecord( void )


    - -This method loads the previous record of the file into the record buffer.

    - - -
    - -

    Method Return Codes

    Return CodeDescription -
    XB_LOCK_FAILEDRead lock not successful -
    XB_NO_ERRORIf there is no error -
    XB_BOFAt beginning of file -
    XB_NOT_OPENIf the file is not open -
    XB_INVALID_RECORDInvalid record number -
    XB_SEEK_ERRORSeek routine error -
    XB_WRITE_ERRORWrite routine error -
    -

    Example Program:

    -See program sample3.cpp for an -example of how to use this method. -
    -

    Method xbShort xbDbf::GetRecord( xbLong RecNo )


    -This method retrieves record RecNo from the database into the record buffer. -

    -This method will call the PutRec method and flush all updates to disk if -necessary before moving to the specified record. If PutRecord is not -successful, this method will return the return code from PutRecord.

    - -
    - -

    Method Return Codes

    Return CodeDescription -
    XB_LOCK_FAILEDRead lock not successful -
    XB_NO_ERRORIf there is no error -
    XB_NOT_OPENIf the file is not open -
    XB_INVALID_RECORDInvalid record number -
    XB_SEEK_ERRORSeek routine error -
    XB_WRITE_ERRORWrite routine error -
    -

    Example Program:

    -See program sample3.cpp for an -example of how to use this method. -
    -

    Method char * xbDbf::GetRecordBuf( void )


    -This method returns a pointer to the record buffer. -

    -

    Example Program:

    -See program sample3.cpp for an -example of how to use this method. -
    -

    Method xbLong xbDbf::NoOfRecords( void )


    -This method returns the number of records in the file.

    -

    Example Program:

    -See program sample3.cpp for an -example of how to use this method. -
    -

    Method xbShort xbDbf::OpenDatabase( char * FileName )


    -This method opens an Xbase (.DBF) file with the name -of FileName. FileName must a valid filename which can include -drives identifier, directory, filename and extension.

    -The OpenDatabase method does not position to any any particular -data record. After opening a database, use GetRecord, GetFirstRecord -or GetLastRecord to position to a particular data record and load -a data record into the record buffer.

    -The record buffer is automatically set to spaces when this method is called. -

    - -
    - -

    Method Return Codes

    Return CodeDescription -
    XB_NO_ERRORIf there is no error -
    XB_OPEN_ERRORCouldn't open the file -
    XB_NO_MEMORYMemory allocation error -
    XB_NOT_XBASENot an xbXBase type file -
    -

    Example Program:

    -See program sample2.cpp for an -example of how to use this method. -
    -

    Method xbShort xbDbf::PackDatabase( xbShort WaitOption )


    -This method removes all records marked for deletion from an Xbase (.DBF) file -and reindexes any open index files. This method also reorganizes any memo -fields stored in a .DBT memo file. -

    -WaitOption is one of:

    -
  • F_SETLK - returns if the xbDbf file can not be exclusively locked -
  • F_SETLKW - will wait to execute until it can exclusively lock the file -

    - -
    - -

    Method Return Codes

    Return CodeDescription -
    XB_NO_ERRORIf there is no error -
    XB_CLOSE_ERRORIf intermediate work file can not be closed -
    XB_OPEN_ERRORCould not open file -
    XB_NO_MEMORYMemory allocation error -
    XB_WRITE_ERRORError writing to file -
    XB_SEEK_ERRORSeek error encountered -
    XB_LOCK_FAILEDCan not lock file or index -
    -

    Example Program:

    -See program packdbf.cpp for an -example of how to use this method. -
    -

    Method xbShort xbDbf::PutRecord( xbLong RecNo )


    -This method copies the record buffer into record RecNo in the database. -This method can be used for updating records which were retrieved by -the GetRecord method.

    -This method updates any open index files.

    - -
    - -

    Method Return Codes

    Return CodeDescription -
    XB_LOCK_FAILEDWrite lock not successful -
    XB_NO_ERRORIf there is no error -
    XB_NOT_OPENDatabase is not open -
    XB_INVALID_RECORDInvalid record number -
    XB_SEEK_ERRORSeek operation failed -
    XB_WRITE_ERRORWrite operation failed -
    -

    Example Program:

    -See program sample3.cpp for an -example of how to use this method. -
    - -

    Method xbShort xbDbf::RebuildAllIndicis( void )


    -This method rebuilds all opened indicis for the database file.

    - -
    - -

    Method Return Codes

    Return CodeDescription -
    XB_NO_ERRORIf there is no error -
    XB_WRITE_ERRORError writing data -
    XB_CLOSE_ERRORError closing work file -
    -

    Example Program:

    -See program reindex.cpp for an -example of how to use this method. -
    - - - -

    Method xbShort xbDbf::RecordDeleted( void )


    -This method returns TRUE (or 1) if a record is marked for deletion and -returns FALSE (or 0) if the record is not marked for deletion.

    - -
    - -

    Method Return Codes

    Return CodeDescription -
    TRUE (1)Record is marked for deletion -
    FALSE (0)Record is not marked for deletion -
    -

    Example Program:

    -See program sample4.cpp for an -example of how to use this method. -
    - - -

    Method xbShort xbDbf::SetVersion( xbShort Vswitch )


    - -This method sets the version of xbDbf and DBT database files and memo files -to be created using the CreateDatabase method. The default setting is -3 - dBASE III+ version files. It can be set to 4 - for dBASE IV style -files.

    -Vswitch is one of:
    -0 - return current setting
    -3 - Set to create version III files (default)
    -4 - Set to create version IV files

    - - -
    - -

    Method Return Codes

    Return CodeDescription -
    XB_NO_ERRORSetting updated -
    3 or 4If Vswitch = 0, it returns current version setting -
    XB_INVALID_OPTIONVswictch not one of 0,3 or 4 -
    -

    Example Program:

    -See program sample1.cpp for an -example of how to use this method. -
    - -

    Method xbShort xbDbf::UndeleteAllRecords( void )


    -This method unmarks all marked for deletion records in the database.

    - -
    - -

    Method Return Codes

    Return CodeDescription -
    XB_NO_ERRORNo error encountered -
    XB_INVALID_RECORDCould not mark record -
    XB_NOT_OPENIf the file is not open -
    XB_SEEK_ERRORSeek routine error -
    XB_WRITE_ERRORWrite routine error -
    -

    Example Program:

    -See program undelall.cpp for an example -of how to use this method. -
    - -

    Method xbShort xbDbf::UndeleteRecord( void )


    -This method removes the mark for deletion on the current record in the -database.

    - -
    - -

    Method Return Codes

    Return CodeDescription -
    XB_NO_ERRORNo error encountered -
    XB_INVALID_RECORDCould not unmark record -
    -

    Example Program:

    -See program sample4.cpp for an -example of how to use this method. -
    - -

    Method xbShort xbDbf::Zap( xbShort WaitOption )


    -This method removes all records from a database and any open indices. -

    -WaitOption is one of:

    -
  • F_SETLK - returns if the xbDbf file can not be exclusively locked -
  • F_SETLKW - will wait to execute until it can exclusively lock the file -

    - -
    -
    - -

    Method Return Codes

    Return CodeDescription -
    XB_NO_ERRORNo error encountered -
    XB_LOCK_FAILEDCould not lock file -
    XB_WRITE_ERRORCould not write to file -
    XB_OPEN_ERRORCould not open temp database -
    -

    Example Program:

    -See program zap.cpp for an -example of how to use this method. -
    - -



    - - diff --git a/html/xbc13.htm b/html/xbc13.htm deleted file mode 100755 index e085157..0000000 --- a/html/xbc13.htm +++ /dev/null @@ -1,470 +0,0 @@ - - -Xbase DBMS Chapter 13 - -

    Field Methods

    -

    Chapter Updated 2/1/99


    - -This chapter lists the field methods and provides examples of how to use -them.

    - - - - -

    Xbase Field Method List

    MethodDescription -
    xbLong cnt FieldCount()Returns the number of fields - in the file -
    xbDouble d GetDoubleField(char * FieldName)Returns a xbDouble field for field name -
    xbDouble d GetDoubleField(xbShort FieldNo)Returns a xbDouble field for field number -
    xbShort rc GetField(xbShort,char *buf)Gets field data from the record buffer -
    xbShort d GetFieldDecimal(xbShort FieldNo)Gets field decimal count -
    xbShort len GetFieldLen(xbShort FieldNo)Returns the length of a given field -
    char * name GetFieldName(xbShort FieldNo)Returns field name for field number -
    xbShort FieldNo GetFieldNo(char * FieldName)Returns the field ID number for a given field -
    char type GetFieldType(xbShort FieldNo)Returns the type of a given field -
    xbFloat f GetFloatField(char * FieldName)Returns a float field for field name -
    xbFloat f GetFloatField(xbShort FieldNo)Returns a float field for field number -
    xbShort l GetLogicalField(xbShort FieldNo)Returns logical field data -
    xbShort l GetLogicalField(char * FieldName)Returns logical field data -
    xbLong l GetLongField(char * FieldName)Returns a long field for field name -
    xbLong l GetLongField(xbShort FieldNo)Returns a long field for field number -
    xbShort rc GetMemoField(xbShort FieldNo,
    xbLong len,char * buf)
    Get memo field data -
    xbLong len GetMemoFieldLen(xbShort FieldNo)Get memo field data length -
    xbShort s MemoFieldsPresent()Determine if memo fields exist in DBF file -
    xbShort s MemoFieldExists(xbShort FieldNo)Determine if a particular memo field has data -
    xbShort rc PutDoubleField(char * FieldName,
    xbDouble d)
    Updates a xbDouble field for field name -
    xbShort rc PutDoubleField(xbShort FieldNo,
    xbDouble d)
    Updates a xbDouble field for field number -
    xbShort rc PutField(xbShort FieldNo,char * val)Fills or overlays a field in the current record buffer -
    - -
    - - - -

    Xbase Field Method List (cont)

    MethodDescription -
    xbShort rc PutFloatField(char * FieldName,
    xbFloat f)
    Updates a float field for field name -
    xbShort rc PutFloatField(xbShort FieldNo,
    xbFloat f)
    Updates a float field for field number -
    xbShort rc PutLongField(char * FieldName,
    xbLong l)
    Updates a long field for field name -
    xbShort rc PutLongField(xbShort FieldNo,
    xbLong l)
    Updates a long field for field number -
    xbShort rc UpdateMemoData(xbShort FieldNo,
    xbLong len,char * buf, -xbShort LockOpt)
    Update memo field data -
    xbShort l ValidLogicalData( char * buf )Check for valid logical data -
    xbShort l ValidNumericData( char * buf )Check for valid numeric data -
    -

    - -
    -

    Method Definitions

    -
    - -

    Method xbLong xbDbf::FieldCount( void )


    -This method returns the number of fields which exist in the database. -

    -

    Method Return Codes


    -If successful, this method returns the number of fields in the database. -

    Example Program:

    -See sample program sample3.cpp for an -example of how to use this method. -
    - -

    Method xbDouble xbDbf::GetxbDoubleField( char * FieldNo )


    -This method returns a xbDouble value for field FieldNo. Fieldno can be retrieved -by using method GetFieldNo. -

    -
    - -

    Method xbDouble xbDbf::GetxbDoubleField( char * FieldName )


    -This method returns a xbDouble value for field FieldName. If multiple accesses -for this particular field will be made from within the program, it is more -efficient to access the data utlizing the field's number, rather than its name. -

    - -
    -

    Method xbShort xbDbf::GetField( xbShort FieldNo, char * buf )


    - -This method fills an application program supplied buffer *buf with data -from the record buffer for field number FieldNo. FieldNo can be retrieved -by using method GetFieldNo.

    - -It is the responsibility of the application program to verify the buffer is -large enough to hold the data. No checking is done by method GetField to -verify the buffer is large enough to hold the data.

    -If successful, this method returns the length of the field in bytes. - -

    Example Program:

    -See sample program sample3.cpp for an -example of how to use this method. - -
    -

    Method xbShort xbDbf::GetFieldDecimal( xbShort FieldNo )


    - -This method returns the decimal count of field FieldNo. FieldNo can be retrieved -by using method GetFieldNo.

    -If successful, this method returns the decimal count. - -
    -

    Method xbShort xbDbf::GetFieldLen( xbShort FieldNo )


    - -This method returns the length of field FieldNo. FieldNo can be retrieved -by using method GetFieldNo.

    -If successful, this method returns the length of the field in bytes. - -

    Example Program:

    -See sample program sample3.cpp for an example -of how to use this method. - -
    -

    Method char * xbDbf::GetFieldName( xbShort FieldNo )


    - -This method returns a pointer to the name of field FieldNo. FieldNo can be retrieved -by using method GetFieldNo.

    -If successful, this method returns the field name.
    - -

    Example Program:

    -See sample program dumpdbt.cpp for an example -of how to use this method. -
    - -

    Method xbShort xbDbf::GetFieldNo( char * FieldName )


    - -This method is used to get a field's ID number based on paramater -FieldName. Where FieldName is a valid name of a field in the database.

    - - -
    - -

    Method Return Codes

    Return CodeDescription -
    -1Field not found in record -
    0 through nThe field number for field FieldName -
    -

    -

    Example Program:

    - -See sample program sample2.cpp for an example -of how to use this method. - -
    -

    Method xbShort xbDbf::GetFieldType( xbShort FieldNo )


    - -This method returns the type of field FieldNo. FieldNo can be retrieved -by using method GetFieldNo.

    - -

    Method Return Codes


    -If successful, this method returns the field type.
    -C = character
    -D = Date
    -L = Logical
    -M = Memo
    -N = Numeric
    -F = Float

    - -

    Example Program:

    -See sample program sample3.cpp for an example -of how to use this method. -
    - -

    Method xbFloat xbDbf::GetFloatField( char * FieldName )


    - -This method returns a float value for field FieldName. If multiple accesses -for this particular field will be made from within the program, it is more -efficient to access the data utlizing the field's number, rather than its name. -

    - -

    Example Program:

    -See sample program sample3.cpp for an -example of how to use this method. -
    -

    Method xbFloat xbDbf::GetFloatField( xbShort * FieldNo )


    - -This method returns a float value for field number FieldNo. -

    - -

    Example Program:

    -See sample program sample3.cpp for an -example of how to use this method. -
    - - -

    Method xbShort xbDbf::GetLogicalField( xbShort FieldNo )


    - -

    Method xbShort xbDbf::GetLogicalField( char * FieldName )


    - -This method returns -1 if field FieldName or FieldNo is not -a logical field. -It returns 1 if field FieldName is a 'T','t','Y' or 'y'. It returns -0 if not 'T','t','Y' or 'y'. -
    -
    -

    Method xbLong xbDbf::GetLongField( xbShort * FieldNo )


    - -

    Method xbLong xbDbf::GetLongField( char * FieldName )


    - -This method returns a long value for field FieldName. If multiple accesses -for this particular field will be made from within the program, it is more -efficient to access the data utlizing the field's number, rather than its name. -

    - -

    Example Program:

    -See sample program zipinit.cpp for an -example of how to use this method. - -
    -

    Method xbLong xbDbf::GetLongField( xbShort * FieldNo )


    - -This method returns a long value for field FieldNo. FieldNo can be -determined by utilizing method GetFieldNo. -

    - -

    Example Program:

    -See sample program zipinq.cpp for an -example of how to use this method. - - - -
    -

    Method xbShort xbDbf::GetMemoField( xbShort FieldNo, xbLong len, char * Buf, xbShort LockOption )


    - -This method returns Len bytes of memo field FieldNo. Buf -is a user supplied buffer large enough to contain the data. No checking -of the field's size is performed by this method.

    - - -Lock Optionis one of:
    - -F_SETLK - return immediately if lock fails
    -F_SETLKW - wait until lock function executes

    - - -
    - -

    Method Return Codes

    Return CodeDescription -
    XB_INVALID_FIELDNOAn invalid field number was used -
    XB_NOT_MEMO_FIELDNot a memo field -
    XB_NO_MEMO_DATANo memo data exists -
    XB_INVALID_BLOCK_NOInternal error, notify tech support -
    XB_SEEK_ERRORDisk Error -
    XB_READ_ERRORDisk Error -
    XB_NO_ERRORNo Error -
    -

    -

    Example Program:

    -See sample program dumpdbt.cpp for -an example of how to use this method. - -
    -

    Method xbLong xbDbf::GetMemoFieldLen( xbShort FieldNo )


    - -This method returns the length of memo field FieldNo. FieldNo can be -retrieved by using method GetFieldNo.

    -If successful, this method returns the length of the memo field in bytes. - -

    Example Program:

    -See sample program dumpdbt.cpp for -an example of how to use this method. - -
    - -

    Method xbShort xbDbf::MemoFieldExists( xbShort FieldNo )


    - -This method returns true (1) if field FieldNo has any memo data. Otherwise -it returns false (0). -

    - -
    - -

    Method Return Codes

    Return CodeDescription -
    0Data file does not have any memo fields -
    1Data file has memo fields -
    -

    -

    Example Program:

    -See sample program dumpdbt.cpp for an -example of how to use this method. - -
    - -

    Method xbShort xbDbf::MemoFieldsPresent( void )


    - -This method returns true (1) if the file has any memo fields. Otherwise -it returns false (0). -

    - -
    - -

    Method Return Codes

    Return CodeDescription -
    0Data file does not have any memo fields -
    1Data file has memo fields -
    -

    -

    Example Program:

    -See sample program dumpdbt.cpp for an -example of how to use this method. - -
    -

    Method xbShort xbDbf::PutxbDoubleField( char * FieldName, xbDouble d )


    - -This method puts a xbDouble value d for field FieldName. If multiple accesses -for this particular field will be made from within the program, it is more -efficient to access the data utlizing the field's number. -

    - -
    - -

    Method Return Codes

    Return CodeDescription -
    XB_INVALID_FIELDNOAn invalid field number was used -
    XB_INVALID_DATAAttempt to load invalid numeric or logical data -
    -


    -

    Method xbShort xbDbf::PutxbDoubleField( xbShort FieldNo, xbDouble d )


    -This method puts a xbDouble value d for field FieldNo. -

    -

    Method Return Codes

    - -
    - -

    Method Return Codes

    Return CodeDescription -
    XB_INVALID_FIELDNOAn invalid field number was used -
    XB_INVALID_DATAAttempt to load invalid numeric or logical data -
    -

    - -
    -

    Method xbShort xbDbf::PutField( xbShort FieldNo, char * buf )


    - -This method fills field number FieldNo, with the data from buffer *buf.

    -It copies data from *buf until a 0x00 character is encountered or the buffer -is filled. The field will be truncated if it is to long.

    -Use method GetFieldNo to determine the value for FieldNo.

    -If the field is type N or F, the field is loaded right justified, left blank -filled onto the record buffer.

    -This method does check the validity of NUMERIC and LOGICAL data it is loading onto the -record buffer. Ther can be no spaces or non-numeric data for numeric fields.

    - -
    - -

    Method Return Codes

    Return CodeDescription -
    XB_INVALID_FIELDNOAn invalid field number was used -
    XB_INVALID_DATAAttempt to load invalid numeric or logical data -
    -

    - -

    Example Program:

    -See sample program sample2.cpp for an example -of how to use this method. -
    - -

    Method xbShort xbDbf::PutFloatField( char * FieldName, FLOAT f )


    - -This method puts a float value f for field FieldName. If multiple accesses -for this particular field will be made from within the program, it is more -efficient to access the data utlizing the field's number. -

    - -
    - -

    Method Return Codes

    Return CodeDescription -
    XB_INVALID_FIELDNOAn invalid field number was used -
    XB_INVALID_DATAAttempt to load invalid numeric or logical data -
    -

    -

    Example Program:

    -See sample program sample2.cpp for an -example of how to use this method. -
    -

    Method xbShort xbDbf::PutFloatField( xbShort FieldNo, FLOAT f )


    -This method puts a float value f for field number FieldNo. -

    - -
    - -

    Method Return Codes

    Return CodeDescription -
    XB_INVALID_FIELDNOAn invalid field number was used -
    XB_INVALID_DATAAttempt to load invalid numeric or logical data -
    -

    -

    Example Program:

    -See sample program sample2.cpp for an -example of how to use this method. -
    -

    Method xbLong xbDbf::PutLongField( char * FieldName, xbLong Val )


    -This method puts a long value Val for field FieldName. If multiple accesses -for this particular field will be made from within the program, it is more -efficient to access the data utlizing the field's number. -

    -

    Example Program:

    -See sample program zipinit.cpp for an -example of how to use this method. - -
    -

    Method xbLong xbDbf::PutLongField( xbShort FieldNo, xbLong Val )


    -This method puts a long value Val for field FieldNo. FieldNo can be determined -by utilizing method GetFieldNo. -

    - -

    Example Program:

    -See sample program zipinq.cpp for an -example of how to use this method. -
    -

    Method xbShort xbDbf::UpdateMemoData( xbShort FieldNo, xbLong len, - char * Buf, xbShort LockOption )


    -This method updates field FieldNo with Len bytes of -data from Buf.

    -This is the only routine necessary to add, revise or delete memo field -data. To delete a memo field, set the length to zero (0L).

    - -LockOption is one of
    -
  • F_SETLK - return immediately if lock fails -
  • F_SETLKW - wait until lock function executes -

    - - -
    - -

    Method Return Codes

    Return CodeDescription -
    XB_LOCK_FAILEDLock Failed -
    XB_INVALID_BLOCK_NOInternal error, notify tech support -
    XB_SEEK_ERRORDisk Error -
    XB_READ_ERRORDisk Error -
    XB_WRITE_ERRORDisk Error -
    XB_NO_ERRORNo Error -
    -

    -

    Example Program:

    -See sample program sample2.cpp for -an example of how to use this method. -
    - - - -

    Method xbShort xbDbf::ValidLogicalData( char * data )


    - -This method returns true if data contains a valid logical data value. -Otherwise, it returns false. -

    - -
    - -

    Method Return Codes

    Return CodeDescription -
    1Valid logical data -
    0Invalid logical data -
    -
    -
    - -

    Method xbShort xbDbf::ValidNumericData( char * data )


    -This method returns true if data contains a valid numeric data value. -Otherwise, it returns false. -

    - -
    - -

    Method Return Codes

    Return CodeDescription -
    1Valid numeric data -
    0Invalid numeric data -
    -
    -
    - -



    - - diff --git a/html/xbc14.htm b/html/xbc14.htm deleted file mode 100755 index 032b57f..0000000 --- a/html/xbc14.htm +++ /dev/null @@ -1,200 +0,0 @@ - - -Base DBMS Chapter 14 - -

    xbString Methods

    -

    Chapter Updated 8/20/03


    -

    This table lists the xbString methods.



    - - - -

    xbString Method List API

    MethodDescription -
    xbString()Class Constructor -
    xbString(size_t size)Constructor, allocates space of size -
    xbString(char c)Constructor, initialized to char c -
    xbString(const char *s)Constructor, initialized to string s -
    xbString(const char *s, size_t maxlen -Constructor, initialized to string s, with minimal string buf size of max_len -
    xbString(const xbString &s)Constructor, initialized to string s -
    ~xbString()Class Destructor -
    const char operator*()Returns data -
    char operator[](int n)Returns char in position n -
    xbString &operator=(const xbString &s)
    - xbString &operator=(const char *s)
    xbString &operator=(char c) -
    Set string to s or c. -
    xbString &operator+=(const char *s)
    -xbSting &operator+=(char c)
    Concatonate data to string -
    xbString &operator-=(const char *s)
    -xbSting &operator+=(char c)
    Concatonate data and eliminate spaces between -strings. -
    bool operator==(const xbString &) -Compare string == -
    bool operator!=(const xbString &) -Compare string != -
    bool operator<(const xbString &s) -Compare string < -
    bool operator>(const xbString &s) -Compare string > -
    bool operator<=(const xbString &s) -Compare string <= -
    bool operator<=(const xbString &s) -Compare string >= -
    xbString addBackSlash( char c )Prefixes all -char c with a backslash. -
    xbString& assign(const xbString& str, size_t pos = 0, -int len = 1)Assign data in str starting at position pos -for a length of len and return a reference. -
    xbString& assign(const xbString& str, int len ) -Assign data in str for a length of len and return a reference. -
    xbString copy() constUsed to copy a string -
    const char * c_str() constReturns the string or NULL -if string is null. Depreciated function. -
    int countChar( char c ) constReturns the count -of char c. -
    int cvtHexChar( char & out )Converts a four byte -string in the format of 0x00 to a one byte char value out. Returns -0 on success, -1 on error. -
    int cvtHexString( zbString & out )Converts a -string of four byte groupings in the format of 0x00 to a string of one byte -characters out. Returns 0 on success, -1 on error. -
    char getCharacter( int n ) constReturns the character -as position n. -
    const char *getdata() constReturns the string -
    bool hasAlphaChars() constReturns true is string -contains any alpha characters, otherwise returns false. -
    bool isEmpty() constReturns true if the string has -no memory allocated, or memory allocated is a zero byte string, otherwise -returns false -
    bool isNull() constReturns true if the string -has no memory allocated for the string, otherwise returns false -
    size_t len() const
    size_t length() const -
    Returns length of string. It does not include the null terminating byte. -
    xbString mid( size_t pos, int len )Pull a string of -data out of another string of data, starting at position pos for a -length of len. -
    void ltrunc( size_t cnt )Left truncate the string -cnt bytes. -
    int pos(char c)Locate character in string -
    int pos(const char *s)Locate string s in string -
    void swapChars(char from, char to)Swap character -from to character to. -
    void putAt(size_t pos, char c)Put character c at position pos -
    void remove( size_t pos = 0, int len )Remove data -from the string to starting at pos for a lenght of len. -
    void setNum(long num)This method sets the string -to the numeric value num. -
    xbString &sprintf(const char * format, ... ) -Used to format a string. See the standard C printf function for formatting -details. Internal 256 byte buffer which can be overflowed. -
    void toLowerCase()Converts string to lower case -
    void toUpperCase()Converts string to upper case -
    void trim()trim trailing spaces -
    void zapChar( char c )Remove all instances of -c from the string. -
    void zapLeadingChar( char c )Left truncate all -of c from the string. -
    - xbString operator-(const xbString &s1, const xbString &s2) -Concatonate two strings together, eliminate spaces -
    - xbString operator+(const xbString &s1, const xbString &s2)
    - xbString operator+(const xbString &s1, const char *s2)
    - xbString operator+(const char *s1, const xbString &s2)
    - xbString operator+(const xbString &s1, char c2)
    - xbString operator+(char c1, const xbString &s2)
    Concatonate two - strings together -
    bool operator==(const xbString &, const char *) -Compare string == -
    bool operator!=(const xbString &, const char *) -Compare string != -



    -

    Sample program

    - - -/* string.cpp - - Xbase project source code - - This program demonstrates the usage of the xbString class - - Copyright (C) 1997 Gary A. Kunkel - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - - Contact: - - Mail: - - Technology Associates, Inc. - XBase Project - 1455 Deming Way #11 - Sparks, NV 89434 - USA - - Email: - - xbase@techass.com - xdb-devel@lists.sourceforge.net - xdb-users@lists.sourceforge.net - - Website: - - xdb.sourceforge.net - -*/ - - -#include <xbase/xbase.h> - -int main() -{ - xbString s1; - xbString s2; - - s1 = "Some string data"; - s2 = "some more string data"; - - std::cout << "s1 => " << s1 << std::endl; - std::cout << "s2 => " << s2 << std::endl; - - - s1 = "s1 "; - s2 = "s2"; - s1 -= s2; - - std::cout << "-= operator => " << s1 << std::endl; - - s1 = "s1 "; - s2 = "s2"; - s1 += s2; - - std::cout << "+= operator => " << s1 << std::endl; - - s1 = "some data"; - s2 = s1.mid( 2, 3 ); - std::cout << "mid() = " << s2 << std::endl; - - return 0; -} - - - - - - -

    -



    - - diff --git a/html/xbc15.htm b/html/xbc15.htm deleted file mode 100755 index de01ec4..0000000 --- a/html/xbc15.htm +++ /dev/null @@ -1,338 +0,0 @@ - - -Xbase DBMS Chapter 15 - -

    xbDate Methods

    -

    Chapter Updated 8/21/03



    - -This chapter lists the xbDate methods and provides an example program to demonstrate usage.
    -Xbase .DBF files and the xbDate class handle dates in the format of CCYYMMDD (Date8).


    - -
    - - - -

    xbDate Method List API

    MethodDescription - -
    xbDate( const char * Date8 )
    xbDate( const xbString & Date8 )
    xbDate() -
    Class constructors. If no date provided, or invalid date provided, date is set to Sysdate(). - -
    ~xbDate()Class destructor - -
    xbString & CharDayOf( const char *Date8 )
    - xbString & CharDayOf( const xbString & Date8 )
    xbString & CharDayOf() -
    Returns Sun - Sat day of week for a given date - -
    xbString & CharMonthOf( const char *Date8 )
    xbString & CharMonthOf( const xbString & Date8 )
    - xbString & CharMonthOf()
    Returns Jan - Dec month of year for a given date - -
    int DateIsValid( const char *Date8 ) const
    int DateIsValid( const xbString & Date8 ) const -
    Checks a date for validity, returns true (1) if date is valid - -
    int DayOf( int Format, const char *Date8 ) const
    int DayOf( int Format, const xbString &Date8 ) const
    - int DayOf( int Format ) const
    Returns day of WEEK, MONTH or YEAR from a given date where Format is one of
    - XB_FMT_WEEK => Number of day in week 0-6 (sun-Sat)
    - XB_FMT_MONTH => Number of day in month 1-31
    - XB_FMT_YEAR => Number of day in year 1-366 - -
    xbString & Formatdate( const char * Format, const char * Date8 )
    - xbString & FormatDate( const xbString & Format, const char * Date8 )
    - xbString & FormatDate( const char * Format, const xbString & Date8 )
    - xbString & FormatDate( const xbString & Format, const xbString & Date8 )
    - xbString & FormatDate( const xbString & Format )
    - xbString & FormatDate( const char * )
    - -
    Return a formatted date.
    - - Format - A format specifier with the following paramaters:
    - - 1) YYDDD - A julian date format
    - - 2) YY or YYYY will print a 2 or 4 digit year
    - - 3) M,MM,MMM or MMMM
    - - M - one digit month if no leading zero
    - MM - two digit month, contains leading zero
    - MMM - Jan through Dec
    - MMMM - January through December
    - - 4) D,DD,DDD or DDDD
    - - D - one digit dayif no leading zero
    - DD - two digit day, contains leading zero
    - DDD - Sun through Sat (or julian if YYDDD)
    - DDDD - Sunday through Saturday
    - - -
    const xbString & GetDate() const
    xbString & GetDate()
    Return date - -
    const xbString & GetFormattedDate() const
    xbString & GetFormattedDate()
    - Returns formatted date. See notes on format paramaters. - -
    int IsLeapYear( const char *Date8 ) const
    int IsLeapYear( const xbString &Date8 ) const
    - int IsLeapYear() const
    Returns true if given date is a leap year - -
    long JulianDays( const char *Date8 ) const
    long JulianDays( const xbString & Date8 ) const
    - long JulianDays() const
    Returns number of days since 1/1/0100 to given date - -
    xbString & JulToDate8( long )Converts julian based date to CCYYMMDD format. - -
    xbString & LastdayOfMonth( const char *Date8 )
    xbString & LastDayOfMonth( const xbString & Date8 )
    - xbString & LastDayOfMonth()
    Returns the Date8 format of the last day of the month for a given date - -
    int MonthOf( const char *Date8 ) const
    int MonthOf( const xbString &Date8) const
    -int MonthOf() const
    Returns month of a date - -
    int SetDate( const char * Date8 )
    int SetDate( const xbString & Date8 )
    - Sets the xbDate to Date8. Return 1 on success, 0 on error. - - -
    xbString & Sysdate()This method sets the class date and returns the system date - -
    int YearOf( const char *Date8 ) const
    int YearOf( const xbString &Date8 ) const
    -int YearOf() const
    Returns century and year of a date - -
    xbString &operator+=( int )+= operator -
    xbString &operator-=( int )-= operator -
    xbString &operator++( int )++ operator -
    xbString &operator--( int )-- operator -
    xbString &operator+( int )+ operator -
    xbString &operator-( int )- operator -
    long operator-( const xbDate & ) const- operator -
    int operator==( const xbDate & ) const== operator -
    int operator!=( const xbDate & ) const!= operator -
    int operator<( const xbDate & ) const< operator -
    int operator>( const xbDate & ) const> operator -
    int operator<=( const xbDate & ) const<= operator -
    int operator>=( const xbDate & ) const>= operator - -
    -


    - -

    Sample program


    -The source for this program is in the libtest directory.

    - - - Xbase project source code - - This program tests the xdate routines - - Copyright (C) 1997 Gary A. Kunkel - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - - Contact: - - Mail: - - Technology Associates, Inc. - XBase Project - 1455 Deming Way #11 - Sparks, NV 89434 - USA - - Email: - - xbase@techass.com - xdb-devel@lists.sourceforge.net - xdb-users@lists.sourceforge.net - - Website: - - xdb.sourceforge.net - - - This program tests and demonstrates usage of the various xbDate methods - - Several of the tests pass either StringDate or Chardate to the method - being tested - this is done to test the class methods. In actual usage, - this may not be necessary due to the instance of the class already - containing a date value. -*/ - -#include "xbase.h" - -int main() -{ - xbString StringDate( "19601007" ); /* oct 7 1960 */ - char CharDate[9] = "19611109"; /* nov 9 1961 */ - - xbDate d1; /* today is default */ - xbDate d2( StringDate ); /* from string data */ - xbDate d3( CharDate ); /* from char data */ - xbDate d4; /* another date class */ - - std::cout << "This program tests the XDATE routines" << std::endl; - std::cout << "Date 1 (Sysdate) is " << d1.GetDate() << std::endl; - std::cout << "Date 2 (StringDate) is " << d2.GetDate() << std::endl; - std::cout << "Date 3 (CharDate) is " << d3.GetDate() << std::endl; - - std::cout << "This year is " << d1.YearOf() << std::endl; - std::cout << "Year of xbString Date is " << d2.YearOf( StringDate ) - << std::endl; - std::cout << "Year of char Date is " << d3.YearOf( CharDate ) - << std::endl; - - std::cout << "This Month is " << d1.MonthOf() << std::endl; - std::cout << "Month of xbString Date is " << d2.MonthOf( StringDate ) - << std::endl; - std::cout << "Month of char Date is " << d3.MonthOf( CharDate ) - << std::endl; - - std::cout << "Today is day " << d1.DayOf( XB_FMT_WEEK ) << " of the week" - << std::endl; - std::cout << "StringDate is day " << d2.DayOf( XB_FMT_MONTH, StringDate ) - << " of the month" << std::endl; - std::cout << "CharDate is day " << d3.DayOf( XB_FMT_YEAR, CharDate ) - << " of the year" << std::endl; - - if( d1.IsLeapYear()) - std::cout << "This is a leapyear" << std::endl; - else - std::cout << "This is not a leap year." << std::endl; - - if( d2.IsLeapYear( StringDate )) - std::cout << "StringDate is a leapyear" << std::endl; - else - std::cout << "StringDate is not a leap year." << std::endl; - - if( d3.IsLeapYear( CharDate )) - std::cout << "CharDate is a leapyear" << std::endl; - else - std::cout << "CharDate is not a leap year." << std::endl; - - std::cout << "Today is " << d1.Sysdate() << std::endl; - - if( d1.DateIsValid( "19951301" )) - std::cout << "19951301 is a valid date" << std::endl; - else - std::cout << "19951301 is not a valid date" << std::endl; - - if( d1.DateIsValid( "19920229" )) - std::cout << "19920229 is a valid date" << std::endl; - else - std::cout << "19920229 is not a valid date" << std::endl; - - if( d2.DateIsValid( StringDate )) - std::cout << StringDate << " is a valid date" << std::endl; - else - std::cout << StringDate << " is not a valid date" << std::endl; - - std::cout << "Today's Julian date " << d1.JulianDays() << std::endl; - std::cout << "StringDate Julian date " << d2.JulianDays( StringDate ) - << std::endl; - - std::cout << "There are " - << ( d1.JulianDays( "19951101" ) - d1.JulianDays( "19951001" )) - << " days between 10/1/95 and 11/1/95." << std::endl; - - std::cout << "Todays Julian date (Number of days since Jan 1 0100):" - << d1.JulianDays() << std::endl; - - d4 = d1; // set d4 class = to sysdate - std::cout << "Object d4 initialized to " << d4.GetDate() << std::endl; - std::cout << "This should be todays date: " - << d4.JulToDate8(d4.JulianDays()) << std::endl; - std::cout << "In 7 days it will be " - << d4.JulToDate8(d4.JulianDays() + 7L ) << std::endl; - - std::cout << "Today is " << d1.CharDayOf() << std::endl; - std::cout << "StringDate day is " << d2.CharDayOf( StringDate ) - << std::endl; - std::cout << "This month is " << d1.CharMonthOf() << std::endl; - std::cout << "StringDate month is " << d2.CharMonthOf() << std::endl; - - - /* various format routines using different formats, strings and chars */ - xbString xbStFmt( "MM/DD/YY" ); - std::cout << "Format (YYDDD) " << d1.FormatDate( "YYDDD" ) << std::endl; - std::cout << "Format (MM/DD/YY) " << d1.FormatDate( xbStFmt ) << std::endl; - xbStFmt = "DD/MM/YY"; - std::cout << "Format (DD/MM/YY) " << d1.FormatDate(xbStFmt, "19730110") - << std::endl; - std::cout << "Format (MMMM DD,YYYY) " - << d1.FormatDate( "MMMM DD,YYYY", d1.GetDate()) << std::endl; - xbStFmt = "DDDD, MMMM DD YYYY"; - std::cout << "Format (DDDD, MMMM DD YYYY) " - << d2.FormatDate( xbStFmt, d2.GetDate()) << std::endl; - - std::cout << "Last day this month " << d1.LastDayOfMonth() << std::endl; - std::cout << "Last day of month for StringDate is " - << d2.LastDayOfMonth( d2.GetDate()) << std::endl; - - std::cout << "Overloaded operators test..." << std::endl; - - if( d1 == d2 ) - std::cout << d1.GetDate() << " is equal to " << d2.GetDate() - << std::endl; - else - std::cout << d1.GetDate() << " is not equal to " << d2.GetDate() - << std::endl; - - if( d1 != d3 ) - std::cout << d1.GetDate() << " is not equal to " << d3.GetDate() - << std::endl; - else - std::cout << d1.GetDate() << " is equal to " << d3.GetDate() - << std::endl; - - if( d1 < d2 ) - std::cout << d1.GetDate() << " is less than " << d2.GetDate() - << std::endl; - else - std::cout << d1.GetDate() << " is not less than " << d2.GetDate() - << std::endl; - - if( d1 > d2 ) - std::cout << d1.GetDate() << " is greater than " << d2.GetDate() - << std::endl; - else - std::cout << d1.GetDate() << " is not greater than " << d2.GetDate() - << std::endl; - - if( d1 <= d2 ) - std::cout << d1.GetDate() << " is less than or equal to " << d2.GetDate() - << std::endl; - else - std::cout << d1.GetDate() << " is not less than or equal to " - << d2.GetDate() << std::endl; - - if( d1 >= d2 ) - std::cout << d1.GetDate() << " is greater than or equal to " - << d2.GetDate() << std::endl; - else - std::cout << d1.GetDate() << " is not greater than or equal to " - << d2.GetDate() << std::endl; - - d1.Sysdate(); - d1++; - std::cout << "Tomorrow is " << d1.GetDate() << std::endl; - d1-=2; - std::cout << "Yesterday was " << d1.GetDate() << std::endl; - std::cout << "There are " << d1 - d2 << " days between " << d1.GetDate() - << " and " << d2.GetDate() << std::endl; - - return 0; -} - - - -
    -



    - - - - diff --git a/html/xbc16.htm b/html/xbc16.htm deleted file mode 100755 index b19511b..0000000 --- a/html/xbc16.htm +++ /dev/null @@ -1,202 +0,0 @@ - - -Xbase DBMS Chapter 16 - -

    Expressions Reference

    -

    Chapter Updated 2/19/04


    -

    - - - -

    Expression Operands

    OperandTypeFunction -
    +AlphaConcatonate -
    +NumericAddition -
    -AlphaConcatonate, remove white space -
    -NumericSubtraction -
    *NumericMultiplication -
    /NumericDivision -
    **NumericExponentiation -
    <LogicalLess Than -
    >LogicalGreater Than -
    =LogicalEqual -
    <>LogicalNot Equal -
    #LogicalNot Equal -
    <=LogicalLess Than or Equal -
    >=LogicalGreater Than or Equal -
    $LogicalContains -
    ->N/AIdentifies database field ie; DATABASE->FIELD -
    .AND.LogicalLogical AND -
    .OR.LogicalLogical OR -
    - -


    - - - -

    Expression Functions

    Expression FunctionXbase C++ MethodDescription -
    ABS()xbDouble EXPN::ABS( xbDouble d ) -Returns absolute numeric value of argument. -
    ASC()xbLong EXPN::ASC( char * String ) -Returns ASCII code of left character of string. -
    AT()xbLong EXPN::AT( char *s1, char *s2 ) -Returns starting position of first alphanumeric argument in second argument. -
    CDOW()char * EXPN::CDOW( char Date8 ) -Returns name of the day of the week of Date8. -
    CHR()char * EXPN::CHR( xbLong l ) -Returns ASCII character corresponding to numeric value supplied. -
    CMONTH()char * EXPN::CMONTH( char * Date8 ) -Returns name of the month of Date8. -
    DATE()char * EXPN::DATE() -Returns system date. -
    DAY()xbLong EXPN::DAY( char * Date8 ) -Returns numeric value of the day of the month for Date8. -
    DESCEND()EXPN::DESCEND() -Descend - used to create descending indices -
    DTOC()char * EXPN::DTOC( char * Date8 ) -Returns a date converted to format MM/DD/YY. -
    EXP()xbDouble EXPN::EXP( xbDouble d ) -Returns exponential for supplied value. -
    IIF() -char * EXPN::IIF( xbShort, const char *,const char *)If statement -
    INT()xbLong EXPN::INT( xbDouble d ) -Converts any numeric value to an integer. -
    ISALPHA()xbLong EXPN::ISALPHA( char * String ) -Returns TRUE if string is alpha. -
    ISLOWER()xbLong EXPN::ISLOWER( char * String ) -Returns TRUE if string is lower case. -
    ISUPPER()xbLong EXPN::ISUPPER( char * String ) -Returns TRUE if string is upper case. -
    LEFT()char * EXPN::LEFT( char * String, xbShort Len ) -Returns Len characters from the left side of String. -
    LEN()xbLong EXPN::LEN( char * String ) -eturns the number of characters in the String. -
    LOG()xbDouble EXPN::LOG( xbDouble d ) -Returns the natural log of d. -
    LOWER()char * EXPN::LOWER( char * String ) -Converts a string to lower case. -
    LTRIM()char * EXPN::LTRIM( char * String ) -Eliminates leading white space from String. -
    MAX()xbDouble EXPN::MAX( xbDouble d1, xbDouble d2 ) -Returns the larger of two numeric arguments. -
    MIN()xbDouble EXPN::MIN(xbDouble d1, xbDouble d2 ) -Returns the smaller of two numeric arguments. -
    MONTH()xbLong EXPN::MONTH( char * Date8 ) -Returns numeric month for Date8. -
    RECNO()xbLong EXPN::RECNO() -Returns the current record number of the associated DBF file -
    REPLICATE()char * EXPN::REPLICATE( char * String, xbShort Count ) -Replicates String Conut times. -
    RIGHT()char * EXPN::RIGHT( char * String, xbShort Count ) -Returns Count characters from the right side of String. -
    RTRIM()char * EXPN::RTRIM( char * String ) -Removes trailing white space from String. -
    SPACE()char * EXPN::SPACE( xbShort Count ) -Returns a buffer filled with Count spaces. -
    SQRT()xbDouble EXPN::SQRT( xbDouble d ) -Returns square root of d. -
    STR() -char * EXPN::STR( xbDouble d )
    -char * EXPN::STR( xbDouble, xbShort )
    -char * EXPN::STR( xbDouble, xbShort, xbShort ) -
    -Converts a number to a string. -
    SUBSTR()char * EXPN::SUBSTR( char * String, xbShort StartPos, xbShort Len ) -Returns a string form String starting at position StartPos for a length of Len. -
    TRIM()char * EXPN::TRIM( char * String ) -Same as RTRIM. -
    UPPER()char * EXPN::UPPER( char * String ) -Converts a string to upper case. -
    VAL()xbLong EXPN::VAL( char * String ) -Converts a string to an integer. -
    YEAR()xbLong EXPN::YEAR( char * Date8 ) -Returns numeric year from Date8. -
    - - - -


    - - - -

    Expression Processing Method List

    MethodDescription -
    GetDoubleResult()Get xbDouble result from processed expression -
    GetIntResult()Get a xbLong result from processed expression -
    GetExpressionHandle()Get an expression's handle -
    GetExpressionResultType(xbExpression *)Get expression result type -
    GetStringResult()Get xbString & result from processed expression -
    ParseExpression(char *,xbDbf *)Parse an expression -
    ProcessExpression(xbExpression *)Process a parsed expression -
    -

    -

    Method Definitions

    -
    - -

    Method xbDouble xbXBase::GetDoubleResult()


    - -This method returns a xbDouble result from a processed expression. -

    -See the program listing in chapter 5 for an example of how to use this method. - -
    -

    Method xbLong xbXBase::GetIntResult()


    -This method returns a xbLong result from a processed expression. -

    -See the program listing in chapter 5 for an example of how to use this method. - -
    -

    Method xbExpression * xbXBase::GetExpressionHandle()


    - -This method returns a handle to a recently parsed expression. -

    -See the program listing in chapter 5 for an example of how to use this method. - -
    -

    Method char xbXBase::GetExpressionResultType( xbExpression * e )


    - -This method returns the result type for a given expression e. - -
    -
    - - - -

    Method Return Codes

    Return Code ValueDescription -
    Cchar * result from processed expression -- use GetStringResult() -
    NxbDouble result from processed expression -- use GetDoubleResult() -
    LxbLong (also logical) result from processed expression -- use GetIntResult() -


    - -See the program listing in chapter 5 for an example of how to use this method. - -
    -

    Method char * xbXBase::GetStringResult()


    - -This method returns a xbString & result from a processed expression. -

    -See the program listing in chapter 5 for an example of how to use this method. - -
    -

    Method xbShort ParseExpression( char * exp, DBF * d)


    - -This method parses expression exp.
    d is a pointer to -a database used for resolving any fieldname which does not contain the --> operator. - -

    -See the program listing in chapter 5 for an example of how to use this method. -
    -

    Method xbShort ProcessExpression( xbExpression * e )


    - -This method processes parsed expression e. -

    -See the program listing in chapter 5 for an example of how to use this method. -

    -
    -



    - - diff --git a/html/xbc17.htm b/html/xbc17.htm deleted file mode 100755 index c1d2c37..0000000 --- a/html/xbc17.htm +++ /dev/null @@ -1,352 +0,0 @@ - - -Xbase DBMS Chapter 17 - -

    Index Methods

    -

    Chapter Updated 2/12/99


    - -This chapter lists the xbNdx and xbNtx index methods and provides -examples of how to use them.

    - -There are many methods in the xbNdx and xbNtx classes which are used for -maintaining and updating NDX and NTX files. Fortunately for the -application programmer, most of the complexities of dealing with the -NDX and NTX indices are automatically cared for by the Xbase library.

    - -xbNdx and xbNtx methods which are used by application programs are documented here. -With some exceptions (OpenIndex,CloseIndex and KeyExists) using the index -routines automatically positions and returns the associated record in -the DBF database.


    - - - - -

    Xbase xbNdx Index Method List

    MethodDescription -
    CheckIndxIntegrityChecks an index file for integrity -
    CloseIndexOptional, closes an index. Closing - the DBF file will close any open indexes. -
    CreateIndexCreate an index -
    FindKeyFind a key in an index file -
    GetFirstKeyGet the first key in an index -
    GetLastKeyGet the last key in an index -
    GetNextKeyGet the next key in an index -
    GetPrevKeyGet the previous key in an index -
    KeyExistsDetermine if a key exists w/o positioning DBF file -
    OpenIndexOpen an index -
    ReIndexRebuilds an index -
    in -

    -
    -

    Method Definitions

    -
    - -

    Method xbShort xbNdx::CheckIndexIntegrity( xbShort option )

    -

    Method xbShort xbNtx::CheckIndexIntegrity( xbShort option )


    - -This method checks an open index for accuracy or file corruption. -If the option is non zero, the method will display informational messages.
    -
    - -
    - -

    Method Return Codes

    Return CodeDescription -
    XB_NO_ERRORIf there is no error -
    XB_LOCK_FAILEDRead lock not successfull -
    XB_NOT_OPENFile not open -
    XB_INVALID_RECORDInvalid record number -
    XB_SEEK_ERRORSeek routine error -
    XB_WRITE_ERRORWrite routine error -
    - -

    Example Program:

    - -See program checkndx.cpp for an example -of how to use this method. - -
    - -

    Method xbShort xbNdx::CloseIndex( VOID )

    -

    Method xbShort xbNtx::CloseIndex( VOID )


    - -This method closes an open NDX index. NDX indexes are closed automatically -by the DBF::CloseDatabase routine, so this is an optional method. -Closed indices are not updated by the Xbase routines.

    - - -
    - -

    Method Return Codes

    Return CodeDescription -
    XB_NO_ERRORIf there is no error -
    - -

    Example Program:

    - -See program sample1.cpp for an example -of how to use this method. - -
    - -

    Method xbShort xbNdx::CreateIndex( char * IndexName, char * KeyExpression, - xbShort Unique, xbShort OverLay )

    - -

    Method xbShort xbNtx::CreateIndex( char * IndexName, char * KeyExpression, - xbShort Unique, xbShort OverLay )


    - -This method creates an index. Indices are created as either a -character based index or a numeric based index, depending on the KeyExpression -value.

    -
  • Indexname - is the name of the physical index file name. -
  • KeyExpression - is the key of the index. -
  • Unique - XB_UNIQUE or XB_NOT_UNIQUE -
  • Overlay - XB_OVERLAY or XB_DONTOVERLAY

    - -
    - -

    Method Return Codes

    Return CodeDescription -
    XB_NO_ERRORIf there is no error -
    XB_NO_MEMORYMemory error -
    XB_OPEN_ERRORCould not open index file -
    XB_INVALID_KEY_EXPRESSIONBad index key expression -
    XB_NOT_OPENThe database was not open -
    XB_SEEK_ERRORSeek error encountered -
    XB_READ_ERRORRead error encountered -
    - -

    -Index expressions can be a single field or multiple fields. Assuming a -database has fields LASTNAME and FIRSTNAME, valid index expressions -could be:

    - - -
    - -

    Sample Index Expressions

    ExpressionDescription -
    "LASTNAME"Index on LASTNAME only. -
    "LASTNAME+FIRSTNAME"Index on LASTNAME and FIRSTNAME -
    "LASTNAME-FIRSTNAME"Index on LASTNAME and FIRSTNAME, -all spaces between the two fields removed. -
    "LASTNAME-','FIRSTNAME"Index on LASTNAME and -FIRSTNAME, insert a comma between the two values, remove spaces between -the two fields. -
    -

    - - -

    Allowable Index Expression Operators

    -
    OperatorKey TypeDescription -
    +CharacterConcatonate string fields -
    -Character -Concatonate string fields, remove trailing spaces -
    'literal'Characterinclude literal value -
    "literal"Characterinclude literal value -
    +NumericAdd two numeric fields togethor -
    -NumericSubtract one numeric field from another -
    *NumericMulitply two numeric fields togethor -
    /NumericDivide one numeric field into another -
    **NumericExponential -
    -

    -

    Example Program:

    - -See program sample1.cpp for an example -of how to use this method. - -
    - -

    Method xbShort xbNdx::FindKey( char * SearchValue )

    -

    Method xbShort xbNdx::FindKey( xbDouble SearchValue )

    -

    Method xbShort xbNtx::FindKey( char * SearchValue )

    -

    Method xbShort xbNtx::FindKey( xbDouble SearchValue )


    - -This method searches the index for key SearchValue. -The routine positions in the index, then positions to the database record -for the key. If the key is not -found, the key value that is the next higher value is returned.

    - -For character keys, the SearchValue should be a null terminated string. -To find an exact match, use a key value which is as long as the key is, -padded on the right with spaces.

    - -For numeric keys, use a xbDouble value for a search value. This is because -all numeric field indices are saved as double values.

    - - -
    - -

    Method Return Codes

    Return CodeDescription -
    XB_FOUNDThe key was found -
    XB_NOT_FOUNDThe key was not found -
    XB_NO_MEMORYMemory error -
    XB_OPEN_ERRORCould not open index file -
    XB_SEEK_ERRORSeek error encountered -
    XB_READ_ERRORRead error encountered -
    - -

    Example Program:

    - -See program sample5.cpp for an example -of how to use this method. - -
    - -

    Method xbShort xbNdx::GetFirstKey( VOID )

    -

    Method xbShort xbNtx::GetFirstKey( VOID )


    - - -This method retrieves the record for the first key in the index.

    - - -
    - -

    Method Return Codes

    Return CodeDescription -
    XB_NO_ERRORIf there is no error -
    XB_NO_MEMORYMemory error -
    XB_OPEN_ERRORCould not open index file -
    XB_SEEK_ERRORSeek error encountered -
    XB_READ_ERRORRead error encountered -
    - -

    Example Program:

    - -See program sample5.cpp for an example -of how to use this method. - - -
    - -

    Method xbShort xbNdx::GetLastKey( VOID )

    -

    Method xbShort xbNtx::GetLastKey( VOID )


    - -This method retrieves the record for the last key in the index.

    - - -
    - -

    Method Return Codes

    Return CodeDescription -
    XB_NO_ERRORIf there is no error -
    XB_NO_MEMORYMemory error -
    XB_OPEN_ERRORCould not open index file -
    XB_SEEK_ERRORSeek error encountered -
    XB_READ_ERRORRead error encountered -
    - -

    Example Program:

    - -See program sample5.cpp for an example -of how to use this method. -

    Method xbShort xbNdx::GetNextKey( VOID )


    -This method retrieves the record for the next key in the index. If the -index is not positioned, a call to GetFirstKey is autoamtically executed.

    - - -
    - -

    Method Return Codes

    Return CodeDescription -
    XB_NO_ERRORIf there is no error -
    XB_NO_MEMORYMemory error -
    XB_OPEN_ERRORCould not open index file -
    XB_SEEK_ERRORSeek error encountered -
    XB_READ_ERRORRead error encountered -
    - -

    Example Program:

    - -See program sample5.cpp for an example -of how to use this method. - - -

    Method xbShort xbNdx::GetPrevKey( VOID )

    -

    Method xbShort xbNtx::GetPrevKey( VOID )


    - -This method retrieves the record for the previous key in the index. If the -index is not positioned, a call to GetLastKey is autoamtically executed.

    - - -
    - -

    Method Return Codes

    Return CodeDescription -
    XB_NO_ERRORIf there is no error -
    XB_NO_MEMORYMemory error -
    XB_OPEN_ERRORCould not open index file -
    XB_SEEK_ERRORSeek error encountered -
    XB_READ_ERRORRead error encountered -
    - -

    Example Program:

    - -See program sample5.cpp for an example -of how to use this method. - -
    - -

    Method xbShort xbNdx::KeyExists( char * SearchValue )

    -

    Method xbShort xbNdx::KeyExists( xbDouble SearchValue )

    -

    Method xbShort xbNtx::KeyExists( char * SearchValue )

    -

    Method xbShort xbNtx::KeyExists( xbDouble SearchValue )


    - -This method searches the index for the key SearchValue. The routine does not -position the database record for the key. See the reference on FindKey for more -information regarding KeyValue.

    - - -
    - -

    Method Return Codes

    Return CodeDescription -
    XB_FOUNDThe key was found -
    XB_NOT_FOUNDThe key was not found -
    XB_NO_MEMORYMemory error -
    XB_OPEN_ERRORCould not open index file -
    XB_SEEK_ERRORSeek error encountered -
    XB_READ_ERRORRead error encountered -
    -

    Example Program:

    - -if( xbNdx::KeyExists( "MyKeyValue" )) - cout << "\nKey was found"; -else - cout << "\nKey was not found"; - -
    -

    Method xbShort xbNdx::OpenIndex( char * IndexName )

    -

    Method xbShort xbNtx::OpenIndex( char * IndexName )


    -This method opens index IndexName for a given DBF database. An index must be -opened before it will be automatically updated by the database update -routines.

    - -
    - -

    Method Return Codes

    Return CodeDescription -
    XB_NO_ERRORIf there is no error -
    XB_NO_MEMORYMemory error -
    XB_OPEN_ERRORCould not open index file -
    XB_INVALID_KEY_EXPRESSIONBad key in index -
    XB_NOT_OPENThe database was not open -
    XB_SEEK_ERRORSeek error encountered -
    XB_READ_ERRORRead error encountered -
    -

    Example Program:

    -See program sample1.cpp for an example -of how to use this method. -
    -

    Method xbShort xbNdx::ReIndex( VOID )

    -

    Method xbShort xbNtx::ReIndex( VOID )


    -This method rebuilds an index. It is used for optimizing an index, or recreating -a damaged index. If the index is severly damaged (ie; the first 512 bytes are -foobar) then the index must be recreated with the CreateIndex method before -using the ReIndex method.

    - -
    - -

    Method Return Codes

    Return CodeDescription -
    XB_NO_ERRORIf there is no error -
    XB_OPEN_ERRORCould not open index file -
    XB_WRITE_ERRORError writing data -
    XB_CLOSE_ERRORError closing work file -
    -

    Example Program:

    -See program reindex.cpp for an example -of how to use this method.

    -
    -



    - - diff --git a/html/xbc18.htm b/html/xbc18.htm deleted file mode 100755 index 78d8de6..0000000 --- a/html/xbc18.htm +++ /dev/null @@ -1,261 +0,0 @@ - - -Xbase DBMS Chapter 18 - -

    Locking Methods

    -

    Chapter Updated 2/1/99


    - -The locking methods return either XB_LOCK_FAILED or XB_NO_ERROR. If they return -LOCK_FAILED the actual reason can be found in the global variable -errno or function perror() can be executed to view the -results. -

    - -The errno field may contain one of the following values if the lock was not -successful.

    - - -
    Error CodeDescription -
    EBADFInvalid file descriptor -
    EINVALInvalid lock information or file does not support locks -
    EACCESS
    EAGAIN
    Lock can not be set because it is blocked by an existing lock on the file. -
    ENOLCKThe system is out of lock resources, too many file locks in place. -
    EDEADLKDeadlock condition -
    EINTRProcess was interrupted by a signal while it was waiting -
    -

    -

    Types of Locks

    - -
  • Write or Exclusive Locks provide exclusive access to a -particular file location. No other process can lock the same location.

    - -
  • Read or Shared Locks prohibit any process from requesting a write -lock on a specified part of the file. Other processes can request -simultaneous read locks.


    - -

    DBF File Locking Techniques

    - -Xbase DBMS uses the following protocol for DBF file and record locking: -

    - -To lock a record - the first byte of the record is locked.
    -To lock the file - the header bytes of the file are locked.

    - -When a record is being appended to the file, the header bytes are locked.
    -When a record is being updated, the header bytes and the specific record are -locked.

    -This locking protocol is probably not compatable with other Xbase type products. -However, Xbase can be safely used for multi-user access when it is not -simultaneously updating DBF or NDX files while other products/programs are. -


    - -

    NDX File Locking Techniques

    - -Xbase DBMS locks indexes by locking the first 512 bytes -of the index file. -The entire index is locked because any updates to the index potentially -can modify significant portions of the index tree. -


    - -

    DBT File Locking Techniques

    - -Xbase DBMS locks memo files by locking the first 4 bytes -of the memo file. This effectively locks the entire file. The entire file -is locked because any updates to the free block chain can significantly -change the structure of the file. -


    - - -

    AutoLocking Features

    - -If XB_LOCKING_ON is set in the options.h file, the locking methods -execute any appropriate locking logic. If XB_LOCKING_ON is not set in the -options.h file, all locking methods return NO_ERROR without -performing any actual record or file locking. This enables the application -program to always call locking routines regardless of the XB_LOCKING_ON switch -in the options.h file. -

    -By leaving the autolocking features enabled, the application program does -not need to address record, file or index locking. All locking is handled -automatically by the Xbase routines. However, if access to the locking -routines is required, they are available to the applciation programmer. -

    -When the files are automatically locked by the Xbase routines, the database -file is locked first, then it locks the indexes in alphabetical order. To -avoid deadlock conditions, files and record locks should always be done in -the same order. When the files are unlocked, then indexes are unlocked -first, then the database is unlocked. -

    -Auto-locking works well in an on-line transaction based environment. -However, it does not function efficiently in batch mode. If you -will be writing programs which process files in a batch mode, disabling -auto-lock and locking the entire file at the beginning of the process -and unlocking the file at the end of the process will significantly -reduce process time. On a 586-200 class machine, a file with 45000 records -can be read thru in a few seconds with the file locked in batch mode. -In record-lock mode it takes about six minutes with the same processor. - -

    For processing large files, locking the file instead of locking each -record is far more efficient. This is how you do it.

    - -For reading the file in batch mode:
    -xbDbf.AutoLockOff();
    -xbDbf.LockDatabase( F_SETLKW, F_RDLCK, 0L );

    -For updating the file in batch mode:
    -xbDbf.AutoLockOff();
    -xbDbf.LockDatabase( F_SETLKW, F_WRLCK, 0L );

    -
    -

    - -

    Method Table

    - - - - -

    MethodDescription -
    xbDbf::AutoLockOnTurns autolocking on -
    xbDbf::AutoLockOffTurns autolocking off -
    xbDbf::ExclusiveLockLock file and indexes in exclusive mode -
    xbDbf::ExclusiveUnlockUnlock files and indexes -
    xbDbf::LockDatabaseLocks or unlocks a DBF database -
    xbNdx::LockIndexLocks or unlocks an xbNdx index -
    xbNdx::LockMemoFileLocks or unlocks a DBT memo field file -
    -

    - -

    Method Descriptions

    - -

    Method VOID xbDbf::AutoLockOn( VOID )


    - -This method turns automatic record locking on. Auto record locking is on -by default if XB_LOCKING_ON is set in the options.h file.

    - -

    Example Program:

    - -See program loadzips.cpp for an example of -how to use this method. -
    - -

    Method VOID xbDbf::AutoLockOff( VOID )


    - -This method turns automatic record locking off. Auto record locking is on -by default if XB_LOCKING_ON is set in the options.h file. -

    -Turning auto locking off will result in slightly better execution speeds -but should not be used in multi-user environments when multiple users can -update files simultanteously. If multiple users are accessing a file which -is read only then it is safe to turn off auto-locking for a particular file. -

    -Turning autolocking off will disable any index file locking which is -particularly dangerous in a multi-user environment if updates on the files -are permitted. - - -

    Example Program:

    - -See program loadzips.cpp for an example of -how to use this method. - -
    -

    Method SHORT xbDbf::ExclusiveLock( SHORT WaitOption )

    -

    Method SHORT xbDbf::ExclusiveUnlock( VOID )


    - -ExclusiveLock and ExclusiveUnclock will lock the data file, memo file (if applicable) -and any associated indexes in an exclusive mode. They also turn auto-lock -on and off as appropriate.

    - -WaitOption is either:

    -
  • F_SETLK - returns immediately regardless if success or failure
    -
  • F_SETLKW - waits until lock function executes

    - -

    Example Program:

    - -See program sample4.cpp for an example of -how to use this method. - -
    -

    Method SHORT xbDbf::LockDatabase( SHORT WaitOption, SHORT LockType, LONG LRecNo ) -


    - -This method locks or unlocks an Xbase (.DBF) file which was previously opened.
    -
    -WaitOption is either:

    -
  • F_SETLK - returns immediately regardless if success or failure
    -
  • F_SETLKW - waits until lock function executes

    - -LockType is one of:

    -
  • F_RDLCK - Perform a Read or Shared Lock
    -
  • F_WRLCK - Perform a Write or Exclusive Lock
    -
  • F_UNLCK - Unlock it

    - -LRecNo is:

    -0 - Lock the header section of the file (use this to lock the file)
    -1 through n - Lock a particular record

    - - - -
    Method Return Codes
    Return CodeDescription -
    XB_INVALID_RECORDAn invalid record given -
    XB_LOCK_FAILEDThe lock action failed, see errno -
    XB_NO_ERRORThe lock was successful -
    - - -

    Example Program:

    - -See program loadzips.cpp for an example of -how to use this method. - -
    - -

    Method xbShort xbDbf::LockIndex( xbShort WaitOption, xbShort LockType ) -


    - -This method locks or unlocks an Index (.NDX) file which was previously opened.
    -
    -WaitOption is either:

    -
  • F_SETLK - returns immediately regardless if success or failure
    -
  • F_SETLKW - waits until lock function executes

    - -LockType is one of:

    -
  • F_RDLCK - Perform a Read or Shared Lock
    -
  • F_WRLCK - Perform a Write or Exclusive Lock
    -
  • F_UNLCK - Unlock it

    - - - -
    Method Return Codes
    Return CodeDescription -
    XB_LOCK_FAILEDThe lock action failed, see errno -
    XB_NO_ERRORThe lock was successful -
    - -

    Example Program:

    -See program loadzips.cpp for an example of -how to use this method. -
    - -

    Method xbShort xbDbf::LockMemoFile( xbShort WaitOption, xbShort LockType ) -


    - -This method locks or unlocks a memo (.DBT) file which was previously opened. -It is not necessary for an application to call this method as locking is -handled automatically by other routines.

    - -WaitOption is either:

    -
  • F_SETLK - returns immediately regardless if success or failure
    -
  • F_SETLKW - waits until lock function executes

    - -LockType is one of:

    -
  • F_RDLCK - Perform a Read or Shared Lock
    -
  • F_WRLCK - Perform a Write or Exclusive Lock
    -
  • F_UNLCK - Unlock it

    - - -
    Method Return Codes
    Return CodeDescription -
    XB_LOCK_FAILEDThe lock action failed, see errno -
    XB_NO_ERRORThe lock was successful -
    -
    -



    - - diff --git a/html/xbc2.htm b/html/xbc2.htm deleted file mode 100755 index ac4800e..0000000 --- a/html/xbc2.htm +++ /dev/null @@ -1,276 +0,0 @@ - - -Xbase DBMS Chapter 2 - -

    Database Overview

    -

    Chapter Updated 3/18/04


    - -The objective of this chapter is to provide information regarding how -the database files are utilized and document the various record structures. -With the exception of the brief section on the record buffer, the -information presented in this chapter is not required to use the -Xbase library. It is mainly information describing internal file -structures utilized by the Xbase routines.

    - -Xbase files are comprised of a variable length header record which stores -information about the file and describes -the fixed length record format, followed by a series of fixed length -data records. -

    - -Each fixed length data record is preceded by a one byte indicator -which identifiies if the record has been deleted. If the record is -not deleted, the indicator is a space (0x20). If deleted, the -indicator contains an asterisk (0x2A). Data fields are stored in records -without field separators or record terminators.

    - -In earlier releases of dBASE, there is an ASCII NULL character -between the $0D end of header indicator and the start of the data. -This NULL was removed starting with dBASE III Plus, making a Plus -header one byte shorter than an identically structured III file. -The methods documented in the Xbase software and documentation follow -the more recent version where the NULL character is not included. -

    - -Each database file is comprised of zero, one or many records. A record is -comprised of fields. Only one record is accessed at a time.

    - -Zero, one or many database files can be open simultaneously.

    - -
    - -

    The Record Buffer

    - -When using the Xbase routines, each open data file has a record buffer -which is manipulated by calling the database, index and field routines. - -Updates are committed from the record buffer to the database when a write, -or append is performed. The library will automatically write updates -to the database if the buffer has been updated and the record is -repositioned or the database is closed.

    - -The record buffer is not used for handling the actual data portion of -memo fields. When working with memo fields, the application program must -allocate enough buffer space for reading and writing memo fields.

    - -Internal to the library, there is an additional record buffer which -stores the original value of the data record before any changes are made. -This is used by the index routines for finding and deleting original key -values from any open indices before adding the new keys. If the key values -are not changed, no index updates occur. - - -

    - -
    -
    -

    Xbase Database File Header

    - -The Xbase file header, located at the beginning of the database, describes -the .DBF database. Knowledge of this structure is not necessary to -effectively utilize the Xbase libraries.


    - - - -
    PositionLengthDescription -
    01 bytefile version number
    - (03H without a .DBT file)
    - (83H with a .DBT file) -
    1-33 bytesdate of last update
    - (YY MM DD) in binary format -
    4-732 bit numbernumber of records in data file -
    8-916 bit numberlength of header structure -
    10-1116 bit numberlength of the record -
    12-3120 bytesreserved -
    32-n32 bytes eachfield descriptor record (see below) -
    n+11 byte0DH as the field terminator -
    -

    - -
    -
    -

    Xbase Field Descriptor Record

    -The Xbase field descriptor record stores information about each field in the -database. Each database has from 1 to 1024 fields. -Knowledge of this structure is not necessary to -effectively utilize the Xbase libraries.


    - - - -
    PositionLengthDescription -
    0-1011 bytesfield name in ASCII zero-filled -
    111 bytefield type in ASCII (C N L D or M) -
    12-1532 bit numberfield data address -
    161 bytefield length in binary -
    171 bytefield decimal count in binary -
    18-3114 bytesreserved bytes (version 1.00) -
    -

    -
    -
    -

    Field Data Format

    -Data are stored in ASCII format in the database as follows:

    - - -
    DATA TYPEDATA RECORD STORAGE -
    CharacterASCII characters, left justified, right blank filled -
    Date(8 digits in YYYYMMDD format, such as
    - 19601007 for October 7, 1960) -
    Logical? Y y N n T t F f (? when not initialized) -
    Memo10 digits representing a .DBT block number -
    Numeric. 0 1 2 3 4 5 6 7 8 9 + -, right justified, left blank filled -
    Float. 0 1 2 3 4 5 6 7 8 9 + -, right justified, left blank filled -
    -

    - -
    -

    Memo Fields

    - -Memo fields store variable length data elements in a seperate .DBT file. -The main .DBF file maintains a ten byte field which is used by the Xbase -routines for determining the location of the data in the .DBT file. -

    - -Xbase DBMS supports both dBASE III+ and dBASE IV version memo files. -The version IV files are somewhat more efficient in that they reuse -unused memo space when data are deleted or freed from use. With version -III files, all new updates are appended to the end of the file and the -unused space is not reclaimed until the datafiles are packed. -

    - -Memo fields can be used for storing a variety of date type. However, -type 3 files are limited to storing textual data because most internal -memo field processing in a type 3 file relies on two contiguous 0x1a -charaters.

    - -Type 4 memo fields can be used for storing BLOB (binary large object) -data reliably, as the internal file structure does not rely on any -special characters embedded in the data.

    - -A special note on storing string data in a memo field. For those users -that are new to C/C++ programming, string fields typically end with -a null (0x00) terminator character. As a general rule of thumb when using -the library, add one to the length of any string when -specifying the length of the data. This stores the null terminating byte -with the data. For example, when storing string "This is a string" -specified size should be 17, not 16. - - -

    Technical memo file information

    - -The following info on memo fields is for the curious. -It is not required -reading if you don't need to know the internals.

    - -
  • Memo files are made up of one or more blocks -
  • For version III files, the block size is 512 -
  • For version IV files, the block size is a multiple of 512 -
  • The minimum amout of space necessary to store one memo field is -one block or 512 bytes. -
  • The default block size can be adjusted by manipulating the -XB_DBT_BLOCK_SIZE macro in the options.h file. - - -
  • The main .DBF file maintains a ten byte numeric field which is blank if -no memo data exists for a given field. Otherwise it contains a number, which -when multiplied by the block size, points to the offset in the file of the head -block in the file/ -

    - -For version 3 memo field files, there are two fields in the head block of -the file, NextBlockNo and Version. Depending on the -Xbase software, some vendors products update these two fields, some do not. -The Xbase library keeps the fields updated, but does not rely on them to -be valued with correct data. This helps to support maximum compatibility -amoungst all Xbase tools available.

    - -For version 4 memo field files, -the first block in the .DBT file is a header block which is comprised of -8 bytes of data which maintain the file's block size and the next free -block available in the file. Blocks two through n contain the actual -memo data. A chain of empty blocks is maintained within the file for -potential future use. When an add or update routine executes, it first -attempts to find a spot in a set of blocks which were earlier allocated, -but not currently in use for the data. If no free spot is found, data are -appended to the end of the file. - -The free block chain is sorted in block number order. When blocks of -data are freed and added to the free block chain, the routines will attempt -to concatonate free block chains togethor where possible. When a delete -occurs, or an update which requires less space occurs, the new free space -is added to the free block chain. - -

    - -

    Various Memo File Block Types

    - - - -
    Valid Block Types -
    Head Block -
    Only data block for memo field -
    First of several contiguous data block set -
    2-n of contiguous data block set -
    Only data block in free chain (version IV only) -
    First of several contiguous free block set (version IV only) -
    2-n of contiguous free block set (type 4 only) -
    -

    - -

    Head Block Structure

    - - -
    1-4LONGNext Block ID -
    5-8LONGNot used all 0x00's -
    9-16CHAR(8)Filename (Version IV Only) -
    17CHARVersion (0x03 = Version III, 0x00 = Version IV) -
    18-20CHAR(3)Not used all 0x00's -
    21-22SHORTBlock Size (Version IV only ) -
    23-Remainder of blockCHARNot used -
    -

    - - -

    Version IV Head Data Block Structure

    - - -
    xbShort0-1-1 -
    xbShort2-3Starting position of data (always 8 ?) -
    xbLong4-7Length of data includes first 8 bytes -
    char (9) - Blocksize8-15Data -
    -

    - -

    Version IV Head Free Block Structure

    - - -
    xbLong0-3Next free block in the free block chain -
    xbLong4-7Number of free blocks in this contiguous free - block set -
    -

    -Version 3 and 4 memo fields are terminated with two contiguous 0x1A bytes of data. -

    -
    -

    64 Bit File Support

    -Beginning with Release 3.0 of the library, Xbase was renamed to Xbase64 and -64 bit file support was incorporated into the library. -

    -This functionality currently works on Linux/Unix platforms which support -64 bit file structures. 64 bit support was not tested with Windows -because the author didn't have access to a compiler which creates 64 -bit Windows apps. If you need this functionality for Windows, consider -donating a Windows 64 bit compiler to the project and I'll get 64 bit -support working for Windows. -

    -It is not advisable to use Xbase 64 bit file support in combination with -32 bit Xbase applications such as older versions of DBase, Clipper and Foxpro. -Xbase64 can extend the files well beyond any limits in the older 32 bit -application development environments. -

    -If Xbase is being built with glibc, verify it is at least version 2.2.3. -


    -


    - - - diff --git a/html/xbc3.htm b/html/xbc3.htm deleted file mode 100755 index b944a1b..0000000 --- a/html/xbc3.htm +++ /dev/null @@ -1,91 +0,0 @@ - - -Xbase DBMS Chapter 3 - -

    Fields and Strings

    -

    Chapter Updated 8/20/03


    - -

    -The title of this chapter almost sounds like a popular North American -magazine called Field and Stream. The difference between this chapter and -that magazine is there are no dead animal carcuses or fishing lures in -this chapter. For those you will need to get a copy of Field and Stream. - -

    -The main objective of this chapter is to provide information regarding the -basic concepts of manipulating data via the field methods.

    - -Field names can be up to ten bytes in length and can contain characters, numbers -or special characters in the name. The field methods are used to manipulate -the data in a record of a data file. There are several types of fields.

    - - - - - -

    Field Types

    TypeSizeAllowable ValuesSchema Value -
    Numeric0 - 17(include sign and decimal point+ - . 0 through 9XB_NUMERIC_FLD -
    Character0 - 254AnythingXB_CHAR_FLD -
    Date8CCYYMMDDXB_DATE_FLD -
    Floating Point0 - 17 (includes sign and decimal point+ - . 0 through 9XB_FLOAT_FLD -
    Logical1? Y y N n T t F f (? - uninitialized)XB_LOGICAL_FLD -
    MemoFixed length portion - 10
    Variable length 0 - 32760 -
    Type III - Text
    Type IV - Anything
    XB_MEMO_FLD -
    - -

    -Field names, types and lengths are defined when a data file is created. -After the file is created, the field characteristics can not be changed. To -change field characteristics, a new database must be defined with the new -field requirements.

    - -

    Memo Fields

    - -Memo fields are variable length data fields which are stored in two parts. -This first part is a ten byte field which is stored -in the fixed length record of the .DBF file. The variable data is stored in -a seperate .DBT file in 512 byte blocks. The ten byte field in the fixed -length portion of the record points to a .DBT block number.

    - -There are two versions of memo data files type III and type IV. Type IV -is more advanced in that released space can be reused and it also -supports BLOB data. The type III file is older technology, does not -support dynamic space reclamation and only supports string data. -See method xbDbf::SetVersion for controlling which version type you are -using. - -

    -To utilize memo fields, the application program must allocate a buffer -which is large enough to handle the memo data.

    - -

    Fields and Field Numbers

    - -The Xbase routines can access field data via using field names or field -numbers. Field numbers are numbered 0-n where the first field in a datafile -is field 0 going through the last field n. Accessing fields by number is -more efficient than accessing by name.

    - -

    Record Schema

    - -The record schema of a file can be found in the documentation for method -CreateDatabase in the Database Methods chapter, or view example program -sample1.cpp.

    - -

    Strings

    - -Beginning with Release 1.8.0a, Xbase includes support for a string class -xbString. The original thinking was not to include a string -class in the library, and encourage users to use the string class -native to the user's compiler. But as C++ does not have a native way -to handle strings, and there is not a standard string class across C++ -compilers, it was decided to include a lightweight string class with the -library. In some cases this is redundant, but it is portable. -

    -The xbString class interface was derived from the Draft Standard C++ -Library by P.J. Plauger and modified. If you are familiar with -other string classes, this one should feel similar. -

    -
    -


    - - diff --git a/html/xbc4.htm b/html/xbc4.htm deleted file mode 100755 index f570ed7..0000000 --- a/html/xbc4.htm +++ /dev/null @@ -1,151 +0,0 @@ - - -Xbase DBMS Chapter 4 - -

    Date Processing

    -

    Chapter Updated 2/12/99


    - -The objective of this chapter is to provide information regarding -the basic concepts of date arithmetic and supply generic -C/C++ date methods.

    - -Two common things of all programmers is that if they write -enough code, they will eventually have to deal with dates. They -may be Julian dates, Gregorian dates, or a date with their best -freind's girl, but they'll eventually be working with dates. The -other thing is that most programmers don't have the time or don't -want to spend time writing mundane date routines.

    - -To explain how dates work, I'll give a brief overview and history of Julian -dates, Gregorian dates, leap years and leap centuries. - -

    Leap Years

    - -Due to the fact that it actually takes about 365 1/4 days for -the earth to circle the sun, every fourth year and every fourth -century have an extra day added to the end of February and the year -is called a leap year. Leap years have 366 days, non leap years -have 365 days. The following code segment describes how to -determine if a given year is a leap year. - -A leap year is a year having 366 days, which can be evenly -divisible by 4 and not by 100 or divisible by 400. - -There are also leap centuries. Leap centuries are years which -are evenly divisible by 400. - -To calculate a leap year, the following code segment can be used - - - int year; - - if(( year % 4 == 0 && year % 100 != 0 ) || year % 400 = 0 ) - LEAP_YEAR = TRUE; - else - LEAP_YEAR = FALSE - - - -

    Julian Dates

    - -Around the time of Jesus Christ, a fellow with the name of Julias Ceasar -established the Julian calendar. The Julian calendar established every -fourth year as a leap year with 366 days and all other years having 365 days. -The months were set up the same as they are with a Gregorian calendar, which -is what we use today. A Julian date is defined as as the number of days from the -first day of the year; February 1 would have a Julian day of 32.

    - -From a programmer's perspective, Julian dates are useful for doing date -arithmetic, determining the difference between two dates or calculating -a future or past date.

    - -To determine the difference between two dates, convert both dates to a -Julian date and subtract one from the other.

    - -To calculate a future or past date, convert the base date to a Julian date, -add (or subtract) the number of days necessary to (from) it and convert the -julian date back to a Gregorian date.

    - -The Julian date routines use a base date of 01/01/1900.

    - -

    Gregorian Dates

    - -In 1582, Pope Gregor XIII introduced a corrected form of the Julian calendar. -Every 4th year still has 366 days except for century years. Century years -were added as leap years if evenly divisible by 400. The year 2000 is a leap century. -

    - -The methods supplied with this software are based on gregorian dates with -the format of CCYYMMDD for century, year, month and day.

    - - -

    CASTELLANO options

    - -There is an option in the options.h file for enabling the date routines -to return Spanish values for days, weeks and months.

    -#define CASTELLANO

    - -

    Date Formats

    - -All dates are stored in the .DBF files with format CCYYMMDD.

    - -All date routines work with dates formated with the same CCYYMMDD format.

    - -

    Sample Program

    - - -#include <iostream.h> -#include <xbase/xbase.h> - -main() -{ - xbXBase x; - long l; - - cout << "\nThis program tests the XDATE routines\n\n"; - - - cout << "\nThis year is " << x.YearOf ( x.Sysdate() ); - cout << "\nThis Month is " << x.MonthOf( x.Sysdate() ); - cout << "\nToday is day " << x.DayOf( WEEK, x.Sysdate()) << " of the week"; - cout << "\nToday is day " << x.DayOf( MONTH, x.Sysdate()) << " of the month"; - cout << "\nToday is day " << x.DayOf( YEAR, x.Sysdate()) << " of the year"; - - if( x.IsLeapYear( x.Sysdate())) - cout << "\nThis is a leapyear"; - else - cout << "\nThis is not a leap year."; - - cout << "\nToday is " << x.Sysdate(); - - if( x.DateIsValid( "19951301" )) - cout << "\n19951301 is a valid date"; - else - cout << "\n19951301 is not a valid date"; - - l = x.JulianDays( "19951101" ) - x.JulianDays( "19951001" ); - - cout << "\nThere are " << l - << " days between 10/1/95 and 11/1/95."; - - cout << "\nIn 7 days it will be " - << x.JulToDate8( x.JulianDays( x.Sysdate()) + 7L ); - - cout << "\nToday is " << x.CharDayOf( x.Sysdate()); - cout << "\nThis month is " << x.CharMonthOf( x.Sysdate()); - - cout << "\nFormat (YYDDD) "; - cout << x.FormatDate( "YYDDD", x.Sysdate()); - cout << "\nFormat (MM/DD/YY) "; - cout << x.FormatDate( "MM/DD/YY", x.Sysdate()); - cout << "\nFormat (MMMM DD,YYYY) "; - cout << x.FormatDate( "MMMM DD,YYYY", x.Sysdate()); - cout << "\nFormat (DDDD, MMMM DD YYYY) "; - cout << x.FormatDate( "DDDD, MMMM DD YYYY", x.Sysdate()); - cout << "\n"; -} - -
    -



    - - diff --git a/html/xbc5.htm b/html/xbc5.htm deleted file mode 100755 index 377129f..0000000 --- a/html/xbc5.htm +++ /dev/null @@ -1,156 +0,0 @@ - - -Xbase DBMS Chapter 5 - -

    Expression Handling

    -

    Chapter Updated 3/12/04


    - -

    Overview

    - -The main objective of this chapter is to provide information regarding the -basic concepts of using the Xbase Expression module.

    - -Beginning with release 1.7.4, the Xbase library includes an expression parsing -routine which assists application programmers by providing a high level data -manipulation tool and also allows for building complex index keys. - -The functions included were derived from dBASE III Plus, but not all -dBASE III Plus functions have been implemented yet. -

    -Release 3.0 brought some upgrades to the expression module of the library -including bug fixes, additional operators and new functions. The expression -module is usable and functional, but has some room for improvement. -A future release of Xbase will include more comprehensive expresion logic. - -

    - -

    Internal fuctioning

    -The expression module works in two phases. Firstly, method -ParseExpression is called and builds an expression tree from -all the components of the expression. The tree is made up of indivdual -nodes. The expression is checked for valid field names, literals, -operands and functions. Any field references are resolved. If fields -are used in an expression and the database name for the field is not -included in the name with the -> operand, the routines assume the -associated database has been successfully opened. -

    -Secondly, method ProcessExpression is called to process the -expression tree created by ParseExpression(). The routine parses each -node in the expression tree, executing functions, processing operands -and manipulating data to produce the desired result.

    - -If an expression will be processed repeatedely, it is best to pre-parse the -tree using ParseExpression, then for each new call to the expression, -execute method ProcessExpression which processes the tree. - - -

    Expression Return Types

    -Expressions will return a type of CHAR *, NUMERIC or LOGICAL.

    - -An expression return type can be determined with method -GetExpressionResultType after parsing it.

    - -Expressions returning a return type of CHAR are limited to a 200 byte internal -buffer. There is also a 100 byte limit for NDX index key support. If -the 200 byte limit is not large enough for your application, adjust field -enum { WorkBufMaxLen = 200 }; in file exp.h. - -

    Expression Functions

    -Each expression function also has a corresponding C++ function. It is -slightly more efficient to call the C++ functions directly, rather than -execute the expression parsing routines. - -

    Expression Components

    -Expressions are made up of one or more tokens. A token is one of literal, -database field, operand or function. Literals are either numeric or character. -Character literals are enclosed in 'single' or "double" quotes. numeric -literals are a series of one or more contiguous numerals, ".", "+" or "-'". -

    -A field is simply a field name in the default database, or is in the form -of database->fieldname. - -

    -
    -

    Sample Program Demonstrating Expression Processing

    - - -/* expressn.cpp */ - -#ifdef DOS -extern unsigned _stklen = 40000; -#endif - -#include <xbase/xbase.h> -xbSchema MyRecord[] = -{ - { "FIELD1", 'C', 20, 0 }, - { "FIELD2", 'C', 20, 0 }, - { "NAME", 'C', 10, 0 }, - { "DOUB1", 'N', 7, 2 }, - { "FLOAT1", 'F', 8, 3 }, - { "DATE1", 'D', 8, 0 }, -}; -xbShort rc; -xbXBase x; -xbDbf d( &x ); -XB_EXPRESSION *e; - -/****************************************************************************/ -xbShort MyExpressionProcessor( char * Expression ) -{ - xbShort rc; - char type; - - if(( rc = x.ParseExpression( Expression, &d )) != 0 ) - { - cout << "\nParse Error " << rc; - return rc; - } - e = x.GetExpressionHandle(); - - if(( rc = x.ProcessExpression( e )) != 0 ) - { - cout << "\nError processing expression rc = " << rc; - return rc; - } - type = x.GetExpressionResultType( e ); - cout << "\nExpression " << Expression << " produced result = "; - if( type == 'C' ) - cout << x.GetStringResult(); - else if( type == 'N' ) - cout << x.GetDoubleResult(); - else if( type == 'L' ) - cout << x.GetIntResult(); - else - cout << "\nUnknown result type " << type; - return 0; -} -/****************************************************************************/ -main() -{ - e = NULL; - - d.CreateDatabase( "TEST", MyRecord, OVERLAY ); - d.BlankRecord(); - d.PutField( d.GetFieldNo( "FIELD1" ), "TESTA " ); - d.PutField( d.GetFieldNo( "FIELD2" ), " testb" ); - d.PutField( d.GetFieldNo( "DOUB1" ), "200.33" ); - d.PutField( d.GetFieldNo( "FLOAT1" ), "100.00" ); - d.PutField( d.GetFieldNo( "DATE1" ), "19980101" ); - d.AppendRecord(); - - /* process 3 simple expressions */ - MyExpressionProcessor( "FIELD1+FIELD2" ); - MyExpressionProcessor( "FIELD1-UPPER(FIELD2)" ); - MyExpressionProcessor( "5+TEST->DOUB1" ); - - d.CloseDatabase(); - return 1; -} - - - -
    -



    - - diff --git a/html/xbc6.htm b/html/xbc6.htm deleted file mode 100755 index f5cf75d..0000000 --- a/html/xbc6.htm +++ /dev/null @@ -1,150 +0,0 @@ - - -Xbase DBMS Chapter 6 - -

    NDX Indices

    -

    Chapter Updated 4/12/04


    - -The objective of this chapter is to provide information regarding the -basic concepts of how .NDX index files work in the Xbase environment.

    - -The information in this chapter has been gathered by searching the internet -and by examining the structure of known good NDX indexes.

    - -

    NDX Index File Characteristics

    - -
  • NDX indices maintain keys in ascending sort order only.

    -
  • NDX indices support unique or non unique keys.

    - -Unique keys must be unique. The database update routines will -fail if an attempt to add a non-unique key is performed.

    - -Non-unique Keys are not required to be unique, duplicate -keys are allowed if the index is created with the XB_NOT_UNIQUE -setting. Duplicate keys are stored in record number order.

    - -
  • NDX indexes are automatically updated by the Xbase library after the -indices are opened.

    - -
  • Character keys are left justified and padded on the right with spaces.

    - -
  • Numeric keys are stored as eight byte double values.

    - -

    NDX File Internals

    - -NDX files are comprised of two or more 512 byte blocks or nodes of -information. There are three types of nodes: Head Nodes, Interior -Nodes and Leaf Nodes.

    - -
  • The Head Node is the first node in the file starting at -position zero (0) and contains information about the NDX file. There -is only one Head Node in each index and it always starts at the -beginning of the file.

    - - - - - -

    NDX Header Node

    TypeSizeField NameDescription -
    xbLong4StartNodeThis identifies the root node of - the index. The Header node is node 0. -
    xbLong4Total NodesThis is the count of the total - nodes in the index. The count includes the header node. -
    xbLong4NoOfKeysTotal number of keys in the index +1 -
    xbUShort2KeyLenThe index key length -
    xbUShort2KeysPerNodeThe maximum number of keys per node -
    xbUShort2KeyTypeType of key
    -00 - Character
    01 - Numeric -
    xbLong4KeysizeKey record size + 8 -
    char1UnknownReserved -
    char1UniqueUnique indicator
    -00 - Not Unique - XB_NON_UNIQUE
    01 - Unique - XB_UNIQUE -
    char488KeyExpressionKey expression string -
    512Total bytes in node -
    -

    -The following structure is used by the Xbase NDX routines: - - struct NdxHeadNode{ - xbLong StartNode; /* header node is node 0 */ - xbLong TotalNodes; /* includes header node */ - xbLong NoOfKeys; /* actual count + 1 */ - xbUShort KeyLen; /* length of key data */ - xbUShort KeysPerNode; /* max number of keys per node */ - xbUShort KeyType; /* 00 = Char, 01 = Numeric */ - xbLong KeySize; /* KeyLen + 8 */ - char Reserved1; /* Not sure about this one */ - char Unique; /* 00 = not unique, 01 = unique*/ - char KeyExpression[488]; /* key definition */ - } - -

    - -

    Interior and Leaf Nodes

    - -Interior Nodes and Leaf Nodes share the same structure in an NDX file. -The difference between the two types is that interior nodes point to -other interior nodes or leaf nodes and leaf nodes point to records in -a DBF file. Interior nodes are optional nodes in an NDX file, -however if there are more than a few keys in the index there will -certainly be one or more interior nodes in the file. There will -always be at least one leaf node in the file. Leaf nodes contain DBF -record numbers which point to the location of the record in the -DBF file.

    - -Interior nodes have field LeftNodeNo valued which points to the node -which points to the keys which are less than the key value in the KeyVal -field. There is one more LeftNodeNo value in the node than there are keys. -The Last LeftNodeNo points to the node which is greater than the highest -key value in the node. Interior nodes have 0 in the value for the -DbfRecNo field.

    - -Leaf nodes have 0 in the LeftNodeNo field but do have a value in the -DbfRecNo field which points to a DFB record.

    - - - - - -

    NDX Interior Node and Leaf Node Structure

    TypeSizeField NameDescription -
    xbLong4NoOfKeysThisNodeThe number of key values in this node. -
    char508KeyRecA repeating structure of - pointers and keys. See the next table for the KeyRec structure. -
    -

    - - - -

    KeyRec Structure

    TypeSizeField NameDescription -
    xbLong4LeftNodeNoThe node number of the lower node - for this key. 0 in Leaf Nodes. -
    xbLong4DbfRecNoThe DBF record number for this key. - 0 in Interior Nodes. -
    charKeyLenKeyValueThe key value. -
    - -

    -For those interested in knowing how the Xbase DBMS manipulates and -navigates index files, the following discussion may be helpfull.

    - -Xbase DBMS navigates through NDX files by using an in-memory chain -of nodes of the current location / key in use. It starts by reading the -Head Node of the index, which points to the first node of the file. The -first node of the file will be a leaf node if the index is small or will -be an interior node if the index has more than one leaf node. The first -interior node is loaded into memory, added to the node chain and points -to the next node to read. The node is made up of one or more keys. If -it is a leaf node, the logic looks for a matching key on the node. -Otherwise, if it is an interior node, the logic looks at the keys until the -search key is greater than or equal to the key in the node and then -traverses down the tree to the next node. It continues down the tree, -adding the nodes to the in-memory node chain until it reaches the correct -leaf node. If it finds a matching key in the leaf node, it returns a -XB_FOUND condition. If it doesn't find an exact match in the leaf node, it -returns a XB_NOT_FOUND condition and stops on the key which is greater than -the search key given. - -
    -



    - - diff --git a/html/xbc7.htm b/html/xbc7.htm deleted file mode 100755 index bffb5ea..0000000 --- a/html/xbc7.htm +++ /dev/null @@ -1,176 +0,0 @@ - - -Xbase DBMS Chapter 7 - -

    NTX Indices

    -

    Chapter Updated 2/12/99


    - -The objective of this chapter is to provide information regarding the -basic concepts of how .NTX index files work in the Xbase environment.

    - -The information in this chapter has been gathered by searching the internet -and by examining the structure of known good NTX indexes.

    - -

    NTX Index File Characteristics

    - -
    • NTX indices maintain keys in ascending sort order only.

      -
    • NTX indices support unique or non unique keys.

      - -Unique keys must be unique. The database update routines will -fail if an attempt to add a non-unique key is performed.

      - -Non-unique Keys are not required to be unique, duplicate -keys are allowed if the index is created with the XB_NOT_UNIQUE -setting. Duplicate keys are stored in record number order.

      - -
    • NTX indexes are automatically updated by the Xbase library after the -indices are opened.

      - -
    • Character keys are left justified and padded on the right with spaces.

      - -
    • Numeric keys are stored as eight byte double values.

      - -The numeric key processing logic performs floating point numeric -calculations on eight byte double values. This logic may be compute intensive -and slow on older machines, especially the older intel processors without a -math coprocessor chip. - -
    - - -

    NTX File Internals

    - -NTX files are comprised of two or more 1024 byte blocks or nodes of -information. There are three types of nodes: Head Nodes, Interior -Nodes and Leaf Nodes.

    - -The Head Node is the first node in the file starting at -position zero (0) and contains information about the NTX file. There -is only one Head Node in each index and it always starts at the -beginning of the file.

    - - - - - -

    NTX Header Node

    TypeSizeField NameDescription -
    xbShort2Signature ByteThe Clipper signature byte. 0x003h indicates Clipper 87. 0x006h indicates Clipper 5.x -
    xbShort2Indexing Version NumberDocumented as the "Compiler Version" but I have observed an increasing number. Incremented whenever the index is changed. -
    xbLong4First Node OffsetThe offset to the first node. -
    xbLong4First Unused Page OffsetThe offset to the first unused node. -
    xbShort2Key Size + 8The Key Size plus 8 bytes. -
    xbShort2Key SizeThe size (length) of the key. -
    xbShort2Number of DecimalsNumber of decimal places in key. -
    xbShort2Max Items Per NodeThe maximum number of key per node. -
    xbShort21/2 The Max Items Per NodeHalf the maximum number of key per node. Important in a B-tree system, as this is the minimum number of keys that must be on a page. -
    char256KeyExpressionKey expression string -
    char1UniqueUnique indicator
    - 00 - Not Unique - XB_NON_UNIQUE
    - 01 - Unique - XB_UNIQUE -
    char745UnusedUnused - - -
    1024Total bytes in node -
    -

    -The following structure is used by the Xbase NTX routines: - - -struct NtxHeadNode { /* ntx header on disk */ - xbUShort Signature; /* Clipper 5.x or Clipper 87 */ - xbUShort Version; /* Compiler Version */ - /* Also turns out to be */ - /* a last modified counter */ - xbULong StartNode; /* Offset in file for first node */ - xbULong UnusedOffset; /* First free node offset */ - xbUShort KeySize; /* Size of items (KeyLen + 8) */ - xbUShort KeyLen; /* Size of the Key */ - xbUShort DecimalCount; /* Number of decimal positions */ - xbUShort KeysPerNode; /* Max number of keys per node */ - xbUShort HalfKeysPerNode; /* Min number of keys per node */ - char KeyExpression[256]; /* Null terminated key expression */ - unsigned Unique; /* Unique Flag */ - char NotUsed[745]; -}; - - - -

    - -

    Interior and Leaf Nodes

    - -NTX files use a B-tree system to store keys. A B-tree is a balanced, -on disk tree who's design minimizes disk access. Interior Nodes and -Leaf Nodes share the same structure in an NTX file. The difference is -that interior nodes point to other nodes. Leaf nodes point to -nothing. Keys in both interior nodes and leaf nodes point to records -in a DBF file. - -Interior nodes have field LeftNodeNo valued which points to the node -which points to the keys which are less than the key value in the KeyVal -field. There is one more LeftNodeNo value in the node than there are keys. The -Last LeftNodeNo points to the node which is greater than the highest -key value in the node.

    - -Leaf nodes have 0 in the LeftNodeNo field.

    - - - - - -

    NTX Interior Node and Leaf Node Structure

    TypeSizeField NameDescription -
    xbShort2NoOfKeysThisNodeThe number of key values in this node. (N) -
    Array of xbUShort2offsets[]Array of -
    HeadNode.KeysPerNode +1
    unsigned longs. - These values are the offsets (in bytes) of each key - in this node, from the beginning of the node. -
    charvariableKeyRecsA repeating structure of - pointers and keys. See the next table for the KeyRec structure. -
    -

    - -One primary difference between NDX files and NTX files is that NTX -files uses an array of offsets on all interior and leaf nodes. Each -offset is the byte count from the beginning of the node where each -KeyRec will be found. The order of the array of offsets determines -the order of keys on a given node. When keys are added or deleted, -thus changing the order of the keys on a node, only the order of the -offset array is changed. All other key data is not moved. This results -in slightly better index performance. - -
    - - - -

    KeyRec Structure

    TypeSizeField NameDescription -
    xbLong4LeftNodeNoThe node number (offset from beginning of file) of the lower node - for this key. 0 in Leaf Nodes. -
    xbLong4DbfRecNoThe DBF record number for this key. - 0 in Interior Nodes. -
    charKeyLenKeyValueThe key value. -
    - -

    -For those interested in knowing how the Xbase DBMS manipulates and -navigates index files, the following discussion may be helpfull.

    - -Xbase DBMS navigates through NTX files by using an in-memory chain of -nodes of the current location / key in use. It starts by reading the -Head Node of the index, which points to the first node of the -file. The first node of the file will be a leaf node if the index is -small or will be an interior node if the index has more than one leaf -node. The first interior node is loaded into memory, added to the -node chain and points to the next node to read. The node is made up -of one or more keys. If it is a leaf node, the logic looks for a -matching key on the node. It continues down the tree, adding the -nodes to the in-memory node chain until it reaches the correct -node. If it finds a matching key in the leaf node, it returns a XB_FOUND -condition. If it doesn't find an exact match in the leaf node, it -returns a XB_NOT_FOUND condition and stops on the key which is greater -than the search key given. - -
    - -Author: Bob Cotton - bob@synxis.com
    - - diff --git a/html/xbc8.htm b/html/xbc8.htm deleted file mode 100755 index efab841..0000000 --- a/html/xbc8.htm +++ /dev/null @@ -1,130 +0,0 @@ - - -Xbase DBMS Chapter 8 - -

    Record and File Locking

    -

    Chapter Updated 2/1/99


    - -

    Locking Overview

    - -Xbase DBMS supports multi-user processing through file and record locks. -Record locking restricts multiple cooperating programs from simultaneously -accessing the same data and corrupting it. Without record and file locking -in a multi-user environment, simultaneous access to the data and index files -can cause the files to become inaccurate and unusable.

    - -Record locking is on by default in the Xbase DBMS library. To disable it, -comment out the XB_LOCKING_ON option in the options.h file in the -xbase/src directory.

    - -The current Xbase DBMS record locking does not co-exist with other Xbase -products and there is not yet support for locking in a DOS/Windows environment. -The locking functions do work correctly for a Xbase DBMS only configuration. -Future version of Xbase DBMS will have enhanced locking features for -co-existing with other Xbase products and also include DOS/Windows support. -

    - -The locking methods return either XB_LOCK_FAILED or XB_NO_ERROR. If they return -XB_LOCK_FAILED the actual reason can be found in the global variable -errno or function perror() can be executed to view the -results. -

    - -The errno field may contain one of the following values if the lock was not -successful.

    - - -
    Error CodeDescription -
    EBADFInvalid file descriptor -
    EINVALInvalid lock information or file does not support locks -
    EACCESS
    EAGAIN
    Lock can not be set because it is blocked by an existing lock on the file. -
    ENOLCKThe system is out of lock resources, too many file locks in place. -
    EDEADLKDeadlock condition -
    EINTRProcess was interrupted by a signal while it was waiting -
    -

    -

    Types of Locks

    - -
  • Write or Exclusive Locks provide exclusive access to a -particular file location. No other process can lock the same location.

    - -
  • Read or Shared Locks prohibit any process from requesting a write -lock on a specified part of the file. Other processes can request -simultaneous read locks.


    - -

    DBF File Locking Techniques

    - -Xbase DBMS uses the following protocol for DBF file and record locking: -

    - -To lock a record - the first byte of the record is locked.
    -To lock the file - the header bytes of the file are locked.

    - -When a record is being appended to the file, the header bytes are locked.
    -When a record is being updated, the header bytes and the specific record are -locked.

    -This locking protocol is probably not compatable with other Xbase type products. -However, Xbase can be safely used for multi-user access when it is not -simultaneously updating DBF or NDX files while other products/programs are. -


    - -

    NDX File Locking Techniques

    - -Xbase DBMS locks indexes by locking the first 512 bytes -of the index file. -The entire index is locked because any updates to the index potentially -can modify significant portions of the index tree. -


    - -

    DBT File Locking Techniques

    - -Xbase DBMS locks memo files by locking the first 4 bytes -of the memo file. This effectively locks the entire file. The entire file -is locked because any updates to the free block chain can significantly -change the structure of the file. -


    - - -

    AutoLocking Features

    - -If XB_LOCKING_ON is set in the options.h file, the locking methods -execute any appropriate locking logic. If XB_LOCKING_ON is not set in the -options.h file, all locking methods return XB_NO_ERROR without -performing any actual record or file locking. This enables the application -program to always call locking routines regardless of the XB_LOCKING_ON switch -in the options.h file. -

    -By leaving the autolocking features enabled, the application program does -not need to address record, file or index locking. All locking is handled -automatically by the Xbase routines. However, if access to the locking -routines is required, they are available to the applciation programmer. -

    -When the files are automatically locked by the Xbase routines, the database -file is locked first, then it locks the indexes in alphabetical order. To -avoid deadlock conditions, files and record locks should always be done in -the same order. When the files are unlocked, then indexes are unlocked -first, then the database is unlocked. -

    -Auto-locking works well in an on-line transaction based environment. -However, it does not function efficiently in batch mode. If you -will be writing programs which process files in a batch mode, disabling -auto-lock and locking the entire file at the beginning of the process -and unlocking the file at the end of the process will significantly -reduce process time. On a 586-200 class machine, a file with 45000 records -can be read thru in a few seconds with the file locked in batch mode. -In record-lock mode it takes about six minutes with the same processor. - -

    For processing large files, locking the file instead of locking each -record is far more efficient. This is how you do it.

    - -For reading the file in batch mode:
    -xbDbf.AutoLockOff();
    -xbDbf.LockDatabase( F_SETLKW, F_RDLCK, 0L );

    -For updating the file in batch mode:
    -xbDbf.AutoLockOff();
    -xbDbf.LockDatabase( F_SETLKW, F_WRLCK, 0L );

    -
    -

    -



    - - diff --git a/html/xblock.htm b/html/xblock.htm deleted file mode 100755 index e95f1e3..0000000 --- a/html/xblock.htm +++ /dev/null @@ -1,281 +0,0 @@ - - -Xbase DBMS Chapter 10 - -

    Xbase DBMS Record and File Locking

    -

    Chapter Updated 4/8/98


    - -

    Locking Overview

    - -Xbase DBMS supports multi-user processing through file and record locks. -Record locking restricts multiple cooperating programs from simultaneously -accessing the same data and corrupting it. Without record and file locking -in a multi-user environment, simultaneous access to the data and index files -can cause the files to become inaccurate and unusable.

    - -Record locking is on by default in the Xbase DBMS library. To disable it, -comment out the LOCKING_ON option in the options.h file in the -xbase/src directory.

    - -The current Xbase DBMS record locking does not co-exist with other Xbase -products and there is not yet support for locking in a DOS/Windows environment. -The locking functions do work correctly for a Xbase DBMS only configuration. -Future version of Xbase DBMS will have enhanced locking features for -co-existing with other Xbase products and also include DOS/Windows support. -

    - -The locking methods return either LOCK_FAILED or NO_ERROR. If they return -LOCK_FAILED the actual reason can be found in the global variable -errno or function perror() can be executed to view the -results. -

    - -The errno field may contain one of the following values if the lock was not -successful.

    - - -
    Error CodeDescription -
    EBADFInvalid file descriptor -
    EINVALInvalid lock information or file does not support locks -
    EACCESS
    EAGAIN
    Lock can not be set because it is blocked by an existing lock on the file. -
    ENOLCKThe system is out of lock resources, too many file locks in place. -
    EDEADLKDeadlock condition -
    EINTRProcess was interrupted by a signal while it was waiting -
    -

    -

    Types of Locks

    - -
  • Write or Exclusive Locks provide exclusive access to a -particular file location. No other process can lock the same location.

    - -
  • Read or Shared Locks prohibit any process from requesting a write -lock on a specified part of the file. Other processes can request -simultaneous read locks.


    - -

    DBF File Locking Techniques

    - -Xbase DBMS uses the following protocol for DBF file and record locking: -

    - -To lock a record - the first byte of the record is locked.
    -To lock the file - the header bytes of the file are locked.

    - -When a record is being appended to the file, the header bytes are locked.
    -When a record is being updated, the header bytes and the specific record are -locked.

    -This locking protocol is probably not compatable with other Xbase type products. -However, Xbase can be safely used for multi-user access when it is not -simultaneously updating DBF or NDX files while other products/programs are. -


    - -

    NDX File Locking Techniques

    - -Xbase DBMS locks indexes by locking the first 512 bytes -of the index file. -The entire index is locked because any updates to the index potentially -can modify significant portions of the index tree. -


    - -

    DBT File Locking Techniques

    - -Xbase DBMS locks memo files by locking the first 4 bytes -of the memo file. This effectively locks the entire file. The entire file -is locked because any updates to the free block chain can significantly -change the structure of the file. -


    - - -

    AutoLocking Features

    - -If LOCKING_ON is set in the options.h file, the locking methods -execute any appropriate locking logic. If LOCKING_ON is not set in the -options.h file, all locking methods return NO_ERROR without -performing any actual record or file locking. This enables the application -program to always call locking routines regardless of the LOCKING_ON switch -in the options.h file. -

    -By leaving the autolocking features enabled, the application program does -not need to address record, file or index locking. All locking is handled -automatically by the Xbase routines. However, if access to the locking -routines is required, they are available to the applciation programmer. -

    -When the files are automatically locked by the Xbase routines, the database -file is locked first, then it locks the indexes in alphabetical order. To -avoid deadlock conditions, files and record locks should always be done in -the same order. When the files are unlocked, then indexes are unlocked -first, then the database is unlocked. -

    -Auto-locking works well in an on-line transaction based environment. -However, it does not function efficiently in batch mode. If you -will be writing programs which process files in a batch mode, disabling -auto-lock and locking the entire file at the beginning of the process -and unlocking the file at the end of the process will significantly -reduce process time. On a 586-200 class machine, a file with 45000 records -can be read thru in a few seconds with the file locked in batch mode. -In record-lock mode it takes about six minutes with the same processor. - -

    For processing large files, locking the file instead of locking each -record is far more efficient. This is how you do it.

    - -For reading the file in batch mode:
    -DBF.AutoLockOff();
    -DBF.LockDatabase( F_SETLKW, F_RDLCK, 0L );

    -For updating the file in batch mode:
    -DBF.AutoLockOff();
    -DBF.LockDatabase( F_SETLKW, F_WRLCK, 0L );

    -
    -

    - -

    Method Table

    - - - - -

    MethodDescription -
    DBF::AutoLockOnTurns autolocking on -
    DBF::AutoLockOffTurns autolocking off -
    DBF::ExclusiveLockLock file and indexes in exclusive mode -
    DBF::ExclusiveUnlockUnlock files and indexes -
    DBF::LockDatabaseLocks or unlocks a DBF database -
    NDX::LockIndexLocks or unlocks an NDX index -
    NDX::LockMemoFileLocks or unlocks a DBT memo field file -
    -

    - -

    Method Descriptions

    - -

    Method VOID DBF::AutoLockOn( VOID )


    - -This method turns automatic record locking on. Auto record locking is on -by default if LOCKING_ON is set in the options.h file.

    - -

    Example Program:

    - -See program loadzips.cpp for an example of -how to use this method. -
    - -

    Method VOID DBF::AutoLockOff( VOID )


    - -This method turns automatic record locking off. Auto record locking is on -by default if LOCKING_ON is set in the options.h file. -

    -Turning auto locking off will result in slightly better execution speeds -but should not be used in multi-user environments when multiple users can -update files simultanteously. If multiple users are accessing a file which -is read only then it is safe to turn off auto-locking for a particular file. -

    -Turning autolocking off will disable any index file locking which is -particularly dangerous in a multi-user environment if updates on the files -are permitted. - - -

    Example Program:

    - -See program loadzips.cpp for an example of -how to use this method. - -
    -

    Method SHORT DBF::ExclusiveLock( SHORT WaitOption )

    -

    Method SHORT DBF::ExclusiveUnlock( VOID )


    - -ExclusiveLock and ExclusiveUnclock will lock the data file, memo file (if applicable) -and any associated indexes in an exclusive mode. They also turn auto-lock -on and off as appropriate.

    - -WaitOption is either:

    -
  • F_SETLK - returns immediately regardless if success or failure
    -
  • F_SETLKW - waits until lock function executes

    - -

    Example Program:

    - -See program sample4.cpp for an example of -how to use this method. - -
    -

    Method SHORT DBF::LockDatabase( SHORT WaitOption, SHORT LockType, LONG LRecNo ) -


    - -This method locks or unlocks an Xbase (.DBF) file which was previously opened.
    -
    -WaitOption is either:

    -
  • F_SETLK - returns immediately regardless if success or failure
    -
  • F_SETLKW - waits until lock function executes

    - -LockType is one of:

    -
  • F_RDLCK - Perform a Read or Shared Lock
    -
  • F_WRLCK - Perform a Write or Exclusive Lock
    -
  • F_UNLCK - Unlock it

    - -LRecNo is:

    -0 - Lock the header section of the file (use this to lock the file)
    -1 through n - Lock a particular record

    - - - -
    Method Return Codes
    Return CodeDescription -
    INVALID_RECORDAn invalid record given -
    LOCK_FAILEDThe lock action failed, see errno -
    NO_ERRORThe lock was successful -
    - - -

    Example Program:

    - -See program loadzips.cpp for an example of -how to use this method. - -
    - -

    Method SHORT DBF::LockIndex( SHORT WaitOption, SHORT LockType ) -


    - -This method locks or unlocks an Index (.NDX) file which was previously opened.
    -
    -WaitOption is either:

    -
  • F_SETLK - returns immediately regardless if success or failure
    -
  • F_SETLKW - waits until lock function executes

    - -LockType is one of:

    -
  • F_RDLCK - Perform a Read or Shared Lock
    -
  • F_WRLCK - Perform a Write or Exclusive Lock
    -
  • F_UNLCK - Unlock it

    - - - -
    Method Return Codes
    Return CodeDescription -
    LOCK_FAILEDThe lock action failed, see errno -
    NO_ERRORThe lock was successful -
    - -

    Example Program:

    -See program loadzips.cpp for an example of -how to use this method. -
    - -

    Method SHORT DBF::LockMemoFile( SHORT WaitOption, SHORT LockType ) -


    - -This method locks or unlocks a memo (.DBT) file which was previously opened. -It is not necessary for an application to call this method as locking is -handled automatically by other routines.

    - -WaitOption is either:

    -
  • F_SETLK - returns immediately regardless if success or failure
    -
  • F_SETLKW - waits until lock function executes

    - -LockType is one of:

    -
  • F_RDLCK - Perform a Read or Shared Lock
    -
  • F_WRLCK - Perform a Write or Exclusive Lock
    -
  • F_UNLCK - Unlock it

    - - - -
    Method Return Codes
    Return CodeDescription -
    LOCK_FAILEDThe lock action failed, see errno -
    NO_ERRORThe lock was successful -
    -
    -



    - - -- cgit v1.2.3