Chapter 19. Using RefDB in your programs

Table of Contents

General thoughts
Interfaces
Call the C clients from your program
Directly talk to refdbd
Tips and tricks
Paging output

General thoughts

RefDB provides command-line clients to access the application server refdbd. This makes it easy to automate tasks through shell scripts or Makefiles. RefDB uses both possibilities for its own purposes. The prime example for a shell script is runbib, which transform your XML documents by invoking, among others, the RefDB bibliography client. Makefiles are more appropriate in other contexts. The Makefile created by refdbnd is just one example.

However, if you want more than that, you'll want to access refdbd from your own programs. Need RefDB support for your favourite editor? It is doable, as you can see from the RefDB integration in Emacs and in Vim. Want to access RefDB through the web? There is a PHP implementation of a web front-end in the RefDB sources with plenty of room for improvements, and there is also a SRU interface. Want to have a pointy-clicky frontend so you'll no longer have to envy the Mac and Windoze users of EndNote? Well, this is a challenge that no one has tried yet. Before you fire up your favourite IDE and start coding, please consider the following:

Do not even think about fiddling with the SQL database! Most languages offer a simple way to access SQL databases, and the database engines often provide client libraries for a variety of languages. However, RefDB is more than just a thin layer on top of a SQL database. RefDB normalizes data. RefDB takes data apart and reassembles them when needed. RefDB takes care of character encoding conversions. Even worse, the SQL table schemas may change from one RefDB version to the next. Therefore you should never attempt to access RefDB data from your own programs on the SQL level. Instead, you should rely on the interfaces that RefDB offers.