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
GrimofDC
Beginner


Joined: 14 Jul 2002
Posts: 18

PostPosted: Mon Sep 16, 2002 10:34 pm   

#DBPUT problem
 
Hello everyone,

   I'm having a problem with disappearing database records. I use an alias to manually add a value to the minlvl field. Here is the alias:

#ALI minlvl {#DBPUT %1ne minlvl="%2";#SH Record %1 minlvl now set to %2;findlist=%1;findresults}

the last part "findlist=%1" and findresults are just a variable and alias I use to display the record in the mud window. I've noticedthe problem occur when I set minlvl field to text and try to #DBPUT a number value, and when I change the minlvl field back to numbers general, the record will disappear if I enter the same value that already exists. I've lost too many records to just ignore this, please help me. Thank you.

Grim
Reply with quote
Kjata
GURU


Joined: 10 Oct 2000
Posts: 4379
Location: USA

PostPosted: Tue Sep 17, 2002 12:57 am   
 
So why do you change the field type after you have entered values into it? Once you define the type of the field, you really should not change it unless all records have that field empty. Take into account that the DB does not use a real database engine, and I'm not surprised that you loose data.

Kjata
Reply with quote
GrimofDC
Beginner


Joined: 14 Jul 2002
Posts: 18

PostPosted: Tue Sep 17, 2002 2:35 am   
 
Re: Kjata

   I didn't start changing the field type until after I noticed the problem. The only real way to ensure my records don't disappear is to go to the database window and do it by hand. If anyone enters additional information into a database record through an alias without losing the data occasionally, I would like to see an example of your alias.

Thank you,
Grim
Reply with quote
GrimofDC
Beginner


Joined: 14 Jul 2002
Posts: 18

PostPosted: Thu Sep 19, 2002 7:20 am   
 
I think this might work, although I don't really know why.

#ali minlvl {#DBGET %1;#DBPUT 1 num 1;#DBPUT %1ne minlvl="%2"}

This seems to save whatever record I want to change to record 1 before I modify whatever record. Too bad #DBPUT 1 %dbget(%1) didn't seem to work. Hope this won't cause any database corruption, since I'm not really sure why #DBPUT 1 num 1 creates a copy of the current record.

Hope this helps,
~Grim
Reply with quote
LightBulb
MASTER


Joined: 28 Nov 2000
Posts: 4817
Location: USA

PostPosted: Thu Sep 19, 2002 6:26 pm   
 
I can't imagine what purpose is served by constantly changing record 1.

It appears you expect to provide two numbers with the "minlvl" alias, with the first number being the record to change, and the second number being the new value for the minlvl field. Your alias surrounds %2 with double-quotes, converting it to text. If you want a number, just use %2.
#AL minlvl {#DBPUT %1ne minlvl %2;#SH {Record %1 minlvl now set to %2};findlist=%1;findresults}

I don't see where you are changing the field to text and then back to number, but as Kjata said, there's no reason to do so. Minlvl should probably always be a number, so just leave the field-type as numbers. If, for some reason, you expect to have a few records that will require it to be text, then change the field-type to text and leave it that way. There's no reason to switch back and forth, the database engine isn't equipped to handle it.

LightBulb
Senior Member
Reply with quote
GrimofDC
Beginner


Joined: 14 Jul 2002
Posts: 18

PostPosted: Fri Sep 20, 2002 6:17 am   
 
Thanks Lightbulb. I removed the double quotes from around %2 and I haven't had any disappearing records, although I'm still going to copy every record to record 1 just in case.

Thanks again!

~Grim
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