Subject Bug report
Author masonwheeler
I just ran into a strange bug in IBO. It goes like this:

First, create a table:

SET TERM ^ ;

execute block as begin
IF (NOT EXISTS(
SELECT RDB$RELATION_NAME
FROM RDB$RELATIONS
WHERE RDB$SYSTEM_FLAG=0
AND RDB$RELATION_NAME = 'CLIENT_SCRIPTS')) THEN
begin
execute statement 'CREATE SEQUENCE GEN_CLIENT_SCRIPT_ID;'
with autonomous transaction;

execute statement 'ALTER SEQUENCE GEN_CLIENT_SCRIPT_ID RESTART WITH 0;'
with autonomous transaction;

execute statement
'CREATE TABLE CLIENT_SCRIPTS (
ID INTEGER NOT NULL,
SCRIPT_TEXT BLOB SUB_TYPE TEXT CHARACTER SET UTF8 NOT NULL,
/* Keys */
PRIMARY KEY (ID)
);'
with autonomous transaction;
end
end^

RECREATE TRIGGER CLIENT_SCRIPT_BI FOR CLIENT_SCRIPTS
ACTIVE BEFORE INSERT POSITION 0 AS
BEGIN
NEW.ID = GEN_ID(GEN_CLIENT_SCRIPT_ID,1);
END^

SET TERM ; ^

Then, create a TIBOQuery, and feed it the following script:

insert into CLIENT_SCRIPTS (SCRIPT_TEXT) values (:script) returning ID

Provide any arbitrary text to fill in the :script parameter, then open the dataset. You'll get back a valid ID value, indicating that the insert ran properly. However, if you query the database, the SCRIPT_TEXT field will be blank.

This is on IBO 5.0.2, under Delphi XE, using the embedded version of FBClient 2.5.1.

Anyone have any idea what's going on here, and how I could work around it?