Hi Wouter, Thanks a bunch. That fixed the error: #!/usr/bin/env php <?php $db = monetdb_connect('xquery', 'localhost', 50000, 'monetdb', 'monetdb') or die ("Failed to connect\n"); $res = monetdb_query('<node>{ for $i in (1,2,3,4) return $i }</node>'); while ($row = monetdb_fetch_row($res)) { var_dump($row); } ?> ...produces this result: array(1) { [0]=> string(20) "<node>1 2 3 4</node>" } - Gene Stevens On Aug 9, 2009, at 3:21 AM, Wouter Alink wrote:
I don't know whether you compiled from sources, but the following path in the clients package should do the trick... (haven't tested it properly).
$ cvs diff -u src/php/Cimpl/php_monetdb.c Index: src/php/Cimpl/php_monetdb.c =================================================================== RCS file: /cvsroot/monetdb/clients/src/php/Cimpl/php_monetdb.c,v retrieving revision 1.14 diff -u -r1.14 php_monetdb.c --- src/php/Cimpl/php_monetdb.c 15 May 2009 12:31:28 -0000 1.14 +++ src/php/Cimpl/php_monetdb.c 9 Aug 2009 09:06:32 -0000 @@ -923,7 +923,12 @@ len = strlen(Z_STRVAL_PP(query)); myq = alloca(sizeof(char) * (len + 2)); memcpy(myq, Z_STRVAL_PP(query), len + 1); - myq[len++] = ';'; + + /* only add the ';' for languages that use ';' as statement delimiter (all but xquery). */ + if (strcmp(mapi_get_lang(monetdb),"xquery") != 0) { + myq[len++] = ';'; + } + myq[len] = '\0'; monetdb_result = mapi_query(monetdb, myq); if ((MG(auto_reset_persistent) & 2) && monetdb_result == NULL) {
2009/8/8 Gene Stevens
: Hi Wouter and Stefan,
Thanks so much for your replies. I apologize for the simple XQuery error below: I tried to clean up and test a simple example before posting to the list ...oops. As you can tell, the error is the same even with a corrected sequence: "count((1,2,3,4))".
I've been using XQuery for about two years now, mostly with BDB XML daemonized within our own servers. I found this project just the other day and it very much piqued my curiosity and got me a little excited after my ultimately disappointing experience with Oracle's product, their query planner in particular. I'm very interested to see how this database handles XML/XQuery, performance-wise, specifically for analytical workloads on large data sets: think analysis/reporting on billions of audit events. But I have a number of projects with different needs where MonetDB might be valuable.
I am not a C developer (I'm a PHP/XML web services developer), but if there is anything I can do to help, please let me know.
Thanks - Gene Stevens
On Aug 8, 2009, at 8:42 AM, Wouter Alink wrote:
Hello Gene,
I think you might have found a bug in the PHP client. The PHP client might only have been tested with SQL and not with XQuery. When using the SQL language, a semi-colon may be automatically added at the end of a statement, but when using XQuery that should of course not be done.
However, you will get an error anyway with the current query. The error you should have gotten is:
error in function application: at (1,1-1,14): wrong number of arguments for function `fn:count' (expected 1, got 4) # halted in functions.c (check_fun_usage), line 361
You should change your query to something like: "count((1,2,3,4))" or "count(1 to 4)"
Greetings, Wouter
2009/8/8 Gene Stevens
: Hi everyone,
I am a new MonetDB user. I am specifically interested in MonetDB's XQuery support with client access through PHP.
I currently get parsing errors when trying any kind of XQuery through the PHP module. I'm wondering if this is a a bug in the client or if I am possibly doing something wrong. E.g.:
#!/usr/bin/env php <?php $db = monetdb_connect('xquery', 'localhost', 50000, 'monetdb', 'monetdb') or die ("Failed to connect\n"); $query = 'count(1,2,3,4)'; $res = monetdb_query($query); ?>
Results in:
Warning: monetdb_query(): Query failed: parse error: syntax error, unexpected ;, expecting $end on line 1, column 15 (next token is `;') !parse error: XQuery parsing failed in /home/user/monet.php on line 6
.... for any variation of an XQuery. I have tried the server from the Ubuntu repository as well as I've built it from source with the same results.
Here is my environment:
PHP 5.2.6-3ubuntu4.1 with Suhosin-Patch 0.9.6.2 (cli) (built: Apr 23 2009 14:37:14) Ubuntu 9.04: Linux ubuntu 2.6.28-11-server #42-Ubuntu SMP Fri Apr 17 02:45:36 UTC 2009 x86_64 GNU/Linux
Mserver --dbinit="module(pathfinder);" # MonetDB Server v4.30.4 # based on GDK v1.30.4 # Copyright (c) 1993-July 2008, CWI. All rights reserved. # Copyright (c) August 2008-2009, MonetDB B.V.. All rights reserved. # Compiled for x86_64-pc-linux-gnu/64bit with 64bit OIDs; dynamically linked. # Visit http://monetdb.cwi.nl/ for further information. # PF/Tijah module v0.13.0 loaded. http://dbappl.cs.utwente.nl/pftijah # MonetDB/XQuery module v0.28.3 loaded (default back-end is 'algebra') # XRPC administrative console at http://127.0.0.1:50001/admin MonetDB>
Thanks for any insight! - Gene Stevens
------------------------------------------------------------------------------ Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day trial. Simplify your report design, integration and deployment - and focus on what you do best, core application coding. Discover what's new with Crystal Reports now. http://p.sf.net/sfu/bobj-july _______________________________________________ MonetDB-users mailing list MonetDB-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/monetdb-users
------------------------------------------------------------------------------ Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day trial. Simplify your report design, integration and deployment - and focus on what you do best, core application coding. Discover what's new with Crystal Reports now. http://p.sf.net/sfu/bobj-july _______________________________________________ MonetDB-users mailing list MonetDB-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/monetdb-users
------------------------------------------------------------------------------ Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day trial. Simplify your report design, integration and deployment - and focus on what you do best, core application coding. Discover what's new with Crystal Reports now. http://p.sf.net/sfu/bobj-july _______________________________________________ MonetDB-users mailing list MonetDB-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/monetdb-users
------------------------------------------------------------------------------ Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day trial. Simplify your report design, integration and deployment - and focus on what you do best, core application coding. Discover what's new with Crystal Reports now. http://p.sf.net/sfu/bobj-july _______________________________________________ MonetDB-users mailing list MonetDB-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/monetdb-users