Home arrow Practices arrow Page 5 - Database Independent Development in C

Extending libdbi - Practices

The libdbi library provides a feature for C programmers that has long been missing. The interface is clean and the framework for adding new drivers is relatively straightforward.

TABLE OF CONTENTS:
  1. Database Independent Development in C
  2. Making the Connection
  3. Getting Results
  4. An Example
  5. Extending libdbi
By: Clay Dowling
Rating: starstarstarstarstar / 12
September 27, 2004

print this article
SEARCH DEV SHED

TOOLS YOU CAN USE

advertisement

The mechanism for adding a new driver is very straight forward. In addition to the detailed guide, the full source code of the other drivers is present, which gives you a good chance to see how others have done it before.

There are a couple of obvious candidates for inclusion. The FreeTDS library would be good for adding Microsoft SQL Server and Sybase support. The Firebird and Interbase client libraries are also good candidates. With these added to your tool kit there won't be much that can stand in the way.

Unfortunately there really isn't room for a full example of a driver port in this article. They're rather long bits of code.

Conclusions

The libdbi library provides a feature for C programmers that has long been missing. Writing one program that can make use of multiple databases used to mean either using ODBC, with its inherent complications, or tying yourself to bulky technology like ADO or the Borland Database Engine. None of these solutions was a good answer for UNIX programmers, especially UNIX programmers deploying CGI programs on a hosted server.

The libdbi interface is clean, and the list of supported databases, although small, covers most of the needs of open source developers. The relatively straightforward framework for adding new drivers means that it's not an unreasonable task to add support for databases that aren't already included, provided client libraries and headers are available.

I'll definitely be using libdbi in future products, both for CGI and desktop applications. If the library shows up well in production, I hope to make it one of my most frequently used tools.



 
 
>>> More Practices Articles          >>> More By Clay Dowling
 

blog comments powered by Disqus
escort Bursa Bursa escort Antalya eskort
   

PRACTICES ARTICLES

- Calculating Development Project Costs
- More Techniques for Finding Things
- Finding Things
- Finishing the System`s Outlines
- The System in So Many Words
- Basic Data Types and Calculations
- What`s the Address? Pointers
- Design with ArgoUML
- Pragmatic Guidelines: Diagrams That Work
- Five-Step UML: OOAD for Short Attention Span...
- Five-Step UML: OOAD for Short Attention Span...
- Introducing UML: Object-Oriented Analysis an...
- Class and Object Diagrams
- Class Relationships
- Classes

Developer Shed Affiliates

 


Dev Shed Tutorial Topics: