You can achieve the same with functions. Here's an example for a method
representing a function in PostgresV3:
ExampleSchemaMirror >> add: a and: b
<pg3Function: 'add'
arguments: #('a' integer 'b' integer)
returns: #integer
volatility: #volatile>
begin
return a + b;
end;
And here's how you call that function:
ExampleSchemaMirror default add: 3 and: 4. "==> 7"
Levente
On Sat, 10 Jan 2015, David Carlos Manuelda wrote:
Well, I want to point a thing to be considered regarding prepared
statements.
It is not only about security/performance, using them also helps to have
your code cleaner and read it better.
* No need to use ' character for text elements inside SQL query
Avoid the mess that: execute: 'INSERT INTO table VALUES (''', aUser
id, ''', ''', Auser otherField, ''');'
Confusing and hard to read '
Instead, with prepared is something like 'INSERT INTO table
VALUES ($1,$2)'
* No need to filter data ( even more readable code )
* Ability to name the SQL so you can use it later by name ( for comodity
)
Just take this in consideration if it is going to be evaluated for
implementation :)