Thanks - I get it now.

Anyway, the way the queryAddColumns works is exactly the semantics I was trying 
to emulate with my custom function - it just seemed natural that those 
semantics would roll up to queryNew().

________________________________________
From: [email protected] [[email protected]] On Behalf Of Adam 
Cameron [[email protected]]
Sent: Sunday, October 07, 2012 4:25 PM
To: [email protected]
Subject: Re: [OpenBD] Feature suggestion

On Sunday, October 7, 2012 10:00:34 PM UTC+1, galvanash wrote:

Anyway, it seems this essentially does the same thing (maybe without the 
columntype support, but I find I rarely need that). Could you post or link any 
example of "query json block"?


There's no special trick here to determine how to build your JSON in such a way 
as to be deserialised as a query.  Just grab a query, serialise it with 
serializeJson(), then eyeball it: that's the format you need to use.

EG:
<cfscript>
    q = queryNew("");
    queryAddColumn(q, "id", "Integer", [1,2,3,4]);
    queryAddColumn(q, "english", "VarChar", ["one","two","three","four"]);
    queryAddColumn(q, "maori", "VarChar", ["tahi","rua","toru","wha"]);

    json = serializeJson(q);
    writeOutput(json);
</cfscript>

Output:
{"COLUMNS":["id","english","maori"],"DATA":[[1,"one","tahi"],[2,"two","rua"],[3,"three","toru"],[4,"four","wha"]]}

That's yer format.

(to answer your earlier question... yeah: "walks like a duck [etc]".

--
Adam

--
online documentation: http://openbd.org/manual/
http://groups.google.com/group/openbd?hl=en

This message is intended only for the addressee.  If you received this message 
in error, please immediately notify the sender.  Since the message may contain 
confidential, proprietary, legally privileged or private healthcare 
information, please also delete and/or destroy all copies of it.  You must not 
use, disclose, distribute, print or copy any part of this message if you are 
not the intended recipient.

-- 
online documentation: http://openbd.org/manual/
 http://groups.google.com/group/openbd?hl=en

Reply via email to