FairCom's c-tree Plus
Price: $895; additional same site programmer licenses may be purchased for 40% off retail price.
Reviewer: Nick Xidis
Industrial strength cross-platform btree file management.
c-tree Plus is a professional developer's package. It has a complex set of features and can produce commercial grade multi-user applications. It will work on almost every platform with a C compiler and applications written on one platform can quickly and easily be ported to others. It can even work around most of the platforms' native file handling weaknesses. If you aren't a professional programmer odds are that you may have never heard of FairCom or c-tree Plus. The manual says:
c-tree Plus is a sophisticated file management product designed to be used in a variety of operating system environments. Written in the C language it is designed to be integrated with your C application program to provide easy to use, yet flexible data file manipulation and indexing.
Wow, what a mouthful! Let's cover the basics first. For those of us who don't eat and sleep C programming, a simple, and therefore good, way to think of c-tree Plus is as a library of C functions that manage data files and indices similar to the way Borland's dBase worked on old DOS platforms. You'll see later that this is professional development package with a lot more to offer than DOS dBase, but bear with me.
In the simplest application, like a business's database of customers, a single data file can be accessed through multiple binary tree (btree) index files. Each time your application accesses the data through a different index, your data looks like another data file sorted by the index you are using. You may create one index on the customer's name and another on the customer's account number. Looking though the customer name index the data appears to be sorted by customer name. Use the account number index and through the magic of btree indexing the same data appears to be a new data file sorted by account number.
Let's run through an outline of how a simple application is built. c-tree Plus offers a full suite of Indexed Sequential Access Method (ISAM) functions that can perform multiple file and index operations in a single ISAM function call. The low-level c-tree Plus functions are also available if you really need to have complete control, but the author and FairCom recommend that you stick with the ISAM functions. In order to be fully compatible across a wide variety of platforms, c-tree Plus uses it own data types. For example, an “int” may be a two-byte integer on one system and a four byte integer another. With c-tree Plus you use COUNT, which is always a two-byte signed integer.
C-tree also provides a pointer to its custom types in the form of pCOUNT, which is the equivalent to COUNT *. One of the most important custom data types is the IFIL, which defines the parameters for an ISAM file instances. You can declare your data structure in your sources or use separate parameter files. I like using the structures in my sources because when you open and close files individually with ISAM parameter files it's all or nothing.
The IFIL structure is pretty straightforward—it contains a pointer to the file name, a file number, the data record length and pointer to an IIDX index file structure. Next you'll declare the parameters for the index keys within the data records for each instance of the data using an IIDX structure containing a key length, key type and flags if duplicate keys or null keys are allowed, and a pointer to the index file name. The ability to have duplicate keys is an important feature of the c-tree package. When you use duplicate keys, the c-tree system actually pads each to make it unique. Your application doesn't have to deal with any of it—it's all taken care of for you.
The last structure is an ISEG which tells c-tree where to find the key values in data records via a segment length and offset. That's it! Just three basic structures and your data schema is laid out. The functions to work with the file structure are well thought out and very intuitive. CreateFile, OpenFile, AddRecord, GetRecord and DeleteRecord all do exactly what you'd expect.
Now a few words about modes. There are four c-tree modes, two single-user and two multi-user. The features vary between each but the base functionality is the same. The simplest, single-user mode, gives you get all the features except file security. The other mode adds Online Transaction Processing (OLTP). C-tree's OLTP suite is awesome; you can roll back transactions, use all kinds of save points, and enjoy wonderful logging and easy recovery. In the author's biased opinion, OLTP is really a must for mission-critical business applications—this package does it right.
Now for the multi-user modes, where the horsepower of this package really shines. First is the non-client/server mode. It uses the traditional methods for file and record locking to which Unix programmers are accustomed. Using Linux's NFS capabilities you could use this mode to create a client/server application, but you'll give up OLTP and a lot of c-tree's file buffering. We compiled some simple applications and found that this mode quickly slowed as you added users. For small businesses where OLTP would not unduly hold things up, using NFS and multi-user mode may be a very cost-effective solution for shared data applicants.
Now for the crown jewel of the c-tree suite: client/server mode. The package includes one FairCom server binary for the platform you specify (Linux, OS/2, Netware, DOS, NT, etc.); this is the only portion of the package for which source code is not available. I was surprised to find there are servers for just about every platform—yes, even lowly DOS can run the FairCom server and handle record locking and file security.
On multi-tasking platforms such as Linux, the server runs in the background and is very well-behaved. When you use client/server mode you get the full set of OLTP, file security, and file and record locks. The FairCom server seems to be fast, but I don't have the facilities to really load it up. Your applications communicate with the server via TCP/IP sockets, shared memory or message queues. I ran it using TCP/IP over Ethernet and PPP dial-up and found the performance to be very good. Another neat trick is that in client/server mode you're able to transparently access the local disk with or without OLTP at the same time. For the most part, you can change modes by recompiling your applications with the right c-tree libraries for that mode. This is very cool, since you can go from a single-user OLTP application to a client/server application by recompiling with a different c-tree library.
Special Reports: DevOps
Have projects in development that need help? Have a great development operation in place that can ALWAYS be better? Regardless of where you are in your DevOps process, Linux Journal can help!
With deep focus on Collaborative Development, Continuous Testing and Release & Deployment, we offer here the DEFINITIVE DevOps for Dummies, a mobile Application Development Primer, advice & help from the experts, plus a host of other books, videos, podcasts and more. All free with a quick, one-time registration. Start browsing now...
- The Ubuntu Conspiracy
- A First Look at IBM's New Linux Servers
- Disney's Linux Light Bulbs (Not a "Luxo Jr." Reboot)
- Vigilante Malware
- System Status as SMS Text Messages
- Libreboot on an X60, Part I: the Setup
- Bluetooth Hacks
- Vagrant Simplified
- Linux and the Internet of Things
- Dealing with Boundary Issues