Subject Re: [Firebird-Architect] Exec. statement parameters
Author Helen Borrie
At 12:40 AM 15/12/2007, Nando Dessena wrote:
>>> It's not consistent semantically. SET does assignment, whereas what
>>> you are after is binding.
>A> Could you describe what exactly is "bind" and how different it is from
>A> "set"?
>"Set" assigns a value to a column. "Bind" binds a value to a name. Here's
>what I mean: This is an assignment:
>update table set column = 2
>This is a binding:
>select 3 as somename from table
>A> AFAIU, "bind" means something, as an OUT parameter, where value assigned
>A> to the parameter is assigned back to the caller variable.
>No, I don't mean this. I mean "to bind" as "to attach", "to tie", "to

[ ... ]

> But the root cause
>is, IMHO, that assignment is not the correct paradigm here. Binding
>Hope I have made my point clear.

Yes, you have, and I also think it is important to separate binding from assignment. Confusing the two is a common source of silly mistakes by application programmers. Also, Adriano seems to have overlooked the fact that " := " is Pascal's assignment operator.

What's wrong with using an SQL-ish syntax like

BINDING (param1 TO expression_or_constant [, param2 TO expression_or_constant [, ...]])


1. it's a new keyword (so no confusion from overloading) and it's one that does not have to be reserved in any place except PSQL

2. It clearly self-describes its function

3. Furthermore, it can be implemented in existing driver layers without breaking existing parser logic for interpreting operators.

And, when/if we ever do get a fully-operational Boolean, something like the following is obvious: