IBM i > TRENDS > OPEN SOURCE

Two New Open-Source Database Tools

A quick look at CGI_WRKDBF and Xataface



 

Xataface

As we’ve noted before, one of the great strengths of the PHP language is its capability to simply build highly flexible applications. This results in several tools and frameworks that can be used to build end-user CRUD (Create, Read, Update, Delete) applications very simply. The latest one we’ve been reviewing is Xataface. We’re impressed with how little you must do to get a simple CRUD application up and running.

Unlike ATK, Xataface is primarily configuration driven. Rather than write PHP code to set up the application, you make entries in configuration files. For more complex extensions, you must write code but, as we’ll demonstrate, you can do an incredible amount without writing one line of PHP code.

The base configuration file is conf.ini, which controls, among other things, what databases are used by the application and how to sign on to the database. Here’s the basic configuration file for our example:

[_database]
host = "localhost"
user = "Jon"
password = "password"
name = "database"
[_tables]
product=Product Details
category=Product Categories

The [_database] entries are pretty self-explanatory. The [_tables] entries identify the actual tables to be used (in this case, product and category) and give them a different name for display purposes (“Product Details” and “Product Category”). Other than the conf.ini file, the only other file we need is the basic PHP startup script (index.php) that’s supplied with the package. This is a slightly edited version (we removed the code that displays the response time for the page):

<?php
/**
* File: index.php

* To use the application simply point your browser to this file
*/
require_once 'xataface/dataface-public-api.php'; 
// include the code containing the APIs
df_init(__FILE__, 'xataface');
// initialize the application and identify root directory for API
$app =& Dataface_Application::getInstance();
// get an application instance
$app->display();
// And display the application - that's it - all done!
?>

 

Jon Paris is a technical editor with IBM Systems Magazine and co-owner of Partner400.

Susan Gantner is a technical editor with IBM Systems Magazine and co-owner of Partner400.


comments powered by Disqus

Advertisement

Advertisement

2019 Solutions Edition

A Comprehensive Online Buyer's Guide to Solutions, Services and Education.

A PHP Partnership

Zend and IBM team up to deliver open-source solutions to IBM i

Making the Net More Inclusive

IBM hopes to help disabled and illiterate users surf the Web

IBM Systems Magazine Subscribe Box Read Now Link Subscribe Now Link iPad App Google Play Store
IBMi News Sign Up Today! Past News Letters