Using Clojure In Place of SQL

For the past week, I’ve been writing more complicated than usual water reports using Informix 4GL. Our meter configuration subsystem application is written primarily in 4GL, and its database is Informix SE (standard engine). Informix SE is a reliable fast ISAM database, but lacks support for some of the more sophisticated SQL statements that can be written with more modern RDBMS systems.

Most of the reports I was writing needed to follow generated billing data that does not contain configuration information, but the segmenting for the reports required the configuration information related to the water account, but not contained with the bill. In other words, getting the data was like traveling on a back road in Maine. You can’t get there from here.

While writing the software, I thought, Clojure could take all this data, if it were “unloaded” into csv format, and significantly reduce these problems to something a lot simpler. Eliminate the SQL; lazily map the data in Clojure, and then manufacture all the combinations needed. This could also be done in SQL by creating temporary tables by providing the necessary information contained in multiple tables, but it would still have taken time to assemble the data. To me, it seemed it might have been simpler to implement these reports in Clojure and might have been faster.

I wonder if thinking this way is a trip to Crazy Land, or if I can see logic combinations in Clojure easier than in SQL. I will not know on this trip out, because I structured my 4GL programs to look likeĀ  C code I wrote when I was first starting out, over twenty-five years ago. Alternatively, if I had used one of the Clojure SQL libraries, like korma, I could not have gotten around SE’s SQL limitations.

Well, I’ll have to think about it again, for the next time.