PHP: How can I get the name of the xquery function where an error occurred?
Friday, 9 July 2010 · 2 messages
NA
Nigel Alderton9 Jul 2010 19:58 #
If I get an error message like this:
[XPST0003] Incomplete 'let' expression.
How can I find out more information regarding the error eg. the name of the function that failed? The error message doesn't give any clue about where the error occurred.
I'm using PHP. My code is based on the example code supplied with BaseX.
<?phpinclude("BaseXClient.php");
$CMD_OPEN = "open cgd-dat"; // BaseX command to open the database.
$xq = "xquery ... a long xquery"; // BaseX xquery command.
try {
$session = new Session("localhost", 1984, "admin", "admin");
$session->execute($CMD_OPEN); print $session->execute($xq);
$session->close();
} catch (Exception $e) { print $e->getMessage();
}
?>
CG
Christian Grün9 Jul 2010 20:11 #
Dear Nigel,
line and column information is omitted in error messages returned by the server. One solution to get more feedback is to use the BaseX API or the command line of BaseX, or to directly test your query in the BaseX GUI Editor.
Your request is a good hint, though; we might add extended server feedback in the next minor release.
Christian
Quoted text · Nigel Alderton · 26 lines
On Fri, Jul 9, 2010 at 7:58 PM, Nigel Alderton <nigel.alderton at bigtooth.co.uk> wrote: > If I get an error message like this: > > [XPST0003] Incomplete 'let' expression. > > How can I find out more information regarding the error eg. the name of the > function that failed? The error message doesn’t give any clue about where > the error occurred. > > I’m using PHP. My code is based on the example code supplied with BaseX. > > <?php > > include("BaseXClient.php"); > $CMD_OPEN = "open cgd-dat"; // BaseX command to open the database. > $xq = "xquery ... a long xquery"; // BaseX xquery command. > > try { > $session = new Session("localhost", 1984, "admin", "admin"); > $session->execute($CMD_OPEN); > print $session->execute($xq); > $session->close(); > } catch (Exception $e) { > print $e->getMessage(); > }
Written for BaseX 6. BaseX may have changed since: please check the current documentation.
⚡Generated with XQuery