Debugging Boolean Expressions of Fielded Buffers
I described the SIGFPE
bomb of Boolean Expressions before. Going through the list of the C functions I was reminded of the Fboolpr32
function that prints the expression tree as it was parsed. Ten minutes later I had added it to the Python Tuxedo library. So let us look at the SIGFPE
bomb again:
>>> import tuxedo as t
>>> t.Fboolev32({"TA_STATUS": "OK123"}, "TA_STATUS %! 'OK.*'")
Floating-point exception
Now we can investigate and verify how it was parsed by Oracle Tuxedo:
>>> t.Fboolpr32("TA_STATUS %! 'OK.*'", sys.stdout)
( ( TA_STATUS[0] ) % ( ! ( 'OK.*' ) ) )
Indeed, it is interpreted as the %
modulo operation and !
negation. And here is what the developer intended to write:
>>> t.Fboolpr32("TA_STATUS !% 'OK.*'", sys.stdout)
( ( TA_STATUS[0] ) !% ( 'OK.*' ) )
P.S. I have even implemented the Fboolpr32
function for my Open Source replacement of Oracle Tuxedo