Информационный сервер для программистов: Исходники со всего света. Паскальные исходники со всего света
  Powered by Поисковый сервер Яndex: Найдется ВСЁ!
На Главную Pascal Форум Информер Страны мира
   Базы Данных    >>    btp15
   
 
 BTP 1.5 - The Btrieve Unit for Turbo Pascal 6.0   John C. Leon 09.11.1991

Модуль для работы с BTrieve из TP6.
The BTP product was born to remove the drudgery from Btrieve programming. BTP includes a number of sound data structures/objects, including these four: TRecMgr, BFile, BFixed, and BFileExt. TRecMgr and BFile are base objects; they are direct descendants of TP6's TObject. BFixed and BFileExt are both direct descendants of BFile.



52k 
 

BTP - The Btrieve Unit for Turbo Pascal 6.0 (C) 1991 John C. Leon (* ---------------------------------------------------------------- *) Version 1.5, 11/9/91 ** DISCLAIMER AND LICENSE ******************************************* This unit was authored by and is the copyrighted property of John C. Leon. It is supplied without warranty of any kind, and without any representations as to its usefulness or adequacy for any task. Under no circumstances does the author take any responsiblity for loss or damage, alleged or actual, arising from usage of this property. Use at your own risk. THIS PRODUCT IS *NO LONGER* FREEWARE. Use of this product beyond an initial trial period of 30 days obligates you to remit the registration fee of $25 (for a non-corporate, non-commercial license) to: John C. Leon 3807 Wood Gardens Court Kingwood, TX 77339 713-359-3641 (residence) CIS #72426,2077 (Email responded to promptly) Corporate users must contact me directly for licensing terms. Production of a commercial product using this unit is strictly forbidden without permission and license. Coming soon ONLY for licensed users...a Turbo Vision based Btrieve utility program for creating files, adding/dropping supplemental indices, reporting stats, cloning and crunching files, etc, etc. Will be free to all registered BTP owners. ********************************************************************** Pre-Requisites to Using this Software ===================================== This unit provides a rich suite of Btrieve programming tools. However, it is NOT an educational tool. While proven to be extremely easy to use, it is assumed that you are familiar with Turbo Pascal 6.0, use of dynamic variables and pointers, object-oriented programming, and Novell's Btrieve product. BTP requires Turbo Pascal 6.0 and will NOT function with prior releases. This unit was designed with, and has only been tested with, version 5.10a of Btrieve, with all current patches applied. WARNING! Do NOT use with other versions! Having said that, I have every reason to believe it will work fine with prior versions if you don't try to use the op codes that apply to later versions. WHAT IT DOES! ------------- It makes the Btrieve black box friendly! Total support for standard, fixed-length Btrieve files, using all standard calls and the get/step extended calls. While no specific support exists for extended insert calls, such calls can readily be made; an example of extended insert calls is in EXAMPLE2.PAS. Imagine opening a Btrieve file in any mode, saving a "permanent" copy of its stats and structure, establishing and isolating its position block, and being able to refer to all your fields by name... all with just ONE SIMPLE CALL with only TWO PARAMETERS!!! NO BTRIEVE CALL MADE WITH THIS UNIT'S TECHNIQUES REQUIRES MORE THAN TWO PARAMETERS (the op code and key number). This is ONLY made possible with object-oriented programming and the encapsulation it provides. INCLUDED in this distribution package are several useful Btrieve utilities that make full use of this unit. The CLONE and CRUNCHx programs, in particular, illustrate the extraordinary ease of Btrieve programming with BTP! The STATS program displays the same information as Novell's BUTIL program. These utility programs alone are worth the $25 registration fee. Further, you are authorized to distribute these compiled utilities freely SO LONG AS YOU DO NOT MODIFY THE SOURCE CODE IN ANY WAY... INCLUDING MY COPYRIGHT NOTICES AND NAME. Full details on BTP are to be found in the BTP.DOC file. Aside from standard TP6-style OOP techniques, BTP uses collections to handle a list of filter and extractor specs for extended calls. That's as sexy as it gets. You don't even need to understand collections... just use them as illustrated in BTP.DOC, CRUNCH3.PAS and EXAMPLE2.PAS! BTP creates, maintains, and disposes of those collections for you. These collections and the provided object methods will transparently set buffer lengths for you, and construct your outgoing data buffers for extended calls. THE SETUP DRUDGERY FOR GET/STEP EXTENDED CALLS IS COMPLETELY REMOVED!! It is imperative that you read the sample programs and documentation. They are structured carefully to take you gradually from the simplest BTP structures to the more "advanced". The best news is that even the advanced structures are a piece of cake to deal with! The suggested order for reviewing the programs is: 1. VERSION: Quite simply, the shortest Btrieve program possible. Just displays a message revealing what Btrieve version is running. 2. STATS: Reports stats on any Btrieve file. Makes a single BTP style call, after which you can immediately read the object's data fields containing the file's stats. Is an effective replacement for 'BUTIL - STAT', and can be distributed with your applications freely. 3. CLONE: Rivals VERSION in being about the shortest Btrieve program possible, but is of GREAT use! Make one BTP style call, then execute just one BTP function to create a clone of the source file! 4. CREATE1: Example of creating a new file on the fly from within your application. Set the values in one BTP data type, and call one function! Included in this .ZIP file is a file named CREATE1.SPC. This is a standard description (spec) file that can be used to create the 'EXAMPLE' Btrieve file with Btrieve's own BUTIL program. CREATE1.SPC is provided only to demonstrate that the CreateFile function in the BTP product does generate files that are byte-for-byte the same as if you used 'BUTIL -create'. 5. CREATE2: Same as CREATE1, but creates the file to use an alternate collating sequence for ordering the keys. Piece of cake w/BTP! 6. CRUNCH1: Creates a duplicate of a file, effectively "squishing" the file to remove dead space. Opens source file in read-only mode, creates the target file and opens it in accelerated mode. Reads records one at time from source file, inserts them one at a time into target file. Uses non-extended calls exclusively. 7. CRUNCH2: Performs same functions as CRUNCH1, but uses extended inserts to populate target file. 8. CRUNCH3: Performs same functions as CRUNCH1, but uses step next extended and extended inserts. 9. EXAMPLE1:A simple program using BTP to insert records into a file of names. Provided only to illustrate use of BTP and several Btrieve calls. 10.EXAMPLE2:Another simple program using BTP with extended calls. Provided only to illustrate syntax of initializing filter and extractor specs for extended calls, and required function overrides. ADDITIONAL BTP FEATURES ======================= The BTP unit provides an initialization section that checks for presence of Btrieve in memory before running your main program. You need never code such a test yourself again. Just 'USES' this unit, and you're covered. The universal Btrv function call IS INCLUDED in the BTP unit. When using BTP, do NOT include the call from any other source. It is used internally by BTP, and is available directly in its 'native' form if needed, exactly as defined on the Btrieve distribution disks from Novell. Pascal's features have made it a pleasure to code this unit. The inherent capabilities of Pascal records, in all their forms, have greatly facilitated what at first seemed a VERY difficult task. The power and flexibility afforded by OOP's encapsulation and inheritance have reduced quick and dirty Btrieve programming to what it should be...quick (but not dirty!). Examine the unit's source code and the example programs carefully. You should find everything there you'll ever need. If it ain't there, let me know and we'll make 'er better! The DOTPC.BAT file is provided for your convenience. Assuming the command line compiler, TPC.EXE, and a properly configured TPC.CFG file are in your path, you can run DOTPC to compile BTP and all the example programs quickly. ENJOY! Constructive criticism and suggestions welcome.