Register to post in forums, or Log in to your existing account
 

Play RetroMUD
Post new topic  Reply to topic     Home » Forums » CMUD General Discussion
Ntr0pY
Beginner


Joined: 10 Feb 2006
Posts: 10

PostPosted: 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
Reply with quote
Tech
GURU


Joined: 18 Oct 2000
Posts: 2733
Location: Atlanta, USA

PostPosted: 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!
Reply with quote
Ntr0pY
Beginner


Joined: 10 Feb 2006
Posts: 10

PostPosted: 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
Reply with quote
Tech
GURU


Joined: 18 Oct 2000
Posts: 2733
Location: Atlanta, USA

PostPosted: 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!
Reply with quote
Ntr0pY
Beginner


Joined: 10 Feb 2006
Posts: 10

PostPosted: Fri May 04, 2007 5:54 am   
 
#show %query(&Killed>10 && &Location = @location) works well.

Thanks for your help.

Ntr0pY
Reply with quote
Zugg
MASTER


Joined: 25 Sep 2000
Posts: 23379
Location: Colorado, USA

PostPosted: 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.
Reply with quote
Display posts from previous:   
Post new topic   Reply to topic     Home » Forums » CMUD General Discussion All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum

© 2009 Zugg Software. Hosted by Wolfpaw.net