|
Rahab Wizard
Joined: 22 Mar 2007 Posts: 2320
|
Posted: 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? |
|
|
|
Daern Sorcerer
Joined: 15 Apr 2011 Posts: 809
|
Posted: 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.
|
|
|
|
Rahab Wizard
Joined: 22 Mar 2007 Posts: 2320
|
Posted: Tue Jun 26, 2012 2:54 pm |
Aha! .List looks perfect! Thanks.
|
|
|
|
|
|
|
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
|
|