| Home | About FairCom | Products | Support | Sales | Contact Info | Site Map | Download | Newsletter |

Company Overview
History
Our Customers
Success Stories
Contact Information
Why FairCom
FairCom Logos
Press Releases
Customer Quotes
Site Map
Read the Dr. Dobb's Journal article on cross-platform database Programming
Read HP WORLD's article on the c-tree Server
Read the Linux Journal review on c-tree Plus
FairCom Brochure
 
 

An ISAM Challenge with C# Ease

c-tree Plus offers multiple APIs for developing the optimal solution for your application needs. For the best performance, many developers make direct calls into their data files through our ISAM API with the standard 'C' language. The c-tree Plus for .NET API provides the same high performance ISAM record based c-tree technology as programming with our ISAM API. However, c-tree Plus for .NET technology handles the intricacies of IFIL and DODA management, freeing you to focus on simple and efficient application design. Put this power to work for your more demanding ISAM programming challenges.

Consider the case of adding an index to an existing data file. To further complicate this situation, try adding and removing fields of an existing data file. This can be a tricky challenge when using direct ISAM calls. In some cases, nearly impossible without completely repopulating an entire table of data.

Complex ISAM Challenge

With the c-tree Plus ISAM API, you define your table and index relationships in the IFIL structure and then add a DODA resource for the schema information.

ISAM Code Example 1

Now the tricky part! How do you remove and/or add a field? How about adding an index? The trick is to modify the internal IFIL and DODA resources, write them back into the file, and then rebuild the indexes. Of course, you need exclusive access to the file to perform these activities.

Note: Adding or changing fields directly from the ISAM API, in general, will only work in the variable length portion of your record. In the code demonstrated below, we do not modify fields in the fixed length portion of the record. Doing so would require us to create a new table, and consequently, copy over all of the records with a transformation of each record!

In the following example, we will add an index to the file with two segments, cm_custnumb, and cm_custname. We will also change the string field cm_custratg to an integer field cm_status. Here is the pseudocode outlining the basic steps required.

ISAM Code Example 2

*Whew* That's a lot of details to keep track of. In addition, this may not always work, due to the nature of the fixed length portion of the record.

Elegant C# Solution

c-tree Plus for .NET makes this easy. The following C# code segment demonstrates how simple the above challenge can become using the Alter Table function.

C# Code Example

That's it! The c-treeDB Alter Table function inspects all of the changes to the table and index relationships, determines what, if any, changes are to be made, and takes care of all the messy details behind the scenes. All with the speed and performance of c-tree Plus!

Not only does c-tree Plus for .NET make these routine programming tasks easy, it seamlessly integrates into the Visual Studio environment. Start typing a few characters of your table name for instance, and Microsoft's IntelliSense brings up a list of matching objects. Pres the "." and the complete list of properties and methods available for this entity is displayed. The complete c-tree Plus environment at your fingertips!

c-tree Plus for .NET still makes it easy to start your application as a simple standalone process, and later, quickly grow into a full client/server enterprise solution. Simply relink your application with the c-tree Plus client library and change a couple lines of code to access the full power of the c-tree Server.

Mix-n-Match APIs!

It is quite possible to extend the elegant c-tree Plus for .NET solution to existing ISAM tables. Given that the table has the appropriate IFIL and DODA resources, simply use a c-tree Plus for .NET Session type of SESSION_TYPE.CTREE_SESSION. You can then work with existing c-tree data files (tables) easily applying the c-tree Plus for .NET API for table modifications. c-tree Plus allows this seamless integration!

Related Articles

Review these previous FairCom eNewsletter articles about the c-tree Plus for .NET interface for other tips and reference.

Build your c-tree Plus for .NET Assembly

Save Time Locating the c-tree Plus for .NET Assembly Reference

.NET Unlicensed dll Errors


 
We have found FairCom to be very responsive and accommodating to our development and deployment needs. The product has always performed well and the FairCom group has always released high quality product. But the best thing is that our customers have told us that they love it, they simply install the server and forget about it.

George J. Gatsis
Executive Director, Development Products,
Follett Software Company

 
WEB COMMENTS
Copyright 2007 FairCom Corporation. All rights reserved.