TweetFollow Us on Twitter

dtF
Volume Number:10
Issue Number:9
Column Tag:Tools of the Trade

dtF

A royalty-free relational database management system

By Jeff Fisher, SalesKit Software Corp.

Note: Source code files accompanying article are located on MacTech CD-ROM or source code disks.

About the Author

Jeff Fisher - Jeff works at SalesKit Software Corp. While looking around for a good database to use with their application software, they ran across dtF. Skeptical at first, he checked it out. Now he’s uses it and loves it. Apparently he’s not alone in how he feels about it. His former partner liked it so much he became the US distributor for it (dtF Americas).

Finally there’s a royalty-free relational database management system for Macintosh C/C++ application developers. The performance may surprise you, yet the library is small and requires only a few hundred K of RAM at runtime. It features SQL, full transaction control, error recovery, client server architecture and is optimized for the Macintosh. The new product is call dtF and was developed in Germany. Like German automobiles, dtF is well built and efficient in every aspect. Unlike German automobiles, dtF does not cost an arm and a leg.

Performance

Many SQL database management systems are just an SQL interface plopped on top of an ISAM record access system. Such a system can’t deliver the performance of a system designed from the ground up. dtF is a true set-oriented SQL engine designed specifically for optimum performance on personal computer architectures.

The performance of dtF is unequaled in our tests. We have clients who want to access large databases (>22,000 records) from a standalone version of our software. With our old database engine, queries that took more than five minutes now take less than thirteen seconds with dtF! I always hate performance comparisons because they never compare aspects relevant to my projects. There is really no substitute for doing your own tests. We compared dtF’s data access speed with 4D, Oracle, Inside Out, and FoxPro 2.5. We found dtF to be over eight times faster on multi-table ordered queries (an aspect relevant to our project) than the nearest competitor.

Client/Server

dtF implements a client/server architecture. It does not use file sharing to support multi-user table access over the network. The dtF server processes queries and sends only results to the client. This ensures high performance, efficient use of the network bandwidth, and data security. File sharing approaches place high demands on a network and the onus of doing lock management, deadlock detection, and error recovery on the application developer.

One interesting aspect of dtF is how it divides labor between client and server. Many client server systems assume a “dumb” client. This traditional approach creates a bottleneck at the server - not only does the server perform client requests but each time a user scrolls a list window the client must ask the server to send down more data. This can create a lot of unwanted network traffic as well as bog the server down with intermittent requests for data. The dtF server passes results to the client so no network traffic is generated when accessing results. This approach is ideal for modern network environments and puts your existing equipment to good use. The precious power of the server is reserved for processing transactions and the client can get right to the job of displaying results.

Both single-user standalone and client-server versions of dtF use the same client-server model and interface.

Stand alone applications with dtF can be converted to multi user client/server applications by simply adding three library calls to your code. This helps dtF offer a practical standalone interface, perhaps the only one for a Macintosh SQL DBMS.

Transaction Control

dtF supports true transaction processing. This is the only way to ensure data integrity. Consider an order processing application that requires one transaction to add the order and five more transactions to add line items to another table. If there is a network failure on the third line item, it is essential to abort the entire transaction. In such a case dtF would simply rollback the transactions and return the database to a state which looks like they never took place.

The current Macintosh version of dtF server can handle 63 parallel concurrent transactions with automatic lock management, automatic deadlock detection, and error recovery. With an ISAM record access system, you have to explicitly lock records and indexes when performing updates and deletes. Lock management and deadlock avoidance can become very complex when you have multiple related tables. For example:


/* 1 */
// must lock both tables to avoid deadlock

act_locked = bogus_lock(accounts);
cnt_locked = bogus_lock(contacts);

if (!act_locked || !cnt_locked )
 return errorDeadLocked;

bogus_use(accounts); // use the accounts table
if (bogus_seek (theAccountID))//  find the desired record
{
 bogus_delete(); // delete the account record
 bogus_use(contacts);// use the contacts table
 bogus_settag(“act_id”);
 if (bogus_seek (theAccountID))  //  find the desired record
 {
 bogus_delete(); // delete the account record
 }
}
bogus_unlock(accounts);
bogus_unlock(contacts);

On the other hand, all lock management and deadlock detection is done by dtF. Client/server applications require no special multiuser considerations. You don’t have to write anything similar to the above code.

Security

All data within a dtF database is encrypted and compressed. Tables requiring 22MB in another database management system took less than 4MB in dtF. Data encryption ensures that data cannot be pilfered, even with disk editors. Access rights are granted at the table level. Read, update, insert, and delete privileges can be set at the table level. Administration rights (create and delete tables and indexes) are also granted at the table level.

Utilities

dtF comes with a database administration tool and browser (written with MacApp) call dtFQuery.

You can use dtFQuery to:

• Import data

• Export data

• Issue SQL statements.

• Create databases with your own creators and file types

• Repair corrupted database files.

Compatibility

dtF supports a large subset of ISO standard SQL, and it is optimized for performance and ease of use on the Macintosh. dtF libraries are included for the latest MPW C/C++ and Symantec environments. I use dtF with MacApp 3.0.1 and TCL and have included a sample MacApp application [available on this month’s source disk and the online services - Ed stb].

API

Both the multi user and stand alone versions of dtF have the same C interface. This allows you to develop applications with client server architecture that will perform great in single user, single platform situations. Converting a single user applications using dtF into a multi user application is easy. Add three function calls to select a dtF server and relink with the multiuser object library.

There are two interface levels called simply Level 1 and Level 2. This provides the developer with two possible levels of abstraction and encapsulation. The Level 2 interface is a high-level, easy-to-use interface. The Level 1 interface gives you raw access to dtF. We use the high-level interface for all of our testing and development and have found no need to access the low level interface so far.

In our MacApp 3.0.1 application, we call 15 different dtF functions. A fully functional application could use as few as three: select database (or server), logon, and execute. While this seems almost too simple, remember that all operations are encapsulated in the SQL you submit to the server.

All memory used by dtF is allocated at startup, so you won’t have to struggle with intermittent low-memory conditions caused by the DBMS. And because it has its own virtual memory and caching system, you will never have to preflight queries. The virtual memory and caching systems can be optimized by adjusting values in a resource.

dtF is ideal for use with MacApp because it will not interfere with MacApp memory allocation and segment management schemes. Other database management systems require you to jump through a few hoops to fit in with MacApp. dtF requires no explicit call to initialize or shutdown, and you don’t have to provide idle handlers to dtF.

Why SQL?

An SQL database management system like dtF offers the developer a single interface for data definition, data manipulation and data administration. ISAM (Indexed Sequential Access Method) architectures aren’t as convenient for getting at your data (selecting indexes, filtering unwanted records, etc ). With an SQL database management system, you describe the results you want with the SQL statement and the database engine does the rest.

As an example, suppose that you are developing a contact management system and you want a list of the contacts with last name equal to “Smith” grouped by account name. The code required to retrieve the desired result from dtF is shown below.


/* 2 */
char theSQL[255];

strcpy(theSQL, "select * from accounts,contacts where
 accounts.act_id = contact.act_id and 
 contacts.l_name = 'Smith' group by
 account.act_name order by contacts.zipcode");

dtF2exec(theSQL);

   // now access the results which are already sorted

All you have to do is submit a simple SQL statement and dtF does all the processing.

The same query with a typical ISAM record access system would look something like the following.


/* 3 */
bogus_use(accounts); // use the accounts table
bogus_settag(“act_name”);
actRecNum = bogus_recordcount();

for (act_index = 1; act_index <= actRecNum; ++act_index)
{
 bogus_fieldstring(“act_name”,accountName);
 bogus_fieldstring(“act_id”,accountID);

 bogus_use(contacts);
 bogus_settag(“l_name”);
 cntRecNum = bogus_recordcount();

 bogus_seek (“Smith”)
 do     // look for hits
 {
 bogus_fieldstring(“act_id”,cntAccountID);
 if (strcmp(cntAccountID,accountID) == 0) // if account ids match
 {
 // we finally found one
 }
 }while (bogus_skip(1));

 bogus_use(accounts);
 bogus_settag(“act_name”);
 bogus_skip(1);
}

Or even worse.


/* 4 */
bogus_act_ref = bogus_open(accounts);// use the accounts table
bogus_cnt_ref = bogus_open(contacts);// use the contacts table

bogus_setbuffer(bogus_act_ref ,&bogus_act_struct); 
 // <<hardcoded structs
bogus_setbuffer(bogus_cnt_ref ,&bogus_cnt_struct); 
 // <<hardcoded structs

bogus_setkey(bogus_act_ref ,”act_name”);
bogus_setkey(bogus_act_ref ,”l_name”);

while (bogus_posvalid(bogus_ref,&bogus_struct))
{
 bogus_cnt_hardcodestruct.act_id = bogus_act_struct.act_id;
 
 // use up a bunch of memory building a result set

 bogus_do_find(bogus_cnt_ref,&bogus_cnt_struct)
 tempSet = bogus_build_set(bogus_cnt_ref ,bogus_cnt_struct);
 bogus_set_read(bogus_cnt_ref ,tempSet );
 bogus_sort_set(tempSet );

 // intersect result set with previous result sets
 bogus_intersection(resultSet,tempSet);
 bogus_skip(bogus_cnt_ref ,1);
}
   // finally use the result set to access selected records

This seems like an extreme example, but I’ve used a database engine that even required me to check to see if the current record was marked as deleted before using the result.

Cursors

When you are going to deal with queries which will generate very large results, sometimes it’s better to let the server keep track of the results, and then use a set of “cursor” calls to navigate through the results without needing to bring them all into the client’s memory all at once. A cursor is a reference into the results, and it can be used to index through the results. Developers familiar with DAL, ODBC, Oracle call interface, Sybase DBLib or any other SQL C programming interface are probably already familiar with this concept.

For an example, consider the large database that MacTech Magazine uses to keep track of its subscribers. The subscription guy needs to notify individuals who’s subscriptions will run out soon to help prevent them from missing a single excellent MacTech issue. He needs a subset of the total subscribers and he may also want them ordered by zip code (so he can save some money on postage). A cursor is an efficient way of producing the ordered subset without building a table in the client’s memory.

In a graphical operating system like the Macintosh, you may want several cursors, one for each list view or one for each window. For example, in a contact management application, you have a list of all available contacts ordered by last name. In another window, you might have a list of contacts with whom you have an appointment, ordered by appointment date. There could be thousands of contacts (my boss has over 6000 in his contact manager) and the query results might just be too big to hold in memory. If every window has its own cursor, each window can display different result sets from the appointments table at the same time. This is supported by a dtF concept called workspaces. Each cursor is referenced by a unique workspace identifier.

dtF allows forward and backward cursor movement. Some client server systems will only move forward or require you to build a result buffer in memory to move backward. Bi-directional cursor movement can really simplify your application.

Support

After using several different DBMS systems, we have amassed many support horror stories and were very concerned about using a database developed in Germany. We decided go to Germany and get the story first hand. dtF was developed by the Theta Group and I was very pleased to find out that they are true Macintosh fanatics. We have been developing with dtF for almost six months and have been thrilled with the support we have received. While all support is currently provided by the Theta Group, plans are well underway to provide support in the United States through dtF Americas, the new US distributor of dtF.

Future of dtF

Currently in the works are a multi user version using TCP/IP rather than AppleTalk, further performance optimization, and cross-platform support. An AppleScript extension using dtF is already available from Graphical Business Interfaces and many other third parties tools and applications will be available in the US by the printing of this article.

Conclusion

dtF is a relational database management system created by Macintosh developers for Macintosh developers. Efficient. Fast. SQL. Compact. Safe. We have examined all of the options and have chosen dtF and now you know why.

Pricing information: dtF Evaluation $129, dtF Macintosh SDK $695, dtf LAN Macintosh SDK $1595, dtf Server $1295.

For more information, contact dtF Americas, Inc. at 14720 Plumas Drive, Chesterfield, MO 63017. (800) DTF-1790 voice, (314) 530-1697 fax, AppleLink DTF.AMERICA.

 

Community Search:
MacTech Search:

Software Updates via MacUpdate

Ableton Live 11.3.11 - Record music usin...
Ableton Live lets you create and record music on your Mac. Use digital instruments, pre-recorded sounds, and sampled loops to arrange, produce, and perform your music like never before. Ableton Live... Read more
Affinity Photo 2.2.0 - Digital editing f...
Affinity Photo - redefines the boundaries for professional photo editing software for the Mac. With a meticulous focus on workflow it offers sophisticated tools for enhancing, editing and retouching... Read more
SpamSieve 3.0 - Robust spam filter for m...
SpamSieve is a robust spam filter for major email clients that uses powerful Bayesian spam filtering. SpamSieve understands what your spam looks like in order to block it all, but also learns what... Read more
WhatsApp 2.2338.12 - Desktop client for...
WhatsApp is the desktop client for WhatsApp Messenger, a cross-platform mobile messaging app which allows you to exchange messages without having to pay for SMS. WhatsApp Messenger is available for... Read more
Fantastical 3.8.2 - Create calendar even...
Fantastical is the Mac calendar you'll actually enjoy using. Creating an event with Fantastical is quick, easy, and fun: Open Fantastical with a single click or keystroke Type in your event details... Read more
iShowU Instant 1.4.14 - Full-featured sc...
iShowU Instant gives you real-time screen recording like you've never seen before! It is the fastest, most feature-filled real-time screen capture tool from shinywhitebox yet. All of the features you... Read more
Geekbench 6.2.0 - Measure processor and...
Geekbench provides a comprehensive set of benchmarks engineered to quickly and accurately measure processor and memory performance. Designed to make benchmarks easy to run and easy to understand,... Read more
Quicken 7.2.3 - Complete personal financ...
Quicken makes managing your money easier than ever. Whether paying bills, upgrading from Windows, enjoying more reliable downloads, or getting expert product help, Quicken's new and improved features... Read more
EtreCheckPro 6.8.2 - For troubleshooting...
EtreCheck is an app that displays the important details of your system configuration and allow you to copy that information to the Clipboard. It is meant to be used with Apple Support Communities to... Read more
iMazing 2.17.7 - Complete iOS device man...
iMazing is the world’s favourite iOS device manager for Mac and PC. Millions of users every year leverage its powerful capabilities to make the most of their personal or business iPhone and iPad.... Read more

Latest Forum Discussions

See All

Motorsport legends NASCAR announce an up...
NASCAR often gets a bad reputation outside of America, but there is a certain charm to it with its close side-by-side action and its focus on pure speed, but it never managed to really massively break out internationally. Now, there's a chance... | Read more »
Skullgirls Mobile Version 6.0 Update Rel...
I’ve been covering Marie’s upcoming release from Hidden Variable in Skullgirls Mobile (Free) for a while now across the announcement, gameplay | Read more »
Amanita Design Is Hosting a 20th Anniver...
Amanita Design is celebrating its 20th anniversary (wow I’m old!) with a massive discount across its catalogue on iOS, Android, and Steam for two weeks. The announcement mentions up to 85% off on the games, and it looks like the mobile games that... | Read more »
SwitchArcade Round-Up: ‘Operation Wolf R...
Hello gentle readers, and welcome to the SwitchArcade Round-Up for September 21st, 2023. I got back from the Tokyo Game Show at 8 PM, got to the office here at 9:30 PM, and it is presently 11:30 PM. I’ve done what I can today, and I hope you enjoy... | Read more »
Massive “Dark Rebirth” Update Launches f...
It’s been a couple of months since we last checked in on Diablo Immortal and in that time the game has been doing what it’s been doing since its release in June of last year: Bringing out new seasons with new content and features. | Read more »
‘Samba De Amigo Party-To-Go’ Apple Arcad...
SEGA recently released Samba de Amigo: Party-To-Go () on Apple Arcade and Samba de Amigo: Party Central on Nintendo Switch worldwide as the first new entries in the series in ages. | Read more »
The “Clan of the Eagle” DLC Now Availabl...
Following the last paid DLC and free updates for the game, Playdigious just released a new DLC pack for Northgard ($5.99) on mobile. Today’s new DLC is the “Clan of the Eagle" pack that is available on both iOS and Android for $2.99. | Read more »
Let fly the birds of war as a new Clan d...
Name the most Norse bird you can think of, then give it a twist because Playdigious is introducing not the Raven clan, mostly because they already exist, but the Clan of the Eagle in Northgard’s latest DLC. If you find gathering resources a... | Read more »
Out Now: ‘Ghost Detective’, ‘Thunder Ray...
Each and every day new mobile games are hitting the App Store, and so each week we put together a big old list of all the best new releases of the past seven days. Back in the day the App Store would showcase the same games for a week, and then... | Read more »
Urban Open-World RPG ‘Project Mugen’ Fro...
Last month, NetEase Games revealed a new free to play open world RPG tentatively titled Project Mugen for mobile, PC, and consoles. I’ve liked the setting and aesthetic since its first trailer, and today’s new video has the Game Designer and... | Read more »

Price Scanner via MacPrices.net

Apple AirPods 2 with USB-C now in stock and o...
Amazon has Apple’s 2023 AirPods Pro with USB-C now in stock and on sale for $199.99 including free shipping. Their price is $50 off MSRP, and it’s currently the lowest price available for new AirPods... Read more
New low prices: Apple’s 15″ M2 MacBook Airs w...
Amazon has 15″ MacBook Airs with M2 CPUs and 512GB of storage in stock and on sale for $1249 shipped. That’s $250 off Apple’s MSRP, and it’s the lowest price available for these M2-powered MacBook... Read more
New low price: Clearance 16″ Apple MacBook Pr...
B&H Photo has clearance 16″ M1 Max MacBook Pros, 10-core CPU/32-core GPU/1TB SSD/Space Gray or Silver, in stock today for $2399 including free 1-2 day delivery to most US addresses. Their price... Read more
Switch to Red Pocket Mobile and get a new iPh...
Red Pocket Mobile has new Apple iPhone 15 and 15 Pro models on sale for $300 off MSRP when you switch and open up a new line of service. Red Pocket Mobile is a nationwide service using all the major... Read more
Apple continues to offer a $350 discount on 2...
Apple has Studio Display models available in their Certified Refurbished store for up to $350 off MSRP. Each display comes with Apple’s one-year warranty, with new glass and a case, and ships free.... Read more
Apple’s 16-inch MacBook Pros with M2 Pro CPUs...
Amazon is offering a $250 discount on new Apple 16-inch M2 Pro MacBook Pros for a limited time. Their prices are currently the lowest available for these models from any Apple retailer: – 16″ MacBook... Read more
Closeout Sale: Apple Watch Ultra with Green A...
Adorama haș the Apple Watch Ultra with a Green Alpine Loop on clearance sale for $699 including free shipping. Their price is $100 off original MSRP, and it’s the lowest price we’ve seen for an Apple... Read more
Use this promo code at Verizon to take $150 o...
Verizon is offering a $150 discount on cellular-capable Apple Watch Series 9 and Ultra 2 models for a limited time. Use code WATCH150 at checkout to take advantage of this offer. The fine print: “Up... Read more
New low price: Apple’s 10th generation iPads...
B&H Photo has the 10th generation 64GB WiFi iPad (Blue and Silver colors) in stock and on sale for $379 for a limited time. B&H’s price is $70 off Apple’s MSRP, and it’s the lowest price... Read more
14″ M1 Pro MacBook Pros still available at Ap...
Apple continues to stock Certified Refurbished standard-configuration 14″ MacBook Pros with M1 Pro CPUs for as much as $570 off original MSRP, with models available starting at $1539. Each model... Read more

Jobs Board

Omnichannel Associate - *Apple* Blossom Mal...
Omnichannel Associate - Apple Blossom Mall Location:Winchester, VA, United States (https://jobs.jcp.com/jobs/location/191170/winchester-va-united-states) - Apple Read more
Cashier - *Apple* Blossom Mall - JCPenney (...
Cashier - Apple Blossom Mall Location:Winchester, VA, United States (https://jobs.jcp.com/jobs/location/191170/winchester-va-united-states) - Apple Blossom Mall Read more
Operations Associate - *Apple* Blossom Mall...
Operations Associate - Apple Blossom Mall Location:Winchester, VA, United States (https://jobs.jcp.com/jobs/location/191170/winchester-va-united-states) - Apple Read more
Retail Key Holder- *Apple* Blossom Mall - Ba...
Retail Key Holder- APPLE BLOSSOM MALL Brand: Bath & Body Works Location: Winchester, VA, US Location Type: On-site Job ID: 03YM1 Job Area: Store: Sales and Support Read more
Omnichannel Associate - *Apple* Blossom Mal...
Omnichannel Associate - Apple Blossom Mall Location:Winchester, VA, United States (https://jobs.jcp.com/jobs/location/191170/winchester-va-united-states) - Apple Read more
All contents are Copyright 1984-2011 by Xplain Corporation. All rights reserved. Theme designed by Icreon.