I've edited portions of this to protect the innocent. The code I wrote to implement this does not make use of any secret internals - it is available to anyone. I chose two arrays - columns names and column values because we only need column names once. The code could easily produce rows as objects instead of arrays. My code accepts an SQL Result - not necessarily a result set - and produces a DAO (dynamic abstract object) from it. A result is returned by executing any SQL statement and it can contain multiple result sets, output-directed columns (not result columns), etc.
USER>set r = $system.SQL.Execute("select top 2 name,birthdate,age from person","odbc")
USER>set r = <something>.resultToDao($system.SQL.Execute("select top 2 name,birthdate,age from person","odbc"))
USER>:pp r
{
"statementType": "SELECT",
"sqlcode": 0,
"metadata": {
"columns": [
{
"name": "name",
"precision": 50,
"scale": 0,
"type": "string"
},
{
"name": "birthDate",
"precision": 10,
"scale": 0,
"type": "datetime"
},
{
"name": "age",
"precision": 10,
"scale": 0,
"type": "number"
}
]
},
"rows": [
[
"Dan",
"1960-01-01",
66
],
[
"Steve",
"1959-12-01",
66
]
],
"rowcount": 2
}
SDK:USER>- Log in to post comments
.png)
.png)