You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In my setup (below), I create the database, table and trigger. I also verified that they are working by assigning a new value to FooBar inside the trigger.
When listening for the event on the FirebirdSql.Data.FirebirdClient side, nothing happens.
What am I doing wrong?
/* Here is the Script I used for creating the Database */
CREATE DATABASE 'C:\data\demo.fdb' page_size 8192
user 'SYSDBA' password 'masterkey';
CONNECT "C:\data\demo.fdb"
user 'SYSDBA' password 'masterkey';
create table demo (id int primary key, foobar varchar(20) character set utf8);
insert into demo values (6, 'FooBar');
set term !! ;
CREATE TRIGGER NEW_DEMO_RECORD_TRIGGER FOR demo
ACTIVE before insert
AS BEGIN
IF (inserting) THEN
BEGIN
new.foobar = 'NewFoobar';
POST_EVENT 'NEWFOOBARD_POSTEVENT';
END
END!!
set term ; !!
insert into demo values (7, 'FooBar');
select * from demo;
insert into demo values (8, 'FooBar');
/* Results */
Use CONNECT or CREATE DATABASE to specify a database
SQL> CREATE DATABASE 'C:\data\demo.fdb' page_size 8192
CON> user 'SYSDBA' password 'masterkey';
SQL> CONNECT "C:\data\demo.fdb"
CON> user 'SYSDBA' password 'masterkey';
Commit current transaction (y/n)?y
Committing.
Database: "C:\data\demo.fdb", User: SYSDBA
SQL> create table demo (id int primary key, foobar varchar(20) character set utf8);
SQL> insert into demo values (6, 'FooBar');
SQL> commit;
SQL>
SQL> set term !! ;
SQL> CREATE TRIGGER NEW_DEMO_RECORD_TRIGGER FOR demo
CON> ACTIVE before insert
CON> AS BEGIN
CON> IF (inserting) THEN
CON> BEGIN
CON> new.foobar = 'NewFoobar';
CON> POST_EVENT 'NEWFOOBARD_POSTEVENT';
CON> END
CON> END!!
SQL> set term ; !!
SQL> insert into demo values (7, 'FooBar');
SQL> select * from demo;
info: Microsoft.EntityFrameworkCore.Infrastructure[10403]
Entity Framework Core 2.1.2-rtm-30932 initialized 'MyContext' using provider 'EntityFrameworkCore.FirebirdSql' with options: None
info: Microsoft.EntityFrameworkCore.Database.Command[20101]
Executed DbCommand (6ms) [Parameters=[], CommandType='Text', CommandTimeout='30']
SELECT "d"."ID", "d"."FOOBAR"
FROM "DEMO" "d"
678
C:\Users\chris\source\repos\FireBirdConsoleExample\FireBirdConsoleExample\bin\Debug\netcoreapp3.1\FireBirdConsoleExample.exe (process 27392) exited with code 0.
To automatically close the console when debugging stops, enable Tools->Options->Debugging->Automatically close the console when debugging stops.
Press any key to close this window . . .
The text was updated successfully, but these errors were encountered:
Gerdus is right. You need to call `QueueEvents`. And also in your code, after the `ReadLine` in `FirebirdEventListener`, you dispose the object and hence listening will stop.
I tried it with and without QueueEvents and didn't have any luck. What i was missing was to call 'commit' in the isql.exe console after the query. like this: "insert into demo values (10, 'FooBar'); commit;"
Submitted by: kickinespresso (kickinespresso)
annot Receive POST_EVENT Data from FirebirdSql.Data.FirebirdClient Events
Windows 10, FireBird 2.5, .NET Core 3.1
Using the code from the example here: https://github.com/FirebirdSQL/NETProvider/blob/ccb602aa4eb373267423c37bc176ff04fba1d099/Provider/docs/events.md
I am not able to receive POST_EVENT from FireBird.
I was able to use the FirebirdSql.EntityFrameworkCore.Firebird DB Content just fine. Docs here: https://github.com/FirebirdSQL/NETProvider/blob/master/Provider/docs/entity-framework-core.md
Here is my sample Code: https://github.com/cdesch/FireBirdConsoleExample
In my setup (below), I create the database, table and trigger. I also verified that they are working by assigning a new value to FooBar inside the trigger.
When listening for the event on the FirebirdSql.Data.FirebirdClient side, nothing happens.
What am I doing wrong?
/* Here is the Script I used for creating the Database */
CREATE DATABASE 'C:\data\demo.fdb' page_size 8192
user 'SYSDBA' password 'masterkey';
CONNECT "C:\data\demo.fdb"
user 'SYSDBA' password 'masterkey';
create table demo (id int primary key, foobar varchar(20) character set utf8);
insert into demo values (6, 'FooBar');
set term !! ;
CREATE TRIGGER NEW_DEMO_RECORD_TRIGGER FOR demo
ACTIVE before insert
AS BEGIN
IF (inserting) THEN
BEGIN
new.foobar = 'NewFoobar';
POST_EVENT 'NEWFOOBARD_POSTEVENT';
END
END!!
set term ; !!
insert into demo values (7, 'FooBar');
select * from demo;
insert into demo values (8, 'FooBar');
/* Results */
Use CONNECT or CREATE DATABASE to specify a database
SQL> CREATE DATABASE 'C:\data\demo.fdb' page_size 8192
CON> user 'SYSDBA' password 'masterkey';
SQL> CONNECT "C:\data\demo.fdb"
CON> user 'SYSDBA' password 'masterkey';
Commit current transaction (y/n)?y
Committing.
Database: "C:\data\demo.fdb", User: SYSDBA
SQL> create table demo (id int primary key, foobar varchar(20) character set utf8);
SQL> insert into demo values (6, 'FooBar');
SQL> commit;
SQL>
SQL> set term !! ;
SQL> CREATE TRIGGER NEW_DEMO_RECORD_TRIGGER FOR demo
CON> ACTIVE before insert
CON> AS BEGIN
CON> IF (inserting) THEN
CON> BEGIN
CON> new.foobar = 'NewFoobar';
CON> POST_EVENT 'NEWFOOBARD_POSTEVENT';
CON> END
CON> END!!
SQL> set term ; !!
SQL> insert into demo values (7, 'FooBar');
SQL> select * from demo;
============ ===============================================================================
6 FooBar
7 NewFoobar
SQL> insert into demo values (8, 'FooBar');
SQL> commit;
SQL> select * from demo;
============ ===============================================================================
6 FooBar
7 NewFoobar
8 NewFoobar
SQL>
/* Output of the console */
Hello World!
Listening...
info: Microsoft.EntityFrameworkCore.Infrastructure[10403]
Entity Framework Core 2.1.2-rtm-30932 initialized 'MyContext' using provider 'EntityFrameworkCore.FirebirdSql' with options: None
info: Microsoft.EntityFrameworkCore.Database.Command[20101]
Executed DbCommand (6ms) [Parameters=[], CommandType='Text', CommandTimeout='30']
SELECT "d"."ID", "d"."FOOBAR"
FROM "DEMO" "d"
678
C:\Users\chris\source\repos\FireBirdConsoleExample\FireBirdConsoleExample\bin\Debug\netcoreapp3.1\FireBirdConsoleExample.exe (process 27392) exited with code 0.
To automatically close the console when debugging stops, enable Tools->Options->Debugging->Automatically close the console when debugging stops.
Press any key to close this window . . .
The text was updated successfully, but these errors were encountered: