Extreme Aggravation

VSarkiss on 2003-10-23T15:37:09

To test potential speedups at my current client, I'm writing a couple of huge queries as DB2 embedded SQL-C programs, and the level of tedium is incredible.

For those who have never written this type of program, here's a brief summary: you need to declare a variable of the correct type for each result column and declare an indicator variable for each column that can be null (these are global, the pre-compiler can't keep track of what routine it's in). Then, in the actual fetch, you need to list the variables and indicators, paired, for each column being retrieved. When you have 128 columns in your result set, this gets extremely tedious.

But wait, there's more! I want to print out the row. But C printf insists on knowing whether the variable is an integer or a float or a string. So again I have to match up types carefully. My first attempt yesterday kept dumping core -- go figure.

MAN, do I miss being able to use Perl. I'd give anything to be able to use DBI and just say print join(" ", @$row). Against this backdrop, the discussions I've had about the ups and downs of Class::DBI seem like they were on another planet.


Generate?

clscott on 2003-10-23T16:54:04

Aren't you using perl to generate all of the really tedious bits?

Re:Generate?

VSarkiss on 2003-10-23T19:17:17

Well, the test was a success, so yes, I'll be writing one very soon. ;-)

I forgot to add that for all that work, what you get in return is a blazingly fast app....

Embed

jdavidb on 2003-10-23T19:05:03

Embed a Perl interpreter in your application. :)

I also like that code generation suggestion.