MySQL Forums
Forum List  »  Stored Procedures

Re: Stored procedures utility library
Posted by: Roland Bouman
Date: November 21, 2005 08:32AM

COMMENT trouble:
http://bugs.mysql.com/bug.php?id=13823
and
http://bugs.mysql.com/bug.php?id=13934

No feature request (yet?) But then, how long should it a comment be?

I made myself a little utils database in which i store my stuff. This means I have to qualify my procedure calls, but I'm used to that. I'm used to working with oracle packages, so i am always calling a something.someproc(). It does not bother me anymore. In fact, if the names are well chosen, i feel it improves understandability of code.

Is there something against creating a separate database for a single set of related procedures? I guess It would simplify grants too. But yeah, you would get a lot of databases, all with no data, but only with procedures.

In addition to Giuseppes point, there's a slight problem writing procedures that are database independant. Suppose you're running a procedure, and you wnat to know the current database you'd just call....Yep, absolutely nothing at all. the built in functions DATABASE() and the synonym SCHEMA() always return the name of the database wherein the current procedure resides, NOT the current database of the session. (see http://bugs.mysql.com/bug.php?id=13584 and http://bugs.mysql.com/bug.php?id=14642)

On the other hand, I can live with very carefully specifying the database to which a call applies. Especially because you can use the SCHEMA() or DATABASE() function in the CALL on the command line, outside of the procedure:

mysql> call util.for_each(database(),'SELECT COUNT(*) FROM');

or someting like that.

BTW, any thoughts on the preferred method of installing stuff? The command line tool strips /* */ and -- comments out of procs (bad, bad bad)



Edited 1 time(s). Last edit at 11/21/2005 08:50AM by Roland Bouman.

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
2574
November 21, 2005 08:06AM
Re: Stored procedures utility library
2388
November 21, 2005 08:32AM
7691
November 23, 2005 11:24AM
2506
December 03, 2005 08:37AM
2411
November 28, 2005 02:26AM
2495
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.