CouchDB

Andre Garzia andre at andregarzia.com
Fri May 13 16:08:29 EDT 2011


Todd,

You should not try to bundle CouchDB.

CouchDB relies on Erlang OTB and friends, it is not something like SQLite
that you can embed. If you want some embedable solution look at Googles
LiveTable thing or some other key/value store but even so, those embedable
solutions will not present you with a REST interface, you will probably need
an external to talk to them. CouchDB and similar NoSQL are not built to be
used like components that you can simply carry around with your software,
just like MySQL and PostgreSQL, they are full servers. Packaging full
servers like that is not wise even though there are MAMP and LAMP pre
packaged solutions out there. You might be able to build them to a self
contained folder and carry all the needed libs or link static and whatever
but still, that was not what it was designed to do. If you want embedable
you'd better go with SQLite, BDB or Valentina and then build a schemaless
stuff on top of it.

Andre

On Fri, May 13, 2011 at 8:27 AM, Todd Geist <todd at geistinteractive.com>wrote:

> 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
> _______________________________________________
> 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
>



-- 
http://www.andregarzia.com All We Do Is Code.



More information about the use-livecode mailing list