Home

Awesome

pharo-cozodb

A CozoDB wrapper for Pharo Smalltalk

Unit Tests Coverage Status

Pharo 11

CozoDB

CozoDB is

Tested (developed) on Win10 & Ubuntu 23.04, fully wrapping the (very minimalistic) C API. More examples / tests incoming.

Dependencies

Load with:

Metacello new
  repository: 'github://Mr-Dispatch/pharo-cozodb/src';
  baseline: 'CozoDB';
  load.

Examples

A simple transient query

session := CDBSession openInMemory.
result := session runImmutableQuery: '?[column, another] <- [[4,"a"],[5,"b"],[6,"c"]]'.
(result columnNamed: #another) inspect.
session close.

Creating a relation, putting in some data and querying again

session := CDBSession openInMemory.

"Create a relation and insert some data"
session 
  runMutableQuery: ':create superclass {sub, super}';
	runMutableQuery: '?[sub, super] <- [[''UndefinedObject'', ''Object'']] :put superclass {sub, super }';
	runMutableQuery: '?[sub, super] <- [[''TestCase'', ''Object'']] :put superclass {sub, super }'.

"Query the relation (table)"	
result := self session runImmutableQuery: '?[subclass, superclass] := *superclass[subclass, superclass]'.
result inspect

esssion close.