IBM i > TRENDS > OPEN SOURCE

Two New Open-Source Database Tools

A quick look at CGI_WRKDBF and Xataface



 

Notice the entry for the category column. It specifies that the type of the column is “select” (i.e., a selection list will be presented when we attempt to add a new record or update one). How is the content of that list populated? That’s the function of the entries in the vocabulary file (valuelists.ini). By saying “vocabulary=category” we inform Xataface that in the valuelists.ini file in the products directory is a definition identified as “category” that will specify the contents of the pull-down. This could be a simple list of values and names, or an SQL statement that retrieves the data we need. For our purposes, the file contains:

[category]
__sql__ = “select id, name from category order by name”

This simple SQL select will be used to populate the category pull-down from the entries in the category table. Figure 2 shows the results of these simple configuration file entries in the edit screen. Note the additional instructions for the field contents as well as the nicer field titles, etc. These improved headings will also appear as column headings in the main list.

Without writing a single line of PHP, we can create quite a powerful mini-application. We could do many other things, such as change the logo on the page, set the field width, add validation to the entry fields, group fields together for display purposes and much more. If we have date columns in the table, we can designate them as such in the fields.ini file and a calendar will automatically be incorporated into the add and edit pages.

We should mention that Xataface, like most PHP applications, uses the MySQL database. To modify it to use DB2 instead would be a major undertaking, but luckily we don’t have to do that! The advent of the DB2 Storage Engine for MySQL means that we can expose our DB2 tables as MySQL tables and use Xataface with them. We’re working with the folks at the YiPs Web site to set up a live demonstration site for Xataface running on IBM i. Once that’s available, we’ll mention it in our weekly blog. In the meantime, we’ve produced a brief video to show you this mini-application in action.

 

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