ebook img

C Database Toolchest PDF

396 Pages·1996·89.667 MB·English
by  
Save to my drive
Quick download
Download
Most books are stored in the elastic cloud where traffic is expensive. For this reason, we have a limit on daily download.

Preview C Database Toolchest

tabase lIest IDatabase] I sl" Database Management c++ Tools for C & ...-.,::-_".._e IDatabase Toolchest™ Database Management Libraries and Tools for C & c++ Copyright © 1996 by Mix Software, Inc. All Rights Reserved Copyright © 1996 by Mix Software, Inc. All rights reserved. No part ofthis book shall be reproduced, stored in a retrieval system, or transmitted by any means, electronic, mechanical, photocopying, recording, or otherwise, without written permission from the publisher. No patent liability is assumed with respect to the use of the information contained herein. While every precaution has been taken in the preparation of this book and the accompanying software, the publisher and author assume no responsibility for errors or omissions. Neither is any liability assumed for damages resulting from the use of the information contained herein. Mix Software, Inc. 1132 Commerce Drive Richardson, TX 75081 Sales: ............................. (800) 333-0330 Fax: ............................... (214) 783-1404 Technical Support: ........ (214) 783-6001 ISBN: 1-879810-11-5 ClDatabase Toolchest™ is a trademark of Mix Software, Inc. dBASE® is a registered trademark of Borland International ii ClDatabase Toolchest Software License Agreement Mix Software, Inc. grants the purchaser a single CPU license for use of the accompanying software. By single CPU license, we mean that the software must not be used on more than one computer at the same time. The purchaser shall not make copies of the software except for the sole purpose of backing up the software to protect against accidental loss of information on the original media. Using Library Functions The library functions included with this software may be linked with your own functions, and the resulting executable program may be distributed without obligation to Mix Software, Inc .. In other words, your own executable files may be distributed royalty free. However, the library functions included with this software may not be distributed as linkable object or library files, or as source code files. Using Sample Programs The sample programs included with this software may not be distributed in any form (executable, linkable, or source code). However, selected functions in the sample programs may be extracted and incorporated into your own programs in a manner similar to using our library functions. Your own executable programs may be distributed royalty free if they perform a substantially different function than the sample programs from which they are derived. Functions extracted from sample programs may not be distributed as linkable object or library files, or as source code files. ClDatabase Too1chest 111 iv C/Database Too1chest Table of Contents Chapter 1 ---Introduction 1 Chapter 2 ---ISAM Databases 3 A Typical Problem ............................................................................... 3 A Computer Solution ........................................................................... 4 The ISAM Library ................................................................................ 6 Database Operations ...................................................................... 6 Indexes ........................................................................................... 7 Data Types ..................................................................................... 8 Variable Length Records ............................................................... 10 The CBT Library .................................................................................. 10 The ISAMCPP Library ......................................................................... 11 Chapter 3 ---ISAM Tutorial 13 Creating a New Database ..................................................................... 13 Opening an Existing Database ............................................................. 14 Making Indexes .................................................................................... 15 Adding Records .................................................................................... 17 Finding Records ................................................................................... 18 Deleting Records .................................................................................. 20 Chapter 4 ---ISAMCPP Tutorial 23 Creating a New Database ..................................................................... 23 Opening an Existing Database ............................................................. 24 Making Indexes .................................................................................... 25 Adding Records .................................................................................... 27 Finding Records ................................................................................... 28 Deleting Records .................................................................................. 30 Chapter 5 ---ISAM Library Functions 33 Chapter 6 ---ISAMCPP Library Functions 145 Chapter 7 ---CBT Library Functions 279 ClDatabase Toolchest v Chapter 8 ---Tools 347 DBFTODB ........................................................................................... 347 DBTODBF ........................................................................................... 349 DUMPDATA ....................................................................................... 350 DUMPTREE ........................................................................................ 350 PRESSDB ............................................................................................. 351 Chapter 9 ---LDM Program 353 Creating a Database .............................................................................. 354 Making Indexes .................................................................................... 355 Adding Records .................................................................................... 357 Finding Records ................................................................................... 358 Editing and Deleting Records .............................................................. 359 Opening an Existing Database ............................................................. 359 Browsing Records ................................................................................ 362 Getting Help ......................................................................................... 364 Exiting LDM ........................................................................................ 364 Appendix A-ISAM Error Constants 365 Appendix B-CBT Error Constants 367 Appendix C-CBT Function Constants 369 Appendix D-CBT Context Constants 371 Appendix E-ISAM Function Summary 373 Appendix F -ISAMCPP Function Summary 375 Appendix G CBT Function Summary 377 Appendix H Installation 379 Index 383 vi ClDatabase Too1chest Chapter 1 Introduction The ClDatabase Toolchest'" is a collection of libraries and tools that enable you to add sophisticated database management capabilities to your own applications. Both C and C++ interfaces are provided so that you can create applications using either of these two popular programming languages. The libraries are designed to support large databases, limited only by the available disk space. To make efficient use of disk space, the database records are automatically stored in variable lengths. Typical databases contain string fields that vary in length from one record to the next. Storing only the exact length of each string eliminates the wasted disk space that occurs in database systems, such as dBASE®, that support only fixed-length records. Further efficiency is gained by allowing numeric values to be stored in either string or binary format. In database systems like dBASE®, numeric values are always translated to strings of digit characters before being stored in the database, then translated back to binary after being retrieved from the database. When database portability is paramount, this is the preferred method for storing numeric values. However, when efficiency is paramount, the preferred method is to store numeric values using their internal binary representation. This method requires no translation and typically requires much less disk storage space. The database indexes are implemented using an efficient derivation of the balanced tree algorithm, sometimes referred to as a B+tree. This algorithm makes it possible to find records quickly, even in very large databases. The index management is handled by an independent library, thereby making the B+tree algorithm available to programs that do not need the complete database management facilities. For use on networks or other multi-user environments, the libraries support file and record locking. An entire database, or one or more records in a database can be locked by a program, thereby blocking access by other programs. Databases ClDatabase Toolchest Chapter 1 -Intoduction may be read-locked or write-locked. When a program read-locks a database, other programs can read but not modify the database. A write-locked database cannot be accessed at all by other programs, not even for reading. This manual includes two short tutorial chapters (one for C and one for C++) that cover some of the fundamental database library functions. Several example programs illustrate how to create a new database, open an existing database, make indexes, add records, find records, and delete records. Two additional chapters describe all of the C and C++ library functions in alphabetical order. The use of each library function is illustrated by a short example program. The source code for all of the example programs is included on disk. Several useful tools are provided that perform various database management tasks. There are tools for converting to and from dBASE®f ormat files, for compressing unused space from databases, and for displaying the contents of database files. A program named LDM (Little Data Manager) allows you to create new databases or edit existing databases. Since this program calls many of the library functions, it provides a more complex example of how to use the database libraries. The source code for these programs is also included on disk. Many combinations of compilers and operating systems are currently supported. For the supported compilers, all you have to do is select the appropriate compiler when you install the software. Since the C and C++ source code is included, it is possible to port the libraries to additional compilers and/or operating systems. Because of the existing standards for the C and C++ languages, porting the libraries to any standard compiler is generally quite easy. For many compilers, no source code changes are necessary. All you have to do is create the appropriate control files for building the libraries. You can start by installing the software for one of the supported compilers, then modify the control files to conform to your particular compiler. Before proceeding further, you should first install the software. See the Installation section of the appendix for instructions. 2 ClDatabase Toolchest

See more

The list of books you might like

Most books are stored in the elastic cloud where traffic is expensive. For this reason, we have a limit on daily download.