Re: [MonetDB-users] Using MonetDB / XQuery with PHP
Hi Fabian, performing SQL and MIL queries succeeds using PHP. Not concerning XQuery. Connecting with: $db = monetdb_connect('xquery'); if (!$db) { die('Could not connect with MonetDB/XQuery server'); } echo 'Connected successfully'; succeeds. Performing a query with: $query = 'count(doc("HelloWorld.xml")/doc)'; $result = monetdb_query($query); if(!$result)die("Query failed : " . monetdb_error() ."\n"); else echo '<br>Performed query'; succeeds as well. But the content of the result set seems to remain 'empty'. print_r($result) -> Resource id #3 But while($row = monetdb_fetch_array($result)) { print_r($row); } remains empty. Does somebody have a working example of performing an XQuery using PHP? I wondered, is it required to connect to a specific database in the monetdb_connect command? (the XML-document) I think not, but hey! With kind regards, -----Original Message----- From: Fabian Groffen [mailto:Fabian.Groffen@cwi.nl] Sent: Wed 11/22/2006 1:08 PM To: monetdb-users@lists.sourceforge.net Cc: Subject: Re: [MonetDB-users] Using MonetDB / XQuery with PHP Hi Menno, Thanks for considering MonetDB. The php_monetdb module can speak all languages that are supported by mapi: mil, mal, sql and xquery. I never used PEAR, but always used the monetdb_xxx functions directly. The monetdb_connect() function accepts a language to use, which can be one of the few mentioned above. Unfortunately the documentation as on the web is outdated in this respect. From the example monetdb_query_demo.php http://monetdb.cvs.sourceforge.net/monetdb/MonetDB/src/mapi/clients/php/Cimpl/examples/monetdb_query_demo.php?revision=1.5&view=markup it shows that the language has to be given as first argument to the monetdb_connect() function. As from the function documenation: proto resource monetdb_connect([string language [, string host [, string port [, string username [, string port [, string database [, int connect_type]]]]]]]) I hope this helps/clears up a bit. Feel free to ask. On 22-11-2006 11:56:40 +0100, Menno Holtkamp wrote:
Dear MonetDB Team, We are currently checking the MonetDB/XQuery distribution for use in several governmental and research projects. We have succesfully installed the MonetDB/XQuery server and are able to perform some example queries by loading some .xq files with the MapiClient. By using the php_monetdb.dll which came along with the MonetDB/SQL server, we were able to perform some SQL queries on that database. But now we want to perform MIL queries on the MonetDB/XQuery server. I assume the used/ripped MAPI dll (version 1.0) does not support the MIL language, in essence, I am not able to configure the php.ini to accept: monetdb.default_language = mil On the website, the only thing mentioned about a windows installation of the MAPI for PHP is (http://monetdb.cwi.nl/TechDocs/APIs/PEARDB/index.html): For windows setups the story is a little bit more complex. TODO Can you explain how to install / acquire the proper dynamically loadable php module php_monetdb.dll which supports MIL and with which we can query our XML data? With kind regards, Menno Holtkamp
------------------------------------------------------------------------- Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT & business topics through brief surveys - and earn cash http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV _______________________________________________ MonetDB-users mailing list MonetDB-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/monetdb-users
On 23-11-2006 14:21:44 +0100, Menno Holtkamp wrote: [snip]
Performing a query with:
$query = 'count(doc("HelloWorld.xml")/doc)'; $result = monetdb_query($query); if(!$result)die("Query failed : " . monetdb_error() ."\n"); else echo '<br>Performed query';
succeeds as well.
But the content of the result set seems to remain 'empty'.
print_r($result) -> Resource id #3
But while($row = monetdb_fetch_array($result)) { print_r($row); }
remains empty.
I see. This is probably because the default XQuery output is a wee bit different. ;) I might be able to fix monetdb_php to support XQuery like JDBC does. Unfortunately I don't have too much time this and next week, so the fix will have to wait a bit. I'll try and see in the weekend if I can easily fix it.
Does somebody have a working example of performing an XQuery using PHP?
No ;)
I wondered, is it required to connect to a specific database in the monetdb_connect command? (the XML-document) I think not, but hey!
Nope; this only works on M5 which has support for multiple catalogs.
participants (2)
-
Fabian Groffen
-
Menno Holtkamp