Subject | Re: [firebird-support] [ibo] INSERT RETURING statement does not return any rows |
---|---|
Author | Helen Borrie (IBPhoenix Pacific) |
Post date | 2008-05-20T07:18:31Z |
At 04:30 PM 20/05/2008, you wrote:
2. Use IBO 4.8.x (the latest is 4.8.7). 4.6 doesn't support the new
features in Fb 2 and above
3. The RETURNING clause isn't going to return anything if your
insert is piggy-backed on a SELECT (the usual Delphi model). You'll
need to use a non-dataset component and call its Execute
method. Read the Fields[0] property of the statement after execution
to get the returned value.
4. Would also recommend using the proper full release of
Firebird. Bugs and regressions *do* show up and get fixed in the RC builds.
This really isn't a firebird-support question though. It's Delphi
and IBO and belongs in the IBO list.
./heLen
>When my application executes an INSERT RETURNING statement via1. Make sure your database is ODS 11.1
>TIB_Query, a 'synchronisation' error is raised, whereas according
>to Firebird documentation it should return a single row which is the
>inserted row.
>
>I am not sure if this is a Firebird problem or an IBO problem.
>
>
>Example:
>INSERT INTO PERSONAL_NAME (SURNAME, GIVENNAMES) VALUES ( 'Durkin',
>'Sean') returning PK_PERSONAL_NAME;
>
>will fail, even though this is valid SQL in a database where the
>following is defined. It should return the primary key of the newly
>inserted record.
>
>CREATE TABLE PERSONAL_NAME(
> PK_PERSONAL_NAME Integer NOT NULL,
> SURNAME Varchar(20) NOT NULL,
> GIVENNAMES Varchar(20)
> PRIMARY KEY (PK_PERSONAL_NAME)
>);
>CREATE GENERATOR GEN_PERSONAL_NAME_ID;
>SET TERM ^ ;
>CREATE TRIGGER PERSONAL_NAME_NEWID FOR PERSONAL_NAME ACTIVE
>BEFORE INSERT POSITION 0 AS
>BEGIN
>NEW.PK_PERSONAL_NAME = GEN_ID(GEN_PERSONAL_NAME_ID,1);
>END^
>SET TERM ; ^
>
>
>My environment is:
>* Delphi 2007 for win32
>* Database = Firebird 2.1 Release Candidate 2 (WI-V2.1.0.17755)
>* IBO component suite, version 4.6B
>
>
>How can I do an INSERT RETURNING statement? Please advise.
2. Use IBO 4.8.x (the latest is 4.8.7). 4.6 doesn't support the new
features in Fb 2 and above
3. The RETURNING clause isn't going to return anything if your
insert is piggy-backed on a SELECT (the usual Delphi model). You'll
need to use a non-dataset component and call its Execute
method. Read the Fields[0] property of the statement after execution
to get the returned value.
4. Would also recommend using the proper full release of
Firebird. Bugs and regressions *do* show up and get fixed in the RC builds.
This really isn't a firebird-support question though. It's Delphi
and IBO and belongs in the IBO list.
./heLen