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
GeneralStonewall
Magician


Joined: 02 Feb 2004
Posts: 364
Location: USA

PostPosted: Fri Jul 02, 2010 9:44 pm   

[3.22] BUG: '#addkey db key %additem( item, list)' issue
 
Setting a value of a key to the result of %additem appears to be truncating key names. This could be more than an issue with just %additem, so I'll experiment more.

code:
Code:
testdb = %null
#addkey testdb {one two} %additem( three, %null)
#var testdb

output:
Quote:
Variable: + testdb (Record) one=three
json: {"one":["three"]} (object)


Last edited by GeneralStonewall on Sat Jul 03, 2010 1:30 am; edited 1 time in total
Reply with quote
Zugg
MASTER


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

PostPosted: Fri Jul 02, 2010 10:07 pm   
 
I'll add this to the bug list but in general it's probably a bad idea to use multi-word keys. Obviously the @db.key syntax won't work with that so you'll be stuck with the %db function. But I don't think the low-level json stuff cares so I'll see what I can do. I even tried putting " quotes around "one two" and that didn't work either, which is quite a surprise.
Reply with quote
GeneralStonewall
Magician


Joined: 02 Feb 2004
Posts: 364
Location: USA

PostPosted: Fri Jul 02, 2010 10:23 pm   
 
Er, I forgot to mention this broke in 3.22. I'm quite certain this worked in 3.21.

Edit: Confirmed to have worked in 3.21.

---Further clarification---

This works right:
Code:
testdb = %null
#addkey testdb {one two} three
#var testdb


This doesn't:
Code:
testdb = %null
#addkey testdb {one two} %list(three)
#var testdb
Reply with quote
charneus
Wizard


Joined: 19 Jun 2005
Posts: 1876
Location: California

PostPosted: Tue Jul 06, 2010 7:34 am   
 
Zugg wrote:
I'll add this to the bug list but in general it's probably a bad idea to use multi-word keys. Obviously the @db.key syntax won't work with that so you'll be stuck with the %db function. But I don't think the low-level json stuff cares so I'll see what I can do. I even tried putting " quotes around "one two" and that didn't work either, which is quite a surprise.


I was about to post this bug myself, having forgot that it was already posted. However, I must say that stating 'it's a bad idea to use multi-word keys' is ridiculous. The reason I say this is there are numerous times when you need to have spaces in the keys, such as people creating a database of afflictions with the value of what cures the ailment, or in my case, subbing an entire line with whatever is the value in the database itself. Instead of making 200 triggers, it's much easier to create one database and one trigger.

Yes, I realize that @db.key will not work in this instance, but that's what %db is for. :P

Charneus
Reply with quote
GeneralStonewall
Magician


Joined: 02 Feb 2004
Posts: 364
Location: USA

PostPosted: Tue Jul 06, 2010 8:23 am   
 
Life wouldn't be worth living without multi-word keys. That's for sure.
Reply with quote
Zugg
MASTER


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

PostPosted: Tue Jul 06, 2010 5:19 pm   
 
Sorry, I didn't mean to imply that multiword keys wouldn't be supported. As I said, the JSON routines don't care. It's just the @db.key syntax that probably won't work. And honestly, I have no idea what caused the #addkey to break with this in the recent version but if it worked in 3.21 then I should be able to get it working again. In any case, it's on the bug list.
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