MySQL Forums
Forum List  »  Stored Procedures

Re: Stored procedures utility library
Posted by: Giuseppe Maxia
Date: November 21, 2005 08:06AM

There is one more thing that we should take into account when talking about general purpose stored routines, i.e. to which database such routines should be linked.
Unfortunately, in MySQL SP language, each routine belongs to a database, and although you can invoke a routine with the db_name.routine_name syntax, each action performed by the routine itself is intended for the default database, unless the programmer is very careful to specify database name and table name for each operation.
For instance, if I have a for_each stored procedure that will execute one query for each table, I would like to use it from any database. To do so, I need to store the routine in a free-for-all database, and invoke it from the database where I want it to work, taking great care at qualifying my intended command with db name and table names.
Alternatively, I can store the routine in each database I am using, and this is a sort of inconvenience when I need to update
the routine, for I need to update it everywhere.
I had a chat about this limitation with some MySQL developers in Frankfurt, during the open source database conference early this month, but nobody sees this situation improving anytime soon.
This is more food for thought. General purpose routines are not to be attached to a single database, so this problem is quite real for almost every routine in my collection as of today.

ciao
Giuseppe

Options: ReplyQuote


Subject
Views
Written By
Posted
5607
November 21, 2005 03:41AM
2648
November 21, 2005 04:39AM
2401
November 21, 2005 05:13AM
2520
November 21, 2005 08:00AM
2664
November 21, 2005 06:53AM
Re: Stored procedures utility library
2574
November 21, 2005 08:06AM
2389
November 21, 2005 08:32AM
7691
November 23, 2005 11:24AM
2506
December 03, 2005 08:37AM
2411
November 28, 2005 02:26AM
2496
November 29, 2005 04:28AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.