Thread: php as stored procedures
I was reading http://www.linuxworld.com.au/article.php3?aid=123&tid=8 and specifically "Later in 2001 this flexibility may extend even within the MySQL database server, with PHP scripts used as stored procedures within MySQL database" I won't hold my breath for that to happen in 2001 knowing MYsql's many promised future features but it got me wondering Since there is pl/perl is it all remotely possible that a pl/php could be implemented ?
mwaples@waples.net writes: > I was reading > http://www.linuxworld.com.au/article.php3?aid=123&tid=8 > and specifically > "Later in 2001 this flexibility may extend even within the MySQL > database server, with PHP scripts used as stored procedures within MySQL > database" > I won't hold my breath for that to happen in 2001 knowing MYsql's many > promised future features but it got me wondering > > Since there is pl/perl is it all remotely possible that a pl/php could > be implemented ? Well, in software, you can do pretty much anything with enough hacking, so it's definitely possible. As for whether it will be done, well, what does PHP give you over Perl? I know Perl well and PHP AFAICS is a tiny subset of Perl designed to be embedded in web pages. Given PL/Perl, do we really need PL/PHP? If someone (you?) think's it's important it'll probably get written. -Doug
> Well, in software, you can do pretty much anything with enough > hacking, so it's definitely possible. > > As for whether it will be done, well, what does PHP give you over > Perl? I know Perl well and PHP AFAICS is a tiny subset of Perl > designed to be embedded in web pages. Given PL/Perl, do we really > need PL/PHP? > > If someone (you?) think's it's important it'll probably get written. > > -Doug what would the over all benifit be to using stored procedures instead of just going about php normaly? would that not put a bit of stress on the db server as well? Mike
Doug McNaught wrote: > > mwaples@waples.net writes: > > > I was reading > > http://www.linuxworld.com.au/article.php3?aid=123&tid=8 > > and specifically > > "Later in 2001 this flexibility may extend even within the MySQL > > database server, with PHP scripts used as stored procedures within MySQL > > database" > > I won't hold my breath for that to happen in 2001 knowing MYsql's many > > promised future features but it got me wondering > > > > Since there is pl/perl is it all remotely possible that a pl/php could > > be implemented ? > > Well, in software, you can do pretty much anything with enough > hacking, so it's definitely possible. > > As for whether it will be done, well, what does PHP give you over > Perl? I know Perl well and PHP AFAICS is a tiny subset of Perl > designed to be embedded in web pages. Given PL/Perl, do we really > need PL/PHP? > > If someone (you?) think's it's important it'll probably get written. > > -Doug PHP probably gives not a lot over perl except for its ease of learning - I know php reasonably well but have been too lazy to learn perl as yet. PHP can be used for stuff like shell scripting - which I use it for quite a bit. It's just that its got a very big and growing user base(plus tons of crappy php scripts) to go with it. It's more of a wish than anything and would make postgresql a bit more attractive to php users. I know a lot of people probably think php isn't for real programmers and this would be a waste of time - but look at the boost MYsql got from every man and his dog using php/mysql on web sites. If I could help to do it I would but its way beyond my skills.
I remember a year ago when I was looking at open source DBs, MySQL was supposed to be getting php script support inside the database. As for having a pl/PHP, I do not believe it is a dire need. If it would make someone's life easier, fine, I don't see why it couldn't be coded and added... I just don't see it as something the steering committee should/would use their time on. It should be a project that is done on the outside and submitted in. The way I see it (as for adding languages to postgres) is a lot like what Microsoft does for their scripting language. You set up basic core functionality that supports the most users (WSH, VBScript, and Jscript) and then have it so that other developers can make add-ons to support other languages. As an example, you can get a python and/or perl engine that will run over the Windows Scripting Host. Perl script on Windows isn't something overly important for MS to support, but the functionality was there to allow someone that did see a need for it to be able to develop add-ons for it. I'd say something along the lines of pl/ languages work the same way. The major ones are supported, if someone wants to add more, more power to them. Adam Lang Systems Engineer Rutgers Casualty Insurance Company http://www.rutgersinsurance.com ----- Original Message ----- From: "Doug McNaught" <doug@wireboard.com> To: <pgsql-general@postgresql.org> Sent: Wednesday, January 31, 2001 12:15 PM Subject: Re: [GENERAL] php as stored procedures > mwaples@waples.net writes: > > > I was reading > > http://www.linuxworld.com.au/article.php3?aid=123&tid=8 > > and specifically > > "Later in 2001 this flexibility may extend even within the MySQL > > database server, with PHP scripts used as stored procedures within MySQL > > database" > > I won't hold my breath for that to happen in 2001 knowing MYsql's many > > promised future features but it got me wondering > > > > Since there is pl/perl is it all remotely possible that a pl/php could > > be implemented ? > > Well, in software, you can do pretty much anything with enough > hacking, so it's definitely possible. > > As for whether it will be done, well, what does PHP give you over > Perl? I know Perl well and PHP AFAICS is a tiny subset of Perl > designed to be embedded in web pages. Given PL/Perl, do we really > need PL/PHP? > > If someone (you?) think's it's important it'll probably get written. > > -Doug
Stored procedures put LESS strain on a database. When you send a query to postgres via PHP, postgres runs the query. If you have a stored procedure on postgres and have PHP use that to execute the query, you get better performance since stored procedures are (should be) precompiled. In both situations the db server does the work. Adam Lang Systems Engineer Rutgers Casualty Insurance Company http://www.rutgersinsurance.com ----- Original Message ----- From: "Mike Sears" <matrix@quadrent.net> To: <pgsql-general@postgresql.org>; "Doug McNaught" <doug@wireboard.com> Sent: Wednesday, January 31, 2001 12:43 PM Subject: [GENERAL] Re: php as stored procedures > what would the over all benifit be to using stored procedures instead of > just going about php normaly? > > would that not put a bit of stress on the db server as well? > > Mike
> what would the over all benifit be to using stored procedures instead of > just going about php normaly? If it were used as a stored procedure, it could be used to enforce database integrity within the database, particularly when used with triggers. > would that not put a bit of stress on the db server as well? Doesn't any stored procedure? Greg
PHP is nice, but it's designed for a very specific purpose -- to write web based applications quickly. Having it in a DB is a little silly if you ask me.. Pl/pgsql is nice for smaller functions, C is great for everything else and of course, if you're a Perl monk, use it! :-) Pl/PHP is possible (simply because anything is possible) but I doubt you'll see any of the core developers doing anything of the sort though.. However, I'm sure they'd encourage anyone to write anything they wanted so go for it! Pl/Ruby - there is an idea *grin* -Mitch ----- Original Message ----- From: "Adam Lang" <aalang@rutgersinsurance.com> To: <pgsql-general@postgresql.org> Sent: Wednesday, January 31, 2001 1:43 PM Subject: Re: php as stored procedures > I remember a year ago when I was looking at open source DBs, MySQL was > supposed to be getting php script support inside the database. > > As for having a pl/PHP, I do not believe it is a dire need. If it would > make someone's life easier, fine, I don't see why it couldn't be coded and > added... I just don't see it as something the steering committee > should/would use their time on. It should be a project that is done on the > outside and submitted in. > > The way I see it (as for adding languages to postgres) is a lot like what > Microsoft does for their scripting language. You set up basic core > functionality that supports the most users (WSH, VBScript, and Jscript) and > then have it so that other developers can make add-ons to support other > languages. As an example, you can get a python and/or perl engine that will > run over the Windows Scripting Host. Perl script on Windows isn't something > overly important for MS to support, but the functionality was there to allow > someone that did see a need for it to be able to develop add-ons for it. > I'd say something along the lines of pl/ languages work the same way. The > major ones are supported, if someone wants to add more, more power to them. > > Adam Lang > Systems Engineer > Rutgers Casualty Insurance Company > http://www.rutgersinsurance.com > ----- Original Message ----- > From: "Doug McNaught" <doug@wireboard.com> > To: <pgsql-general@postgresql.org> > Sent: Wednesday, January 31, 2001 12:15 PM > Subject: Re: [GENERAL] php as stored procedures > > > > mwaples@waples.net writes: > > > > > I was reading > > > http://www.linuxworld.com.au/article.php3?aid=123&tid=8 > > > and specifically > > > "Later in 2001 this flexibility may extend even within the MySQL > > > database server, with PHP scripts used as stored procedures within MySQL > > > database" > > > I won't hold my breath for that to happen in 2001 knowing MYsql's many > > > promised future features but it got me wondering > > > > > > Since there is pl/perl is it all remotely possible that a pl/php could > > > be implemented ? > > > > Well, in software, you can do pretty much anything with enough > > hacking, so it's definitely possible. > > > > As for whether it will be done, well, what does PHP give you over > > Perl? I know Perl well and PHP AFAICS is a tiny subset of Perl > > designed to be embedded in web pages. Given PL/Perl, do we really > > need PL/PHP? > > > > If someone (you?) think's it's important it'll probably get written. > > > > -Doug > >
postgres support for pl/VB? :) Adam Lang Systems Engineer Rutgers Casualty Insurance Company http://www.rutgersinsurance.com ----- Original Message ----- From: "Mitch Vincent" <mitch@venux.net> To: <pgsql-general@postgresql.org> Sent: Wednesday, January 31, 2001 1:54 PM Subject: [GENERAL] Re: php as stored procedures > PHP is nice, but it's designed for a very specific purpose -- to write web > based applications quickly. Having it in a DB is a little silly if you ask > me.. Pl/pgsql is nice for smaller functions, C is great for everything else > and of course, if you're a Perl monk, use it! :-) > > Pl/PHP is possible (simply because anything is possible) but I doubt you'll > see any of the core developers doing anything of the sort though.. However, > I'm sure they'd encourage anyone to write anything they wanted so go for it! > > Pl/Ruby - there is an idea *grin* > > -Mitch
: As for whether it will be done, well, what does PHP give you over : Perl? I know Perl well and PHP AFAICS is a tiny subset of Perl : designed to be embedded in web pages. Given PL/Perl, do we really : need PL/PHP? I wouldn't call PHP a subset of Perl at all! I'd call them sibling languages with different strengths. I think Perl does certain things better than PHP but PHP has strengths that Perl probably can't compete with. But for the most part, AFAIK, anything you can do in Perl, you can also do in PHP. -Dan
On Wed, Jan 31, 2001 at 12:15:49PM -0500, Doug McNaught wrote: > mwaples@waples.net writes: > > > I was reading > > http://www.linuxworld.com.au/article.php3?aid=123&tid=8 > > and specifically > > "Later in 2001 this flexibility may extend even within the MySQL > > database server, with PHP scripts used as stored procedures within MySQL > > database" > > I won't hold my breath for that to happen in 2001 knowing MYsql's many > > promised future features but it got me wondering > > > > Since there is pl/perl is it all remotely possible that a pl/php could > > be implemented ? > > Well, in software, you can do pretty much anything with enough > hacking, so it's definitely possible. > > As for whether it will be done, well, what does PHP give you over > Perl? I know Perl well and PHP AFAICS is a tiny subset of Perl > designed to be embedded in web pages. Given PL/Perl, do we really > need PL/PHP? Given PL/pgsql do we really need PL/Perl? PHP is by no means a subset of perl, nor tiny. I've been using PHP for some stuff lately, and it reads like a cross between C and Perl, with some other interesting behaviors. It is very un-perl-like, unless you write your perl like C. I've found that it is handy for small projects, but they tend to get pretty hairy as soon as you put more then two engineers on them, since there is really no type checking involved. Perl has some of these issues as well, but with many more options for "creative syntax." I've not used PL/Perl, but I would expect that PL/PHP would be no more or less useful. I've had a few encounters with the internals of Zend, the interpreter engine upon which PHP is based, and it seems pretty well done. If anything, it might be interesting to adopt some of the ideas of PHP and create our own language or sub-PHP. I am, however, in no way volunteering for such a project. -- Adam Haberlach |A cat spends her life conflicted between a adam@newsnipple.com |deep, passionate, and profound desire for http://www.newsnipple.com |fish and an equally deep, passionate, and '88 EX500 |profound desire to avoid getting wet.
On Wed, Jan 31, 2001 at 02:58:23PM -0500, some SMTP stream spewed forth: > postgres support for pl/VB? :) Well, the most important, of course, would be.... pl/COBOL!!! gh > > Adam Lang > Systems Engineer > Rutgers Casualty Insurance Company > http://www.rutgersinsurance.com > ----- Original Message ----- > From: "Mitch Vincent" <mitch@venux.net> > To: <pgsql-general@postgresql.org> > Sent: Wednesday, January 31, 2001 1:54 PM > Subject: [GENERAL] Re: php as stored procedures > > > > PHP is nice, but it's designed for a very specific purpose -- to write > web > > based applications quickly. Having it in a DB is a little silly if you ask > > me.. Pl/pgsql is nice for smaller functions, C is great for everything > else > > and of course, if you're a Perl monk, use it! :-) > > > > Pl/PHP is possible (simply because anything is possible) but I doubt > you'll > > see any of the core developers doing anything of the sort though.. > However, > > I'm sure they'd encourage anyone to write anything they wanted so go for > it! > > > > Pl/Ruby - there is an idea *grin* > > > > -Mitch > >
On Wed, 31 Jan 2001, Dan Wilson wrote: > I wouldn't call PHP a subset of Perl at all! I'd call them sibling > languages with different strengths. I think Perl does certain things better > than PHP but PHP has strengths that Perl probably can't compete with. But > for the most part, AFAIK, anything you can do in Perl, you can also do in > PHP. Err... I would say it's more the other way around... anything you can do in PHP you can do in Perl. -- Brett http://www.chapelperilous.net/~bmccoy/ --------------------------------------------------------------------------- Learn to pause -- or nothing worthwhile can catch up to you.
On Wed, Jan 31, 2001 at 12:15:49PM -0500, Doug McNaught wrote: > > As for whether it will be done, well, what does PHP give you over > Perl? I know Perl well and PHP AFAICS is a tiny subset of Perl > designed to be embedded in web pages. Given PL/Perl, do we really > need PL/PHP? PHP is a tiny subset of Perl? Did you use PHP? Dunno, personally i think PHP's syntax (being very similar to C's) is more clear than Perl's (which is full of "features" smelling like hacks). > If someone (you?) think's it's important it'll probably get written. I would appreciate if it would get written, but unfortunatelly i amn't seem to be the one who is going to do the actual work... -- Denis A. Doroshenko [GPRS/IN/WAP, VAS group engineer] .-. _|_ | [Omnitel Ltd., T.Sevcenkos st. 25, Vilnius, Lithuania] | | _ _ _ .| _ | [Phone: +370 9863207 E-mail: d.doroshenko@omnitel.net] |_|| | || |||(/_|_
On Wed, Jan 31, 2001 at 07:34:51PM -0500, Brett W. McCoy wrote: > On Wed, 31 Jan 2001, Dan Wilson wrote: > > > I wouldn't call PHP a subset of Perl at all! I'd call them sibling > > languages with different strengths. I think Perl does certain things better > > than PHP but PHP has strengths that Perl probably can't compete with. But > > for the most part, AFAIK, anything you can do in Perl, you can also do in > > PHP. > > Err... I would say it's more the other way around... anything you can do > in PHP you can do in Perl. Well, they are both turing complete and extensible enough to be able to execute arbitrary functions via plug-ins. I studied computer engineering and not computer science, but I'm pretty sure this makes them functionally equivalent, so you are both right. -- Adam Haberlach |A cat spends her life conflicted between a adam@newsnipple.com |deep, passionate, and profound desire for http://www.newsnipple.com |fish and an equally deep, passionate, and '88 EX500 |profound desire to avoid getting wet.