Hi Torsten,

This sounds very interesting.

I tried to play with it on Mac, but I got a bit stuck. Here is what I did:

- I downloaded the UnQLite sources from:
http://unqlite.org/db/unqlite-db-20130825-116.zip

- In that folder I did:
gcc -m32 -c unqlite.c
gcc -m32 -dynamiclib -o unqlite.dylib unqlite.o

- I then copied the unqlite.dylib file in the plugins folder:
Pharo.app/Contents/MacOS/Plugins

- I started a Pharo 4 image with the corresponding VM

- I loaded the stable version of PUnQLite from the ConfigurationBrowser

- I executed without errors the code you mentioned:
|db|
db := PqDatabase open: 'comments.db'.
db disableAutoCommit.
db transact: [
Object subclasses do: [:cls | | key |
    key := cls asString.
    db at: key put: cls comment ]
].
db close.

==> However I do not get a comments.db file/folder, and the Database
Browser does not show anything.

Am I doing something wrong?

Cheers,
Doru


On Thu, Jan 29, 2015 at 9:20 AM, Torsten Bergmann <[email protected]> wrote:

> Hi,
>
> are you in need for really simple out of image persistency?
>
> If you like to use a small RDBMS solution with Pharo then there is the
> embeddable SQLite
> shared library and NBSQLite3 project [1] to access it. Combine it with
> Glorp [2] and you do
> not have to fight too much with SQL.
>
> On the other end of persistency world there are the so called "NoSQL
> databases" and beside
> Mongo and all the others that require special setup etc. there is this
> wonderful small UnQLite
> embeddable database [3] that similar to SQlite world only requires a
> simple library.
>
> Thanks to Masashi Umezawa there is a nice wrapper for Pharo already to
> access this
> tiny embeddable NoSQL database called "PUnQLite" [4] and [5], also
> including access to
> the Jx9 machinery of UnQLite. It is really cool that he made this
> available.
>
> This week I updated "PUnQLite" a little bit:
>    - refactored the Native boost wrapper for UnQLite (using shared pools,
> ...)
>    - documented classes
>    - added a help topic
>    - fixed a bug in cursors when accessing the keys in an empty database
>    - and finally added a small spec based tool to work with a database
> file (see attached screenshot)
>      One can use it to open an unqlite database, show the key value pairs
> and remove or add entries.
>
> If you are in latest Pharo 4 already you can load all of that right from
> the config browser. Be aware
> that you need the external unqlite shared library which is downloaded and
> extracted into a folder
> "pharo-vm" when loading the config.
>
> For instance on Windows it automagically downloads a file
> "pharo-vm/unqlite.dll" below your
> image directory and you just have to copy this shared library file to the
> folder where your
> VM (Pharo.exe) resides. Havent tried on other OS platforms.
>
> From the Pharo side using the UnQLite database basically works like having
> some kind
> "external dictionary" in a database file. Just run that in a workspace:
>
> |db|
> db := PqDatabase open: 'comments.db'.
> db disableAutoCommit.
> db transact: [
> Object subclasses do: [:cls | | key |
>     key := cls asString.
>     db at: key put: cls comment ]
> ].
> db close.
>
> Then open the "Database Browser" from the world menu and open the
> "comments.db" file.
> You can browse the keys and values, remove entries or add new. A filter
> for the keys
> is also included. Nothing fancy but hope you like it or find it usable.
>
> Couldnt make it to PharoConf 2015 but I hope all participants enjoy their
> time there.
> Keep the others updated by using the #pharodays2015 on Twitter. Have fun!
>
> Bye
> T.
>
>
> [1]
> http://lists.pharo.org/pipermail/pharo-dev_lists.pharo.org/2015-January/104720.html
> [2]
> http://lists.pharo.org/pipermail/pharo-users_lists.pharo.org/2015-January/015809.html
> [3] http://unqlite.org/
> [4] https://github.com/mumez/PunQLite
> [5] http://smalltalkhub.com/#!/~MasashiUmezawa/PunQLite




-- 
www.tudorgirba.com

"Every thing has its own flow"

Reply via email to