Passing Variables to Execute Procedure

18 views
Skip to first unread message

Dalton Calford

unread,
Jul 2, 2024, 2:33:01 PM (11 hours ago) Jul 2
to firebird...@googlegroups.com
Hi everyone

Is there a way to pass variables to the AS section of the execute block ie use variables for user; password and role?

I have not been able to find any examples.

Does anyone know of examples or documentation that describes using variables for user/password/role?

best regards

Dalton

Dimitry Sibiryakov

unread,
Jul 2, 2024, 3:18:46 PM (10 hours ago) Jul 2
to firebird...@googlegroups.com
Dalton Calford wrote 02.07.2024 20:32:
> Is there a way to pass variables to the AS section of the execute block ie use variables for user; password and role?

> Does anyone know of examples or documentation that describes using variables for
> user/password/role?

Something like this or something completely different?

https://firebirdsql.org/file/documentation/chunk/en/refdocs/fblangref40/fblangref40-contextvars-current-user.html#fblangref40-contextvars-current-user

What is your goal and why you cannot use parameters?

https://firebirdsql.org/file/documentation/chunk/en/refdocs/fblangref40/fblangref40-dml-execblock.html#fblangref40-dml-execblock

--
WBR, SD.

Dalton Calford

unread,
Jul 2, 2024, 3:27:17 PM (10 hours ago) Jul 2
to firebird...@googlegroups.com
I use a number of execute statement blocks, but having the user name/password hardcoded in the stored procedures is both a maintenance and security nightmare.
having the ability to

for execute statement :remotesql on external :connection_statement as user :remote_user password :remote_password role :remote_role
into ..... do begin....

The remotesql and connection statement works, BUT the as block does not seem to support variables.

I am hoping that this is already implemented as it is key to using the execute statements for remote connections without having hard to maintain code.



--
You received this message because you are subscribed to the Google Groups "firebird-support" group.
To unsubscribe from this group and stop receiving emails from it, send an email to firebird-suppo...@googlegroups.com.
To view this discussion on the web, visit https://groups.google.com/d/msgid/firebird-support/74ab31a4-c89a-405e-87ab-2d1fb86ec091%40ibphoenix.com.

Dimitry Sibiryakov

unread,
Jul 2, 2024, 3:30:00 PM (10 hours ago) Jul 2
to firebird...@googlegroups.com
Dalton Calford wrote 02.07.2024 21:27:
> The remotesql and connection statement works, BUT the as block does not seem to
> support variables.

According to documentation it does: "Username. It can be a string,
CURRENT_USER or a string variable".

https://firebirdsql.org/file/documentation/chunk/en/refdocs/fblangref50/fblangref50-psql-coding.html#fblangref50-psql-execstmt

Show what you tried and what error you got.

--
WBR, SD.

Dalton Calford

unread,
Jul 2, 2024, 3:34:59 PM (10 hours ago) Jul 2
to firebird...@googlegroups.com
That is what I thought, and although it compiles, but fails when running, reporting the line/column of the first variable.

For example, this works

for execute statement :remote_sql
on external :connection_statement
as user 'sysdba' password 'masterkey' role 'agent'

But this does not

for execute statement :remote_sql on external :connection_statement

as user :remote_user password :remote_password role :remote_role

I was hoping to see some example code to see where I am going wrong.



--
You received this message because you are subscribed to the Google Groups "firebird-support" group.
To unsubscribe from this group and stop receiving emails from it, send an email to firebird-suppo...@googlegroups.com.

Dimitry Sibiryakov

unread,
Jul 2, 2024, 3:40:13 PM (10 hours ago) Jul 2
to firebird...@googlegroups.com
Dalton Calford wrote 02.07.2024 21:34:
>
> But this does not
>
> for execute statement :remote_sql on external :connection_statement
> as user :remote_user password :remote_password role :remote_role
>
> I was hoping to see some example code to see where I am going wrong.

What is whole error message?

--
WBR, SD.

Dalton Calford

unread,
Jul 2, 2024, 3:51:57 PM (9 hours ago) Jul 2
to firebird...@googlegroups.com
found it - hidden embedded character between linux/flamerobin within the string.

Thanks for the help Dimitry, I was thinking I was going nuts or missing something in the docs when it was an issue with copy/paste across platforms 

--
You received this message because you are subscribed to the Google Groups "firebird-support" group.
To unsubscribe from this group and stop receiving emails from it, send an email to firebird-suppo...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages