?

Log in

No account? Create an account

Playing around with XMLValue

« previous entry | next entry »
Apr. 13th, 2007 | 11:14 pm

From IM:
"So can anything be done with XML?"

Create a table:

CREATE TABLE `krow` (
`a` varchar(125) NOT NULL DEFAULT '',
`b` text,
PRIMARY KEY (`a`)
) ENGINE=HTTP DEFAULT CHARSET=latin1 CONNECTION='http://krow.livejournal.com/data/'

Now... can I extract anything?

mysql> select EXTRACTVALUE(b, '/rss/channel/title') from krow WHERE a="rss";
+--------------------------------------------------+
| EXTRACTVALUE(b, '/rss/channel/title') |
+--------------------------------------------------+
| Brian "Krow" Aker's Idle Thoughts |
+--------------------------------------------------+
1 row in set (1.29 sec)

Basically I use the new XML methods in 5.1 to extract out realtime data from 5.1.

I publicly committed mod_methods:
http://hg.tangent.org/mod_methods

I would not enable it on a public server. I've never fixed the security for it, and its quite dangerous for that reason. It is handy for testing services like this since it has a plain GET/PUT/HEAD/DELETE method.

Link | Leave a comment | Share

Comments {4}

Dossy

(no subject)

from: dossy
date: Apr. 14th, 2007 03:12 pm (UTC)
Link

Oh my, evil. Still, the MyHTTP storage engine in "read-only" mode is still quite useful, especially with the new XML functions in 5.1.

So, when is MyHTTP going to be a standard part of the MySQL codebase? :-)

Reply | Thread

Brian "Krow" Aker

(no subject)

from: krow
date: Apr. 14th, 2007 03:56 pm (UTC)
Link

Read only you think? Let me put up another blog entry :)

Standard? No idea, not really in the goal list right now. To easy to develop/just install it externally.

Reply | Parent | Thread

Dossy

(no subject)

from: dossy
date: Apr. 14th, 2007 04:14 pm (UTC)
Link

I meant "read only, without any mod_tomfoolery" ... which is still very useful.

Reply | Parent | Thread

Brian "Krow" Aker

(no subject)

from: krow
date: Apr. 14th, 2007 04:28 pm (UTC)
Link

Well its a matter of an API. A webserver is just a big giant bit pump. By default Apache is configured type a certain set of bits... those that are flat files or executable CGI files. Add PHP... add mod_perl... and you get more types of execution. Add something like mod_mp3 and you get protocols different from HTTP.

I am not expecting many to use this as default... I am just hoping to kick start those who write web service infrastructures to think of this from a different angle.

Reply | Parent | Thread