View Single Post
  #6   (View Single Post)  
Old 11th September 2008
TerryP's Avatar
TerryP TerryP is offline
Arp Constable
 
Join Date: May 2008
Location: USofA
Posts: 1,547
Default

ADOdb looks interesting, but I don't think it's quite what I'm looking for.

Odds are, I'll probably need to play around a bit myself. Another thing I've added to my priority list, is iterators. I personally don't like explicit iterators in languages like C++/Java but in this case, I think it might be worth while. What I'm thinking is something more like this:

Code:
require_once 'ourlibname/dbl.php';
require_once 'functions.php';

$dbl = init_sas_dbl($dbi);  // return the db layer object or explode, 
                            // so I don't have to check it every file.

echo table_start("header message");

try {
    $data = $dbl->query("select statement");

    while($data->hasNext()) {
       do something to $data->next() in some shape or form
    }
} catch (SASSQLException $e) {
    // deal with problem -- empty row, accessing null values, etc
}

echo table_end();
At least, that's probably what it would look like at first, if I had to implement it. I think PHP5 has an interface that can be used to allow foreach'ing over an object, so I'll need to look it up.


It might not be a great way to do it, but it can't be any worse then what I've already got to stare at...




@Carpetsmoker, I agree lol.


The first time I was asked to work on a module, I came back with comments about bleeding eyes. I like PHP has a language, but on sasclan.org most of it looks like that, or worse... There are still bits of HTML out there, that I still can't find in HTML 2,3,4.01 references! The most eye-appeasing code around consists of PHP, SQL, HTML, and JavaScript by the tangle and without end in such style as the above, dating back to 2005 or worse.

Maintaining consists of two people, me (vim/sftp) and my friend (DreamWeaver), and I'm the only one generally fluent in (X)HTML. I did create a small utility class to handle the HTML output, hoping that using it would improve legibility but I'm the only one who uses it. If I ever meet the original author of most of our custom modules, he'll probably loose a few teeth.
__________________
My Journal

Thou shalt check the array bounds of all strings (indeed, all arrays), for surely where thou typest ``foo'' someone someday shall type ``supercalifragilisticexpialidocious''.
Reply With Quote