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

Play RetroMUD
Post new topic  Reply to topic     Home » Forums » zMUD General Discussion
MrCheviot
Novice


Joined: 02 Dec 2007
Posts: 42

PostPosted: Sat Apr 05, 2008 6:03 pm   

#DBPUT Overwriting records
 
I ran into this problem with an internal DB that I had been using for months, figured it may have gotten corrupted over time so I made a new (clean) DB. Things were working fine but ran into the problem again...

I'm trying to swap information contained in two records, and in this particular case it's just a boolean flag.

I have a string list of the records, e.g. record_list = 1db|2db

Code:
#dbget %item(@record_list,1)
#va temp_datarec %rec
#dbget %item(@record_list,2)
#if (&flag != @temp_datarec.flag) {
  #if (&flag=1) {
    #dbput %item(@record_list,1) {flag=1}
    #wait 250
    #dbput %item(@record_list,2) {flag=0}
  } {
    #dbput %item(@record_list,1) {flag=0}
    #wait 250
    #dbput %item(@record_list,2) {flag=1}
  }
} {#show Flags are the same.}


After doing this, I'll find that I no longer have both records. In the DB window, I'll see:

Row 1 | 1db | information about this record
Row 2 | 1db | same information (i.e. 2db has been overwritten)

This is really NOT good, and I've tried inserting the #WAIT in hopes that slowing down the consecutive #DBPUT's would help. I may ultimately fetch both records into temporary datarec variables, modify them via #addkey, and then #DBPUT record @temp_datarec1/2 (so copy all information from the record, modify it, and then overwrite the whole record), as I'm worried that trying to update a single field in the record will continue to have problems. This MUST be reliable.

Anyone have thoughts on this, or run into similar problems?

Thanks,

-MrC
Reply with quote
Display posts from previous:   
Post new topic   Reply to topic     Home » Forums » zMUD 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