I wrote my last post about enabling booleans in Firebird after several hours of poking around in database code trying to get my query to execute without errors. Once it worked, everything seemed great. But I missed an important step: I hadn’t tried to write anything back to the database yet.
Posts tagged ‘RTTI Surgery’
Firebird is a great database, but it’s got one really irritating drawback: no native support for the boolean type. The standard solution to this issue is to create a BOOLEAN domain as a special restricted version of a smallint, and then make your database driver output the correct type.
The first part is easy. The second, not so much, if you want to use DBExpress. This really should be handled internally as a special case inside the DBX driver. Unfortunately neither Embarcadero nor Chau Chee Yang, maker of the alternative dbExpress Firebird driver, has released the source to their drivers, neither driver handles the BOOLEAN domain, and neither driver has any sort of callback/event handler that you can set up to intercept and modify the schema of a query result. But I’m not gonna let a little thing like that stop me! Continue reading ‘Adding boolean support to Firebird+DBX’ »
A lot of the UI design for the TURBU editor is based on data-aware controls bound to client datasets. I was trying to build a new form this morning that required me to filter one of the datasets. Problem is, that would break other things that expected it not to be filtered. Well, that’s not such a big problem, because TClientDataset has an awesome method called CloneCursor that lets you set up a second client dataset that shares the first one’s data store, but with independent view settings. So I used a cloned dataset, and immediately got an exception when I tried to run. The control I was using couldn’t find the field.
I’ll admit, I don’t like the default settings for Delphi 2010’s extended RTTI. Making almost everything included by default ends up compiling a ton of junk into the EXE, most of which will never get used. But every once in a while, you can find some sort of use for it.