CouchDB
Todd Geist
todd at geistinteractive.com
Fri May 13 14:27:39 EDT 2011
Thanks for the responses.
I believe there already is a JSON library in Live Code. So that isn't the
main issue to me. The main issue is how to get CouchDB bundled into a
standalone that runs on Desktops and Mobile devices. That is the part that I
have no idea how to do. I am not even sure if it can be done. Possiblly
through an external???
Todd
On Fri, May 13, 2011 at 8:51 AM, Jeff Massung <massung at gmail.com> wrote:
> Todd,
>
> CouchDB (or Mongo, Riak, and other NoSQL alternatives) are excellent
> databases in the right situation. I haven't used on with LC, but have used
> CouchDB plenty. Their main benefits lie in A) no schema and B) replication.
> If you have no need of either, then it might be more work to get working
> than it's worth.
>
> While most NoSQL solutions use a REST API to insert, select, update, etc.
> the real trick is the JSON input and output through the HTTP protocol. So,
> what you'd need to do is write a JSON library in LC for encoding and
> decoding values. Once that's in place, everything else should be trivial.
>
> ## example encoding function... likely needs tweaked (doesn't handle
> null/nil)
> function encodeJSON pVal
> if pVal is true then
> return "true"
> elseif pVal is false then
> return "false"
> elseif isNumber(pVal) then
> return pVal
> elseif isArray(pVal) then
> local tObject = "{"
>
> repeat for each line tKey in the keys of pVal
> put quote & tKey & quote & ":" & encodeJSON pVal[tKey] & comma after
> tObject
> end repeat
>
> return tObject & "}"
> end if
>
> return quote & pVal & quote
> end encodeJSON
>
> I don't have time to try and whip together an example decode, but it would
> basically involve parsing JSON and creating either an array (from a JSON
> object) or just returning the value (since everything in LC is a string).
>
> After that it's just posting, getting, etc.
>
> Jeff M.
> _______________________________________________
> use-livecode mailing list
> use-livecode at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your
> subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode
>
Todd Geist
------------------------------
geist interactive <http://www.geistinteractive.com>
805-419-9382
More information about the use-livecode
mailing list