1. Technology
Send to a Friend via Email
RTL Reference|Glossary|Tips/Tricks|FREE App/VCL|Best'O'Net|Books|Link Back

Table Scanner

Introduction...
Well, we have all been working with Paradox/DBbase tables. One of the things that really annoy me while developing database application are those famous "VAL file out of date" errors. The other problem is distributing an application that has more than one version; I think of structure updates to tables (adding, modifying or renaming fields). After a few sleepless nights, I started to wonder wouldn't it be fabulous to have some tool, that could create db, mb, px, val, x??, y??, dbf, mdx, dbt on the fly. If that software could also fix corrupted tables, and even pack them then I'll be "saved". Naturally web was the first place to start looking...
If you have ever experienced same problems, I got the software for you. The one that is really a great relief.

What's this all about...
Table Scanner is a Object Pascal source code generator. It is designed to add table maintenance routines to your Delphi (1/2/3/4) application. Following features are easily imported to any Delphi database application:

  • First time the application is run non-existent tables are automatically created.
  • Non-existent indexes, validations checks or referential integrities constraints are also automatically crated.
  • Tables are checked for errors every time the application is run and any damaged indexes, validations checks or referential integrities constraints are automatically fixed.
  • Any modifications to table names, field layout, indexes, validations checks or referential integrities constraints are automatically applied to tables on disk the first time the modifications are detected.

Two most important files in Table Scanner software package are: Scanner.exe (the source code generator) and TblScn.dll (core table handling routines for Delphi projects used to create, check, pack and restructure tables).

Make my day or Just One Line of Code...
With the use of Borland Database Engine (BDE), Table Scanner and its companion DLL, we can really enhance our database applications.
There are two main steps when working with Table Scanner. First, you have to build your source code with Scanner.exe, second put just one line of code in your project. Working with code generator is incredibly easy. Pick tables that need to be distributed with your application, push a single button, save generated code, and you are ready to move on.

Scanner

Generated code (pas unit) contains one public procedure that can be called directly through your application.
Not to forget, you have to put source code unit, usually MakeDB.pas, to the Uses clause of the project main form. Now, everything we have to write down is (in the main form OnCreate event):

TForm1.FormCreate(Sender: TObject);
begin
CheckTables([true/false]);
end;

We are now ready to distribute our application.
Files that always have to be distributed:
1. The application executable file;
2. Borland Database Engine (BDE);
3. TblScn.dll.
Files that never have to be distributed: auxiliary files (px, val, x??, y??, mdx)
Files that may have to be distributed: data files (db, mb, dbf, dbt).

What can't we do...
There are some restrictions to TableScanner. One of the most important that I miss: corrupted Data files (*.db and *.mb) cannot be fixed by TblScn.dll at run-time. But this is maybe too much to ask. Some other restrictions are (mostly) linked to BDE limitations.

Finally...
Table Scanner 3.0 is a shareware program, and is worth every cent you give for it (US$39). You can contact the author for any additional information about this product.

Some more database related tools:

All graphics in this feature created by Zarko Gajic.

More Delphi
· Learn another routine every day - RTL Quick Reference.
· Download free source code applications and components.
· Talk about Delphi Programming, real time.
· Link to the Delphi Programming site from your Web pages.
· Tutorials, articles, tech. tips by date: 2001|2000|1999|1998 or by TOPIC.
· NEXT ARTICLE: BACK me UP!.
Review of TBackupFile, a small backup and restore component for Delphi.
Stay informed with all new and interesting things about Delphi (for free).
Subscribe to the Newsletter
Name
Email

Got some code to share? Got a question? Need some help?

©2014 About.com. All rights reserved.