|
Ntr0pY Beginner
Joined: 10 Feb 2006 Posts: 10
|
Posted: Wed May 02, 2007 9:56 pm
[1.32] %query Problem |
Hi there,
today I've chosen to play around with the CMUD Database. Well, I don't know where the error is but:
#show %query((&Killed > 10) && (&location = @location))
results in:
Error: parsing Command
Extra ) parenthesis.
Cursor is at &&.
Since this is just the slightly modified '%query' example, i hope this is not my fault :(
Ntr0pY |
|
Last edited by Ntr0pY on Thu May 03, 2007 4:35 am; edited 1 time in total |
|
|
|
Tech GURU
Joined: 18 Oct 2000 Posts: 2733 Location: Atlanta, USA
|
Posted: Wed May 02, 2007 9:59 pm |
The example is a carry over from zMUD.
try this and see if it helps.
#show %query("(&Killed > 10) && (&location = @location)") |
|
_________________ Asati di tempari! |
|
|
|
Ntr0pY Beginner
Joined: 10 Feb 2006 Posts: 10
|
Posted: Thu May 03, 2007 4:45 am |
Thank you, this helped :)
But... well look at this:
My Database is just a small database with 3 Fields and 2 Records (yep, just playing around :)
id Name killed location
0ge Ratte 10 Wald auf Kor
1ge Wendigo 20 Gebirge auf Kor
#show %query(&killed>0)
or
#show %query("(&killed>0)")
results in 0ge|1ge
#show %query("(&killed>0)&&(&location="Wald auf Kor")")
results also in 0ge|1ge
after further testing I figured out, that %query("(*)") results in retrieving every item from the db.
So, after all, this might not be the correct syntax :(
Ntr0pY |
|
|
|
Tech GURU
Joined: 18 Oct 2000 Posts: 2733 Location: Atlanta, USA
|
Posted: Thu May 03, 2007 11:43 pm |
Ok.. I've finally got a chance to review this (and actually test code). The good news is that for what you want you can simply do this
#show %query( &killed>0 && &location="Wald auf Kor" )
But you also uncovered a parser error since the use of parentheses in %query causes a syntax error which prevents specify more complex order of precedence queries.
Finally you can't seem to use local variables with the %query command. I thought this was fixed for all functions but I may be mistaken.
Consider
Code: |
$query = "&Killed>10"
#SHOW %query( "&Killed>10" )
#show %concat( "foo",$query)
#SHOW %query( $query ) |
As a side note, I now need to check my queries as well. |
|
_________________ Asati di tempari! |
|
|
|
Ntr0pY Beginner
Joined: 10 Feb 2006 Posts: 10
|
Posted: Fri May 04, 2007 5:54 am |
#show %query(&Killed>10 && &Location = @location) works well.
Thanks for your help.
Ntr0pY |
|
|
|
Zugg MASTER
Joined: 25 Sep 2000 Posts: 23379 Location: Colorado, USA
|
Posted: Fri May 04, 2007 5:16 pm |
The reason the %query function doesn't support parenthesis or local variables is that it's part of the database module, which (like the automapper) was directly ported from zMUD and isn't fully integrated into CMUD. This will get fixed when the database module is rewritten later this year.
|
|
|
|
|
|