Delphi Clinic C++Builder Gate Training & Consultancy Delphi Notes Weblog Dr.Bob's Webshop
Dr.Bob's Delphi Notes Dr.Bob's Delphi Clinics Dr.Bob's Delphi Courseware Manuals
 Dr.Bob Examines... #63
See Also: other Dr.Bob Examines columns or Delphi articles

This article was also published in the February 2005 issue of C++Builder Developer's Journal

Database Development with C++Builder
Most people may know me from my Delphi related articles, but apart from writing about Delphi (on Windows, Linux or .NET), I also use, support and write about C++Builder. In fact, I was co-author of the C++Builder Developer's Guide books, and I've written a few dozen articles for the C++Builder Developer's Journal over the years.
Last month, I proposed to Damon Chandler (editor of the C++Builder Developer's Journal) to start a new series covering database related technologies that are supported in C++Builder. Like many of our readers, I think this is an important topic, especially since some of the data access technologies currently available in C++Builder might be on the brink of being deprecated (like SQL Links) or frozen (like the BDE and ADO), and with the .NET Framework looming on the horizon.

Introduction
In this first article, I will only give a brief introduction, list all available data access technologies that are available in C++Builder.
As of next month, I'll follow up with one article per "technology", working with similar data, showing similar techniques (how to work with a single table, do master-details, queries, queries with parameters, use lookup tables, insert/add records, edit/post, and delete records, etc.), which databases can be used, and what it takes to deploy the resulting application.
The data access technologies that are present in C++Builder and will be covered in the following months, are the following:

This means that the series is currently scheduled to end in the summer of 2005, which might also be around the time that Microsoft releases the .NET Framework version 2.0, and Borland might start to provide some information about the upcoming new release of the Delphi IDE, which - as mentioned in the C++Builder Open Letter and chat - will not only host Delphi and C#, but also the C++Builder personality (supporting VCL).
But that's for the future. Right now, let's define the problem space - the data model if you wish - for the upcoming database articles. I wanted to cover something that was both fun, not to artificial, small enough to do in an article, and yet even a bit useful.

CD/DVD Data Model
The answer is: my CD/DVD collection database. It contains enough fields and tables to make it worthwhile, and is in fact a real-world application (for all my family members who want to borrow DVDs - and for me keeping track of who has borrowed what, and since when).
The first design of the CD/DVD collection database consists of four tables:

Note that the Borrow table and the CD / DVD table actually have a 1-on-1 relationship. But since the Borrow fields will only be used if the CD / DVD is actually borrowed, it makes sense to put this information in a separate table. As a downside: it'll take longer to determine if a CD / DVD is actually available (but that might be one of our observations later in the series).
Also note that in the proposed data model, the two description fields are optional for my examples, and will probably be expanded to several fields with interesting information (but totally irrelevant to the technologies I want to demonstrate).

Summary
In this article, I have introduced the data model for a series of articles in the C++Builder Developer's Journal on data access technologies found in C++Builder.

Epilogue: Borland Database Engine (BDE)
In the March 2005 issue, I've covered the Borland Database Engine, using Paradox files to implement the data model in four physical tables. The screenshot below shows the data module that I ended up with:

The data module contains three tables and two queries (with parameters, I must add). The article shows how to define lookup fields as well as calculated fields, and how to add parameter values to the queries.
The final result is a first GUI application using the Borland Database Engine to work with data from four tables (still almost empty in the screenshot below):

The full article can be read in the C++Builder Developer's Journal, just like the follow-up articles. I might also publish one or more of them on this website after a few months (like the ones using dbExpress or DataSnap).

In the meantime, I've filled the CD / DVD table with a few hundred DVDs. Just in time to move on to ADO and an ADO database (like SQL Server MSDE or Access) in April, followed by an issue in May where well examine the stand-alone TClientDataSet as alternative. In the June issue of the C++Builder Developer's Journal, Ill cover dbExpress- the cross-platform data access technologies that was branded as the replacement for SQL Links. And finally in July and perhaps also August well extend all this to the multi-tier world, adding DataSnap to the mix (which can use any of the previously covered data access technologies as basis).
If you have questions or feedback, feel free to use the C++Builder Developer's Journal Forum or contact me directly.
Hope to see you next time!


This webpage © 2005-2010 by Bob Swart (aka Dr.Bob - www.drbob42.com). All Rights Reserved.