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

Play RetroMUD
Post new topic  Reply to topic     Home » Forums » CMUD General Discussion
Rahab
Wizard


Joined: 22 Mar 2007
Posts: 2320

PostPosted: Tue Jun 26, 2012 1:38 am   

Can you interpet row.Data property of a %sql() query result?
 
I've intended for a long time to create a user-friendly interface for creating the kind of database that mud-users usually want, with simple Cmud functions and aliases interacting invisibly with an sqlite database. I'm finally getting around to this project!

As I play with %sql, it seems that it would be terribly useful if I could just interpret the raw results of %sql into a JSON string. The results of the .Data property is described as "the raw JSON data table of the current row". Clearly the raw result contains the column names as well as the values, since the .Item() property allows you to specify the name of a column. But there does not seem to be a way to grab the column names from this data. Does anyone know whether there is any way to either grab the column names from an %sql() query or convert the .Data property into an ordinary JSON string?
Reply with quote
Daern
Sorcerer


Joined: 15 Apr 2011
Posts: 809

PostPosted: Tue Jun 26, 2012 3:33 am   
 
I'm not sure what row.Data is doing, but I don't think it works how it's documented. It doesn't seem to be returning JSON, it's returning an array type, at least judging by #show-ing it, which displayed <Array>. I wasn't able to use %arrget on it though, so I'm not really sure what to make of that. There is, however, an undocumented row.List property, which does what I think you're trying to do.
Reply with quote
Rahab
Wizard


Joined: 22 Mar 2007
Posts: 2320

PostPosted: Tue Jun 26, 2012 2:54 pm   
 
Aha! .List looks perfect! Thanks.
Reply with quote
Display posts from previous:   
Post new topic   Reply to topic     Home » Forums » CMUD 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