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
Relax
Newbie


Joined: 05 Sep 2005
Posts: 9

PostPosted: Sat Jul 07, 2007 12:17 pm   

[1.34] %query() doesn't support local variable for expression
 
The following code builds a query expression out of a db variable, then looks it up in my database.

Code:
$expr = "";
#loopdb @ident_data
{
  $t = {~&%key = ~"%val~"}
  #additem $expr $t
}
$expr = {~(~(%expandlist($expr,  ") && (" )~)~)}
$db_list = %query($expr, All)


$db_list is empty when I use a local variable ($expr) as the query.

The following work-around fixes this
Code:
ident_query = $expr
$db_list = %query(@ident_query


However, I would prefer not to have to use a non-local variable, as it just seems too messy.

Has anyone got a solution to this that doesn't need a non-local variable?

Thanks

Relax
Reply with quote
Arminas
Wizard


Joined: 11 Jul 2002
Posts: 1265
Location: USA

PostPosted: Sat Jul 07, 2007 1:46 pm   
 
%query Is from the old database module. So it has not been updated yet. Zugg is waiting until he rewrites the db to change the functions to support local variables.

Here is one way to work around this until the re-write.

Code:
$db_list =  %exec("%query("$expr", All)")
_________________
Arminas, The Invisible horseman
Windows 7 Pro 32 bit
AMD 64 X2 2.51 Dual Core, 2 GB of Ram
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