To get the behaviour I wanted, I added the following code to the AfterConnect even of the PgConnection
PgConnectionSOP.ExecSQL( 'SET app.current_tenant = ' + QuotedStr(tenant_id));
Search found 7 matches
- Tue 02 Feb 2021 11:20
- Forum: PostgreSQL Data Access Components
- Topic: Can you set a session variable with a query parameter?
- Replies: 7
- Views: 13140
- Mon 01 Feb 2021 12:47
- Forum: PostgreSQL Data Access Components
- Topic: PgConnectDialog in FMX project importing PgDacVcl
- Replies: 1
- Views: 16348
PgConnectDialog in FMX project importing PgDacVcl
I have a project that we have been using for a while, recently while making some changes I can no longer use the PgConnectDialog component
Delphi is switching PgDacFmx for PgDacVcl and refusing to compile
The only way I can solve it is by removing the PgConnectDialog component
Strange!
Delphi is switching PgDacFmx for PgDacVcl and refusing to compile
The only way I can solve it is by removing the PgConnectDialog component
Strange!
- Mon 18 Jan 2021 17:16
- Forum: PostgreSQL Data Access Components
- Topic: Can you set a session variable with a query parameter?
- Replies: 7
- Views: 13140
Re: Can you set a session variable with a query parameter?
So that all queries in the session run with app.tenet_id set to the connection value!
- Mon 18 Jan 2021 17:03
- Forum: PostgreSQL Data Access Components
- Topic: Can you set a session variable with a query parameter?
- Replies: 7
- Views: 13140
Re: Can you set a session variable with a query parameter?
Can I set a session variable when I connect?
Thanks
Thanks
- Fri 28 Aug 2020 16:13
- Forum: PostgreSQL Data Access Components
- Topic: Can you set a session variable with a query parameter?
- Replies: 7
- Views: 13140
Re: Can you set a session variable with a query parameter?
Thank you, that works
- Tue 25 Aug 2020 15:00
- Forum: PostgreSQL Data Access Components
- Topic: Can you set a session variable with a query parameter?
- Replies: 7
- Views: 13140
Can you set a session variable with a query parameter?
The following code works fine:
However, with :tid, I get Syntax Error at or near $1
Code: Select all
SET app.current_tenant='8f8266ba-efdb-4fe3-ad16-fc4a295fe8a7';
SELECT * FROM tenant_user;
Code: Select all
SET app.current_tenant=:tid;
SELECT * FROM tenant_user;
- Tue 02 May 2017 09:37
- Forum: PostgreSQL Data Access Components
- Topic: CRBatchMove fails with '' not valid floating point
- Replies: 1
- Views: 4405
CRBatchMove fails with '' not valid floating point
I use CRBatchMove successfully in one part of my project, but in another place with similar (small tables) I get an error unless I set AbortOnError to False. The data looks ok, with this fix ... but it's strange that if works fine With AbortOnError set to True in another part of the project with very similar tables
I'm using Delphi XE7
Thanks
I'm using Delphi XE7
Thanks