ZF2: FunctionIdentifier for SQL creation

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view

ZF2: FunctionIdentifier for SQL creation

This post has NOT been accepted by the mailing list yet.
Would be nice to introduce FunctionIdentifier which could kind of combines TableIndetifier and Expression.

Many customers use "SELECT * FROM schema.func($1, $2, ..)" approach where source of data is function/procedure call.

This has few benefits:
- Better encapsulation of DB code. Change your DB tables, reorganize and what-so-ever without need for PHP change.
- Better privilege management by allowing only execute privilege. You don't grant access on table level.
- Possible to work with DB in PHP: $this->DbRw->user->register($name, $email); which actually produces DB function call.

In postgres you do it like SELECT * FROM foo.bar(param1::int, param2::text);
In mysql you can do it in limited way also: CALL foo.bar(param1, param2);
Don't know about other database system.