Monday, October 27, 2008

2 days I'll never get back

Through sheer happenstance, one of the test databases for our new system was (mis)configured in such a way that an Oracle sequence was generating very large ID's for a certain field.

Very large as in 123,456,789,236

Guess which horrible application uses a 'long' type to hold those IDs? Guess which horrible application is supported on both HP-UX and Windows? Guess what type might be 32bit on Windows and 64bit on HP-UX? Ding! Ding! Ding!

Spent all day Friday and today rejiggering the code to use 'long long'. Most of today was spent un-rejiggering and re-rejiggering the code to work around Oracle Pro*C's inability to use 'long long' as a host variable -- today I had to swap all that out of the embedded SQL in order to use character strings and stroll/sprintf to move values from the strings to 'long long' and vice-versa.

I had thought the code was 'OK' on HP-UX... after all these recent changes, I'm not so sure. The code to transfer the values from the query results to their 'long' variable instances seems wrong. In any case... it'll work the same on both platforms now.

I take some solace from finding the problem before any customer. We have at least 3 customers nearing 1-billion bills -- although the horrible app is 10+ years old, the rate they're adding bills to their systems grows every year. They can also start/change their sequences whenever they feel like it. So, maybe we had another 1-5 years before it became a major emergency.