NYCPHP Meetup

NYPHP.org

[nycphp-talk] Native PHP functions in MySQL?

Dan Cech dcech at phpwerx.net
Fri Dec 26 14:03:02 EST 2003


Yeah, I've seen a little of the clew discussion, I'm kinda new to the 
whole nyphp thing so I'm a little behind.

Why did you decide on Nested Sets?  I have had good success in the past 
with Modified Preorder Traversal Trees in MySQL and Postgres, basically 
a mixture of Nested Sets and adjacency tables, with the advantages (and 
disadvantages) of both.  They seem to be to be a little more robust than 
vanilla nested sets, as well as giving you more options for retrieving data.

For a sample implementation see phpGACL, we haven't released a version 
using the new trees yet, but everything is in CVS and undergoing final 
testing prior to release.

I also have an implementation of all the functions required for 
Tropashko's Partial Order Nested Sets in PHP, might have to have a play 
with those when I get some free time.

Dan

Chris Snyder wrote:

> Wow, thanks Dan! An excellent Boxing Day gift to those of us without 
> Oracle. :-)
> 
> I'm just beginning to wrap my head around the Nested Set approach, 
> having always used a Materialized Path. It's always nice to find that 
> there's more than one way to do it.
> 
> The clew project (NYPHP's new mailing list / forum) uses a Celko-style 
> Nested Set to store the message heirarchy, courtesy of Hans Zaunere's 
> pNSM class. Once we work through the implementation and have it up and 
> running, it would be a great idea to take a shot at the Partial Order 
> approach spelled out by Tropashko, using myphp to do the math.
> 
>   csnyder
> 
> 
> Dan Cech wrote:
> 
>> Actually there is a UDF which can execute PHP code already.  Written 
>> by David Sklar, you can find it here:
>>
>> <http://www.sklar.com/page/article/myphp>
>>
>> As for usefulness, it could be very handy if you wanted to for 
>> instance implement partial order nested sets:
>>
>> <http://www.dbazine.com/tropashko4.html>
>>
>> There are plenty of situations where the ability to execute php code 
>> could be a Good Thing, though for most cases the same results can be 
>> achieved with SQL-99 stored procedures, which are supported in MySQL 
>> 5.x and much more portable than embedded php code.
>>
>> Dan Cech
>>
>> jon baer wrote:
>>
>>> i noticed this project just recently:
>>>
>>> http://freshmeat.net/projects/judf/?topic_id=66
>>>
>>> basically a wrapper using mysql w/  CREATE FUNCTION foo RETURNS STRING
>>> SONAME "foo.so"; to run Java natively ... so you could do this:
>>>
>>> mysql> SELECT foo("classes/MyClasss", COLUMN1, COLUMN2) FROM foobar;
>>>
>>> i wonder what the major advantages of this really are or if its 
>>> overkill, im
>>> assuming the same thing could be done w/ php ... but beyond filtering 
>>> what
>>> would it be good for?
>>>
>>> - jon
>>>
>>> pgp key: http://www.jonbaer.net/jonbaer.asc
>>> fingerprint: F438 A47E C45E 8B27 F68C 1F9B 41DB DB8B 9A0C AF47
>>>
>>> _______________________________________________
>>> talk mailing list
>>> talk at lists.nyphp.org
>>> http://lists.nyphp.org/mailman/listinfo/talk
>>>
>>
>> _______________________________________________
>> talk mailing list
>> talk at lists.nyphp.org
>> http://lists.nyphp.org/mailman/listinfo/talk
> 
> 
> 
> 
> _______________________________________________
> talk mailing list
> talk at lists.nyphp.org
> http://lists.nyphp.org/mailman/listinfo/talk
> 




More information about the talk mailing list