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: Tue Jan 27, 2009 1:29 am   

#Query Code for the interested.
 
Having a rather painful time to get a dB Query to actually return what I want I thought I would re-share a sort of solution :

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

Fed By This Call Format and it's hard on the eyes:
@DBQUERY(Actions, ToDo, {~&FieldName=~"~"$LocalVariable~"~"})

Or in a more advanced and rather specific to my application:
@DBQUERY(Actions, ToDo, {(~&Name=~"~"$AddActionTemp.Name~"~")~&~&(~&Pram=~"~"$AddActionTemp.Pram~"~")~&~&(~&BalReq=~"~"$AddActionTemp.BalReq~"~")})

@DBQUERY with return null or a %rec of the first match. You could put in a loop in the query function to produce record numbers stringlists or whatever you wanted.
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