diff options
author | Jörg Frings-Fürst <debian@jff-webhosting.net> | 2014-08-02 08:43:31 +0200 |
---|---|---|
committer | Jörg Frings-Fürst <debian@jff-webhosting.net> | 2014-08-02 08:43:31 +0200 |
commit | daf17154bf13139d9375f48525d19d6aaba08155 (patch) | |
tree | e3c08b6c49dc8a8e83f03327591310546675b43d /html |
Imported Upstream version 3.1.2upstream/3.1.2
Diffstat (limited to 'html')
-rwxr-xr-x | html/Makefile.am | 34 | ||||
-rwxr-xr-x | html/Makefile.in | 254 | ||||
-rwxr-xr-x | html/Xb2cpp.htm | 81 | ||||
-rwxr-xr-x | html/copying.lib | 443 | ||||
-rwxr-xr-x | html/index.htm | 39 | ||||
-rwxr-xr-x | html/xba1.htm | 65 | ||||
-rwxr-xr-x | html/xba2.htm | 110 | ||||
-rwxr-xr-x | html/xbapps.htm | 39 | ||||
-rwxr-xr-x | html/xbase.jpg | bin | 0 -> 6421 bytes | |||
-rwxr-xr-x | html/xbbib.htm | 63 | ||||
-rwxr-xr-x | html/xbc1.htm | 232 | ||||
-rwxr-xr-x | html/xbc11.htm | 40 | ||||
-rwxr-xr-x | html/xbc12.htm | 566 | ||||
-rwxr-xr-x | html/xbc13.htm | 470 | ||||
-rwxr-xr-x | html/xbc14.htm | 200 | ||||
-rwxr-xr-x | html/xbc15.htm | 338 | ||||
-rwxr-xr-x | html/xbc16.htm | 202 | ||||
-rwxr-xr-x | html/xbc17.htm | 352 | ||||
-rwxr-xr-x | html/xbc18.htm | 261 | ||||
-rwxr-xr-x | html/xbc2.htm | 276 | ||||
-rwxr-xr-x | html/xbc3.htm | 91 | ||||
-rwxr-xr-x | html/xbc4.htm | 151 | ||||
-rwxr-xr-x | html/xbc5.htm | 156 | ||||
-rwxr-xr-x | html/xbc6.htm | 150 | ||||
-rwxr-xr-x | html/xbc7.htm | 176 | ||||
-rwxr-xr-x | html/xbc8.htm | 130 | ||||
-rwxr-xr-x | html/xblock.htm | 281 |
27 files changed, 5200 insertions, 0 deletions
diff --git a/html/Makefile.am b/html/Makefile.am new file mode 100755 index 0000000..62aaa21 --- /dev/null +++ b/html/Makefile.am @@ -0,0 +1,34 @@ +## Process this file with automake to produce Makefile.in +## +# This file is part of the XBase libraries +# Copyright (C) 1998,1999 Vitaly Fedrushkov <fedrushkov@acm.org> + +# 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 new file mode 100755 index 0000000..2902a47 --- /dev/null +++ b/html/Makefile.in @@ -0,0 +1,254 @@ +# 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 <fedrushkov@acm.org> + +# 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 new file mode 100755 index 0000000..aa9d532 --- /dev/null +++ b/html/Xb2cpp.htm @@ -0,0 +1,81 @@ +<HTML> +<HEAD> +<TITLE>Xbase to Xbase DBMS C++ Converter</TITLE> +</HEAD> +<BODY> + +<H1>Xbase to Xbase DBMS C++ Converter</H1> + +<H2>Program Xb2cpp.pl V0.1 26-11-98</P> +<H2>Author</H2> +<A HREF="mailto:kehl@informatik.tu-muenchen.de">Hubertus Kehl</A>, kehl@informatik.tu-muenchen.de, kehlh@hotmail.com +<BR>Please send suggestions, bug reports, patches, etc. one of these email +adresses. +<H2>Language</H2> +<P>Perl 5.0</P> +<H2>Purpose</H2> +<P>Convert Dbase, Clipper, FOXPRO Source Code to XBASE C++ Code for use with +<A HREF="http://xdb.sourceforge.net">XBASE DBMS Library</A></P> +<H2>Output</H2> +<P>.cpp File and .h File</P> +<H2>Arguments</H2> +<P>1st arg = filename</P> +<H2>Remarks</H2> +<P>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.</P> +<P>Three special comments have been designed to add this info:</P> +<PRE>* XB2CPP(SelectedArea) +or * XB2CPP(SelectedArea,Workarea1,Alias1,Wa2,Al2...) +or * XB2CPP(SelA,WA1,Al1[Total1, Active1],Wa2, Al2[Tot2,Act2])</PRE> +<P>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.</P> +<P>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.</P> +<H2>Hints</H2> + +<OL> +<LI>Always give an ALIAS in USE-Statements this is needed for generation +of the Database Classnames</LI> +<LI>Give the above described additional infos where necessary.</LI> +<LI>Use ALIASes in Expressions with database fields, this helps the script +in knowing where database references are.</LI> +<LI>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.</LI> +<LI>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.</LI> +<LI>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 +:)</LI> +</OL> + +<H2>Copyright</H2> +<P>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)</P> + +<P>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.</P> +<HR> +<ADDRESS> +<A HREF="mailto:kehl@informatik.tu-muenchen.de">Hubertus Kehl</A>,29-11-1998 +</ADDRESS> +</BODY> +</HTML> diff --git a/html/copying.lib b/html/copying.lib new file mode 100755 index 0000000..e3df74a --- /dev/null +++ b/html/copying.lib @@ -0,0 +1,443 @@ +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 new file mode 100755 index 0000000..2825ac4 --- /dev/null +++ b/html/index.htm @@ -0,0 +1,39 @@ +<!DOCTYPE HTML PUBLIC> +<HTML><TITLE>Xbase DBMS Documentation Table of Contents</TITLE> +<BODY BGCOLOR=#FFFFFF> +<H1><p align="center">Xbase DBMS<br> +Last Updated 3/19/04<br>Version 3.0</p></H1> +<h2>Documentation Table Of Contents</h2> +<h3>Section 1 - Xbase Concepts</h3> +<h4> +<A HREF="xbc1.htm">Chapter 1 - Getting Started</A><br> +<A HREF="xbc2.htm">Chapter 2 - Database Overview</A><br> +<A HREF="xbc3.htm">Chapter 3 - Fields and Strings</A><br> +<A HREF="xbc4.htm">Chapter 4 - Date Processing</A><br> +<A HREF="xbc5.htm">Chapter 5 - Expression Handling</A><br> +<A HREF="xbc6.htm">Chapter 6 - NDX (DBase) Indices</A><br> +<A HREF="xbc7.htm">Chapter 7 - NTX (Clipper) Indices</A><br> +<A HREF="xbc8.htm">Chapter 8 - Record and File Locking</A><br> +</h4> +<h3>Section 2 - Using the Library</h3> +<h4> +<A HREF="xbc11.htm">Chapter 11 - Library Options and Methods</A><br> +<A HREF="xbc12.htm">Chapter 12 - Database Methods</A><br> +<A HREF="xbc13.htm">Chapter 13 - Field Methods</A><br> +<A HREF="xbc14.htm">Chapter 14 - String Methods</A><br> +<A HREF="xbc15.htm">Chapter 15 - Date Methods</A><br> +<A HREF="xbc16.htm">Chapter 16 - Expression Reference</A><br> +<A HREF="xbc17.htm">Chapter 17 - Index Methods</A><br> +<A HREF="xbc18.htm">Chapter 18 - Locking Methods</A><br> +</h4> +<h3>Section 3 - Appendices</h3> +<h4> +<A HREF="xba1.htm">Appendix A - Return Codes and Exception Processing</A><br> +<A HREF="xba2.htm">Appendix B - Quick Reference</A><br> +<A HREF="copying.lib">Appendix C - GPL Library License</A><br> +<A HREF="xbbib.htm">Appendix D - Bibliography</A><br> +<A HREF="Xb2cpp.htm">Appendix F - Xbase DBMS Perl conversion program</A><br> +</h4> +<p><img src="xbase.jpg"><br><hr> +</BODY> +</HTML> diff --git a/html/xba1.htm b/html/xba1.htm new file mode 100755 index 0000000..7125e79 --- /dev/null +++ b/html/xba1.htm @@ -0,0 +1,65 @@ +<!DOCTYPE HTML PUBLIC> +<HTML> +<TITLE>Xbase DBMS Appendix A</TITLE> +<BODY BGCOLOR=#FFFFFF> +<H1><p align="center">Xbase Return Codes</p></H1> +<p align="center">Page Updated 2/19/04</p><hr> + + +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.<br><br> + +<TABLE BORDER> +<CAPTION ALIGN="TOP"><h3>Xbase Return Codes</h3></CAPTION> +<TR ALIGN="BASELINE"> +<TR><TH ALIGN="LEFT">Number<TD>Error<TD>Description<TD>Type +<TR><TH ALIGN="LEFT">0<TD>XB_NO_ERROR<TD>Success<TD>General +<TR><TH ALIGN="LEFT">100<TD>XB_XBASE_EOF<TD>End of file<TD>Database<br>Index +<TR><TH ALIGN="LEFT">102<TD>XB_NO_MEMORY<TD>Error when allocating memory<TD>General +<TR><TH ALIGN="LEFT">103<TD>XB_FILE_EXISTS<TD>File Already Exists<TD>Database +<TR><TH ALIGN="LEFT">104<TD>XB_OPEN_ERROR<TD>Error when opening file<TD>Database +<TR><TH ALIGN="LEFT">105<TD>XB_WRITE_ERROR<TD>Error occured when writing to file<TD>Database<br>Index +<TR><TH ALIGN="LEFT">106<TD>XB_UNKNOWN_FIELD_TYPE<TD>Field was not one of:<br> +XB_CHAR_FLD<br>XB_FLOAT_FLD<br>XB_NUMERIC_FLD<br>XB_DATE_FLD<br> +XB_LOGICAL_FLD or XB_MEMO_FLD<br><TD>Field +<TR><TH ALIGN="LEFT">107<TD>XB_ALREADY_OPEN<TD>Can't open the same file twice<TD>Database<br>Index +<TR><TH ALIGN="LEFT">108<TD>XB_NOT_XBASE<TD>Can't open non X-Base file with<br> + X-Base routines<TD>Database +<TR><TH ALIGN="LEFT">109<TD>XB_INVALID_RECORD<TD>Not a valid record<TD>Database +<TR><TH ALIGN="LEFT">110<TD>XB_INVALID_OPTION<TD>Not a valid option<TD>General +<TR><TH ALIGN="LEFT">112<TD>XB_SEEK_ERROR<TD>Could not position in file<TD>Database<br>Index +<TR><TH ALIGN="LEFT">114<TD>XB_NOT_FOUND<TD>Record for key not found<TD>Index +<TR><TH ALIGN="LEFT">116<TD>XB_INVALID_KEY<TD>Invalid key argument given<TD>Index +<TR><TH ALIGN="LEFT">118<TD>XB_KEY_NOT_UNIQUE<TD>Trying to add a duplicate key for an unique index<TD>Index +<TR><TH ALIGN="LEFT">119<TD>XB_INVALID_KEY_EXPRESSION<TD>An invalid key expression given<TD>Index +<TR><TH ALIGN="LEFT">121<TD>XB_INVALID_KEY_TYPE<TD>Invalid Key Type<TD>Index +<TR><TH ALIGN="LEFT">122<TD>XB_INVALID_NODE_NO<TD>Internal index error, notify tech support<TD>Index +<TR><TH ALIGN="LEFT">123<TD>XB_NODE_FULL<TD>Internal index error, notify tech support<TD>Index +<TR><TH ALIGN="LEFT">124<TD>XB_INVALID_FIELDNO<TD>Attempt to access invalid field number<TD>Field +<TR><TH ALIGN="LEFT">125<TD>XB_INVALID_DATA<TD>Invalid data encountered<TD>Field +<TR><TH ALIGN="LEFT">126<TD>XB_NOT_LEAFNODE<TD>Internal index error, notify tech support<TD>Index +<TR><TH ALIGN="LEFT">127<TD>XB_LOCK_FAILED<TD>Lock function failed<BR>See errno for detail + <TD>Lock +<TR><TH ALIGN="LEFT">128<TD>XB_CLOSE_ERROR<TD>Error closing file<TD>Database<br>Index +<TR><TH ALIGN="LEFT">129<TD>XB_INVALID_SCHEMA<TD>Error with schema definition, check decimal points<TD>Database +<TR><TH ALIGN="LEFT">130<TD>XB_INVALID_NAME<TD>Invalid database name<TD>Memo +<TR><TH ALIGN="LEFT">131<TD>XB_INVALID_BLOCK_SIZE<TD>Block size is invalid, must be increment of 512<TD>Memo +<TR><TH ALIGN="LEFT">132<TD>XB_INVALID_BLOCK_NO<TD>Invalid block number used<TD>Memo +<TR><TH ALIGN="LEFT">133<TD>XB_NOT_MEMO_FIELD<TD>Not a memo field<TD>Memo +<TR><TH ALIGN="LEFT">134<TD>XB_NO_MEMO_DATA<TD>No memo data<TD>Memo +<TR><TH ALIGN="LEFT">135<TD>XB_EXP_SYNTAX_ERROR<TD>Expression syntax error<TD>Expression +<TR><TH ALIGN="LEFT">136<TD>XB_PARSE_ERROR<TD>Parse error in expression<TD>Expression +<TR><TH ALIGN="LEFT">137<TD>XB_NO_DATA<TD>No data for expression<TD>Expression +<TR><TH ALIGN="LEFT">140<TD>XB_INVALID_FIELD<TD>Invalid field in expression<TD>Expression +<TR><TH ALIGN="LEFT">141<TD>XB_INSUFFICIENT_PARMS<TD>Insufficient paramaters for function<TD>Expression +<TR><TH ALIGN="LEFT">142<TD>XB_INVALID_FUNCTION<TD>Invalid function encountered<TD>Expression +</TABLE><br><br><hr> +<p><img src="xbase.jpg"><br><hr> +</BODY> +</HTML> diff --git a/html/xba2.htm b/html/xba2.htm new file mode 100755 index 0000000..4a39d3c --- /dev/null +++ b/html/xba2.htm @@ -0,0 +1,110 @@ +<!DOCTYPE xbHtml PUBLIC> +<xbHtml> +<TITLE>Xbase DBMS Appendix B</TITLE> +<BODY BGCOLOR=#FFFFFF> +<H1><p align="center">Xbase DBMS Quick Reference</p></H1> +<p align="center">Page Updated 2/19/04</p><hr> + +<TABLE BORDER> +<CAPTION ALIGN="TOP"><h3>Xbase Quick Reference Method List</h3></CAPTION> +<TR VALIGN="BASELINE"> +<TR><TH ALIGN="LEFT">xbShort rc xbDbf::AppendRecord() +<TR><TH ALIGN="LEFT">void xbDbf::AutoLockOff() +<TR><TH ALIGN="LEFT">void xbDbf::AutoLockOn() +<TR><TH ALIGN="LEFT">xbShort rc xbDbf::BlankRecord() +<TR><TH ALIGN="LEFT">xbLong cs xbDbf::CalcCheckSum() +<TR><TH ALIGN="LEFT">xbShort rc xbDbf::CloseDatabase() +<TR><TH ALIGN="LEFT">xbShort rc xbDbf::CopyDbfStructure( char * NewFileName, xbShort Overlay ) +<TR><TH ALIGN="LEFT">xbShort rc xbDbf::CreateDatabase( char * FileName, xbSchema * RecordLayout, xbShort Overlay ) +<TR><TH ALIGN="LEFT">xbULong RecNo xbDbf::CurrentRecNo() +<TR><TH ALIGN="LEFT">xbShort rc xbDbf::DeleteAllRecords() +<TR><TH ALIGN="LEFT">xbShort rc xbDbf::DeleteRecord() +<TR><TH ALIGN="LEFT">xbShort rc xbDbf::DumpHeader( xbShort Option ) +<TR><TH ALIGN="LEFT">xbShort rc xbDbf::DumpRecord( xbULong RecNo ) +<TR><TH ALIGN="LEFT">xbShort rc xbDbf::ExclusiveLock( xbShort WaitOption ) +<TR><TH ALIGN="LEFT">xbShort rc xbDbf::ExclusiveUnlock() +<TR><TH ALIGN="LEFT">xbLong NoOfFields xbDbf::FieldCount() +<TR><TH ALIGN="LEFT">xbLong RecNo xbDbf::GetCurRecNo() +<TR><TH ALIGN="LEFT">xbDouble Val xbDbf::GetDoubleField( char * FieldName) +<TR><TH ALIGN="LEFT">xbDouble Val xbDbf::GetDoubleField( xbShort FieldNo ) +<TR><TH ALIGN="LEFT">xbShort rc xbDbf::GetField( xbShort FieldNo, char * FieldName ) +<TR><TH ALIGN="LEFT">xbShort DecimalCount xbDbf::GetFieldDecimal( xbShort FieldNo ) +<TR><TH ALIGN="LEFT">xbShort FieldLen xbDbf::GetFieldLen( xbShort FieldNo ) +<TR><TH ALIGN="LEFT">char * FieldName xbDbf::GetFieldName( xbShort FieldNo ) +<TR><TH ALIGN="LEFT">xbShort FieldNo xbDbf::GetFieldNo( char * FieldName ) +<TR><TH ALIGN="LEFT">char Type xbDbf::GetFieldType( xbShort FieldNo ) +<TR><TH ALIGN="LEFT">xbShort rc xbDbf::GetFirstRecord() +<TR><TH ALIGN="LEFT">xbFloat FloatVal xbDbf::GetFloatField( char * FieldName ) +<TR><TH ALIGN="LEFT">xbFloat FloatVal xbDbf::GetFloatField( xbShort FieldNo ) +<TR><TH ALIGN="LEFT">xbShort rc xbDbf::GetLastRecord() +<TR><TH ALIGN="LEFT">xbShort Val xbDbf::GetLogicalField( char * FieldName ) +<TR><TH ALIGN="LEFT">xbShort Val xbDbf::GetLogicalField( xbShort FieldNo ) +<TR><TH ALIGN="LEFT">xbLong LongVal xbDbf::GetLongField( char * FieldName ) +<TR><TH ALIGN="LEFT">xbLong LongVal xbDbf::GetLongField( xbShort FieldNo ) +<TR><TH ALIGN="LEFT">xbShort rc xbDbf::GetMemoField( xbShort FieldNo, xbLong len, char * Buf ) +<TR><TH ALIGN="LEFT">xbShort rc xbDbf::GetMemoFieldLen( xbShort FieldNo ) +<TR><TH ALIGN="LEFT">xbShort rc xbDbf::GetNextRecord() +<TR><TH ALIGN="LEFT">xbShort rc xbDbf::GetPrevRecord() +<TR><TH ALIGN="LEFT">xbShort rc xbDbf::GetRecord( xbLong RecNo ) +<TR><TH ALIGN="LEFT">char * BufPtr xbDbf::GetRecordBuf() +<TR><TH ALIGN="LEFT">xbShort rc xbDbf::LockDatabase( xbShort WaitOption, xbShort LockType, xbLong RecNo ) +<TR><TH ALIGN="LEFT">xbShort rc xbDbf::MemoFieldExists( xbShort FieldNo ) +<TR><TH ALIGN="LEFT">xbShort rc xbDbf::MemoFieldsPresent() +<TR><TH ALIGN="LEFT">xbLong RecCnt xbDbf::NoOfRecords() +<TR><TH ALIGN="LEFT">xbShort rc xbDbf::OpenDatabase( char * FileName ) +<TR><TH ALIGN="LEFT">xbShort rc xbDbf::PackDatabase( xbShort WaitOption ) +<TR><TH ALIGN="LEFT">xbShort rc xbDbf::PutDoubleField( char * FieldName,xbDouble DoubleValue ) +<TR><TH ALIGN="LEFT">xbShort rc xbDbf::PutDoubleField( xbShort FieldNo,xbDouble DoubleValue ) +<TR><TH ALIGN="LEFT">xbShort rc xbDbf::PutField( xbShort FieldNo, char * Buf ) +<TR><TH ALIGN="LEFT">xbShort rc xbDbf::PutFloatField( char * FieldName, xbFloat FloatValue ) +<TR><TH ALIGN="LEFT">xbShort rc xbDbf::PutFloatField( xbShort FieldNo, xbFloat FloatValue ) +<TR><TH ALIGN="LEFT">xbShort rc xbDbf::PutLongField( char * FieldName, xbLong LongValue ) +<TR><TH ALIGN="LEFT">xbShort rc xbDbf::PutLongField( xbShort FieldNo, xbLong LongValue ) +<TR><TH ALIGN="LEFT">xbShort rc xbDbf::PutRecord( xbLong RecNo ) +<TR><TH ALIGN="LEFT">xbShort rc xbDbf::RebuildAllIndices() +<TR><TH ALIGN="LEFT">xbShort rc xbDbf::RecordDeleted() +<TR><TH ALIGN="LEFT">xbShort rc xbDbf::SetVersion( xbShort Version ) +<TR><TH ALIGN="LEFT">xbShort rc xbDbf::UndeleteAllRecords() +<TR><TH ALIGN="LEFT">xbShort rc xbDbf::UndeleteRecord() +<TR><TH ALIGN="LEFT">xbShort rc xbDbf::UpdateMemoData( xbShort FieldNo, xbLong len, char * Buf, xbShort LockOption ) +<TR><TH ALIGN="LEFT">xbShort rc xbDbf::ValidLogicalData( xbShort FieldNo ) +<TR><TH ALIGN="LEFT">xbShort rc xbDbf::ValidNumericData( xbShort FieldNo ) + + +<TR><TH ALIGN="LEFT">char * Day xbXBase::CharDayOf( char * Date8 ) +<TR><TH ALIGN="LEFT">char * Month xbXBase::CharMonthOf( char * Date8 ) +<TR><TH ALIGN="LEFT">xbShort rc xbXBase::DateIsValid( char * Date8 ) +<TR><TH ALIGN="LEFT">xbShort Day xbXBase::DayOf( xbShort Format, char * Date8 ) +<TR><TH ALIGN="LEFT">char * Date xbXBase::FormatDate( char * Format, char * Date8 ) +<TR><TH ALIGN="LEFT">xbString & Result xbXBase::GetStringResult() +<TR><TH ALIGN="LEFT">xbDouble * Result xbXBase::GetDoubleResult() +<TR><TH ALIGN="LEFT">XB_EXPRESSION * Exp xbXBase::GetExpressionHandle() +<TR><TH ALIGN="LEFT">char Type xbXBase::GetExpressionResultType( XB_EXPRESSION * ) +<TR><TH ALIGN="LEFT">xbLong * result xbXBase::GetIntResult() +<TR><TH ALIGN="LEFT">xbShort rc xbXBase::IsLeapYear( char * Date8 ) +<TR><TH ALIGN="LEFT">xbLong JulVal xbXBase::JulianDays( char * Date8 ) +<TR><TH ALIGN="LEFT">char * Date8 xbXBase::JulToDate8( xbLong JulVal ) +<TR><TH ALIGN="LEFT">xbLong JulVal xbXBase::LastDayOfMonth( char * Date8 ) +<TR><TH ALIGN="LEFT">xbShort Month xbXBase::MonthOf( char * Date8 ) +<TR><TH ALIGN="LEFT">xbShort rc xbXBase::ParseExpression( char * exp, xbDbf * d ) +<TR><TH ALIGN="LEFT">xbShort rc xbXBase::ProcessExpression( XB_EXPRESSION * ) +<TR><TH ALIGN="LEFT">char * Date8 xbXBase::Sysdate() +<TR><TH ALIGN="LEFT">xbShort Year xbXBase::YearOf( char * Date8 ) + +<TR><TH ALIGN="LEFT">xbShort rc xbNdx::CheckNdxIntegrity( xbShort Option ) +<TR><TH ALIGN="LEFT">xbShort rc xbNdx::CloseIndex() +<TR><TH ALIGN="LEFT">xbShort rc xbNdx::CreateIndex( char * IndexName, char * KeyExpression, xbShort Unique, xbShort Overlay ) +<TR><TH ALIGN="LEFT">xbShort rc xbNdx::FindKey( char * SearchValue ) +<TR><TH ALIGN="LEFT">xbShort rc xbNdx::FindKey( xbDouble SearchValue ) +<TR><TH ALIGN="LEFT">xbShort rc xbNdx::GetFirstKey() +<TR><TH ALIGN="LEFT">xbShort rc xbNdx::GetLastKey() +<TR><TH ALIGN="LEFT">xbShort rc xbNdx::GetNextKey() +<TR><TH ALIGN="LEFT">xbShort rc xbNdx::GetPrevKey() +<TR><TH ALIGN="LEFT">xbShort rc xbNdx::KeyExists( char * SearchValue ) +<TR><TH ALIGN="LEFT">xbShort rc xbNdx::KeyExists( xbDouble SearchValue ) +<TR><TH ALIGN="LEFT">xbShort rc xbNdx::LockIndex( xbShort WaitOption, xbShort LockType ) +<TR><TH ALIGN="LEFT">xbShort rc xbNdx::OpenIndex( char * IndexName ) +<TR><TH ALIGN="LEFT">xbShort rc xbNdx::ReIndex() +</TABLE> +<br><br><hr> +<p><img src="xbase.jpg"><br><hr> diff --git a/html/xbapps.htm b/html/xbapps.htm new file mode 100755 index 0000000..7a87d02 --- /dev/null +++ b/html/xbapps.htm @@ -0,0 +1,39 @@ +<!DOCTYPE HTML PUBLIC> +<HTML> +<TITLE>Xbase DBMS Sample Application</TITLE> +<BODY BGCOLOR=#FFFFFF> +<H1><p align=center>Sample Programs</p></H1> +<p align=center>Page Updated 2/12/04</p><hr><br><br> +Sample Xbase DBMS programs are located in the xbase/samples and xbase/bin +directories.<br><br> +<CENTER> +<TABLE BORDER> +<CAPTION ALIGN=TOP><H3>X-Base Sample Programs</H3></CAPTION> +<TR ALIGN=BASELINE> +<TR><TH ALIGN=LEFT>Program<TD>Program Description +<TR><TH ALIGN=LEFT>checkndx<TD>This program checks an NDX file +<TR><TH ALIGN=LEFT>copydbf<TD>This program copies a DBF file structure +<TR><TH ALIGN=LEFT>dbfxtrct<TD>Extract data from dbf file and load into +<TR><TH ALIGN=LEFT>dbfutil1<TD>Menu program for executing Xbase functions +<TR><TH ALIGN=LEFT>deletall<TD>This program marks all records in a DBF file for deletion +<TR><TH ALIGN=LEFT>dumpdbt<TD>Debug memo files +<TR><TH ALIGN=LEFT>dumphdr<TD>This program opens an Xbase file and prints its header +<TR><TH ALIGN=LEFT>dumprecs<TD>This program dumps records for an X-Base file +<TR><TH ALIGN=LEFT>exfilter<TD>Expression filter test program +<TR><TH ALIGN=LEFT>packdbf<TD>This program packs a database file +<TR><TH ALIGN=LEFT>reindex<TD>This program rebuilds an index +<TR><TH ALIGN=LEFT>sample1<TD>This program creates an Xbase file MYFILE.DBF +<TR><TH ALIGN=LEFT>sample2<TD>This program populates file MYFILE.DBF created by program sample1 +<TR><TH ALIGN=LEFT>sample3<TD>This program lists MYFILE.DBF data populated by program sample2 +<TR><TH ALIGN=LEFT>sample4<TD>This program deletes records, undeletes records, locks and packs datafile MYFILE.DBF +<TR><TH ALIGN=LEFT>sample5<TD>This program demonstrates NDX class usage +<TR><TH ALIGN=LEFT>testdate<TD>This program tests the Xbase date methods +<TR><TH ALIGN=LEFT>undelall<TD>This program undeletes all deleted records in a dbf file +<TR><TH ALIGN=LEFT>zap<TD>This program removes all records from a DBF file + comma delimitedoutput file suitable for input into an awk or perl script +</TABLE></CENTER> +P<br><br> +<hr> +<p><img src="xbase.jpg"><br><hr> +</BODY> +</HTML> diff --git a/html/xbase.jpg b/html/xbase.jpg Binary files differnew file mode 100755 index 0000000..5070fcb --- /dev/null +++ b/html/xbase.jpg diff --git a/html/xbbib.htm b/html/xbbib.htm new file mode 100755 index 0000000..70e4e82 --- /dev/null +++ b/html/xbbib.htm @@ -0,0 +1,63 @@ +<!DOCTYPE HTML PUBLIC> +<HTML> +<TITLE>Xbase DBMS Bibliography</TITLE> +<BODY BGCOLOR=#FFFFFF> +<H1><p align="center">Xbase DBMS Bibliography</p></H1> +<p align="center">Page Updated 2/1/99</p><hr> + +Bachman, Erik<br> +Xbase File Format Description / Erik Bachman, Roskilde, Denmark: Clickety +Click Software, 1996-1998, 44 pages<br><br> + +Loomis, Mary:<br> +The Database Book, Macmillan Publishing Company, 1987, New York, New York: +ISBN 0-02-371760-2<br><br> + +Dorfman, Len:<br> +Building C Libraries, Windcrest, 1990, Blue Ridge Summit, PA: +ISBN 0-8306-3418-5<br><br> + +Eckel, Bruce:<br> +Using C++, Osborne, McGraw-Hill, 1990, Berkeley, CA: +ISBN 0-07-881522-3<br><br> + +Aho, Alfred: Hopcroft, John: Ullman, Jeffrey:<br> +Data Structures and Algorithms, Addison-Wesley Publishing, 1983, +Reading Massachusetts: ISBN 0-201-00023-7<br><br> + +Stevens, Al:<br> +C Database Development, MIS Press, 1991, Portland Oregon: +ISBN 1-55828-136-3<br><br> + +Pressman, Roger:<br> +Software Engineering: A Practitioner's Approach, McGraw-Hill, 1982, +New York ISBN 0-07-050781-3<br><br> + +Chou, George Tsu-der:<br> +2nd Edition dBase III Plus Handbook: Que Corporation, 1986, +Indianapolis, Indiana ISBN 0-88022-269-7<br><br> + +Krumm, Rob:<br> +Understanding and Using dBase II & III, Brady Communications Company, Inc, +1985, Bowie MD ISBN 0-89303-917-9<br><br> + +Hursch, Jack: Hursch, Carulyn:<br> +dBase IV Essentials, Windcrest, 1988, Blue Ridge Summit, PA +ISBN 0-8306-9616-4<br><br> + +Borland:<br> +Turbo C++, Programmer's Guide, Borland International, 1990, +Scotts Valley CA<br><br> + +Borland:<br> +Turbo C++, Library Reference, Borland International 1990, +Scotts Valley CA<br><br> + +The Draft Standard C++ Library by P.J. Plauger, Prentice Hall, New Jersey, +1995.<br><br> + +H.M Dietel/P.J. Deitel: C++ How To Program, Prentice Hall, Englewod Cliffs, +New Jersey 07632<br><br> + +</BODY> +</HTML> diff --git a/html/xbc1.htm b/html/xbc1.htm new file mode 100755 index 0000000..72c9904 --- /dev/null +++ b/html/xbc1.htm @@ -0,0 +1,232 @@ +<!DOCTYPE HTML PUBLIC> +<HTML> +<TITLE>Xbase DBMS Chapter 1</TITLE> +<BODY BGCOLOR=#FFFFFF> + +<h1><p align="center">Getting Started</p></h1> +<p align="center">Chapter Updated 8/14/03</p> + +<hr><h2>Overview</h2> + +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. +<br><br> + +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.<br><br> + +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.<br><br><br> + +<hr><h2>System Requirements</h2> + +To use Xbase DBMS, the following items are needed:<br><br> + +A computer and C/C++ compiler.<br><br> + +The original source code is developed on a Linux platform with the GCC +public domain C/C++ compiler. +<br><br> + +Xbase DBMS has been successfully ported and runs on Linux, Sun Solaris, +OpenVMS, FreeBSD, OS2 and DOS/Windows (Using the large memory model). +<br><br> + +This software is not intended to be used on any system using an SCO operating +system. +<br><br> + +<hr><h2>Classes and User Interface</h2> + +There are six classes in the Xbase library which are available +for use in a typical Xbase application program.<br><br><br> + +<CENTER><TABLE BORDER> +<CAPTION ALIGN=TOP><H3>Xbase Classes - Version 1.8.0 and newer</H3></CAPTION> +<TR VALIGN=BASELINE> +<TR><TH ALIGN=LEFT>Class<TD>Basic Description<TD>How Used<TD>Old Class<br>Name +<TR><TH ALIGN=LEFT>xbXBase<TD>Basic Xbase Class<TD>Every program gets one of these<TD>XBASE +<TR><TH ALIGN=LEFT>xbDbf<TD>Database and Field class<TD>Need one of these for each open DBF file<TD>DBF +<TR><TH ALIGN=LEFT>xbNdx<TD>Ndx index class<TD>Need one of these for each open NDX index<TD>NDX +<TR><TH ALIGN=LEFT>xbNtx<TD>Ntx index class<TD>Need one of these for each open NTX index +<TR><TH ALIGN=LEFT>xbString<TD>String class<TD>Used for handling strings +<TR><TH ALIGN=LEFT>xbHtml<TD>Html generation class<TD>Needed for creating HTML code<TD>HTML +</TABLE></CENTER> +<br><br> +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. + +<br><br> +<hr><h2>Portability, Type Defs and Structures</h2> + +To effectively make the Xbase library as portable across platforms as possible, +three things occured. +<br><br> +<li>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. +<br><br> +<li>Secondly, field types must be consistently defined in each environment. The <em>types.h</em> +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 <em>types.h</em> +file for your site and recompile.<br><br> +<li>Thirdly, support for unix automake and autoconf has been to provided +support on a wide variety of unices. +<hr><br><br> +<CENTER> +<TABLE BORDER> +<CAPTION ALIGN=TOP><h3>Field Types</h3></CAPTION> +<TR ALIGN=BASELINE> +<TR><TH ALIGN=LEFT>Type<TD>Description +<TR><TH ALIGN=LEFT>xbULong<TD>unsigned long int +<TR><TH ALIGN=LEFT>xbUShort<TD>unsigned short int +<TR><TH ALIGN=LEFT>xbShort<TD>short int +<TR><TH ALIGN=LEFT>xbLong<TD>long +<TR><TH ALIGN=LEFT>xbFloat<TD>float +<TR><TH ALIGN=LEFT>xbDouble<TD>double +<TR><TH ALIGN=LEFT>char<TD>char +<TR><TH ALIGN=LEFT>void<TD>void +<TR><TH ALIGN=LEFT>struct SCHEMA<TD>Used for defining record structures +</TABLE></CENTER> +<br><br> + +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). +<br><br> + +<hr><h2>Compilation Overview</h2> +If you are building the sources on a Linux/Unix platform:<br><br> +Download the source<br> +./configure<br> +make<br> +su<br> +make install<br> +exit<br><br> + +<br><br> +Before compiling the library, you may need to modify the options for your +environment. Do "./configure --help" for a list of the current options + +<br><br> +On my server, I had to: +<li>Verify the library and associated links were copied from xbase/xbase/.libs +into /usr/local/lib +<li>Add /usr/local/lib is in /etc/ld.so.conf +<li>execute program <em>ldconfig</em> as root to refresh the new libs + +<br><br> +Actual milage at your site may vary. +<br><br> + +<hr><h2>Building a program with the Xbase library</H2> + +Create a directory for your project:<br><br> + +cd /home/me<br> +mkdir MyProject<br> +cd MyProject<br> +vi MyProg.cpp<br><br> + +To use the Xbase classes, include the following header file in the program: +<br><br> + +#include <xbase/xbase.h><br><br> + +For more details, check out the sample programs in the +xbase/examples directory. +<br><br> +<hr><h2>Compiling and Linking Unix Application Program for v3.0 later</h2> + +The install script should have provided specific instructions for your +environment on how to link with the xbase library. <br><br> + +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 +<br><br> + +To Compile:<br> +g++ -c -Wall -I/usr/include -I/usr/src/linux/include-asm-i386 -I/usr/local/include +-I/usr/local/xbase myprog.cpp<br><br> +To Link Edit:<br> +g++ -o myprog myprog.o libxbase.so<br><br> + +<hr><h2>Compiling an Application Program with Borland v4.5 C/C++compiler</h2> +With Borland C compiler: bcc -Ic:\xbase\src myprog.cpp -Lc:\xbase\src\xbase.lib +<br><br> + +<hr><h2>Getting the latest development version of XBase</h2> + +<br>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. + +<br><h3>Notes about using the current development library</h3> +<li>1 - Library functions may or may not be documented +<li>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 +<A HREF="mailto:xdb-devel@lists.sourceforeg.net">xdb-devel@lists.sourceforge.net +</A> 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. +<li>3 - If you have changes to contribute to the library, mail your updates +to<A HREF="mailto:xdb-devel@lists.sourceforge.net"> +xdb-devel@lists.sourceforge.net</A><br>. + +<hr><br> +<h2>System Limitations</h2> +<br> +Maximum size of a database file is the size of LONG - 2,147,483,647 bytes<br> +Total number of fields in a database - 1024 <br> +Total number of characters in all fields - 32767<br> +Maximum number of characters in a field - 254<br> +Total number of records in a file - 1 billion<br> +Maximum index key length - 100 bytes<br> +Maximum .DBT file memo block size - 32256<br> +Maximum expression result length - 100 bytes<br> +Maximum NDX index key length - 100 bytes<br><br> +<hr><br><br> + +<CENTER> +<TABLE BORDER> +<CAPTION ALIGN=TOP><H3>Xbase Options - Unix Automake environment</H3></CAPTION> +<TR VALIGN=BASELINE> +<TR><TH ALIGN=LEFT>OPTION<TD>DESCRIPTION +<TR><TH ALIGN=LEFT>--without-xbase-debug<TD>Turns off xbase debugging code +<TR><TH ALIGN=LEFT>--without-index-ndx<TD>Turns off NDX index options +<TR><TH ALIGN=LEFT>--without-index-ntx<TD>Turns off NTX index options +<TR><TH ALIGN=LEFT>--without-memo-fields<TD>Turns off memo fields +<TR><TH ALIGN=LEFT>--without-expressions<TD>Turns off expression processing +<TR><TH ALIGN=LEFT>--without-ui-html<TD>Turns off HTML user interface class +<TR><TH ALIGN=LEFT>--without-xbase-locking<TD>Turns off xbase locking +<TR><TH ALIGN=LEFT>--without-xbase-debug<TD>Turns off debug logic +<TR><TH ALIGN=LEFT>--without-exceptions<TD>Turns on exception processing +<TR><TH ALIGN=LEFT>--with-castellano<TD>Turn on castellano/spanish date options +<TR><TH ALIGN=LEFT>--without-realdelete<TD>Turn off Xbase record deletion +<TR><TH ALIGN=LEFT>--without-xbase-filter<TD>Turn off Xbase filter logic +</TABLE></CENTER> +<br><br> + +Use these options on the command line when executing the <em>./configure</em> +command. Also, you can execute <em>./configure --help</em> for a complete +list of all unix configure options. +<br><br> +<B>Q</B> Why turn any of thes options off?<br> +<B>A</B> Smaller library<br><br><hr> + + +<p><img src=xbase.jpg><br><hr> +</BODY> +</HTML> diff --git a/html/xbc11.htm b/html/xbc11.htm new file mode 100755 index 0000000..9af3860 --- /dev/null +++ b/html/xbc11.htm @@ -0,0 +1,40 @@ +<!DOCTYPE HTML PUBLIC> +<HTML> +<TITLE>Xbase DBMS Chapter 11</TITLE> +<BODY BGCOLOR=#FFFFFF> +<H1><p align="center">Library Options and Methods<br></H1> +<p align="center">Chapter Updated 2/1/99</p><hr> +<br> +<TABLE BORDER> +<CAPTION ALIGN="TOP"><h3>xbXbase Class Methods</H3></CAPTION> +<TR VALIGN="BASELINE"> +<TR><TH ALIGN="LEFT">Method<TD>Description +<TR><TH ALIGN="LEFT">void xbXBase::DisplayError(xbShort ErrorNumber)<TD>Display error text +<TR><TH ALIGN="LEFT">char * xbXbase::GetDefaultDateFormat()<TD>Return the default date format +<TR><TH ALIGN="LEFT">void xbXBase::SetDefaultDateFormat(char * Format)<TD>Set the default date format +</TABLE> +<br><br> +<hr> +<h2>Method Definitions</h2> +<hr> +<h4>Method void xbXbase::DisplayError( xbShort ErrorNo )</h4><br> +This method prints a text description of an error code. +<h4>Example Code Snipit:</h4> + +<xmp> +xbShort rc; +rc = d.SomeXbaseFunction(...); +if( rc < 0 ) + x.DisplayError( rc ); +else + DoSomethingUsefull(); +</xmp> +<hr> +<h4>Method char * xbXBase::GetDefaultDateFormat( void )<br> +Method void xbXBase::SetDefaultDateFormat( char * NewDateFormat )</h4><br> +These methods are used for retrieving and setting the default date format +which is used by expression function DTOC. +<br><br><hr> +<p><img src="xbase.jpg"><br><hr> +</BODY> +</HTML> diff --git a/html/xbc12.htm b/html/xbc12.htm new file mode 100755 index 0000000..af33408 --- /dev/null +++ b/html/xbc12.htm @@ -0,0 +1,566 @@ +<!DOCTYPE xbHtml PUBLIC> +<xbHtml> +<TITLE>Xbase DBMS Chapter 12</TITLE> +<BODY BGCOLOR=#FFFFFF> +<H1><p align="center">Database Methods</p></H1> +<p align="center">Chapter Updated 1/30/99</p><hr> +<br> +This chapter lists the database methods and provides links to examples of how +to use them.<br><br><br> +<TABLE BORDER> +<CAPTION ALIGN="TOP"><h3>Xbase Database Method List</h3></CAPTION> +<TR VALIGN="BASELINE"> +<TR><TH ALIGN="LEFT">Method<TD>Description +<TR><TH ALIGN="LEFT">xbShort rc AppendRecord()<TD>Append a new record to the end of an open database +<TR><TH ALIGN="LEFT">void AutoLockOn()<TD>Turns on automatic record locking (see locking chapter) +<TR><TH ALIGN="LEFT">void AutoLockOff()<TD>Turns off automatic record locking (see locking chapter) +<TR><TH ALIGN="LEFT">void BlankRecord()<TD>Fill the current record buffer with blanks +<TR><TH ALIGN="LEFT">xbLong csum CalcCheckSum()<TD>Calculate checksum on a data record +<TR><TH ALIGN="LEFT">xbShort rc CloseDatabase()<TD>Close an open database +<TR><TH ALIGN="LEFT">xbShort rc CopyDbfStructure(<br> char * NewFileName,<br> + xbShort OverlaySwitch )<TD>Copies the structure of a xbDbf file to a new file +<TR><TH ALIGN="LEFT">xbShort rc CreateDatabase(<br>char * FileName, + XbSchema *s, xbShort OverlaySwitch )<TD>Close an open database +<TR><TH ALIGN="LEFT">xbULong CurrentRecNo()<TD>Returns the current record number +<TR><TH ALIGN="LEFT">xbShort rc DeleteAllRecords()<TD>Mark all records for deletion +<TR><TH ALIGN="LEFT">xbShort rc DeleteRecord()<TD>Mark a record for deletion +<TR><TH ALIGN="LEFT">xbShort rc DumpHeader(xbShort option)<TD>Display information about a .DBF file header +<TR><TH ALIGN="LEFT">xbShort rc DumpRecord(<br>xbULong RecNo)<TD>Dump a record for a database +<TR><TH ALIGN="LEFT">xbLong cnt FieldCount()<TD>Returns number of fields in database +<TR><TH ALIGN="LEFT">xbLong recno GetCurRecNo()<TD>Returns current record number +<TR><TH ALIGN="LEFT">xbShort rc GetFirstRecord()<TD>Get the first record in the database +<TR><TH ALIGN="LEFT">xbShort rc GetLastRecord()<TD>Get the last record in the database +<TR><TH ALIGN="LEFT">xbShort rc GetNextRecord()<TD>Get the next record in the database +<TR><TH ALIGN="LEFT">xbShort rc GetPrevRecord()<TD>Get the previous record in the database +<TR><TH ALIGN="LEFT">xbShort rc GetRecord(xbLong RecNo)<TD>Get a record by record number from an open database +<TR><TH ALIGN="LEFT">char * buf GetRecordBuf()<TD>Returns a pointer to the record buffer +<TR><TH ALIGN="LEFT">xbLong RecCnt NoOfRecords()<TD>Returns the number of records in an open database +<TR><TH ALIGN="LEFT">xbShort rc OpenDatabase(char * FileName)<TD>Open an existing database +<TR><TH ALIGN="LEFT">xbShort rc PackDatabase(<br>xbShort WaitOption)<TD>Compress file and remove deleted records +<TR><TH ALIGN="LEFT">xbShort rc PutRecord(xbULong RecNo)<TD>Put a record in an open database +<TR><TH ALIGN="LEFT">xbShort rc RebuildAllIndices()<TD>Rebuilds all open indices +<TR><TH ALIGN="LEFT">xbShort dflag RecordDeleted()<TD>Determine if a record has been deleted +<TR><TH ALIGN="LEFT">xbShort version SetVersion(xbShort Ver)<TD>Set version to xbase III+ or IV style xbDbf files +<TR><TH ALIGN="LEFT">xbShort rc UndeleteAllRecords()<TD>Unmark all deleted records +<TR><TH ALIGN="LEFT">xbShort rc UndeleteRecord()<TD>Unmark a deleted record +<TR><TH ALIGN="LEFT">xbShort rc Zap(xbShort WaitOption)<TD>Deletes all records from a database +</TABLE> +<BR><BR><hr> +<h2>Method Definitions</h2> +<hr> +<h3>Method xbShort xbDbf::AppendRecord( void )</h3><br> +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.<br><br> +This method also updates any open indexes associated with the database.<br><br> +<TABLE BORDER> +<CAPTION ALIGN="TOP"><h3>Method Return Codes</h3></CAPTION><br> +<TR VALIGN="BASELINE"> +<TR><TH ALIGN="LEFT">Return Code<TD>Description +<TR><TH ALIGN="LEFT">XB_LOCK_FAILED<TD>Write lock not successful +<TR><TH ALIGN="LEFT">XB_NO_ERROR<TD>If there is no error +<TR><TH ALIGN="LEFT">XB_WRITE_ERROR<TD>Unsuccessful write operation +</TABLE> +<h4>Example Program:</h4> +See program <A HREF="/XbaseSamples/sample2.cpp">sample2.cpp</A> for an example +of how to use this method. +<hr> +<h3>Method xbShort xbDbf::BlankRecord( void )</h3><br> +This method overlays the database record buffer with space (0x20) +CHARacters. This method is useful for initializing the record buffer.<br> +<h4>Example Program:</h4> +See program <A HREF="/XbaseSamples/sample2.cpp">sample2.cpp</A> for an example of +how to use this method. +<hr> + +<h3>Method xbLong xbDbf::CalcCheckSum( void )</h3><br> +This method calculates the checksum of a database record. +<hr> + +<h3>Method xbShort xbDbf::CloseDatabase( void )</h3><br> +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.<br><br> +This method automatically closes any open indexes associated with the +database before closing the database.<br><br> +<TABLE BORDER> +<CAPTION ALIGN="TOP"><h3>Method Return Codes</h3></CAPTION><br> +<TR VALIGN="BASELINE"> +<TR><TH ALIGN="LEFT">Return Code<TD>Description +<TR><TH ALIGN="LEFT">XB_NO_ERROR<TD>If there is no error +<TR><TH ALIGN="LEFT">XB_NOT_OPEN<TD>If there is no error +</TABLE> +<h4>Example Program:</h4> +See program <A HREF="/XbaseSamples/sample2.cpp">sample2.cpp</A> for an example +of how to use this method. +<hr> + + +<h3>Method xbShort xbDbf::CopyDbfStructure( char *NewFileName, xbShort OverLay )</h3><br> +This method copies the structure of an Xbase (.DBF) file to file <em>NewFileName</em>. +If there are memo fields, they are included. +<br><br> +The <em>OverLay</em> switch is +used to determine what to do if a xbDbf file with the same name +already exists. If <em>OverLay</em> is set to XB_OVERLAY and the file exists, +the file is overwritten, otherwise an error is returned.<br><br> +<em>Overlay Switch</em> is:<br> +<li>XB_OVERLAY = Overlay file if it exists<br> +<li>XB_DONTOVERLAY = Return with error if file exists<br><br> + +<TABLE BORDER> +<CAPTION ALIGN="TOP"><h3>Method Return Codes</h3></CAPTION><br> +<TR VALIGN="BASELINE"> +<TR><TH ALIGN="LEFT">Return Code<TD>Description +<TR><TH ALIGN="LEFT">XB_NO_ERROR<TD>If there is no error +<TR><TH ALIGN="LEFT">XB_FILE_EXISTS<TD>If a file exists and OverLay switch = FALSE +<TR><TH ALIGN="LEFT">XB_OPEN_ERROR<TD>Couldn't open the file +<TR><TH ALIGN="LEFT">XB_NO_MEMORY<TD>Memory allocation error +<TR><TH ALIGN="LEFT">XB_WRITE_ERROR<TD>Couldn't write to disk +<TR><TH ALIGN="LEFT">XB_SEEK_ERROR<TD>Seek routine error +</TABLE> +<h4>Example Program:</h4> +See program <A HREF="/XbaseSamples/copydbf.cpp">copydbf.cpp</A> for an example +of how to use this method. +<hr> + + +<h3>Method: xbShort xbDbf::CreateDatabase( char *FileName, + xbSchema *s, xbShort OverLay )</h3><br> +This method creates an Xbase (.DBF) file with the name +of FileName and builds the header record with the format as +defined in the <em>xbSchema</em> parameter. The <em>OverLay</em> switch is +used to determine what to do if a xbDbf file with the same name +already exists. If <em>OverLay</em> is set to XB_OVERLAY and the file exists, +the file is overwritten, otherwise an error is returned.<br><br> +<em>Overlay Switch</em> is:<br> +<li>XB_OVERLAY = Overlay file if it exists<br> +<li>XB_DONTOVERLAY = Return with error if file exists<br><br> +<em>xbSchema</em> has the following format:<br> +<xmp> +xbSchema MyRecordSchema[] = +{ + { FieldName, Type, FieldLength, NoOfDecimals }, + { FieldName2, Type, FieldLength, NoOfDecimals }, + ... + { "",0,0,0 } +}; +</xmp> +Where:<br> +<li><em>FieldName</em> is the name of the data field.<br> +<li><em>Type</em><br><br> +<h4>Version 1.7.4 and greater:</h4> +XB_CHAR_FLD or C<br> +XB_DATE_FLD or D<br> +XB_LOGICAL_FLD or L<br> +XB_MEMO_FLD or M<br> +XB_FLOAT_FLD or F<br> +XB_NUMERIC_FLD or N<br><br> +<li><em>FieldLength</em> is the length of the field.<br> +<li><em>NoOfDecimals</em> is the number of decimals for NUMERIC fields.<br> +<br> +The record buffer is automatically set to spaces when this method is called. +<br><br> +<TABLE BORDER> +<CAPTION ALIGN="TOP"><h3>Method Return Codes</h3></CAPTION><br> +<TR VALIGN="BASELINE"> +<TR><TH ALIGN="LEFT">Return Code<TD>Description +<TR><TH ALIGN="LEFT">XB_NO_ERROR<TD>If there is no error +<TR><TH ALIGN="LEFT">XB_FILE_EXISTS<TD>If a file exists and OverLay switch = FALSE +<TR><TH ALIGN="LEFT">XB_OPEN_ERROR<TD>Couldn't open the file +<TR><TH ALIGN="LEFT">XB_NO_MEMORY<TD>Memory allocation error +<TR><TH ALIGN="LEFT">XB_WRITE_ERROR<TD>Couldn't write to disk +</TABLE> +<h4>Example Program:</h4> +See program <A HREF="/XbaseSamples/sample1.cpp">sample1.cpp</A> for an example +of how to use this method. +<hr> +<h3>Method xbULong xbDbf::CurrentRecNo( void )</h3><br> +This method returns the current record number.<br><br> +<h4>Example Program:</h4> +See program <A HREF="/XbaseSamples/dumprecs.cpp">dumprecs.cpp</A> for an example +of how to use this method. + +<hr> +<h3>Method xbShort xbDbf::DeleteAllRecords( void )</h3><br> +This method marks all unmarked records in the database for deletion.<br><br> +<TABLE BORDER> +<CAPTION ALIGN="TOP"><h3>Method Return Codes</h3></CAPTION><br> +<TR VALIGN="BASELINE"> +<TR><TH ALIGN="LEFT">Return Code<TD>Description +<TR><TH ALIGN="LEFT">XB_NO_ERROR<TD>No error encountered +<TR><TH ALIGN="LEFT">XB_INVALID_RECORD<TD>Could not mark record +<TR><TH ALIGN="LEFT">XB_NOT_OPEN<TD>If the file is not open +<TR><TH ALIGN="LEFT">XB_SEEK_ERROR<TD>Seek routine error +<TR><TH ALIGN="LEFT">XB_WRITE_ERROR<TD>Write routine error +</TABLE> +<h4>Example Program:</h4> +See program <A HREF="/XbaseSamples/deletall.cpp">deletall.cpp</A> for an example +of how to use this method. + +<hr> +<h3>Method xbShort xbDbf::DeleteRecord( void )</h3><br> +This method marks the current record for deletion in the database.<br><br> +<TABLE BORDER> +<CAPTION ALIGN="TOP"><h3>Method Return Codes</h3></CAPTION><br> +<TR VALIGN="BASELINE"> +<TR><TH ALIGN="LEFT">Return Code<TD>Description +<TR><TH ALIGN="LEFT">XB_NO_ERROR<TD>No error encountered +<TR><TH ALIGN="LEFT">XB_INVALID_RECORD<TD>Could not mark record +</TABLE> +<h4>Example Program:</h4> +See program <A HREF="/XbaseSamples/sample4.cpp">sample4.cpp</A> for an example +of how to use this method. + +<hr> +<h3>Method xbShort xbDbf::DumpHeader( xbShort Option )</h3><br> +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 +<em>options.h</em> file<br><br> +<TABLE BORDER> +<CAPTION ALIGN="TOP"><h3>Method Options</h3></CAPTION><br> +<TR VALIGN="BASELINE"> +<TR><TH ALIGN="LEFT">Option<TD>Action +<TR><TH ALIGN="LEFT">1<TD>Print Header Only +<TR><TH ALIGN="LEFT">2<TD>Field Data Only +<TR><TH ALIGN="LEFT">3<TD>Header and Field Data +</TABLE> +<br> +<TABLE BORDER> +<CAPTION ALIGN="TOP"><h3>Method Return Codes</h3></CAPTION><br> +<TR VALIGN="BASELINE"> +<TR><TH ALIGN="LEFT">Return Code<TD>Description +<TR><TH ALIGN="LEFT">XB_INVALID_OPTION<TD>Option must be 1,2 or 3 +<TR><TH ALIGN="LEFT">XB_NOT_OPEN<TD>File is not open +<TR><TH ALIGN="LEFT">XB_NO_ERROR<TD>No error encountered +</TABLE> +<br> +<h4>Example Program:</h4> +See program <A HREF="/XbaseSamples/dumphdr.cpp">dumphdr.cpp</A> for an +example of how to use this method. + +<hr> +<h3>Method xbShort xbDbf::DumpRecord( xbULong RecNo )</h3><br> +This method dumps record RecNo for the database to stdout.<br><br> +<TABLE BORDER> +<CAPTION ALIGN="TOP"><h3>Method Return Codes</h3></CAPTION><br> +<TR VALIGN="BASELINE"> +<TR><TH ALIGN="LEFT">Return Code<TD>Description +<TR><TH ALIGN="LEFT">XB_NO_ERROR<TD>No error encountered +<TR><TH ALIGN="LEFT">XB_INVALID_RECORD<TD>Invalid record for RecNo parameter +</TABLE> +<h4>Example Program:</h4> +See program <A HREF="/XbaseSamples/dumprecs.cpp">dumprecs.cpp</A> for an +example of how to use this method. +<hr> +<h3>Method xbLong xbDbf::FieldCount( void )</h3><br> +This method returns the number of fields defined in the database. +<br><br> +<hr> +<h3>Method xbLong xbDbf::GetCurRecNo( void )</h3><br> +This method returns the current record number of the record in the record buffer. +<br><br> +<h4>Example Program:</h4> +See program <A HREF="/XbaseSamples/sample3.cpp">sample3.cpp</A> for an +example of how to use this method. +<hr> +<h3>Method xbShort xbDbf::GetFirstRecord( void )</h3><br> +This method loads the first record of the file into the record buffer.<br><br> +<TABLE BORDER> +<CAPTION ALIGN="TOP"><h3>Method Return Codes</h3></CAPTION><br> +<TR VALIGN="BASELINE"> +<TR><TH ALIGN="LEFT">Return Code<TD>Description +<TR><TH ALIGN="LEFT">XB_NO_ERROR<TD>If there is no error +<TR><TH ALIGN="LEFT">XB_INVALID_RECORD<TD>Invalid record number +<TR><TH ALIGN="LEFT">XB_LOCK_FAILED<TD>Unsuccessful lock operation +<TR><TH ALIGN="LEFT">XB_NOT_OPEN<TD>If the file is not open +<TR><TH ALIGN="LEFT">XB_SEEK_ERROR<TD>Seek routine error +<TR><TH ALIGN="LEFT">XB_WRITE_ERROR<TD>Write routine error +</TABLE> +<h4>Example Program:</h4> + +See program <A HREF="/XbaseSamples/sample3.cpp">sample3.cpp</A> for an +example of how to use this method. +<hr> +<h3>Method xbShort xbDbf::GetLastRecord( void )</h3><br> + +This method loads the last record of the file into the record buffer.<br><br> + +<TABLE BORDER> +<CAPTION ALIGN="TOP"><h3>Method Return Codes</h3></CAPTION><br> +<TR VALIGN="BASELINE"> +<TR><TH ALIGN="LEFT">Return Code<TD>Description +<TR><TH ALIGN="LEFT">XB_LOCK_FAILED<TD>Read lock not successful +<TR><TH ALIGN="LEFT">XB_NO_ERROR<TD>If there is no error +<TR><TH ALIGN="LEFT">XB_EOF<TD>At end of file +<TR><TH ALIGN="LEFT">XB_NOT_OPEN<TD>If the file is not open +<TR><TH ALIGN="LEFT">XB_INVALID_RECORD<TD>Invalid record number +<TR><TH ALIGN="LEFT">XB_SEEK_ERROR<TD>Seek routine error +<TR><TH ALIGN="LEFT">XB_WRITE_ERROR<TD>Write routine error +</TABLE> + +<h4>Example Program:</h4> + +See program <A HREF="/XbaseSamples/sample3.cpp">sample3.cpp</A> for an example +of how to use this method. +<hr> +<h3>Method xbShort xbDbf::GetNextRecord( void )</h3><br> + +This method loads the next record of the file into the record buffer.<br><br> + +<TABLE BORDER> +<CAPTION ALIGN="TOP"><h3>Method Return Codes</h3></CAPTION><br> +<TR VALIGN="BASELINE"> +<TR><TH ALIGN="LEFT">Return Code<TD>Description +<TR><TH ALIGN="LEFT">XB_LOCK_FAILED<TD>Read lock not successful +<TR><TH ALIGN="LEFT">XB_NO_ERROR<TD>If there is no error +<TR><TH ALIGN="LEFT">XB_EOF<TD>At end of file +<TR><TH ALIGN="LEFT">XB_NOT_OPEN<TD>If the file is not open +<TR><TH ALIGN="LEFT">XB_INVALID_RECORD<TD>Invalid record number +<TR><TH ALIGN="LEFT">XB_SEEK_ERROR<TD>Seek routine error +<TR><TH ALIGN="LEFT">XB_WRITE_ERROR<TD>Write routine error +</TABLE> +</TABLE> + +<h4>Example Program:</h4> + +See program <A HREF="/XbaseSamples/sample3.cpp">sample3.cpp</A> for an +example of how to use this method. +<hr> +<h3>Method xbShort xbDbf::GetPrevRecord( void )</h3><br> + +This method loads the previous record of the file into the record buffer.<br><br> + +<TABLE BORDER> +<CAPTION ALIGN="TOP"><h3>Method Return Codes</h3></CAPTION><br> +<TR VALIGN="BASELINE"> +<TR><TH ALIGN="LEFT">Return Code<TD>Description +<TR><TH ALIGN="LEFT">XB_LOCK_FAILED<TD>Read lock not successful +<TR><TH ALIGN="LEFT">XB_NO_ERROR<TD>If there is no error +<TR><TH ALIGN="LEFT">XB_BOF<TD>At beginning of file +<TR><TH ALIGN="LEFT">XB_NOT_OPEN<TD>If the file is not open +<TR><TH ALIGN="LEFT">XB_INVALID_RECORD<TD>Invalid record number +<TR><TH ALIGN="LEFT">XB_SEEK_ERROR<TD>Seek routine error +<TR><TH ALIGN="LEFT">XB_WRITE_ERROR<TD>Write routine error +</TABLE> +<h4>Example Program:</h4> +See program <A HREF="/XbaseSamples/sample3.cpp">sample3.cpp</A> for an +example of how to use this method. +<hr> +<h3>Method xbShort xbDbf::GetRecord( xbLong RecNo )</h3><br> +This method retrieves record RecNo from the database into the record buffer. +<br><br> +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.<br><br> +<TABLE BORDER> +<CAPTION ALIGN="TOP"><h3>Method Return Codes</h3></CAPTION><br> +<TR VALIGN="BASELINE"> +<TR><TH ALIGN="LEFT">Return Code<TD>Description +<TR><TH ALIGN="LEFT">XB_LOCK_FAILED<TD>Read lock not successful +<TR><TH ALIGN="LEFT">XB_NO_ERROR<TD>If there is no error +<TR><TH ALIGN="LEFT">XB_NOT_OPEN<TD>If the file is not open +<TR><TH ALIGN="LEFT">XB_INVALID_RECORD<TD>Invalid record number +<TR><TH ALIGN="LEFT">XB_SEEK_ERROR<TD>Seek routine error +<TR><TH ALIGN="LEFT">XB_WRITE_ERROR<TD>Write routine error +</TABLE> +<h4>Example Program:</h4> +See program <A HREF="/XbaseSamples/sample3.cpp">sample3.cpp</A> for an +example of how to use this method. +<hr> +<h3>Method char * xbDbf::GetRecordBuf( void )</h3><br> +This method returns a pointer to the record buffer. +<br><br> +<h4>Example Program:</h4> +See program <A HREF="/XbaseSamples/sample3.cpp">sample3.cpp</A> for an +example of how to use this method. +<hr> +<h3>Method xbLong xbDbf::NoOfRecords( void )</h3><br> +This method returns the number of records in the file.<br><br> +<h4>Example Program:</h4> +See program <A HREF="/XbaseSamples/sample3.cpp">sample3.cpp</A> for an +example of how to use this method. +<hr> +<h3>Method xbShort xbDbf::OpenDatabase( char * FileName )</h3><br> +This method opens an Xbase (.DBF) file with the name +of FileName. <em>FileName</em> must a valid filename which can include +drives identifier, directory, filename and extension. <br><br> +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.<br><br> +The record buffer is automatically set to spaces when this method is called. +<br><br> +<TABLE BORDER> +<CAPTION ALIGN="TOP"><h3>Method Return Codes</h3></CAPTION><br> +<TR VALIGN="BASELINE"> +<TR><TH ALIGN="LEFT">Return Code<TD>Description +<TR><TH ALIGN="LEFT">XB_NO_ERROR<TD>If there is no error +<TR><TH ALIGN="LEFT">XB_OPEN_ERROR<TD>Couldn't open the file +<TR><TH ALIGN="LEFT">XB_NO_MEMORY<TD>Memory allocation error +<TR><TH ALIGN="LEFT">XB_NOT_XBASE<TD>Not an xbXBase type file +</TABLE> +<h4>Example Program:</h4> +See program <A HREF="/XbaseSamples/sample2.cpp">sample2.cpp</A> for an +example of how to use this method. +<hr> +<h3>Method xbShort xbDbf::PackDatabase( xbShort WaitOption )</h3><br> +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. +<br><br> +<em>WaitOption</em> is one of:<br><br> +<li>F_SETLK - returns if the xbDbf file can not be exclusively locked +<li>F_SETLKW - will wait to execute until it can exclusively lock the file +<br><br> +<TABLE BORDER> +<CAPTION ALIGN="TOP"><h3>Method Return Codes</h3></CAPTION><br> +<TR VALIGN="BASELINE"> +<TR><TH ALIGN="LEFT">Return Code<TD>Description +<TR><TH ALIGN="LEFT">XB_NO_ERROR<TD>If there is no error +<TR><TH ALIGN="LEFT">XB_CLOSE_ERROR<TD>If intermediate work file can not be closed +<TR><TH ALIGN="LEFT">XB_OPEN_ERROR<TD>Could not open file +<TR><TH ALIGN="LEFT">XB_NO_MEMORY<TD>Memory allocation error +<TR><TH ALIGN="LEFT">XB_WRITE_ERROR<TD>Error writing to file +<TR><TH ALIGN="LEFT">XB_SEEK_ERROR<TD>Seek error encountered +<TR><TH ALIGN="LEFT">XB_LOCK_FAILED<TD>Can not lock file or index +</TABLE> +<h4>Example Program:</h4> +See program <A HREF="/XbaseSamples/packdbf.cpp">packdbf.cpp</A> for an +example of how to use this method. +<hr> +<h3>Method xbShort xbDbf::PutRecord( xbLong RecNo )</h3><br> +This method copies the record buffer into record <em>RecNo</em> in the database. +This method can be used for updating records which were retrieved by +the GetRecord method.<br><br> +This method updates any open index files.<br><br> +<TABLE BORDER> +<CAPTION ALIGN="TOP"><h3>Method Return Codes</h3></CAPTION><br> +<TR VALIGN="BASELINE"> +<TR><TH ALIGN="LEFT">Return Code<TD>Description +<TR><TH ALIGN="LEFT">XB_LOCK_FAILED<TD>Write lock not successful +<TR><TH ALIGN="LEFT">XB_NO_ERROR<TD>If there is no error +<TR><TH ALIGN="LEFT">XB_NOT_OPEN<TD>Database is not open +<TR><TH ALIGN="LEFT">XB_INVALID_RECORD<TD>Invalid record number +<TR><TH ALIGN="LEFT">XB_SEEK_ERROR<TD>Seek operation failed +<TR><TH ALIGN="LEFT">XB_WRITE_ERROR<TD>Write operation failed +</TABLE> +<h4>Example Program:</h4> +See program <A HREF="/XbaseSamples/sample3.cpp">sample3.cpp</A> for an +example of how to use this method. +<hr> + +<h3>Method xbShort xbDbf::RebuildAllIndicis( void )</h3><br> +This method rebuilds all opened indicis for the database file.<br><br> +<TABLE BORDER> +<CAPTION ALIGN="TOP"><h3>Method Return Codes</h3></CAPTION><br> +<TR VALIGN="BASELINE"> +<TR><TH ALIGN="LEFT">Return Code<TD>Description +<TR><TH ALIGN="LEFT">XB_NO_ERROR<TD>If there is no error +<TR><TH ALIGN="LEFT">XB_WRITE_ERROR<TD>Error writing data +<TR><TH ALIGN="LEFT">XB_CLOSE_ERROR<TD>Error closing work file +</TABLE> +<h4>Example Program:</h4> +See program <A HREF="/XbaseSamples/reindex.cpp">reindex.cpp</A> for an +example of how to use this method. +<hr> + + + +<h3>Method xbShort xbDbf::RecordDeleted( void )</h3><br> +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. <br><br> +<TABLE BORDER> +<CAPTION ALIGN="TOP"><h3>Method Return Codes</h3></CAPTION><br> +<TR VALIGN="BASELINE"> +<TR><TH ALIGN="LEFT">Return Code<TD>Description +<TR><TH ALIGN="LEFT">TRUE (1)<TD>Record is marked for deletion +<TR><TH ALIGN="LEFT">FALSE (0)<TD>Record is not marked for deletion +</TABLE> +<h4>Example Program:</h4> +See program <A HREF="/XbaseSamples/sample4.cpp">sample4.cpp</A> for an +example of how to use this method. +<hr> + + +<h3>Method xbShort xbDbf::SetVersion( xbShort Vswitch )</h3><br> + +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.<br><br> +Vswitch is one of:<br> +0 - return current setting<br> +3 - Set to create version III files (default)<br> +4 - Set to create version IV files<br><br> + +<TABLE BORDER> +<CAPTION ALIGN="TOP"><h3>Method Return Codes</h3></CAPTION><br> +<TR VALIGN="BASELINE"> +<TR><TH ALIGN="LEFT">Return Code<TD>Description +<TR><TH ALIGN="LEFT">XB_NO_ERROR<TD>Setting updated +<TR><TH ALIGN="LEFT">3 or 4<TD>If Vswitch = 0, it returns current version setting +<TR><TH ALIGN="LEFT">XB_INVALID_OPTION<TD>Vswictch not one of 0,3 or 4 +</TABLE> +<h4>Example Program:</h4> +See program <A HREF="/XbaseSamples/sample1.cpp">sample1.cpp</A> for an +example of how to use this method. +<hr> + +<h3>Method xbShort xbDbf::UndeleteAllRecords( void )</h3><br> +This method unmarks all marked for deletion records in the database.<br><br> +<TABLE BORDER> +<CAPTION ALIGN="TOP"><h3>Method Return Codes</h3></CAPTION><br> +<TR VALIGN="BASELINE"> +<TR><TH ALIGN="LEFT">Return Code<TD>Description +<TR><TH ALIGN="LEFT">XB_NO_ERROR<TD>No error encountered +<TR><TH ALIGN="LEFT">XB_INVALID_RECORD<TD>Could not mark record +<TR><TH ALIGN="LEFT">XB_NOT_OPEN<TD>If the file is not open +<TR><TH ALIGN="LEFT">XB_SEEK_ERROR<TD>Seek routine error +<TR><TH ALIGN="LEFT">XB_WRITE_ERROR<TD>Write routine error +</TABLE> +<h4>Example Program:</h4> +See program <A HREF="/XbaseSamples/undelall.cpp">undelall.cpp</A> for an example +of how to use this method. +<hr> + +<h3>Method xbShort xbDbf::UndeleteRecord( void )</h3><br> +This method removes the mark for deletion on the current record in the +database.<br><br> +<TABLE BORDER> +<CAPTION ALIGN="TOP"><h3>Method Return Codes</h3></CAPTION><br> +<TR VALIGN="BASELINE"> +<TR><TH ALIGN="LEFT">Return Code<TD>Description +<TR><TH ALIGN="LEFT">XB_NO_ERROR<TD>No error encountered +<TR><TH ALIGN="LEFT">XB_INVALID_RECORD<TD>Could not unmark record +</TABLE> +<h4>Example Program:</h4> +See program <A HREF="/XbaseSamples/sample4.cpp">sample4.cpp</A> for an +example of how to use this method. +<hr> + +<h3>Method xbShort xbDbf::Zap( xbShort WaitOption )</h3><br> +This method removes all records from a database and any open indices. +<br><br> +<em>WaitOption</em> is one of:<br><br> +<li>F_SETLK - returns if the xbDbf file can not be exclusively locked +<li>F_SETLKW - will wait to execute until it can exclusively lock the file +<br><br> +<TABLE BORDER> +<TABLE BORDER> +<CAPTION ALIGN="TOP"><h3>Method Return Codes</h3></CAPTION><br> +<TR VALIGN="BASELINE"> +<TR><TH ALIGN="LEFT">Return Code<TD>Description +<TR><TH ALIGN="LEFT">XB_NO_ERROR<TD>No error encountered +<TR><TH ALIGN="LEFT">XB_LOCK_FAILED<TD>Could not lock file +<TR><TH ALIGN="LEFT">XB_WRITE_ERROR<TD>Could not write to file +<TR><TH ALIGN="LEFT">XB_OPEN_ERROR<TD>Could not open temp database +</TABLE> +<h4>Example Program:</h4> +See program <A HREF="/XbaseSamples/zap.cpp">zap.cpp</A> for an +example of how to use this method. +<hr> + +<p><img src="xbase.jpg"><br><hr> +</BODY> +</xbHtml> diff --git a/html/xbc13.htm b/html/xbc13.htm new file mode 100755 index 0000000..e085157 --- /dev/null +++ b/html/xbc13.htm @@ -0,0 +1,470 @@ +<!DOCTYPE HTML PUBLIC> +<HTML> +<TITLE>Xbase DBMS Chapter 13</TITLE> +<BODY BGCOLOR=#FFFFFF> +<H1><p align="center">Field Methods</p></H1> +<p align="center">Chapter Updated 2/1/99</p><hr> + +This chapter lists the field methods and provides examples of how to use +them.<br><br> + +<TABLE BORDER> +<CAPTION ALIGN="TOP"><h3>Xbase Field Method List</h3></CAPTION> +<TR VALIGN="BASELINE"> +<TR><TH ALIGN="LEFT">Method<TD>Description +<TR><TH ALIGN="LEFT">xbLong cnt FieldCount()<TD>Returns the number of fields + in the file +<TR><TH ALIGN="LEFT">xbDouble d GetDoubleField(char * FieldName)<TD>Returns a xbDouble field for field name +<TR><TH ALIGN="LEFT">xbDouble d GetDoubleField(xbShort FieldNo)<TD>Returns a xbDouble field for field number +<TR><TH ALIGN="LEFT">xbShort rc GetField(xbShort,char *buf)<TD>Gets field data from the record buffer +<TR><TH ALIGN="LEFT">xbShort d GetFieldDecimal(xbShort FieldNo)<TD>Gets field decimal count +<TR><TH ALIGN="LEFT">xbShort len GetFieldLen(xbShort FieldNo)<TD>Returns the length of a given field +<TR><TH ALIGN="LEFT">char * name GetFieldName(xbShort FieldNo)<TD>Returns field name for field number +<TR><TH ALIGN="LEFT">xbShort FieldNo GetFieldNo(char * FieldName)<TD>Returns the field ID number for a given field +<TR><TH ALIGN="LEFT">char type GetFieldType(xbShort FieldNo)<TD>Returns the type of a given field +<TR><TH ALIGN="LEFT">xbFloat f GetFloatField(char * FieldName)<TD>Returns a float field for field name +<TR><TH ALIGN="LEFT">xbFloat f GetFloatField(xbShort FieldNo)<TD>Returns a float field for field number +<TR><TH ALIGN="LEFT">xbShort l GetLogicalField(xbShort FieldNo)<TD>Returns logical field data +<TR><TH ALIGN="LEFT">xbShort l GetLogicalField(char * FieldName)<TD>Returns logical field data +<TR><TH ALIGN="LEFT">xbLong l GetLongField(char * FieldName)<TD>Returns a long field for field name +<TR><TH ALIGN="LEFT">xbLong l GetLongField(xbShort FieldNo)<TD>Returns a long field for field number +<TR><TH ALIGN="LEFT">xbShort rc GetMemoField(xbShort FieldNo,<br>xbLong len,char * buf)<TD>Get memo field data +<TR><TH ALIGN="LEFT">xbLong len GetMemoFieldLen(xbShort FieldNo)<TD>Get memo field data length +<TR><TH ALIGN="LEFT">xbShort s MemoFieldsPresent()<TD>Determine if memo fields exist in DBF file +<TR><TH ALIGN="LEFT">xbShort s MemoFieldExists(xbShort FieldNo)<TD>Determine if a particular memo field has data +<TR><TH ALIGN="LEFT">xbShort rc PutDoubleField(char * FieldName,<br>xbDouble d)<TD>Updates a xbDouble field for field name +<TR><TH ALIGN="LEFT">xbShort rc PutDoubleField(xbShort FieldNo,<br>xbDouble d)<TD>Updates a xbDouble field for field number +<TR><TH ALIGN="LEFT">xbShort rc PutField(xbShort FieldNo,char * val)<TD>Fills or overlays a field in the current record buffer +</TABLE> + +<br> +<TABLE BORDER> +<CAPTION ALIGN="TOP"><h3>Xbase Field Method List (cont)</h3></CAPTION> +<TR VALIGN="BASELINE"> +<TR><TH ALIGN="LEFT">Method<TD>Description +<TR><TH ALIGN="LEFT">xbShort rc PutFloatField(char * FieldName,<br>xbFloat f)<TD>Updates a float field for field name +<TR><TH ALIGN="LEFT">xbShort rc PutFloatField(xbShort FieldNo,<br>xbFloat f)<TD>Updates a float field for field number +<TR><TH ALIGN="LEFT">xbShort rc PutLongField(char * FieldName,<br>xbLong l)<TD>Updates a long field for field name +<TR><TH ALIGN="LEFT">xbShort rc PutLongField(xbShort FieldNo,<br>xbLong l)<TD>Updates a long field for field number +<TR><TH ALIGN="LEFT">xbShort rc UpdateMemoData(xbShort FieldNo,<br>xbLong len,char * buf, +xbShort LockOpt)<TD>Update memo field data +<TR><TH ALIGN="LEFT">xbShort l ValidLogicalData( char * buf )<TD>Check for valid logical data +<TR><TH ALIGN="LEFT">xbShort l ValidNumericData( char * buf )<TD>Check for valid numeric data +</TABLE> +<BR><BR> + +<hr> +<h2>Method Definitions</h2> +<hr> + +<h3>Method xbLong xbDbf::FieldCount( void )</h3><br> +This method returns the number of fields which exist in the database. +<br><br> +<h4>Method Return Codes</h4><br> +If successful, this method returns the number of fields in the database. +<h4>Example Program:</h4> +See sample program <A HREF="/XbaseSamples/sample3.cpp">sample3.cpp</A> for an +example of how to use this method. +<hr> + +<h3>Method xbDouble xbDbf::GetxbDoubleField( char * FieldNo )</h3><br> +This method returns a xbDouble value for field FieldNo. Fieldno can be retrieved +by using method GetFieldNo. +<br><br> +<hr> + +<h3>Method xbDouble xbDbf::GetxbDoubleField( char * FieldName )</h3><br> +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. +<br><br> + +<hr> +<h3>Method xbShort xbDbf::GetField( xbShort FieldNo, char * buf )</h3><br> + +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.<br><br> + +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.<br><br> +If successful, this method returns the length of the field in bytes. + +<h4>Example Program:</h4> +See sample program <A HREF="/XbaseSamples/sample3.cpp">sample3.cpp</A> for an +example of how to use this method. + +<hr> +<h3>Method xbShort xbDbf::GetFieldDecimal( xbShort FieldNo )</h3><br> + +This method returns the decimal count of field FieldNo. FieldNo can be retrieved +by using method GetFieldNo.<br><br> +If successful, this method returns the decimal count. + +<hr> +<h3>Method xbShort xbDbf::GetFieldLen( xbShort FieldNo )</h3><br> + +This method returns the length of field FieldNo. FieldNo can be retrieved +by using method GetFieldNo.<br><br> +If successful, this method returns the length of the field in bytes. + +<h4>Example Program:</h4> +See sample program <A HREF="/XbaseSamples/sample3.cpp">sample3.cpp</A> for an example +of how to use this method. + +<hr> +<h3>Method char * xbDbf::GetFieldName( xbShort FieldNo )</h3><br> + +This method returns a pointer to the name of field FieldNo. FieldNo can be retrieved +by using method GetFieldNo.<br><br> +If successful, this method returns the field name.<br> + +<h4>Example Program:</h4> +See sample program <A HREF="/XbaseSamples/dumpdbt.cpp">dumpdbt.cpp</A> for an example +of how to use this method. +<hr> + +<h3>Method xbShort xbDbf::GetFieldNo( char * FieldName )</h3><br> + +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.<br><br> + +<TABLE BORDER> +<CAPTION ALIGN="TOP"><h3>Method Return Codes</h3></CAPTION><br> +<TR VALIGN="BASELINE"> +<TR><TH ALIGN="LEFT">Return Code<TD>Description +<TR><TH ALIGN="LEFT">-1<TD>Field not found in record +<TR><TH ALIGN="LEFT">0 through n<TD>The field number for field FieldName +</TABLE> +<br><br> +<h4>Example Program:</h4> + +See sample program <A HREF="/XbaseSamples/sample2.cpp">sample2.cpp</A> for an example +of how to use this method. + +<hr> +<h3>Method xbShort xbDbf::GetFieldType( xbShort FieldNo )</h3><br> + +This method returns the type of field FieldNo. FieldNo can be retrieved +by using method GetFieldNo.<br><br> + +<h4>Method Return Codes</h4><br> +If successful, this method returns the field type.<br> +C = character<br> +D = Date<br> +L = Logical<br> +M = Memo<br> +N = Numeric<br> +F = Float<br><br> + +<h4>Example Program:</h4> +See sample program <A HREF="/XbaseSamples/sample3.cpp">sample3.cpp</A> for an example +of how to use this method. +<hr> + +<h3>Method xbFloat xbDbf::GetFloatField( char * FieldName )</h3><br> + +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. +<br><br> + +<h4>Example Program:</h4> +See sample program <A HREF="/XbaseSamples/sample3.cpp">sample3.cpp</A> for an +example of how to use this method. +<hr> +<h3>Method xbFloat xbDbf::GetFloatField( xbShort * FieldNo )</h3><br> + +This method returns a float value for field number FieldNo. +<br><br> + +<h4>Example Program:</h4> +See sample program <A HREF="/XbaseSamples/sample3.cpp">sample3.cpp</A> for an +example of how to use this method. +<hr> + + +<h3>Method xbShort xbDbf::GetLogicalField( xbShort FieldNo )</h3><br> + +<h3>Method xbShort xbDbf::GetLogicalField( char * FieldName )</h3><br> + +This method returns -1 if field <em>FieldName</em> or <em>FieldNo</em> is not +a logical field. +It returns 1 if field <em>FieldName</em> is a 'T','t','Y' or 'y'. It returns +0 if not 'T','t','Y' or 'y'. +<br> +<hr> +<h3>Method xbLong xbDbf::GetLongField( xbShort * FieldNo )</h3><br> + +<h3>Method xbLong xbDbf::GetLongField( char * FieldName )</h3><br> + +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. +<br><br> + +<h4>Example Program:</h4> +See sample program <A HREF="/zips/zipinit.cpp">zipinit.cpp</A> for an +example of how to use this method. + +<hr> +<h3>Method xbLong xbDbf::GetLongField( xbShort * FieldNo )</h3><br> + +This method returns a long value for field FieldNo. FieldNo can be +determined by utilizing method GetFieldNo. +<br><br> + +<h4>Example Program:</h4> +See sample program <A HREF="/zips/zipinq.cpp">zipinq.cpp</A> for an +example of how to use this method. + + + +<hr> +<h3>Method xbShort xbDbf::GetMemoField( xbShort FieldNo, xbLong len, char * Buf, xbShort LockOption )</h3><br> + +This method returns <em>Len</em> bytes of memo field <em>FieldNo</em>. <em>Buf</em> +is a user supplied buffer large enough to contain the data. No checking +of the field's size is performed by this method.<br><br> + + +<em>Lock Option</em>is one of:<br> + +F_SETLK - return immediately if lock fails<br> +F_SETLKW - wait until lock function executes<br><br> + +<TABLE BORDER> +<CAPTION ALIGN="TOP"><h3>Method Return Codes</h3></CAPTION><br> +<TR VALIGN="BASELINE"> +<TR><TH ALIGN="LEFT">Return Code<TD>Description +<TR><TH ALIGN="LEFT">XB_INVALID_FIELDNO<TD>An invalid field number was used +<TR><TH ALIGN="LEFT">XB_NOT_MEMO_FIELD<TD>Not a memo field +<TR><TH ALIGN="LEFT">XB_NO_MEMO_DATA<TD>No memo data exists +<TR><TH ALIGN="LEFT">XB_INVALID_BLOCK_NO<TD>Internal error, notify tech support +<TR><TH ALIGN="LEFT">XB_SEEK_ERROR<TD>Disk Error +<TR><TH ALIGN="LEFT">XB_READ_ERROR<TD>Disk Error +<TR><TH ALIGN="LEFT">XB_NO_ERROR<TD>No Error +</TABLE> +<br><br> +<h4>Example Program:</h4> +See sample program <A HREF="/XbaseSamples/dumpdbt.cpp">dumpdbt.cpp</A> for +an example of how to use this method. + +<hr> +<h3>Method xbLong xbDbf::GetMemoFieldLen( xbShort FieldNo )</h3><br> + +This method returns the length of memo field FieldNo. FieldNo can be +retrieved by using method GetFieldNo.<br><br> +If successful, this method returns the length of the memo field in bytes. + +<h4>Example Program:</h4> +See sample program <A HREF="/XbaseSamples/dumpdbt.cpp">dumpdbt.cpp</A> for +an example of how to use this method. + +<hr> + +<h3>Method xbShort xbDbf::MemoFieldExists( xbShort FieldNo )</h3><br> + +This method returns true (1) if field FieldNo has any memo data. Otherwise +it returns false (0). +<br><br> +<TABLE BORDER> +<CAPTION ALIGN="TOP"><h3>Method Return Codes</h3></CAPTION><br> +<TR VALIGN="BASELINE"> +<TR><TH ALIGN="LEFT">Return Code<TD>Description +<TR><TH ALIGN="LEFT">0<TD>Data file does not have any memo fields +<TR><TH ALIGN="LEFT">1<TD>Data file has memo fields +</TABLE> +<br><br> +<h4>Example Program:</h4> +See sample program <A HREF="/XbaseSamples/dumpdbt.cpp">dumpdbt.cpp</A> for an +example of how to use this method. + +<hr> + +<h3>Method xbShort xbDbf::MemoFieldsPresent( void )</h3><br> + +This method returns true (1) if the file has any memo fields. Otherwise +it returns false (0). +<br><br> +<TABLE BORDER> +<CAPTION ALIGN="TOP"><h3>Method Return Codes</h3></CAPTION><br> +<TR VALIGN="BASELINE"> +<TR><TH ALIGN="LEFT">Return Code<TD>Description +<TR><TH ALIGN="LEFT">0<TD>Data file does not have any memo fields +<TR><TH ALIGN="LEFT">1<TD>Data file has memo fields +</TABLE> +<br><br> +<h4>Example Program:</h4> +See sample program <A HREF="/XbaseSamples/dumpdbt.cpp">dumpdbt.cpp</A> for an +example of how to use this method. + +<hr> +<h3>Method xbShort xbDbf::PutxbDoubleField( char * FieldName, xbDouble d )</h3><br> + +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. +<br><br> +<TABLE BORDER> +<CAPTION ALIGN="TOP"><h3>Method Return Codes</h3></CAPTION><br> +<TR VALIGN="BASELINE"> +<TR><TH ALIGN="LEFT">Return Code<TD>Description +<TR><TH ALIGN="LEFT">XB_INVALID_FIELDNO<TD>An invalid field number was used +<TR><TH ALIGN="LEFT">XB_INVALID_DATA<TD>Attempt to load invalid numeric or logical data +</TABLE> +<br><br><hr> +<h3>Method xbShort xbDbf::PutxbDoubleField( xbShort FieldNo, xbDouble d )</h3><br> +This method puts a xbDouble value d for field FieldNo. +<br><br> +<h3>Method Return Codes</h3> +<TABLE BORDER> +<CAPTION ALIGN="TOP"><h3>Method Return Codes</h3></CAPTION><br> +<TR VALIGN="BASELINE"> +<TR><TH ALIGN="LEFT">Return Code<TD>Description +<TR><TH ALIGN="LEFT">XB_INVALID_FIELDNO<TD>An invalid field number was used +<TR><TH ALIGN="LEFT">XB_INVALID_DATA<TD>Attempt to load invalid numeric or logical data +</TABLE> +<br><br> + +<hr> +<h3>Method xbShort xbDbf::PutField( xbShort FieldNo, char * buf )</h3><br> + +This method fills field number FieldNo, with the data from buffer *buf.<br><br> +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.<br><br> +Use method GetFieldNo to determine the value for FieldNo.<br><br> +If the field is type N or F, the field is loaded right justified, left blank +filled onto the record buffer.<br><br> +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.<br><br> +<TABLE BORDER> +<CAPTION ALIGN="TOP"><h3>Method Return Codes</h3></CAPTION><br> +<TR VALIGN="BASELINE"> +<TR><TH ALIGN="LEFT">Return Code<TD>Description +<TR><TH ALIGN="LEFT">XB_INVALID_FIELDNO<TD>An invalid field number was used +<TR><TH ALIGN="LEFT">XB_INVALID_DATA<TD>Attempt to load invalid numeric or logical data +</TABLE> +<br><br> + +<h4>Example Program:</h4> +See sample program <A HREF="/XbaseSamples/sample2.cpp">sample2.cpp</A> for an example +of how to use this method. +<hr> + +<h3>Method xbShort xbDbf::PutFloatField( char * FieldName, FLOAT f )</h3><br> + +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. +<br><br> +<TABLE BORDER> +<CAPTION ALIGN="TOP"><h3>Method Return Codes</h3></CAPTION><br> +<TR VALIGN="BASELINE"> +<TR><TH ALIGN="LEFT">Return Code<TD>Description +<TR><TH ALIGN="LEFT">XB_INVALID_FIELDNO<TD>An invalid field number was used +<TR><TH ALIGN="LEFT">XB_INVALID_DATA<TD>Attempt to load invalid numeric or logical data +</TABLE> +<br><br> +<h4>Example Program:</h4> +See sample program <A HREF="/XbaseSamples/sample2.cpp">sample2.cpp</A> for an +example of how to use this method. +<hr> +<h3>Method xbShort xbDbf::PutFloatField( xbShort FieldNo, FLOAT f )</h3><br> +This method puts a float value f for field number FieldNo. +<br><br> +<TABLE BORDER> +<CAPTION ALIGN="TOP"><h3>Method Return Codes</h3></CAPTION><br> +<TR VALIGN="BASELINE"> +<TR><TH ALIGN="LEFT">Return Code<TD>Description +<TR><TH ALIGN="LEFT">XB_INVALID_FIELDNO<TD>An invalid field number was used +<TR><TH ALIGN="LEFT">XB_INVALID_DATA<TD>Attempt to load invalid numeric or logical data +</TABLE> +<br><br> +<h4>Example Program:</h4> +See sample program <A HREF="/XbaseSamples/sample2.cpp">sample2.cpp</A> for an +example of how to use this method. +<hr> +<h3>Method xbLong xbDbf::PutLongField( char * FieldName, xbLong Val )</h3><br> +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. +<br><br> +<h4>Example Program:</h4> +See sample program <A HREF="/zips/zipinit.cpp">zipinit.cpp</A> for an +example of how to use this method. + +<hr> +<h3>Method xbLong xbDbf::PutLongField( xbShort FieldNo, xbLong Val )</h3><br> +This method puts a long value Val for field FieldNo. FieldNo can be determined +by utilizing method GetFieldNo. +<br><br> + +<h4>Example Program:</h4> +See sample program <A HREF="/zips/zipinq.cpp">zipinq.cpp</A> for an +example of how to use this method. +<hr> +<h3>Method xbShort xbDbf::UpdateMemoData( xbShort FieldNo, xbLong len, + char * Buf, xbShort LockOption )</h3><br> +This method updates field <em>FieldNo</em> with <em>Len</em> bytes of +data from <em>Buf</em>.<br><br> +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).<br><br> + +<em>LockOption</em> is one of<br> +<li>F_SETLK - return immediately if lock fails +<li>F_SETLKW - wait until lock function executes +<br><br> + +<TABLE BORDER> +<CAPTION ALIGN="TOP"><h3>Method Return Codes</h3></CAPTION><br> +<TR VALIGN="BASELINE"> +<TR><TH ALIGN="LEFT">Return Code<TD>Description +<TR><TH ALIGN="LEFT">XB_LOCK_FAILED<TD>Lock Failed +<TR><TH ALIGN="LEFT">XB_INVALID_BLOCK_NO<TD>Internal error, notify tech support +<TR><TH ALIGN="LEFT">XB_SEEK_ERROR<TD>Disk Error +<TR><TH ALIGN="LEFT">XB_READ_ERROR<TD>Disk Error +<TR><TH ALIGN="LEFT">XB_WRITE_ERROR<TD>Disk Error +<TR><TH ALIGN="LEFT">XB_NO_ERROR<TD>No Error +</TABLE> +<br><br> +<h4>Example Program:</h4> +See sample program <A HREF="/XbaseSamples/sample2.cpp">sample2.cpp</A> for +an example of how to use this method. +<hr> + + + +<h3>Method xbShort xbDbf::ValidLogicalData( char * data )</h3><br> + +This method returns true if <em>data</em> contains a valid logical data value. +Otherwise, it returns false. +<br><br> +<TABLE BORDER> +<CAPTION ALIGN="TOP"><h3>Method Return Codes</h3></CAPTION><br> +<TR VALIGN="BASELINE"> +<TR><TH ALIGN="LEFT">Return Code<TD>Description +<TR><TH ALIGN="LEFT">1<TD>Valid logical data +<TR><TH ALIGN="LEFT">0<TD>Invalid logical data +</TABLE> +<br> +<hr> + +<h3>Method xbShort xbDbf::ValidNumericData( char * data )</h3><br> +This method returns true if <em>data</em> contains a valid numeric data value. +Otherwise, it returns false. +<br><br> +<TABLE BORDER> +<CAPTION ALIGN="TOP"><h3>Method Return Codes</h3></CAPTION><br> +<TR VALIGN="BASELINE"> +<TR><TH ALIGN="LEFT">Return Code<TD>Description +<TR><TH ALIGN="LEFT">1<TD>Valid numeric data +<TR><TH ALIGN="LEFT">0<TD>Invalid numeric data +</TABLE> +<br> +<hr> + +<p><img src="xbase.jpg"><br><hr> +</BODY> +</HTML> diff --git a/html/xbc14.htm b/html/xbc14.htm new file mode 100755 index 0000000..032b57f --- /dev/null +++ b/html/xbc14.htm @@ -0,0 +1,200 @@ +<!DOCTYPE HTML PUBLIC> +<html> +<title>Base DBMS Chapter 14</title> +<body bgcolor=#FFFFFF> +<h1><p align="center">xbString Methods</p></h1> +<p align="center">Chapter Updated 8/20/03</p><hr> +<h2>This table lists the xbString methods.</h2><br><br> +<table border> +<caption align=top><h3>xbString Method List API</h3></caption> +<tr valign=baseline> +<tr><th align=left>Method<td>Description +<tr><th align=left>xbString()<td>Class Constructor +<tr><th align=left>xbString(size_t size)<td>Constructor, allocates space of size +<tr><th align=left>xbString(char c)<td>Constructor, initialized to char c +<tr><th align=left>xbString(const char *s)<td>Constructor, initialized to string s +<tr><th align=left>xbString(const char *s, size_t maxlen<td> +Constructor, initialized to string s, with minimal string buf size of max_len +<tr><th align=left>xbString(const xbString &s)<td>Constructor, initialized to string s +<tr><th align=left>~xbString()<td>Class Destructor +<tr><th align=left>const char operator*()<td>Returns data +<tr><th align=left>char operator[](int n)<td>Returns char in position n +<tr><th align=left>xbString &operator=(const xbString &s)<br> + xbString &operator=(const char *s)<br>xbString &operator=(char c) + <td>Set string to <em>s</em> or <em>c</em>. +<tr><th align=left>xbString &operator+=(const char *s)<br> +xbSting &operator+=(char c)<td>Concatonate data to string +<tr><th align=left>xbString &operator-=(const char *s)<br> +xbSting &operator+=(char c)<td>Concatonate data and eliminate spaces between +strings. +<tr><th align=left>bool operator==(const xbString &)<td> +Compare string == +<tr><th align=left>bool operator!=(const xbString &)<td> +Compare string != +<tr><th align=left>bool operator<(const xbString &s)<td> +Compare string < +<tr><th align=left>bool operator>(const xbString &s)<td> +Compare string > +<tr><th align=left>bool operator<=(const xbString &s)<td> +Compare string <= +<tr><th align=left>bool operator<=(const xbString &s)<td> +Compare string >= +<tr><th align=left>xbString addBackSlash( char c )<td>Prefixes all +char <em>c</em> with a backslash. +<tr><th align=left>xbString& assign(const xbString& str, size_t pos = 0, +int len = 1)<td>Assign data in <em>str</em> starting at position <em>pos</em> +for a length of <em>len</em> and return a reference. +<tr><th align=left>xbString& assign(const xbString& str, int len )<td> +Assign data in <em>str</em> for a length of <em>len</em> and return a reference. +<tr><th align=left>xbString copy() const<td>Used to copy a string +<tr><th align=left>const char * c_str() const<td>Returns the string or NULL +if string is null. Depreciated function. +<tr><th align=left>int countChar( char c ) const<td>Returns the count +of char <em>c</em>. +<tr><th align=left>int cvtHexChar( char & out )<td>Converts a four byte +string in the format of 0x00 to a one byte char value <em>out</em>. Returns +0 on success, -1 on error. +<tr><th align=left>int cvtHexString( zbString & out )<td>Converts a +string of four byte groupings in the format of 0x00 to a string of one byte +characters <em>out</em>. Returns 0 on success, -1 on error. +<tr><th align=left>char getCharacter( int n ) const<td>Returns the character +as position <em>n</em>. +<tr><th align=left>const char *getdata() const<td>Returns the string +<tr><th align=left>bool hasAlphaChars() const<td>Returns true is string +contains any alpha characters, otherwise returns false. +<tr><th align=left>bool isEmpty() const<td>Returns true if the string has +no memory allocated, or memory allocated is a zero byte string, otherwise +returns false +<tr><th align=left>bool isNull() const<td>Returns true if the string +has no memory allocated for the string, otherwise returns false +<tr><th align=left>size_t len() const<br>size_t length() const +<td>Returns length of string. It does not include the null terminating byte. +<tr><th align=left>xbString mid( size_t pos, int len )<td>Pull a string of +data out of another string of data, starting at position <em>pos</em> for a +length of <em>len</em>. +<tr><th align=left>void ltrunc( size_t cnt )<td>Left truncate the string +<em>cnt</em> bytes. +<tr><th align=left>int pos(char c)<td>Locate character in string +<tr><th align=left>int pos(const char *s)<td>Locate string <em>s</em> in string +<tr><th align=left>void swapChars(char from, char to)<td>Swap character +<em>from</em> to character <em>to</em>. +<tr><th align=left>void putAt(size_t pos, char c)<td>Put character c at position pos +<tr><th align=left>void remove( size_t pos = 0, int len )<td>Remove data +from the string to starting at <em>pos</em> for a lenght of <em>len</em>. +<tr><th align=left>void setNum(long num)<td>This method sets the string +to the numeric value <em>num</em>. +<tr><th align=left>xbString &sprintf(const char * format, ... )<td> +Used to format a string. See the standard C printf function for formatting +details. Internal 256 byte buffer which can be overflowed. +<tr><th align=left>void toLowerCase()<td>Converts string to lower case +<tr><th align=left>void toUpperCase()<td>Converts string to upper case +<tr><th align=left>void trim()<td>trim trailing spaces +<tr><th align=left>void zapChar( char c )<td>Remove all instances of +<em>c</em> from the string. +<tr><th align=left>void zapLeadingChar( char c )<td>Left truncate all +of <em>c</em> from the string. +<tr><th align=left> + xbString operator-(const xbString &s1, const xbString &s2) +<td>Concatonate two strings together, eliminate spaces +<tr><th align=left> + xbString operator+(const xbString &s1, const xbString &s2)<br> + xbString operator+(const xbString &s1, const char *s2)<br> + xbString operator+(const char *s1, const xbString &s2)<br> + xbString operator+(const xbString &s1, char c2)<br> + xbString operator+(char c1, const xbString &s2)<td>Concatonate two + strings together +<tr><th align=left>bool operator==(const xbString &, const char *)<td> +Compare string == +<tr><th align=left>bool operator!=(const xbString &, const char *)<td> +Compare string != +</table><br><br><br> +<h2>Sample program</h2> +<xmp> + +/* 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; +} + + + +</xmp> + + +<br><hr> +<p><img src="xbase.jpg"><br><hr> +</body> +</html> diff --git a/html/xbc15.htm b/html/xbc15.htm new file mode 100755 index 0000000..de01ec4 --- /dev/null +++ b/html/xbc15.htm @@ -0,0 +1,338 @@ +<!DOCTYPE HTML PUBLIC> +<html> +<title>Xbase DBMS Chapter 15</title> +<body bgcolor=#FFFFFF> +<h1><p align="center">xbDate Methods</p></h1> +<p align="center">Chapter Updated 8/21/03</p><hr><br> + +This chapter lists the xbDate methods and provides an example program to demonstrate usage.<br> +Xbase .DBF files and the xbDate class handle dates in the format of CCYYMMDD (Date8).<br><br><br> + +<center> +<table border> +<caption align=top><h3>xbDate Method List API</h3></caption> + +<tr><th align=left>Method<td>Description + +<tr><th align=left>xbDate( const char * Date8 )<br>xbDate( const xbString & Date8 )<br>xbDate() + <td>Class constructors. If no date provided, or invalid date provided, date is set to Sysdate(). + +<tr><th align=left>~xbDate()<td>Class destructor + +<tr><th align=left>xbString & CharDayOf( const char *Date8 )<br> + xbString & CharDayOf( const xbString & Date8 )<br>xbString & CharDayOf() + <td>Returns <em>Sun - Sat</em> day of week for a given date + +<tr><th align=left>xbString & CharMonthOf( const char *Date8 )<br>xbString & CharMonthOf( const xbString & Date8 )<br> + xbString & CharMonthOf()<td>Returns <em>Jan - Dec</em> month of year for a given date + +<tr><th align=left>int DateIsValid( const char *Date8 ) const<br>int DateIsValid( const xbString & Date8 ) const + <td>Checks a date for validity, returns true (1) if date is valid + +<tr><th align=left>int DayOf( int Format, const char *Date8 ) const<br>int DayOf( int Format, const xbString &Date8 ) const<br> + int DayOf( int Format ) const<td>Returns day of WEEK, MONTH or YEAR from a given date where <em>Format</em> is one of<br> + <em>XB_FMT_WEEK</em> => Number of day in week 0-6 (sun-Sat)<br> + <em>XB_FMT_MONTH</em> => Number of day in month 1-31<br> + <em>XB_FMT_YEAR</em> => Number of day in year 1-366 + +<tr><th align=left>xbString & Formatdate( const char * Format, const char * Date8 )<br> + xbString & FormatDate( const xbString & Format, const char * Date8 )<br> + xbString & FormatDate( const char * Format, const xbString & Date8 )<br> + xbString & FormatDate( const xbString & Format, const xbString & Date8 )<br> + xbString & FormatDate( const xbString & Format )<br> + xbString & FormatDate( const char * )<br> + + <td>Return a formatted date.<br> + + Format - A format specifier with the following paramaters:<br> + + 1) YYDDD - A julian date format<br> + + 2) YY or YYYY will print a 2 or 4 digit year<br> + + 3) M,MM,MMM or MMMM<br> + + M - one digit month if no leading zero<br> + MM - two digit month, contains leading zero<br> + MMM - Jan through Dec<br> + MMMM - January through December<br> + + 4) D,DD,DDD or DDDD<br> + + D - one digit dayif no leading zero<br> + DD - two digit day, contains leading zero <br> + DDD - Sun through Sat (or julian if YYDDD)<br> + DDDD - Sunday through Saturday<br> + + +<tr><th align=left>const xbString & GetDate() const<br>xbString & GetDate()<td>Return date + +<tr><th align=left>const xbString & GetFormattedDate() const<br>xbString & GetFormattedDate()<td> + Returns formatted date. See notes on format paramaters. + +<tr><th align=left>int IsLeapYear( const char *Date8 ) const<br>int IsLeapYear( const xbString &Date8 ) const<br> + int IsLeapYear() const<td>Returns true if given date is a leap year + +<tr><th align=left>long JulianDays( const char *Date8 ) const<br>long JulianDays( const xbString & Date8 ) const<br> + long JulianDays() const<td>Returns number of days since 1/1/0100 to given date + +<tr><th align=left>xbString & JulToDate8( long )<td>Converts julian based date to CCYYMMDD format. + +<tr><th align=left>xbString & LastdayOfMonth( const char *Date8 )<br>xbString & LastDayOfMonth( const xbString & Date8 )<br> + xbString & LastDayOfMonth()<td>Returns the Date8 format of the last day of the month for a given date + +<tr><th align=left>int MonthOf( const char *Date8 ) const<br>int MonthOf( const xbString &Date8) const<br> +int MonthOf() const<td>Returns month of a date + +<tr><th align=left>int SetDate( const char * Date8 )<br>int SetDate( const xbString & Date8 )<td> + Sets the xbDate to <em>Date8</em>. Return 1 on success, 0 on error. + + +<tr><th align=left>xbString & Sysdate()<td>This method sets the class date and returns the system date + +<tr><th align=left>int YearOf( const char *Date8 ) const<br>int YearOf( const xbString &Date8 ) const<br> +int YearOf() const<td>Returns century and year of a date + +<tr><th align=left>xbString &operator+=( int )<td>+= operator +<tr><th align=left>xbString &operator-=( int )<td>-= operator +<tr><th align=left>xbString &operator++( int )<td>++ operator +<tr><th align=left>xbString &operator--( int )<td>-- operator +<tr><th align=left>xbString &operator+( int )<td>+ operator +<tr><th align=left>xbString &operator-( int )<td>- operator +<tr><th align=left>long operator-( const xbDate & ) const<td>- operator +<tr><th align=left>int operator==( const xbDate & ) const<td>== operator +<tr><th align=left>int operator!=( const xbDate & ) const<td>!= operator +<tr><th align=left>int operator<( const xbDate & ) const<td>< operator +<tr><th align=left>int operator>( const xbDate & ) const<td>> operator +<tr><th align=left>int operator<=( const xbDate & ) const<td><= operator +<tr><th align=left>int operator>=( const xbDate & ) const<td>>= operator + +</table></center> +<br><br><br> + +<h2>Sample program</h2><br> +The source for this program is in the libtest directory. <br><br> + +<xmp> + 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; +} + + +</xmp> +<hr> +<p><img src="xbase.jpg"><br><hr> +</BODY> +</HTML> + + diff --git a/html/xbc16.htm b/html/xbc16.htm new file mode 100755 index 0000000..b19511b --- /dev/null +++ b/html/xbc16.htm @@ -0,0 +1,202 @@ +<!doctype html public> +<html> +<title>Xbase DBMS Chapter 16</title> +<body bgcolor=#FFFFFF> +<h1><p align="center">Expressions Reference<br></h1> +<p align="center">Chapter Updated 2/19/04</p><hr> +<br><br> +<table border> +<caption align=top><h3>Expression Operands</h3></caption> +<TR VALIGN="BASELINE"> +<TR><TH ALIGN="LEFT">Operand<TD>Type<TD>Function +<TR><TH ALIGN="LEFT">+<TD>Alpha<TD>Concatonate +<TR><TH ALIGN="LEFT">+<TD>Numeric<TD>Addition +<TR><TH ALIGN="LEFT">-<TD>Alpha<TD>Concatonate, remove white space +<TR><TH ALIGN="LEFT">-<TD>Numeric<TD>Subtraction +<TR><TH ALIGN="LEFT">*<TD>Numeric<TD>Multiplication +<TR><TH ALIGN="LEFT">/<TD>Numeric<TD>Division +<TR><TH ALIGN="LEFT">**<TD>Numeric<TD>Exponentiation +<TR><TH ALIGN="LEFT"><<TD>Logical<TD>Less Than +<TR><TH ALIGN="LEFT">><TD>Logical<TD>Greater Than +<TR><TH ALIGN="LEFT">=<TD>Logical<TD>Equal +<TR><TH ALIGN="LEFT"><><TD>Logical<TD>Not Equal +<TR><TH ALIGN="LEFT">#<TD>Logical<TD>Not Equal +<TR><TH ALIGN="LEFT"><=<TD>Logical<TD>Less Than or Equal +<TR><TH ALIGN="LEFT">>=<TD>Logical<TD>Greater Than or Equal +<TR><TH ALIGN="LEFT">$<TD>Logical<TD>Contains +<TR><TH ALIGN="LEFT">-><TD>N/A<TD>Identifies database field ie; DATABASE->FIELD +<TR><TH ALIGN="LEFT">.AND.<TD>Logical<TD>Logical AND +<TR><TH ALIGN="LEFT">.OR.<TD>Logical<TD>Logical OR +</TABLE> + +<br><br><br> +<TABLE BORDER> +<CAPTION ALIGN="TOP"><h3>Expression Functions</h3></CAPTION> +<TR VALIGN="BASELINE"> +<TR><TH ALIGN="LEFT">Expression Function<TD>Xbase C++ Method<TD>Description +<TR><TH ALIGN="LEFT">ABS()<TD>xbDouble EXPN::ABS( xbDouble d )<TD> +Returns absolute numeric value of argument. +<TR><TH ALIGN="LEFT">ASC()<TD>xbLong EXPN::ASC( char * String )<TD> +Returns ASCII code of left character of string. +<TR><TH ALIGN="LEFT">AT()<TD>xbLong EXPN::AT( char *s1, char *s2 )<TD> +Returns starting position of first alphanumeric argument in second argument. +<TR><TH ALIGN="LEFT">CDOW()<TD>char * EXPN::CDOW( char Date8 )<TD> +Returns name of the day of the week of Date8. +<TR><TH ALIGN="LEFT">CHR()<TD>char * EXPN::CHR( xbLong l )<TD> +Returns ASCII character corresponding to numeric value supplied. +<TR><TH ALIGN="LEFT">CMONTH()<TD>char * EXPN::CMONTH( char * Date8 )<TD> +Returns name of the month of Date8. +<TR><TH ALIGN="LEFT">DATE()<TD>char * EXPN::DATE()<TD> +Returns system date. +<TR><TH ALIGN="LEFT">DAY()<TD>xbLong EXPN::DAY( char * Date8 )<TD> +Returns numeric value of the day of the month for Date8. +<TR><TH ALIGN="LEFT">DESCEND()<TD>EXPN::DESCEND()<TD> +Descend - used to create descending indices +<TR><TH ALIGN="LEFT">DTOC()<TD>char * EXPN::DTOC( char * Date8 )<TD> +Returns a date converted to format MM/DD/YY. +<TR><TH ALIGN="LEFT">EXP()<TD>xbDouble EXPN::EXP( xbDouble d )<TD> +Returns exponential for supplied value. +<TR><TH ALIGN="LEFT">IIF()<TD> +char * EXPN::IIF( xbShort, const char *,const char *)<TD>If statement +<TR><TH ALIGN="LEFT">INT()<TD>xbLong EXPN::INT( xbDouble d )<TD> +Converts any numeric value to an integer. +<TR><TH ALIGN="LEFT">ISALPHA()<TD>xbLong EXPN::ISALPHA( char * String )<TD> +Returns TRUE if string is alpha. +<TR><TH ALIGN="LEFT">ISLOWER()<TD>xbLong EXPN::ISLOWER( char * String )<TD> +Returns TRUE if string is lower case. +<TR><TH ALIGN="LEFT">ISUPPER()<TD>xbLong EXPN::ISUPPER( char * String )<TD> +Returns TRUE if string is upper case. +<TR><TH ALIGN="LEFT">LEFT()<TD>char * EXPN::LEFT( char * String, xbShort Len )<TD> +Returns <em>Len</em> characters from the left side of <em>String</em>. +<TR><TH ALIGN="LEFT">LEN()<TD>xbLong EXPN::LEN( char * String )<TD> +eturns the number of characters in the String. +<TR><TH ALIGN="LEFT">LOG()<TD>xbDouble EXPN::LOG( xbDouble d )<TD> +Returns the natural log of d. +<TR><TH ALIGN="LEFT">LOWER()<TD>char * EXPN::LOWER( char * String )<TD> +Converts a string to lower case. +<TR><TH ALIGN="LEFT">LTRIM()<TD>char * EXPN::LTRIM( char * String )<TD> +Eliminates leading white space from String. +<TR><TH ALIGN="LEFT">MAX()<TD>xbDouble EXPN::MAX( xbDouble d1, xbDouble d2 )<TD> +Returns the larger of two numeric arguments. +<TR><TH ALIGN="LEFT">MIN()<TD>xbDouble EXPN::MIN(xbDouble d1, xbDouble d2 )<TD> +Returns the smaller of two numeric arguments. +<TR><TH ALIGN="LEFT">MONTH()<TD>xbLong EXPN::MONTH( char * Date8 )<TD> +Returns numeric month for Date8. +<TR><TH ALIGN="LEFT">RECNO()<TD>xbLong EXPN::RECNO()<TD> +Returns the current record number of the associated DBF file +<TR><TH ALIGN="LEFT">REPLICATE()<TD>char * EXPN::REPLICATE( char * String, xbShort Count )<TD> +Replicates String Conut times. +<TR><TH ALIGN="LEFT">RIGHT()<TD>char * EXPN::RIGHT( char * String, xbShort Count )<TD> +Returns Count characters from the right side of String. +<TR><TH ALIGN="LEFT">RTRIM()<TD>char * EXPN::RTRIM( char * String )<TD> +Removes trailing white space from String. +<TR><TH ALIGN="LEFT">SPACE()<TD>char * EXPN::SPACE( xbShort Count )<TD> +Returns a buffer filled with Count spaces. +<TR><TH ALIGN="LEFT">SQRT()<TD>xbDouble EXPN::SQRT( xbDouble d )<TD> +Returns square root of d. +<TR><TH ALIGN="LEFT">STR()<TD> +char * EXPN::STR( xbDouble d )<hr> +char * EXPN::STR( xbDouble, xbShort )<hr> +char * EXPN::STR( xbDouble, xbShort, xbShort ) +<TD> +Converts a number to a string. +<TR><TH ALIGN="LEFT">SUBSTR()<TD>char * EXPN::SUBSTR( char * String, xbShort StartPos, xbShort Len )<TD> +Returns a string form String starting at position StartPos for a length of Len. +<TR><TH ALIGN="LEFT">TRIM()<TD>char * EXPN::TRIM( char * String )<TD> +Same as RTRIM. +<TR><TH ALIGN="LEFT">UPPER()<TD>char * EXPN::UPPER( char * String )<TD> +Converts a string to upper case. +<TR><TH ALIGN="LEFT">VAL()<TD>xbLong EXPN::VAL( char * String )<TD> +Converts a string to an integer. +<TR><TH ALIGN="LEFT">YEAR()<TD>xbLong EXPN::YEAR( char * Date8 )<TD> +Returns numeric year from Date8. +</TABLE> + + + +<br><br><br> +<TABLE BORDER> +<CAPTION ALIGN="TOP"><h3>Expression Processing Method List</h3></CAPTION> +<TR VALIGN="BASELINE"> +<TR><TH ALIGN="LEFT">Method<TD>Description +<TR><TH ALIGN="LEFT">GetDoubleResult()<TD>Get xbDouble result from processed expression +<TR><TH ALIGN="LEFT">GetIntResult()<TD>Get a xbLong result from processed expression +<TR><TH ALIGN="LEFT">GetExpressionHandle()<TD>Get an expression's handle +<TR><TH ALIGN="LEFT">GetExpressionResultType(xbExpression *)<TD>Get expression result type +<TR><TH ALIGN="LEFT">GetStringResult()<TD>Get xbString & result from processed expression +<TR><TH ALIGN="LEFT">ParseExpression(char *,xbDbf *)<TD>Parse an expression +<TR><TH ALIGN="LEFT">ProcessExpression(xbExpression *)<TD>Process a parsed expression +</TABLE> +<br><hr> +<h3>Method Definitions</h3> +<hr> + +<h3>Method xbDouble xbXBase::GetDoubleResult()</h3><br> + +This method returns a xbDouble result from a processed expression. +<br><br> +See the program listing in chapter 5 for an example of how to use this method. + +<hr> +<h3>Method xbLong xbXBase::GetIntResult()</h3><br> +This method returns a xbLong result from a processed expression. +<br><br> +See the program listing in chapter 5 for an example of how to use this method. + +<hr> +<h3>Method xbExpression * xbXBase::GetExpressionHandle()</h3><br> + +This method returns a handle to a recently parsed expression. +<br><br> +See the program listing in chapter 5 for an example of how to use this method. + +<hr> +<h3>Method char xbXBase::GetExpressionResultType( xbExpression * e )</h3><br> + +This method returns the result type for a given expression <em>e</em>. + +<br> +<br> +<TABLE BORDER> +<CAPTION ALIGN="TOP"><h3>Method Return Codes</h3></CAPTION> +<TR VALIGN="BASELINE"> +<TR><TH ALIGN="LEFT">Return Code Value<TD>Description +<TR><TH ALIGN="LEFT">C<TD>char * result from processed expression +- use GetStringResult() +<TR><TH ALIGN="LEFT">N<TD>xbDouble result from processed expression +- use GetDoubleResult() +<TR><TH ALIGN="LEFT">L<TD>xbLong (also logical) result from processed expression +- use GetIntResult() +</TABLE><br><br> + +See the program listing in chapter 5 for an example of how to use this method. + +<hr> +<h3>Method char * xbXBase::GetStringResult()</h3><br> + +This method returns a xbString & result from a processed expression. +<br><br> +See the program listing in chapter 5 for an example of how to use this method. + +<hr + +<hr> +<h3>Method xbShort ParseExpression( char * exp, DBF * d)</h3><br> + +This method parses expression <em>exp</em>.<br><em>d</em> is a pointer to +a database used for resolving any fieldname which does not contain the +<en>-></em> operator. + +<br><br> +See the program listing in chapter 5 for an example of how to use this method. +<hr> +<h3>Method xbShort ProcessExpression( xbExpression * e )</h3><br> + +This method processes parsed expression <em>e</em>. +<br><br> +See the program listing in chapter 5 for an example of how to use this method. +<br><br> +<hr> +<p><img src="xbase.jpg"><br><hr> +</BODY> +</HTML> diff --git a/html/xbc17.htm b/html/xbc17.htm new file mode 100755 index 0000000..c1d2c37 --- /dev/null +++ b/html/xbc17.htm @@ -0,0 +1,352 @@ +<!DOCTYPE HTML PUBLIC> +<HTML> +<TITLE>Xbase DBMS Chapter 17</TITLE> +<BODY BGCOLOR=#FFFFFF> +<H1><p align="center">Index Methods</p></H1> +<p align="center">Chapter Updated 2/12/99</p><hr> + +This chapter lists the xbNdx and xbNtx index methods and provides +examples of how to use them.<br><br> + +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.<br><br> + +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.<br><br><br> + +<TABLE BORDER> +<CAPTION ALIGN="TOP"><h3>Xbase xbNdx Index Method List</h3></CAPTION> +<TR VALIGN="BASELINE"> +<TR><TH ALIGN="LEFT">Method<TD>Description +<TR><TH ALIGN="LEFT">CheckIndxIntegrity<TD>Checks an index file for integrity +<TR><TH ALIGN="LEFT">CloseIndex<TD>Optional, closes an index. Closing + the DBF file will close any open indexes. +<TR><TH ALIGN="LEFT">CreateIndex<TD>Create an index +<TR><TH ALIGN="LEFT">FindKey<TD>Find a key in an index file +<TR><TH ALIGN="LEFT">GetFirstKey<TD>Get the first key in an index +<TR><TH ALIGN="LEFT">GetLastKey<TD>Get the last key in an index +<TR><TH ALIGN="LEFT">GetNextKey<TD>Get the next key in an index +<TR><TH ALIGN="LEFT">GetPrevKey<TD>Get the previous key in an index +<TR><TH ALIGN="LEFT">KeyExists<TD>Determine if a key exists w/o positioning DBF file +<TR><TH ALIGN="LEFT">OpenIndex<TD>Open an index +<TR><TH ALIGN="LEFT">ReIndex<TD>Rebuilds an index +</TABLE>in +<BR><BR> +<hr> +<h2>Method Definitions</h2> +<hr> + +<h3>Method xbShort xbNdx::CheckIndexIntegrity( xbShort option )</h3> +<h3>Method xbShort xbNtx::CheckIndexIntegrity( xbShort option )</h3><br> + +This method checks an open index for accuracy or file corruption. +If the option is non zero, the method will display informational messages.<br> +<br> +<TABLE BORDER> +<CAPTION ALIGN="TOP"><h3>Method Return Codes</h3></CAPTION><br> +<TR VALIGN="BASELINE"> +<TR><TH ALIGN="LEFT">Return Code<TD>Description +<TR><TH ALIGN="LEFT">XB_NO_ERROR<TD>If there is no error +<TR><TH ALIGN="LEFT">XB_LOCK_FAILED<TD>Read lock not successfull +<TR><TH ALIGN="LEFT">XB_NOT_OPEN<TD>File not open +<TR><TH ALIGN="LEFT">XB_INVALID_RECORD<TD>Invalid record number +<TR><TH ALIGN="LEFT">XB_SEEK_ERROR<TD>Seek routine error +<TR><TH ALIGN="LEFT">XB_WRITE_ERROR<TD>Write routine error +</TABLE> + +<h4>Example Program:</h4> + +See program <A HREF="/XbaseSamples/checkndx.cpp">checkndx.cpp</A> for an example +of how to use this method. + +<hr> + +<h3>Method xbShort xbNdx::CloseIndex( VOID )</h3> +<h3>Method xbShort xbNtx::CloseIndex( VOID )</h3><br> + +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.<br><br> + +<TABLE BORDER> +<CAPTION ALIGN="TOP"><h3>Method Return Codes</h3></CAPTION><br> +<TR VALIGN="BASELINE"> +<TR><TH ALIGN="LEFT">Return Code<TD>Description +<TR><TH ALIGN="LEFT">XB_NO_ERROR<TD>If there is no error +</TABLE> + +<h4>Example Program:</h4> + +See program <A HREF="/XbaseSamples/sample1.cpp">sample1.cpp</A> for an example +of how to use this method. + +<hr> + +<h3>Method xbShort xbNdx::CreateIndex( char * IndexName, char * KeyExpression, + xbShort Unique, xbShort OverLay )</h3> + +<h3>Method xbShort xbNtx::CreateIndex( char * IndexName, char * KeyExpression, + xbShort Unique, xbShort OverLay )</h3><br> + +This method creates an index. Indices are created as either a +character based index or a numeric based index, depending on the KeyExpression +value.<br><br> +<li><em>Indexname</em> - is the name of the physical index file name. +<li><em>KeyExpression</em> - is the key of the index. +<li><em>Unique</em> - XB_UNIQUE or XB_NOT_UNIQUE +<li><em>Overlay</em> - XB_OVERLAY or XB_DONTOVERLAY<br><br> +<TABLE BORDER> +<CAPTION ALIGN="TOP"><h3>Method Return Codes</h3></CAPTION><br> +<TR VALIGN="BASELINE"> +<TR><TH ALIGN="LEFT">Return Code<TD>Description +<TR><TH ALIGN="LEFT">XB_NO_ERROR<TD>If there is no error +<TR><TH ALIGN="LEFT">XB_NO_MEMORY<TD>Memory error +<TR><TH ALIGN="LEFT">XB_OPEN_ERROR<TD>Could not open index file +<TR><TH ALIGN="LEFT">XB_INVALID_KEY_EXPRESSION<TD>Bad index key expression +<TR><TH ALIGN="LEFT">XB_NOT_OPEN<TD>The database was not open +<TR><TH ALIGN="LEFT">XB_SEEK_ERROR<TD>Seek error encountered +<TR><TH ALIGN="LEFT">XB_READ_ERROR<TD>Read error encountered +</TABLE> + +<br><br> +Index expressions can be a single field or multiple fields. Assuming a +database has fields LASTNAME and FIRSTNAME, valid index expressions +could be:<br><br> + +<TABLE BORDER> +<CAPTION ALIGN="TOP"><h3>Sample Index Expressions</h3></CAPTION><br> +<TR VALIGN="BASELINE"> +<TR><TH ALIGN="LEFT">Expression<TD>Description +<TR><TH ALIGN="LEFT">"LASTNAME"<TD>Index on LASTNAME only. +<TR><TH ALIGN="LEFT">"LASTNAME+FIRSTNAME"<TD>Index on LASTNAME and FIRSTNAME +<TR><TH ALIGN="LEFT">"LASTNAME-FIRSTNAME"<TD>Index on LASTNAME and FIRSTNAME, +all spaces between the two fields removed. +<TR><TH ALIGN="LEFT">"LASTNAME-','FIRSTNAME"<TD>Index on LASTNAME and +FIRSTNAME, insert a comma between the two values, remove spaces between +the two fields. +</TABLE> +<br><br> +<TABLE BORDER> +<CAPTION ALIGN="TOP"><H3>Allowable Index Expression Operators</H3> +<TR VALIGN="BASELINE"> +<TR><TH ALIGN="LEFT">Operator<TD>Key Type<TD>Description +<TR><TH ALIGN="LEFT">+<TD>Character<TD>Concatonate string fields +<TR><TH ALIGN="LEFT">-<TD>Character<TD> +Concatonate string fields, remove trailing spaces +<TR><TH ALIGN="LEFT">'literal'<TD>Character<TD>include literal value +<TR><TH ALIGN="LEFT">"literal"<TD>Character<TD>include literal value +<TR><TH ALIGN="LEFT">+<TD>Numeric<TD>Add two numeric fields togethor +<TR><TH ALIGN="LEFT">-<TD>Numeric<TD>Subtract one numeric field from another +<TR><TH ALIGN="LEFT">*<TD>Numeric<TD>Mulitply two numeric fields togethor +<TR><TH ALIGN="LEFT">/<TD>Numeric<TD>Divide one numeric field into another +<TR><TH ALIGN="LEFT">**<TD>Numeric<TD>Exponential +</TABLE> +<br><br> +<h4>Example Program:</h4> + +See program <A HREF="/XbaseSamples/sample1.cpp">sample1.cpp</A> for an example +of how to use this method. + +<hr> + +<h3>Method xbShort xbNdx::FindKey( char * SearchValue )</h3> +<h3>Method xbShort xbNdx::FindKey( xbDouble SearchValue )</h3> +<h3>Method xbShort xbNtx::FindKey( char * SearchValue )</h3> +<h3>Method xbShort xbNtx::FindKey( xbDouble SearchValue )</h3><br> + +This method searches the index for key <em>SearchValue</em>. +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.<br><br> + +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.<br><br> + +For numeric keys, use a xbDouble value for a search value. This is because +all numeric field indices are saved as double values.<br><br> + +<TABLE BORDER> +<CAPTION ALIGN="TOP"><h3>Method Return Codes</h3></CAPTION><br> +<TR VALIGN="BASELINE"> +<TR><TH ALIGN="LEFT">Return Code<TD>Description +<TR><TH ALIGN="LEFT">XB_FOUND<TD>The key was found +<TR><TH ALIGN="LEFT">XB_NOT_FOUND<TD>The key was not found +<TR><TH ALIGN="LEFT">XB_NO_MEMORY<TD>Memory error +<TR><TH ALIGN="LEFT">XB_OPEN_ERROR<TD>Could not open index file +<TR><TH ALIGN="LEFT">XB_SEEK_ERROR<TD>Seek error encountered +<TR><TH ALIGN="LEFT">XB_READ_ERROR<TD>Read error encountered +</TABLE> + +<h4>Example Program:</h4> + +See program <A HREF="/XbaseSamples/sample5.cpp">sample5.cpp</A> for an example +of how to use this method. + +<hr> + +<h3>Method xbShort xbNdx::GetFirstKey( VOID )</h3> +<h3>Method xbShort xbNtx::GetFirstKey( VOID )</h3><br> + + +This method retrieves the record for the first key in the index.<br><br> + +<TABLE BORDER> +<CAPTION ALIGN="TOP"><h3>Method Return Codes</h3></CAPTION><br> +<TR VALIGN="BASELINE"> +<TR><TH ALIGN="LEFT">Return Code<TD>Description +<TR><TH ALIGN="LEFT">XB_NO_ERROR<TD>If there is no error +<TR><TH ALIGN="LEFT">XB_NO_MEMORY<TD>Memory error +<TR><TH ALIGN="LEFT">XB_OPEN_ERROR<TD>Could not open index file +<TR><TH ALIGN="LEFT">XB_SEEK_ERROR<TD>Seek error encountered +<TR><TH ALIGN="LEFT">XB_READ_ERROR<TD>Read error encountered +</TABLE> + +<h4>Example Program:</h4> + +See program <A HREF="/XbaseSamples/sample5.cpp">sample5.cpp</A> for an example +of how to use this method. + + +<hr> + +<h3>Method xbShort xbNdx::GetLastKey( VOID )</h3> +<h3>Method xbShort xbNtx::GetLastKey( VOID )</h3><br> + +This method retrieves the record for the last key in the index.<br><br> + +<TABLE BORDER> +<CAPTION ALIGN="TOP"><h3>Method Return Codes</h3></CAPTION><br> +<TR VALIGN="BASELINE"> +<TR><TH ALIGN="LEFT">Return Code<TD>Description +<TR><TH ALIGN="LEFT">XB_NO_ERROR<TD>If there is no error +<TR><TH ALIGN="LEFT">XB_NO_MEMORY<TD>Memory error +<TR><TH ALIGN="LEFT">XB_OPEN_ERROR<TD>Could not open index file +<TR><TH ALIGN="LEFT">XB_SEEK_ERROR<TD>Seek error encountered +<TR><TH ALIGN="LEFT">XB_READ_ERROR<TD>Read error encountered +</TABLE> + +<h4>Example Program:</h4> + +See program <A HREF="/XbaseSamples/sample5.cpp">sample5.cpp</A> for an example +of how to use this method. +<hr><h3>Method xbShort xbNdx::GetNextKey( VOID )</h3><br> +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.<br><br> + +<TABLE BORDER> +<CAPTION ALIGN="TOP"><h3>Method Return Codes</h3></CAPTION><br> +<TR VALIGN="BASELINE"> +<TR><TH ALIGN="LEFT">Return Code<TD>Description +<TR><TH ALIGN="LEFT">XB_NO_ERROR<TD>If there is no error +<TR><TH ALIGN="LEFT">XB_NO_MEMORY<TD>Memory error +<TR><TH ALIGN="LEFT">XB_OPEN_ERROR<TD>Could not open index file +<TR><TH ALIGN="LEFT">XB_SEEK_ERROR<TD>Seek error encountered +<TR><TH ALIGN="LEFT">XB_READ_ERROR<TD>Read error encountered +</TABLE> + +<h4>Example Program:</h4> + +See program <A HREF="/XbaseSamples/sample5.cpp">sample5.cpp</A> for an example +of how to use this method. + + +<hr><h3>Method xbShort xbNdx::GetPrevKey( VOID )</h3> +<hr><h3>Method xbShort xbNtx::GetPrevKey( VOID )</h3><br> + +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.<br><br> + +<TABLE BORDER> +<CAPTION ALIGN="TOP"><h3>Method Return Codes</h3></CAPTION><br> +<TR VALIGN="BASELINE"> +<TR><TH ALIGN="LEFT">Return Code<TD>Description +<TR><TH ALIGN="LEFT">XB_NO_ERROR<TD>If there is no error +<TR><TH ALIGN="LEFT">XB_NO_MEMORY<TD>Memory error +<TR><TH ALIGN="LEFT">XB_OPEN_ERROR<TD>Could not open index file +<TR><TH ALIGN="LEFT">XB_SEEK_ERROR<TD>Seek error encountered +<TR><TH ALIGN="LEFT">XB_READ_ERROR<TD>Read error encountered +</TABLE> + +<h4>Example Program:</h4> + +See program <A HREF="/XbaseSamples/sample5.cpp">sample5.cpp</A> for an example +of how to use this method. + +<hr> + +<h3>Method xbShort xbNdx::KeyExists( char * SearchValue )</h3> +<h3>Method xbShort xbNdx::KeyExists( xbDouble SearchValue )</h3> +<h3>Method xbShort xbNtx::KeyExists( char * SearchValue )</h3> +<h3>Method xbShort xbNtx::KeyExists( xbDouble SearchValue )</h3><br> + +This method searches the index for the key <em>SearchValue</em>. The routine does not +position the database record for the key. See the reference on FindKey for more +information regarding KeyValue.<br><br> + +<TABLE BORDER> +<CAPTION ALIGN="TOP"><h3>Method Return Codes</h3></CAPTION><br> +<TR VALIGN="BASELINE"> +<TR><TH ALIGN="LEFT">Return Code<TD>Description +<TR><TH ALIGN="LEFT">XB_FOUND<TD>The key was found +<TR><TH ALIGN="LEFT">XB_NOT_FOUND<TD>The key was not found +<TR><TH ALIGN="LEFT">XB_NO_MEMORY<TD>Memory error +<TR><TH ALIGN="LEFT">XB_OPEN_ERROR<TD>Could not open index file +<TR><TH ALIGN="LEFT">XB_SEEK_ERROR<TD>Seek error encountered +<TR><TH ALIGN="LEFT">XB_READ_ERROR<TD>Read error encountered +</TABLE> +<h4>Example Program:</h4> +<xmp> +if( xbNdx::KeyExists( "MyKeyValue" )) + cout << "\nKey was found"; +else + cout << "\nKey was not found"; +</xmp> +<hr> +<h3>Method xbShort xbNdx::OpenIndex( char * IndexName )</h3> +<h3>Method xbShort xbNtx::OpenIndex( char * IndexName )</h3><br> +This method opens index <em>IndexName</em> for a given DBF database. An index must be +opened before it will be automatically updated by the database update +routines.<br><br> +<TABLE BORDER> +<CAPTION ALIGN="TOP"><h3>Method Return Codes</h3></CAPTION><br> +<TR VALIGN="BASELINE"> +<TR><TH ALIGN="LEFT">Return Code<TD>Description +<TR><TH ALIGN="LEFT">XB_NO_ERROR<TD>If there is no error +<TR><TH ALIGN="LEFT">XB_NO_MEMORY<TD>Memory error +<TR><TH ALIGN="LEFT">XB_OPEN_ERROR<TD>Could not open index file +<TR><TH ALIGN="LEFT">XB_INVALID_KEY_EXPRESSION<TD>Bad key in index +<TR><TH ALIGN="LEFT">XB_NOT_OPEN<TD>The database was not open +<TR><TH ALIGN="LEFT">XB_SEEK_ERROR<TD>Seek error encountered +<TR><TH ALIGN="LEFT">XB_READ_ERROR<TD>Read error encountered +</TABLE> +<h4>Example Program:</h4> +See program <A HREF="/XbaseSamples/sample1.cpp">sample1.cpp</A> for an example +of how to use this method. +<hr> +<h3>Method xbShort xbNdx::ReIndex( VOID )</h3> +<h3>Method xbShort xbNtx::ReIndex( VOID )</h3><br> +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.<br><br> +<TABLE BORDER> +<CAPTION ALIGN="TOP"><h3>Method Return Codes</h3></CAPTION><br> +<TR VALIGN="BASELINE"> +<TR><TH ALIGN="LEFT">Return Code<TD>Description +<TR><TH ALIGN="LEFT">XB_NO_ERROR<TD>If there is no error +<TR><TH ALIGN="LEFT">XB_OPEN_ERROR<TD>Could not open index file +<TR><TH ALIGN="LEFT">XB_WRITE_ERROR<TD>Error writing data +<TR><TH ALIGN="LEFT">XB_CLOSE_ERROR<TD>Error closing work file +</TABLE> +<h4>Example Program:</h4> +See program <A HREF="/XbaseSamples/reindex.cpp">reindex.cpp</A> for an example +of how to use this method.<br><br> +<hr> +<p><img src="xbase.jpg"><br><hr> +</BODY> +</HTML> diff --git a/html/xbc18.htm b/html/xbc18.htm new file mode 100755 index 0000000..78d8de6 --- /dev/null +++ b/html/xbc18.htm @@ -0,0 +1,261 @@ +<!DOCTYPE HTML PUBLIC> +<HTML> +<TITLE>Xbase DBMS Chapter 18</TITLE> +<BODY BGCOLOR=#FFFFFF> +<H1><p align="center">Locking Methods</p></H1> +<p align="center">Chapter Updated 2/1/99</p><hr> + +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 +<em>errno</em> or function <em>perror()</em> can be executed to view the +results. +<br><br> + +The errno field may contain one of the following values if the lock was not +successful.<br><br> +<TABLE BORDER> +<TR VALIGN="BASELINE"> +<TR><TH ALIGN="LEFT">Error Code<TD>Description +<TR><TH ALIGN="LEFT">EBADF<TD>Invalid file descriptor +<TR><TH ALIGN="LEFT">EINVAL<TD>Invalid lock information or file does not support locks +<TR><TH ALIGN="LEFT">EACCESS<BR>EAGAIN<TD>Lock can not be set because it is blocked by an existing lock on the file. +<TR><TH ALIGN="LEFT">ENOLCK<TD>The system is out of lock resources, too many file locks in place. +<TR><TH ALIGN="LEFT">EDEADLK<TD>Deadlock condition +<TR><TH ALIGN="LEFT">EINTR<TD>Process was interrupted by a signal while it was waiting +</TABLE> +<br><br> +<h3>Types of Locks</h3> + +<li><em>Write or Exclusive Locks</em> provide exclusive access to a +particular file location. No other process can lock the same location.<br><br> + +<li><em>Read or Shared Locks</em> prohibit any process from requesting a write +lock on a specified part of the file. Other processes can request +simultaneous read locks.<br><br><br> + +<h3>DBF File Locking Techniques</h3> + +Xbase DBMS uses the following protocol for DBF file and record locking: +<br><br> + +To lock a record - the first byte of the record is locked.<br> +To lock the file - the header bytes of the file are locked.<br><br> + +When a record is being appended to the file, the header bytes are locked.<br> +When a record is being updated, the header bytes and the specific record are +locked.<br><br> +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. +<br><br><br> + +<h3>NDX File Locking Techniques</h3> + +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. +<br><br><br> + +<h3>DBT File Locking Techniques</h3> + +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. +<br><br><br> + + +<h3>AutoLocking Features</h3> + +If XB_LOCKING_ON is set in the <em>options.h</em> file, the locking methods +execute any appropriate locking logic. If XB_LOCKING_ON is not set in the +<em>options.h</em> 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 <em>options.h</em> file. +<br><br> +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. +<br><br> +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. +<br><br> +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. + +<br><br>For processing large files, locking the file instead of locking each +record is far more efficient. This is how you do it.<br><br> + +For reading the file in batch mode:<br> +xbDbf.AutoLockOff();<br> +xbDbf.LockDatabase( F_SETLKW, F_RDLCK, 0L );<br><br> +For updating the file in batch mode:<br> +xbDbf.AutoLockOff();<br> +xbDbf.LockDatabase( F_SETLKW, F_WRLCK, 0L );<br><br> +<br> +<hr><br> + +<h3>Method Table</h3> + +<TABLE BORDER> +<CAPTION ALIGN="TOP"><h3><Xbase Locking Method List</h3></CAPTION> +<TR VALIGN="BASELINE"> +<TR><TH ALIGN="LEFT">Method<TD>Description +<TR><TH ALIGN="LEFT">xbDbf::AutoLockOn<TD>Turns autolocking on +<TR><TH ALIGN="LEFT">xbDbf::AutoLockOff<TD>Turns autolocking off +<TR><TH ALIGN="LEFT">xbDbf::ExclusiveLock<TD>Lock file and indexes in exclusive mode +<TR><TH ALIGN="LEFT">xbDbf::ExclusiveUnlock<TD>Unlock files and indexes +<TR><TH ALIGN="LEFT">xbDbf::LockDatabase<TD>Locks or unlocks a DBF database +<TR><TH ALIGN="LEFT">xbNdx::LockIndex<TD>Locks or unlocks an xbNdx index +<TR><TH ALIGN="LEFT">xbNdx::LockMemoFile<TD>Locks or unlocks a DBT memo field file +</TABLE> +<BR><HR> + +<h4>Method Descriptions</h4> + +<h4>Method VOID xbDbf::AutoLockOn( VOID )</h4><br> + +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.<br><br> + +<h4>Example Program:</h4> + +See program <A HREF="/zips/loadzips.cpp">loadzips.cpp</A> for an example of +how to use this method. +<hr> + +<h4>Method VOID xbDbf::AutoLockOff( VOID )</h4><br> + +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. +<br><br> +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. +<br><br> +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. + + +<h4>Example Program:</h4> + +See program <A HREF="/zips/loadzips.cpp">loadzips.cpp</A> for an example of +how to use this method. + +<hr> +<h4>Method SHORT xbDbf::ExclusiveLock( SHORT WaitOption )</h4> +<h4>Method SHORT xbDbf::ExclusiveUnlock( VOID )</h4><br> + +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.<br><br> + +WaitOption is either:<br><br> +<li>F_SETLK - returns immediately regardless if success or failure<br> +<li>F_SETLKW - waits until lock function executes<br><br> + +<h4>Example Program:</h4> + +See program <A HREF="/XbaseSamples/sample4.cpp">sample4.cpp</A> for an example of +how to use this method. + +<hr> +<h3>Method SHORT xbDbf::LockDatabase( SHORT WaitOption, SHORT LockType, LONG LRecNo ) +</h3><br> + +This method locks or unlocks an Xbase (.DBF) file which was previously opened.<br> +<br> +WaitOption is either:<br><br> +<li>F_SETLK - returns immediately regardless if success or failure<br> +<li>F_SETLKW - waits until lock function executes<br><br> + +LockType is one of:<br><br> +<li>F_RDLCK - Perform a Read or Shared Lock<br> +<li>F_WRLCK - Perform a Write or Exclusive Lock<br> +<li>F_UNLCK - Unlock it<br><br> + +LRecNo is:<br><br> +0 - Lock the header section of the file (use this to lock the file)<br> +1 through n - Lock a particular record<br><br> + +<TABLE BORDER> +<CAPTION ALIGN="TOP"<h4>Method Return Codes</h4></CAPTION> +<TR><TH ALIGN="LEFT">Return Code<TD>Description +<TR><TH ALIGN="LEFT">XB_INVALID_RECORD<TD>An invalid record given +<TR><TH ALIGN="LEFT">XB_LOCK_FAILED<TD>The lock action failed, see errno +<TR><TH ALIGN="LEFT">XB_NO_ERROR<TD>The lock was successful +</TABLE> + + +<h4>Example Program:</h4> + +See program <A HREF="/zips/loadzips.cpp">loadzips.cpp</A> for an example of +how to use this method. + +<hr> + +<h3>Method xbShort xbDbf::LockIndex( xbShort WaitOption, xbShort LockType ) +</h3><br> + +This method locks or unlocks an Index (.NDX) file which was previously opened.<br> +<br> +WaitOption is either:<br><br> +<li>F_SETLK - returns immediately regardless if success or failure<br> +<li>F_SETLKW - waits until lock function executes<br><br> + +LockType is one of:<br><br> +<li>F_RDLCK - Perform a Read or Shared Lock<br> +<li>F_WRLCK - Perform a Write or Exclusive Lock<br> +<li>F_UNLCK - Unlock it<br><br> + +<TABLE BORDER> +<CAPTION ALIGN="TOP"<h4>Method Return Codes</h4></CAPTION> +<TR><TH ALIGN="LEFT">Return Code<TD>Description +<TR><TH ALIGN="LEFT">XB_LOCK_FAILED<TD>The lock action failed, see errno +<TR><TH ALIGN="LEFT">XB_NO_ERROR<TD>The lock was successful +</TABLE> + +<h4>Example Program:</h4> +See program <A HREF="/zips/loadzips.cpp">loadzips.cpp</A> for an example of +how to use this method. +<hr> + +<h3>Method xbShort xbDbf::LockMemoFile( xbShort WaitOption, xbShort LockType ) +</h3><br> + +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.<br><br> + +WaitOption is either:<br><br> +<li>F_SETLK - returns immediately regardless if success or failure<br> +<li>F_SETLKW - waits until lock function executes<br><br> + +LockType is one of:<br><br> +<li>F_RDLCK - Perform a Read or Shared Lock<br> +<li>F_WRLCK - Perform a Write or Exclusive Lock<br> +<li>F_UNLCK - Unlock it<br><br> +<TABLE BORDER> +<CAPTION ALIGN="TOP"<h4>Method Return Codes</h4></CAPTION> +<TR><TH ALIGN="LEFT">Return Code<TD>Description +<TR><TH ALIGN="LEFT">XB_LOCK_FAILED<TD>The lock action failed, see errno +<TR><TH ALIGN="LEFT">XB_NO_ERROR<TD>The lock was successful +</TABLE> +<hr> +<p><img src="xbase.jpg"><br><hr> +</BODY> +</HTML> diff --git a/html/xbc2.htm b/html/xbc2.htm new file mode 100755 index 0000000..ac4800e --- /dev/null +++ b/html/xbc2.htm @@ -0,0 +1,276 @@ +<!DOCTYPE HTML PUBLIC> +<HTML> +<TITLE>Xbase DBMS Chapter 2</TITLE> +<BODY BGCOLOR=#FFFFFF> +<H2><p align="center">Database Overview</p></H2> +<p align="center">Chapter Updated 3/18/04</p><hr> + +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.<br><br> + +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. +<br><br> + +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.<br><br> + +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. +<br><br> + +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.<br><br> + +Zero, one or many database files can be open simultaneously.<br><br> + +<hr> + +<h3>The Record Buffer</h3> + +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.<br><br> + +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.<br><br> + +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. + + +<br><br> + +<hr> +<br> +<h3>Xbase Database File Header</h3> + +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.<br><br><br> + +<TABLE BORDER> +<TR valign="BASELINE"> +<TR><TH ALIGN="LEFT">Position<TD>Length<TD>Description +<TR><TH ALIGN="LEFT">0<TD>1 byte<TD>file version number<br> + (03H without a .DBT file)<br> + (83H with a .DBT file) +<TR><TH ALIGN="LEFT">1-3<TD>3 bytes<TD>date of last update<br> + (YY MM DD) in binary format +<TR><TH ALIGN="LEFT">4-7<TD>32 bit number<TD>number of records in data file +<TR><TH ALIGN="LEFT">8-9<TD>16 bit number<TD>length of header structure +<TR><TH ALIGN="LEFT">10-11<TD>16 bit number<TD>length of the record +<TR><TH ALIGN="LEFT">12-31<TD>20 bytes<TD>reserved +<TR><TH ALIGN="LEFT">32-n<TD>32 bytes each<TD>field descriptor record (see below) +<TR><TH ALIGN="LEFT">n+1<TD>1 byte<TD>0DH as the field terminator +</TABLE> +<BR><BR> + +<hr> +<br> +<h3>Xbase Field Descriptor Record</h3> +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.<br><br><br> + +<TABLE BORDER> +<TR VALIGN="BASELIGN"> +<TR><TH ALIGN="LEFT">Position<TD>Length<TD>Description +<TR><TH ALIGN="LEFT">0-10<TD>11 bytes<TD>field name in ASCII zero-filled +<TR><TH ALIGN="LEFT">11<TD>1 byte<TD>field type in ASCII (C N L D or M) +<TR><TH ALIGN="LEFT">12-15<TD>32 bit number<TD>field data address +<TR><TH ALIGN="LEFT">16<TD>1 byte<TD>field length in binary +<TR><TH ALIGN="LEFT">17<TD>1 byte<TD>field decimal count in binary +<TR><TH ALIGN="LEFT">18-31<TD>14 bytes<TD>reserved bytes (version 1.00) +</TABLE> +<BR><BR> +<hr> +<br> +<h3>Field Data Format</h3> +Data are stored in ASCII format in the database as follows:<br><br> +<TABLE BORDER> +<TR VALIGN="BASELIGN"> +<TR><TH ALIGN="LEFT">DATA TYPE<TD>DATA RECORD STORAGE +<TR><TH ALIGN="LEFT">Character<TD>ASCII characters, left justified, right blank filled +<TR><TH ALIGN="LEFT">Date<TD>(8 digits in YYYYMMDD format, such as<BR> + 19601007 for October 7, 1960) +<TR><TH ALIGN="LEFT">Logical<TD>? Y y N n T t F f (? when not initialized) +<TR><TH ALIGN="LEFT">Memo<TD>10 digits representing a .DBT block number +<TR><TH ALIGN="LEFT">Numeric<TD>. 0 1 2 3 4 5 6 7 8 9 + -, right justified, left blank filled +<TR><TH ALIGN="LEFT">Float<TD>. 0 1 2 3 4 5 6 7 8 9 + -, right justified, left blank filled +</TABLE> +<BR><BR> + +<hr> +<h3>Memo Fields</h3> + +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. +<br><br> + +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. +<br><br> + +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. <br><br> + +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.<br><br> + +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. + + +<h4>Technical memo file information</h4> + +The following info on memo fields is for the curious. +It is not required +reading if you don't need to know the internals.<br><br> + +<li>Memo files are made up of one or more blocks +<li>For version III files, the block size is 512 +<li>For version IV files, the block size is a multiple of 512 +<li>The minimum amout of space necessary to store one memo field is +one block or 512 bytes. +<li>The default block size can be adjusted by manipulating the +XB_DBT_BLOCK_SIZE macro in the options.h file. + + +<li>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/ +<br><br> + +For version 3 memo field files, there are two fields in the head block of +the file, <em>NextBlockNo</em> and <em>Version</em>. 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.<br><br> + +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. + +<br><br> + +<h3>Various Memo File Block Types</h3> + +<TABLE BORDER> +<TR VALIGN="BASELIGN"> +<TR><TH ALIGN="LEFT">Valid Block Types +<TR><TH ALIGN="LEFT">Head Block +<TR><TH ALIGN="LEFT">Only data block for memo field +<TR><TH ALIGN="LEFT">First of several contiguous data block set +<TR><TH ALIGN="LEFT">2-n of contiguous data block set +<TR><TH ALIGN="LEFT">Only data block in free chain (version IV only) +<TR><TH ALIGN="LEFT">First of several contiguous free block set (version IV only) +<TR><TH ALIGN="LEFT">2-n of contiguous free block set (type 4 only) +</TABLE> +<BR><BR> + +<h3>Head Block Structure</h3> +<TABLE BORDER> +<TR VALIGN="BASELIGN"> +<TR><TH ALIGN="LEFT">1-4<TD>LONG<TD>Next Block ID +<TR><TH ALIGN="LEFT">5-8<TD>LONG<TD>Not used all 0x00's +<TR><TH ALIGN="LEFT">9-16<TD>CHAR(8)<TD>Filename (Version IV Only) +<TR><TH ALIGN="LEFT">17<TD>CHAR<TD>Version (0x03 = Version III, 0x00 = Version IV) +<TR><TH ALIGN="LEFT">18-20<TD>CHAR(3)<TD>Not used all 0x00's +<TR><TH ALIGN="LEFT">21-22<TD>SHORT<TD>Block Size (Version IV only ) +<TR><TH ALIGN="LEFT">23-Remainder of block<TD>CHAR<TD>Not used +</TABLE> +<BR><BR> + + +<h3>Version IV Head Data Block Structure</h3> +<TABLE BORDER> +<TR VALIGN="BASELIGN"> +<TR><TH ALIGN="LEFT">xbShort<TD>0-1<TD>-1 +<TR><TH ALIGN="LEFT">xbShort<TD>2-3<TD>Starting position of data (always 8 ?) +<TR><TH ALIGN="LEFT">xbLong<TD>4-7<TD>Length of data includes first 8 bytes +<TR><TH ALIGN="LEFT">char (9) - Blocksize<TD>8-15<TD>Data +</TABLE> +<BR><BR> + +<h3>Version IV Head Free Block Structure</h3> +<TABLE BORDER> +<TR VALIGN="BASELIGN"> +<TR><TH ALIGN="LEFT">xbLong<TD>0-3<TD>Next free block in the free block chain +<TR><TH ALIGN="LEFT">xbLong<TD>4-7<TD>Number of free blocks in this contiguous free + block set +</table> +<br><br> +Version 3 and 4 memo fields are terminated with two contiguous 0x1A bytes of data. +<br><br> +<hr> +<h3>64 Bit File Support</h3> +Beginning with Release 3.0 of the library, Xbase was renamed to Xbase64 and +64 bit file support was incorporated into the library. +<br><br> +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. +<br><br> +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. +<br><br> +If Xbase is being built with glibc, verify it is at least version 2.2.3. +<br><br><hr> +<p><img src="xbase.jpg"><hr> +</BODY> +</HTML> + diff --git a/html/xbc3.htm b/html/xbc3.htm new file mode 100755 index 0000000..b944a1b --- /dev/null +++ b/html/xbc3.htm @@ -0,0 +1,91 @@ +<!DOCTYPE HTML PUBLIC> +<HTML> +<TITLE>Xbase DBMS Chapter 3</TITLE> +<BODY BGCOLOR=#FFFFFF> +<H1><p align="center">Fields and Strings</p></H1> +<p align="center">Chapter Updated 8/20/03</p><hr> + +<br><br> +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. + +<br><br> +The main objective of this chapter is to provide information regarding the +basic concepts of manipulating data via the field methods.<br><br> + +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.<br><br> + + +<TABLE BORDER> +<CAPTION ALIGN="TOP"><h3>Field Types</H3></CAPTION> +<TR VALIGN="BASELINE"> +<TR><TH ALIGN="LEFT">Type<TD>Size<TD>Allowable Values<TD>Schema Value +<TR><TH ALIGN="LEFT">Numeric<TD>0 - 17(include sign and decimal point<TD>+ - . 0 through 9<TD>XB_NUMERIC_FLD +<TR><TH ALIGN="LEFT">Character<TD>0 - 254<TD>Anything<TD>XB_CHAR_FLD +<TR><TH ALIGN="LEFT">Date<TD>8<TD>CCYYMMDD<TD>XB_DATE_FLD +<TR><TH ALIGN="LEFT">Floating Point<TD>0 - 17 (includes sign and decimal point<TD>+ - . 0 through 9<TD>XB_FLOAT_FLD +<TR><TH ALIGN="LEFT">Logical<TD>1<TD>? Y y N n T t F f (? - uninitialized)<TD>XB_LOGICAL_FLD +<TR><TH ALIGN="LEFT">Memo<TD>Fixed length portion - 10<br>Variable length 0 - 32760 +<TD>Type III - Text<br>Type IV - Anything<TD>XB_MEMO_FLD +</TABLE> + +<br><br> +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.<br><br> + +<h2>Memo Fields</h2> + +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.<br><br> + +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. + +<br><br> +To utilize memo fields, the application program must allocate a buffer +which is large enough to handle the memo data.<br><br> + +<h2>Fields and Field Numbers</h2> + +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.<br><br> + +<h2>Record Schema</h2> + +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.</A><br><br> + +<h2>Strings</h2> + +Beginning with Release 1.8.0a, Xbase includes support for a string class +<em>xbString</em>. 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. +<br><br> +The xbString class interface was derived from the <em>Draft Standard C++ +Library by P.J. Plauger</em> and modified. If you are familiar with +other string classes, this one should feel similar. +<br><br> +<hr> +<p><img src="xbase.jpg"><hr> +</BODY> +</HTML> diff --git a/html/xbc4.htm b/html/xbc4.htm new file mode 100755 index 0000000..f570ed7 --- /dev/null +++ b/html/xbc4.htm @@ -0,0 +1,151 @@ +<!DOCTYPE HTML PUBLIC> +<HTML> +<TITLE>Xbase DBMS Chapter 4</TITLE> +<BODY BGCOLOR=#FFFFFF> +<H1><p align="center">Date Processing</p></H1> +<p align="center">Chapter Updated 2/12/99</p><hr> + +The objective of this chapter is to provide information regarding +the basic concepts of date arithmetic and supply generic +C/C++ date methods.<br><br> + +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.<br><br> + +To explain how dates work, I'll give a brief overview and history of Julian +dates, Gregorian dates, leap years and leap centuries. + +<h2>Leap Years</h2> + +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 + +<xmp> + int year; + + if(( year % 4 == 0 && year % 100 != 0 ) || year % 400 = 0 ) + LEAP_YEAR = TRUE; + else + LEAP_YEAR = FALSE +</xmp> + + +<h2>Julian Dates</h2> + +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.<br><br> + +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.<br><br> + +To determine the difference between two dates, convert both dates to a +Julian date and subtract one from the other.<br><br> + +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.<br><br> + +The Julian date routines use a base date of 01/01/1900.<br><br> + +<h2>Gregorian Dates</h2> + +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. +<br><br> + +The methods supplied with this software are based on gregorian dates with +the format of CCYYMMDD for century, year, month and day.<br><br> + + +<h2>CASTELLANO options</h2> + +There is an option in the <em>options.h</em> file for enabling the date routines +to return Spanish values for days, weeks and months.<br><br> +#define CASTELLANO<br><br> + +<h2>Date Formats</h2> + +All dates are stored in the .DBF files with format CCYYMMDD.<br><br> + +All date routines work with dates formated with the same CCYYMMDD format.<br><br> + +<h2>Sample Program</h2> + +<xmp> +#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"; +} +</xmp> +<hr> +<p><img src="xbase.jpg"><br><hr> +</BODY> +</HTML> diff --git a/html/xbc5.htm b/html/xbc5.htm new file mode 100755 index 0000000..377129f --- /dev/null +++ b/html/xbc5.htm @@ -0,0 +1,156 @@ +<!DOCTYPE HTML PUBLIC> +<html> +<title>Xbase DBMS Chapter 5</title> +<body bgcolor=#FFFFFF> +<h1><p align="center">Expression Handling<br></h1> +<p align="center">Chapter Updated 3/12/04</p><hr> + +<h3>Overview</h3> + +The main objective of this chapter is to provide information regarding the +basic concepts of using the Xbase Expression module.<br><br> + +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. +<br><br> +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. + +<br><br> + +<h3>Internal fuctioning</h3> +The expression module works in two phases. Firstly, method +<em>ParseExpression</em> 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. +<br><br> +Secondly, method <em>ProcessExpression</em> 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.<br><br> + +If an expression will be processed repeatedely, it is best to pre-parse the +tree using <em>ParseExpression</em>, then for each new call to the expression, +execute method <em>ProcessExpression</em> which processes the tree. + + +<h3>Expression Return Types</h3> +Expressions will return a type of CHAR *, NUMERIC or LOGICAL.<br><br> + +An expression return type can be determined with method <em> +GetExpressionResultType</em> after parsing it.<br><br> + +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 +<em>enum { WorkBufMaxLen = 200 };</em> in file <em>exp.h</em>. + +<h3>Expression Functions</h3> +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. + +<h3>Expression Components</h3> +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 "-'". +<br><br> +A field is simply a field name in the default database, or is in the form +of database->fieldname. + +<br><br> +<hr> +<h3>Sample Program Demonstrating Expression Processing</h3> +<xmp> + +/* 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; +} + +</xmp> + +<hr> +<p><img src="xbase.jpg"><br><hr> +</BODY> +</HTML> diff --git a/html/xbc6.htm b/html/xbc6.htm new file mode 100755 index 0000000..f5cf75d --- /dev/null +++ b/html/xbc6.htm @@ -0,0 +1,150 @@ +<!DOCTYPE HTML PUBLIC> +<HTML> +<TITLE>Xbase DBMS Chapter 6</TITLE> +<BODY BGCOLOR=#FFFFFF> +<H2><p align="center">NDX Indices</p></H2> +<p align="center">Chapter Updated 4/12/04</p><hr> + +The objective of this chapter is to provide information regarding the +basic concepts of how .NDX index files work in the Xbase environment.<br><br> + +The information in this chapter has been gathered by searching the internet +and by examining the structure of known good NDX indexes.<br><br> + +<h4>NDX Index File Characteristics</h4> + +<li>NDX indices maintain keys in ascending sort order only.<br><br> +<li>NDX indices support <em>unique</em> or <em>non unique</em> keys.<br><br> + +<em>Unique</em> keys must be unique. The database update routines will +fail if an attempt to add a non-unique key is performed.<br><br> + +<em>Non-unique</em> 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.<br><br> + +<li>NDX indexes are automatically updated by the Xbase library after the +indices are opened.<br><br> + +<li>Character keys are left justified and padded on the right with spaces.<br><br> + +<li>Numeric keys are stored as eight byte double values.<br><br> + +<h4>NDX File Internals</h4> + +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.<br><br> + +<li>The <em>Head Node</em> 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.<br><br> + + +<TABLE BORDER> +<CAPTION ALIGN="TOP"><h3>NDX Header Node</H3></CAPTION> +<TR VALIGN="BASELINE"> +<TR><TH ALIGN="LEFT">Type<TD>Size<TD>Field Name<TD>Description +<TR><TH ALIGN="LEFT">xbLong<TD>4<TD>StartNode<TD>This identifies the root node of + the index. The Header node is node 0. +<TR><TH ALIGN="LEFT">xbLong<TD>4<TD>Total Nodes<TD>This is the count of the total + nodes in the index. The count includes the header node. +<TR><TH ALIGN="LEFT">xbLong<TD>4<TD>NoOfKeys<TD>Total number of keys in the index +1 +<TR><TH ALIGN="LEFT">xbUShort<TD>2<TD>KeyLen<TD>The index key length +<TR><TH ALIGN="LEFT">xbUShort<TD>2<TD>KeysPerNode<TD>The maximum number of keys per node +<TR><TH ALIGN="LEFT">xbUShort<TD>2<TD>KeyType<TD>Type of key<br> +00 - Character<br>01 - Numeric +<TR><TH ALIGN="LEFT">xbLong<TD>4<TD>Keysize<TD>Key record size + 8 +<TR><TH ALIGN="LEFT">char<TD>1<TD>Unknown<TD>Reserved +<TR><TH ALIGN="LEFT">char<TD>1<TD>Unique<TD>Unique indicator<br> +00 - Not Unique - XB_NON_UNIQUE<br>01 - Unique - XB_UNIQUE +<TR><TH ALIGN="LEFT">char<TD>488<TD>KeyExpression<TD>Key expression string +<TR><TH ALIGN="LEFT"><TD>512<TD><TD>Total bytes in node +</TABLE> +<br><br> +The following structure is used by the Xbase NDX routines: +<xmp> + 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 */ + } +</xmp> +<br><br> + +<h4>Interior and Leaf Nodes</h4> + +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.<br><br> + +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.<br><br> + +Leaf nodes have 0 in the LeftNodeNo field but do have a value in the +DbfRecNo field which points to a DFB record.<br><br> + + +<TABLE BORDER> +<CAPTION ALIGN="TOP"><h3>NDX Interior Node and Leaf Node Structure</H3></CAPTION> +<TR VALIGN="BASELINE"> +<TR><TH ALIGN="LEFT">Type<TD>Size<TD>Field Name<TD>Description +<TR><TH ALIGN="LEFT">xbLong<TD>4<TD>NoOfKeysThisNode<TD>The number of key values in this node. +<TR><TH ALIGN="LEFT">char<TD>508<TD>KeyRec<TD>A repeating structure of + pointers and keys. See the next table for the KeyRec structure. +</TABLE> +<br><br> +<TABLE BORDER> +<CAPTION ALIGN="TOP"><h3>KeyRec Structure</H3></CAPTION> +<TR VALIGN="BASELINE"> +<TR><TH ALIGN="LEFT">Type<TD>Size<TD>Field Name<TD>Description +<TR><TH ALIGN="LEFT">xbLong<TD>4<TD>LeftNodeNo<TD>The node number of the lower node + for this key. 0 in Leaf Nodes. +<TR><TH ALIGN="LEFT">xbLong<TD>4<TD>DbfRecNo<TD>The DBF record number for this key. + 0 in Interior Nodes. +<TR><TH ALIGN="LEFT">char<TD>KeyLen<TD>KeyValue<TD>The key value. +</TABLE> + +<br><br> +For those interested in knowing how the Xbase DBMS manipulates and +navigates index files, the following discussion may be helpfull.<br><br> + +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. + +<hr> +<p><img src="xbase.jpg"><br><hr> +</BODY> +</HTML> diff --git a/html/xbc7.htm b/html/xbc7.htm new file mode 100755 index 0000000..bffb5ea --- /dev/null +++ b/html/xbc7.htm @@ -0,0 +1,176 @@ +<!DOCTYPE HTML PUBLIC> +<HTML> +<TITLE>Xbase DBMS Chapter 7</TITLE> +<BODY BGCOLOR=#FFFFFF> +<H2><p align="center">NTX Indices</p></H2> +<p align="center">Chapter Updated 2/12/99</p><hr> + +The objective of this chapter is to provide information regarding the +basic concepts of how .NTX index files work in the Xbase environment.<br><br> + +The information in this chapter has been gathered by searching the internet +and by examining the structure of known good NTX indexes.<br><br> + +<h4>NTX Index File Characteristics</h4> + +<ul><li>NTX indices maintain keys in ascending sort order only.<br><br> +<li>NTX indices support <em>unique</em> or <em>non unique</em> keys.<br><br> + +<em>Unique</em> keys must be unique. The database update routines will +fail if an attempt to add a non-unique key is performed.<br><br> + +<em>Non-unique</em> 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.<br><br> + +<li>NTX indexes are automatically updated by the Xbase library after the +indices are opened.<br><br> + +<li>Character keys are left justified and padded on the right with spaces.<br><br> + +<li>Numeric keys are stored as eight byte double values.<br><br> + +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. + +</ul> + + +<h4>NTX File Internals</h4> + +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.<br><br> + +The <em>Head Node</em> 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.<br><br> + + +<TABLE BORDER> +<CAPTION ALIGN="TOP"><h3>NTX Header Node</H3></CAPTION> +<TR VALIGN="BASELINE"> +<TR><TH ALIGN="LEFT">Type<TD>Size<TD>Field Name<TD>Description +<TR><TH ALIGN="LEFT">xbShort<TD>2<TD>Signature Byte<TD>The Clipper signature byte. 0x003h indicates Clipper 87. 0x006h indicates Clipper 5.x +<TR><TH ALIGN="LEFT">xbShort<TD>2<TD>Indexing Version Number<TD>Documented as the "Compiler Version" but I have observed an increasing number. Incremented whenever the index is changed. +<TR><TH ALIGN="LEFT">xbLong<TD>4<TD>First Node Offset<TD>The offset to the first node. +<TR><TH ALIGN="LEFT">xbLong<TD>4<TD>First Unused Page Offset<TD>The offset to the first unused node. +<TR><TH ALIGN="LEFT">xbShort<TD>2<TD>Key Size + 8<TD>The Key Size plus 8 bytes. +<TR><TH ALIGN="LEFT">xbShort<TD>2<TD>Key Size<TD>The size (length) of the key. +<TR><TH ALIGN="LEFT">xbShort<TD>2<TD>Number of Decimals<TD>Number of decimal places in key. +<TR><TH ALIGN="LEFT">xbShort<TD>2<TD>Max Items Per Node<TD>The maximum number of key per node. +<TR><TH ALIGN="LEFT">xbShort<TD>2<TD>1/2 The Max Items Per Node<TD>Half 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. +<TR><TH ALIGN="LEFT">char<TD>256<TD>KeyExpression<TD>Key expression string +<TR><TH ALIGN="LEFT">char<TD>1<TD>Unique<TD>Unique indicator<br> + 00 - Not Unique - XB_NON_UNIQUE<br> + 01 - Unique - XB_UNIQUE +<TR><TH ALIGN="LEFT">char<TD>745<TD>Unused<TD>Unused + + +<TR><TH ALIGN="LEFT"><TD>1024<TD><TD>Total bytes in node +</TABLE> +<br><br> +The following structure is used by the Xbase NTX routines: +<xmp> + +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]; +}; + +</xmp> + +<br><br> + +<h4>Interior and Leaf Nodes</h4> + +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. <br><br> + +Leaf nodes have 0 in the LeftNodeNo field.<br><br> + + +<TABLE BORDER> +<CAPTION ALIGN="TOP"><h3>NTX Interior Node and Leaf Node Structure</H3></CAPTION> +<TR VALIGN="BASELINE"> +<TR><TH ALIGN="LEFT">Type<TD>Size<TD>Field Name<TD>Description +<TR><TH ALIGN="LEFT">xbShort<TD>2<TD>NoOfKeysThisNode<TD>The number of key values in this node. (N) +<TR><TH ALIGN="LEFT">Array of xbUShort<TD>2<TD>offsets[]<TD>Array of + <pre>HeadNode.KeysPerNode +1</pre> unsigned longs. + These values are the offsets (in bytes) of each key + in this node, from the beginning of the node. +<TR><TH ALIGN="LEFT">char<TD>variable<TD>KeyRecs<TD>A repeating structure of + pointers and keys. See the next table for the KeyRec structure. +</TABLE> +<br><br> + +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. + +<BR> +<TABLE BORDER> +<CAPTION ALIGN="TOP"><h3>KeyRec Structure</H3></CAPTION> +<TR VALIGN="BASELINE"> +<TR><TH ALIGN="LEFT">Type<TD>Size<TD>Field Name<TD>Description +<TR><TH ALIGN="LEFT">xbLong<TD>4<TD>LeftNodeNo<TD>The node number (offset from beginning of file) of the lower node + for this key. 0 in Leaf Nodes. +<TR><TH ALIGN="LEFT">xbLong<TD>4<TD>DbfRecNo<TD>The DBF record number for this key. + 0 in Interior Nodes. +<TR><TH ALIGN="LEFT">char<TD>KeyLen<TD>KeyValue<TD>The key value. +</TABLE> + +<br><br> +For those interested in knowing how the Xbase DBMS manipulates and +navigates index files, the following discussion may be helpfull.<br><br> + +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. + +<hr> +<A HREF="mailto:bob@#synxis.com"> +Author: Bob Cotton - bob@synxis.com</A><br> +</BODY> +</HTML> diff --git a/html/xbc8.htm b/html/xbc8.htm new file mode 100755 index 0000000..efab841 --- /dev/null +++ b/html/xbc8.htm @@ -0,0 +1,130 @@ +<!DOCTYPE HTML PUBLIC> +<HTML> +<TITLE>Xbase DBMS Chapter 8</TITLE> +<BODY BGCOLOR=#FFFFFF> +<H1><p align="center">Record and File Locking</p></H1> +<p align="center">Chapter Updated 2/1/99</p><hr> + +<h3>Locking Overview</h3> + +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.<br><br> + +Record locking is on by default in the Xbase DBMS library. To disable it, +comment out the XB_LOCKING_ON option in the <em>options.h</em> file in the +xbase/src directory.<br><br> + +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. +<br><br> + +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 +<em>errno</em> or function <em>perror()</em> can be executed to view the +results. +<br><br> + +The errno field may contain one of the following values if the lock was not +successful.<br><br> +<TABLE BORDER> +<TR VALIGN="BASELINE"> +<TR><TH ALIGN="LEFT">Error Code<TD>Description +<TR><TH ALIGN="LEFT">EBADF<TD>Invalid file descriptor +<TR><TH ALIGN="LEFT">EINVAL<TD>Invalid lock information or file does not support locks +<TR><TH ALIGN="LEFT">EACCESS<BR>EAGAIN<TD>Lock can not be set because it is blocked by an existing lock on the file. +<TR><TH ALIGN="LEFT">ENOLCK<TD>The system is out of lock resources, too many file locks in place. +<TR><TH ALIGN="LEFT">EDEADLK<TD>Deadlock condition +<TR><TH ALIGN="LEFT">EINTR<TD>Process was interrupted by a signal while it was waiting +</TABLE> +<br><br> +<h3>Types of Locks</h3> + +<li><em>Write or Exclusive Locks</em> provide exclusive access to a +particular file location. No other process can lock the same location.<br><br> + +<li><em>Read or Shared Locks</em> prohibit any process from requesting a write +lock on a specified part of the file. Other processes can request +simultaneous read locks.<br><br><br> + +<h3>DBF File Locking Techniques</h3> + +Xbase DBMS uses the following protocol for DBF file and record locking: +<br><br> + +To lock a record - the first byte of the record is locked.<br> +To lock the file - the header bytes of the file are locked.<br><br> + +When a record is being appended to the file, the header bytes are locked.<br> +When a record is being updated, the header bytes and the specific record are +locked.<br><br> +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. +<br><br><br> + +<h3>NDX File Locking Techniques</h3> + +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. +<br><br><br> + +<h3>DBT File Locking Techniques</h3> + +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. +<br><br><br> + + +<h3>AutoLocking Features</h3> + +If XB_LOCKING_ON is set in the <em>options.h</em> file, the locking methods +execute any appropriate locking logic. If XB_LOCKING_ON is not set in the +<em>options.h</em> 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 <em>options.h</em> file. +<br><br> +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. +<br><br> +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. +<br><br> +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. + +<br><br>For processing large files, locking the file instead of locking each +record is far more efficient. This is how you do it.<br><br> + +For reading the file in batch mode:<br> +xbDbf.AutoLockOff();<br> +xbDbf.LockDatabase( F_SETLKW, F_RDLCK, 0L );<br><br> +For updating the file in batch mode:<br> +xbDbf.AutoLockOff();<br> +xbDbf.LockDatabase( F_SETLKW, F_WRLCK, 0L );<br><br> +<br> +<hr><br> +<p><img src="xbase.jpg"><br><hr> +</BODY> +</HTML> diff --git a/html/xblock.htm b/html/xblock.htm new file mode 100755 index 0000000..e95f1e3 --- /dev/null +++ b/html/xblock.htm @@ -0,0 +1,281 @@ +<!DOCTYPE HTML PUBLIC> +<HTML> +<TITLE>Xbase DBMS Chapter 10</TITLE> +<BODY BGCOLOR=#FFFFFF> +<H1><p align="center">Xbase DBMS Record and File Locking</p></H1> +<p align="center">Chapter Updated 4/8/98</p><hr> + +<h3>Locking Overview</h3> + +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.<br><br> + +Record locking is on by default in the Xbase DBMS library. To disable it, +comment out the LOCKING_ON option in the <em>options.h</em> file in the +xbase/src directory.<br><br> + +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. +<br><br> + +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 +<em>errno</em> or function <em>perror()</em> can be executed to view the +results. +<br><br> + +The errno field may contain one of the following values if the lock was not +successful.<br><br> +<TABLE BORDER> +<TR VALIGN="BASELINE"> +<TR><TH ALIGN="LEFT">Error Code<TD>Description +<TR><TH ALIGN="LEFT">EBADF<TD>Invalid file descriptor +<TR><TH ALIGN="LEFT">EINVAL<TD>Invalid lock information or file does not support locks +<TR><TH ALIGN="LEFT">EACCESS<BR>EAGAIN<TD>Lock can not be set because it is blocked by an existing lock on the file. +<TR><TH ALIGN="LEFT">ENOLCK<TD>The system is out of lock resources, too many file locks in place. +<TR><TH ALIGN="LEFT">EDEADLK<TD>Deadlock condition +<TR><TH ALIGN="LEFT">EINTR<TD>Process was interrupted by a signal while it was waiting +</TABLE> +<br><br> +<h3>Types of Locks</h3> + +<li><em>Write or Exclusive Locks</em> provide exclusive access to a +particular file location. No other process can lock the same location.<br><br> + +<li><em>Read or Shared Locks</em> prohibit any process from requesting a write +lock on a specified part of the file. Other processes can request +simultaneous read locks.<br><br><br> + +<h3>DBF File Locking Techniques</h3> + +Xbase DBMS uses the following protocol for DBF file and record locking: +<br><br> + +To lock a record - the first byte of the record is locked.<br> +To lock the file - the header bytes of the file are locked.<br><br> + +When a record is being appended to the file, the header bytes are locked.<br> +When a record is being updated, the header bytes and the specific record are +locked.<br><br> +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. +<br><br><br> + +<h3>NDX File Locking Techniques</h3> + +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. +<br><br><br> + +<h3>DBT File Locking Techniques</h3> + +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. +<br><br><br> + + +<h3>AutoLocking Features</h3> + +If LOCKING_ON is set in the <em>options.h</em> file, the locking methods +execute any appropriate locking logic. If LOCKING_ON is not set in the +<em>options.h</em> 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 <em>options.h</em> file. +<br><br> +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. +<br><br> +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. +<br><br> +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. + +<br><br>For processing large files, locking the file instead of locking each +record is far more efficient. This is how you do it.<br><br> + +For reading the file in batch mode:<br> +DBF.AutoLockOff();<br> +DBF.LockDatabase( F_SETLKW, F_RDLCK, 0L );<br><br> +For updating the file in batch mode:<br> +DBF.AutoLockOff();<br> +DBF.LockDatabase( F_SETLKW, F_WRLCK, 0L );<br><br> +<br> +<hr><br> + +<h3>Method Table</h3> + +<TABLE BORDER> +<CAPTION ALIGN="TOP"><h3><Xbase Locking Method List</h3></CAPTION> +<TR VALIGN="BASELINE"> +<TR><TH ALIGN="LEFT">Method<TD>Description +<TR><TH ALIGN="LEFT">DBF::AutoLockOn<TD>Turns autolocking on +<TR><TH ALIGN="LEFT">DBF::AutoLockOff<TD>Turns autolocking off +<TR><TH ALIGN="LEFT">DBF::ExclusiveLock<TD>Lock file and indexes in exclusive mode +<TR><TH ALIGN="LEFT">DBF::ExclusiveUnlock<TD>Unlock files and indexes +<TR><TH ALIGN="LEFT">DBF::LockDatabase<TD>Locks or unlocks a DBF database +<TR><TH ALIGN="LEFT">NDX::LockIndex<TD>Locks or unlocks an NDX index +<TR><TH ALIGN="LEFT">NDX::LockMemoFile<TD>Locks or unlocks a DBT memo field file +</TABLE> +<BR><HR> + +<h4>Method Descriptions</h4> + +<h4>Method VOID DBF::AutoLockOn( VOID )</h4><br> + +This method turns automatic record locking on. Auto record locking is on +by default if LOCKING_ON is set in the options.h file.<br><br> + +<h4>Example Program:</h4> + +See program <A HREF="/zips/loadzips.cpp">loadzips.cpp</A> for an example of +how to use this method. +<hr> + +<h4>Method VOID DBF::AutoLockOff( VOID )</h4><br> + +This method turns automatic record locking off. Auto record locking is on +by default if LOCKING_ON is set in the options.h file. +<br><br> +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. +<br><br> +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. + + +<h4>Example Program:</h4> + +See program <A HREF="/zips/loadzips.cpp">loadzips.cpp</A> for an example of +how to use this method. + +<hr> +<h4>Method SHORT DBF::ExclusiveLock( SHORT WaitOption )</h4> +<h4>Method SHORT DBF::ExclusiveUnlock( VOID )</h4><br> + +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.<br><br> + +WaitOption is either:<br><br> +<li>F_SETLK - returns immediately regardless if success or failure<br> +<li>F_SETLKW - waits until lock function executes<br><br> + +<h4>Example Program:</h4> + +See program <A HREF="/XbaseSamples/sample4.cpp">sample4.cpp</A> for an example of +how to use this method. + +<hr> +<h3>Method SHORT DBF::LockDatabase( SHORT WaitOption, SHORT LockType, LONG LRecNo ) +</h3><br> + +This method locks or unlocks an Xbase (.DBF) file which was previously opened.<br> +<br> +WaitOption is either:<br><br> +<li>F_SETLK - returns immediately regardless if success or failure<br> +<li>F_SETLKW - waits until lock function executes<br><br> + +LockType is one of:<br><br> +<li>F_RDLCK - Perform a Read or Shared Lock<br> +<li>F_WRLCK - Perform a Write or Exclusive Lock<br> +<li>F_UNLCK - Unlock it<br><br> + +LRecNo is:<br><br> +0 - Lock the header section of the file (use this to lock the file)<br> +1 through n - Lock a particular record<br><br> + +<TABLE BORDER> +<CAPTION ALIGN="TOP"<h4>Method Return Codes</h4></CAPTION> +<TR><TH ALIGN="LEFT">Return Code<TD>Description +<TR><TH ALIGN="LEFT">INVALID_RECORD<TD>An invalid record given +<TR><TH ALIGN="LEFT">LOCK_FAILED<TD>The lock action failed, see errno +<TR><TH ALIGN="LEFT">NO_ERROR<TD>The lock was successful +</TABLE> + + +<h4>Example Program:</h4> + +See program <A HREF="/zips/loadzips.cpp">loadzips.cpp</A> for an example of +how to use this method. + +<hr> + +<h3>Method SHORT DBF::LockIndex( SHORT WaitOption, SHORT LockType ) +</h3><br> + +This method locks or unlocks an Index (.NDX) file which was previously opened.<br> +<br> +WaitOption is either:<br><br> +<li>F_SETLK - returns immediately regardless if success or failure<br> +<li>F_SETLKW - waits until lock function executes<br><br> + +LockType is one of:<br><br> +<li>F_RDLCK - Perform a Read or Shared Lock<br> +<li>F_WRLCK - Perform a Write or Exclusive Lock<br> +<li>F_UNLCK - Unlock it<br><br> + +<TABLE BORDER> +<CAPTION ALIGN="TOP"<h4>Method Return Codes</h4></CAPTION> +<TR><TH ALIGN="LEFT">Return Code<TD>Description +<TR><TH ALIGN="LEFT">LOCK_FAILED<TD>The lock action failed, see errno +<TR><TH ALIGN="LEFT">NO_ERROR<TD>The lock was successful +</TABLE> + +<h4>Example Program:</h4> +See program <A HREF="/zips/loadzips.cpp">loadzips.cpp</A> for an example of +how to use this method. +<hr> + +<h3>Method SHORT DBF::LockMemoFile( SHORT WaitOption, SHORT LockType ) +</h3><br> + +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.<br><br> + +WaitOption is either:<br><br> +<li>F_SETLK - returns immediately regardless if success or failure<br> +<li>F_SETLKW - waits until lock function executes<br><br> + +LockType is one of:<br><br> +<li>F_RDLCK - Perform a Read or Shared Lock<br> +<li>F_WRLCK - Perform a Write or Exclusive Lock<br> +<li>F_UNLCK - Unlock it<br><br> + +<TABLE BORDER> +<CAPTION ALIGN="TOP"<h4>Method Return Codes</h4></CAPTION> +<TR><TH ALIGN="LEFT">Return Code<TD>Description +<TR><TH ALIGN="LEFT">LOCK_FAILED<TD>The lock action failed, see errno +<TR><TH ALIGN="LEFT">NO_ERROR<TD>The lock was successful +</TABLE> +<hr> +<p><img src="xbase.jpg"><br><hr> +</BODY> +</HTML> |