NYCPHP Meetup

NYPHP.org

[nycphp-talk] MySQL 5.1 Extractvalue() and PEAR XML_Serializer

Jon Baer jonbaer at jonbaer.com
Sat Jan 21 16:49:16 EST 2006


Just a small quick note if you are trying it out (5.1.5 is out  
now) ... it seems that the only way to delete matching rows is a  
subselect, im not sure if this is the "official" way, does anyone know?

delete from t where (select extractvalue(xml,'//foo') = 'bar');

- Jon

On Jan 21, 2006, at 12:43 PM, Adam Fields wrote:

> On Sat, Jan 21, 2006 at 12:31:02PM -0500, csnyder wrote:
>> Jon Baer wrote in a couple weeks ago with news that MySQL 5.1 will
>> support extraction of values from XML fields using XPATH.
>> http://dev.mysql.com/tech-resources/articles/mysql-5.1-xml.html
>>
>> That led me to think about ways in which this might be useful to  
>> PHP developers.
>>
>> Which in turn led me to XML_Serializer (and unserializer) at
>> http://pear.php.net/package/XML_Serializer
>>
>> Hmmm, select and update serialized php object properties in the  
>> database...
>>
>> SELECT * FROM object WHERE extractvalue( object.xml,
>> '/object/color/hue/blue' ) > 64;
>>
>> SELECT extractvalue( UpdateXML( object.xml,
>> '/object/icon/href[self::text() = '/icons/xml.gif']'
>> ,'<href>/icons/xml.png</href>' ),''/object/icon/href' ) FROM object;
>>
>> Can't wait to try it.
>
> "Wait" is probably the correct word.
>
> -- 
> 				- Adam
>
> ** Expert Technical Project and Business Management
> **** System Performance Analysis and Architecture
> ****** [ http://www.everylastounce.com ]
>
> [ http://www.aquick.org/blog ] ............ Blog
> [ http://www.adamfields.com/resume.html ].. Experience
> [ http://www.flickr.com/photos/fields ] ... Photos
> [ http://www.aquicki.com/wiki ].............Wiki
> [ http://del.icio.us/fields ] ............. Links
>
>
>
> _______________________________________________
> New York PHP Community Talk Mailing List
> Show Your Participation
> http://www.nyphp.org/show_participation.php
> http://lists.nyphp.org/mailman/listinfo/talk
> http://www.nyphp.org
>




More information about the talk mailing list