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

Play RetroMUD
Post new topic  Reply to topic     Home » Forums » CMUD Beta Forum
atpeace
Novice


Joined: 26 Jan 2009
Posts: 32

PostPosted: Mon Jan 26, 2009 2:29 pm   

#LOOPVIEW Severly broken
 
#DBLOAD Actions
#DBFIRST
#VIEW All
#DBFIRST
#LOOPVIEW {#SHOW &Num}
#LOOPVIEW {} {#SHOW &Num}
;Above Produces no output
#LOOPVIEW {All|Actions} {#SHOW &Num}
#LOOPVIEW {All|ac} {#SHOW &Num}
#LOOPVIEW "All|ac" {#SHOW &Num}
#LOOPVIEW All {#SHOW &Num}
#LOOPVIEW All|ac {#SHOW &Num}
#LOOPVIEW All|Actions {#SHOW &Num}
;All of the above produce a loop of #SENDS based on the Database View|dBName

#LOOPVIEW "#SHOW &Num"
;Works!?!
Reply with quote
Zugg
MASTER


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

PostPosted: Mon Jan 26, 2009 6:08 pm   
 
This is because the database module was directly ported from zMUD and requires a string argument to it's database commands and functions. This will be fixed whenever the database module is rewritten for CMUD, but that's going to be a while.

So, as you noticed, you need to put quotes around the entire command for #LOOPVIEW instead of using {} whenever you use the &Column syntax.
Reply with quote
atpeace
Novice


Joined: 26 Jan 2009
Posts: 32

PostPosted: Mon Jan 26, 2009 7:22 pm   
 
If the database module is a direct port then I suspect the %query function will produce database corruption when searching for Boolean values depending on the current view of the dB applet. I was forced to write my own ZMud query functions to avoid this corruption. If anyone can use this CMud code please do:

<func name="DBQUERY" id="894">
<value>#LOCAL $Result
#DBOFFLINE
#DBLOAD $Database
#DBFIRST
#VIEW $View
#DBFIRST
#QUERY {(%string($Query))} {} {1}
#DBFIRST
$Result = %rec
#DBONLINE
#RETURN $Result</value>
<arglist>$Database,$View,$Query</arglist>
</func>

The excessive use of DBFIRST is used to avoid 0's appearing in set column's of a database you happened to be viewing.

Please note this will only produce one result, which is fine for what I needed to do. You could add a #WHILE (not null (%rec) {#DBNEXT;#ADDITEM $Result %res;#DBNEXT;} to return all results. or use &Num instead of rec to get the numbers instead.
Reply with quote
Display posts from previous:   
Post new topic   Reply to topic     Home » Forums » CMUD Beta Forum 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