# \[ANN\] Object Database Access v 1.0 released

**URL:** <https://rubytalk.org/t/ann-object-database-access-v-1-0-released/23441>\
**Category:** ruby-talk\
**Created:** [20 December 2005 10:27 UTC](https://rubytalk.org/t/ann-object-database-access-v-1-0-released/23441 "2005-12-20T10:27:15Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Hannes\_Wyss1](https://avatars.discourse-cdn.com/v4/letter/h/ea666f/32.png) [@Hannes\_Wyss1](https://rubytalk.org/u/Hannes_Wyss1)\
**Post date:** [20 December 2005 10:27 UTC](https://rubytalk.org/t/ann-object-database-access-v-1-0-released/23441/1 "2005-12-20T10:27:15Z")

</div>

Hi all!

Here comes yet another way to map Ruby-Objects to a Relational Database:

ODBA is an unintrusive Object Cache system. It adresses the crosscutting  
concern of object storage by disconnecting and serializing objects into  
storage. All disconnected connections are replaced by instances of  
ODBA::Stub, thus enabling transparent object-loading.

ODBA supports:  
\* transparent loading of connected objects  
\* index-vectors  
\* transactions  
\* transparently fetches Hash-Elements without loading the entire Hash

An Example:  
include 'odba'

#connect default storage manager to a relational database  
ODBA.storage.dbi = ODBA::ConnectionPool.new('DBI::pg::database', 'user', 'pw')

class Counter  
&nbsp;&nbsp;include ODBA::Persistable  
&nbsp;&nbsp;def initialize  
&nbsp;&nbsp;&nbsp;&nbsp;@pos = 0  
&nbsp;&nbsp;end  
&nbsp;&nbsp;def up  
&nbsp;&nbsp;&nbsp;&nbsp;@pos += 1  
&nbsp;&nbsp;&nbsp;&nbsp;self.odba\_store  
&nbsp;&nbsp;&nbsp;&nbsp;@pos  
&nbsp;&nbsp;end  
&nbsp;&nbsp;def down  
&nbsp;&nbsp;&nbsp;&nbsp;@pos -= 1  
&nbsp;&nbsp;&nbsp;&nbsp;self.odba\_store  
&nbsp;&nbsp;&nbsp;&nbsp;@pos  
&nbsp;&nbsp;end  
end

Thanks in advance for any feedback that comes my way!

Cheers  
Hannes

> **···**
>
> --  
> Mit freundlichen Grüssen / best regards
> 
> Hannes Wyss  
> Konzeption & Entwicklung
> 
> pub 1024D/60312B5F 2003-10-09 Hannes Wyss \<[hwyss@ywesee.com](mailto:hwyss@ywesee.com)\>  
> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Key fingerprint = 82D1 90C7 3F3D 93DC F715 4F8B 987A 628E 6031 2B5F
> 
> +41 43 540 05 49
> 
> [www.ywesee.com](http://www.ywesee.com) \> intellectual capital connected \> [www.oddb.org](http://www.oddb.org)

---

<div class="post-metadata">

**Author:** ![Hannes\_Wyss1](https://avatars.discourse-cdn.com/v4/letter/h/ea666f/32.png) [@Hannes\_Wyss1](https://rubytalk.org/u/Hannes_Wyss1)\
**Post date:** [20 December 2005 10:48 UTC](https://rubytalk.org/t/ann-object-database-access-v-1-0-released/23441/2 "2005-12-20T10:48:40Z")

</div>

Oops. Where can you get it?

raa:  
[http://raa.ruby-lang.org/project/odba/](http://raa.ruby-lang.org/project/odba/)  
documentation:  
[http://odba.ywesee.com/](http://odba.ywesee.com/)  
download:  
[http://odba.ywesee.com/](http://odba.ywesee.com/)  
scm:  
[http://scm.ywesee.com/?p=odba](http://scm.ywesee.com/?p=odba)

Hannes

> **···**
>
> --  
> Mit freundlichen Grüssen / best regards
> 
> Hannes Wyss  
> Konzeption & Entwicklung
> 
> pub 1024D/60312B5F 2003-10-09 Hannes Wyss \<[hwyss@ywesee.com](mailto:hwyss@ywesee.com)\>  
> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Key fingerprint = 82D1 90C7 3F3D 93DC F715 4F8B 987A 628E 6031 2B5F
> 
> +41 43 540 05 49
> 
> [www.ywesee.com](http://www.ywesee.com) \> intellectual capital connected \> [www.oddb.org](http://www.oddb.org)

---

<div class="post-metadata">

**Author:** ![Lou\_Vanek](https://avatars.discourse-cdn.com/v4/letter/l/c77e96/32.png) [@Lou\_Vanek](https://rubytalk.org/u/Lou_Vanek)\
**Post date:** [20 December 2005 14:19 UTC](https://rubytalk.org/t/ann-object-database-access-v-1-0-released/23441/3 "2005-12-20T14:19:44Z")

</div>

Interesting.

How would you do a search?  
For example, how would you find all Counters with a pos \> 10 but not 13?  
Is the search done centrally, or must you download all Counters before  
you can do the search?

Hannes Wyss wrote:

> **···**
>
> > Hi all!
> > 
> > Here comes yet another way to map Ruby-Objects to a Relational Database:
> > 
> > ODBA is an unintrusive Object Cache system. It adresses the crosscutting concern of object storage by disconnecting and serializing objects into storage. All disconnected connections are replaced by instances of ODBA::Stub, thus enabling transparent object-loading.
> > 
> > ODBA supports: \* transparent loading of connected objects  
> > \* index-vectors  
> > \* transactions  
> > \* transparently fetches Hash-Elements without loading the entire Hash
> > 
> > An Example:  
> > include 'odba'
> > 
> > #connect default storage manager to a relational database ODBA.storage.dbi = ODBA::ConnectionPool.new('DBI::pg::database', 'user', 'pw')
> > 
> > class Counter include ODBA::Persistable  
> > &nbsp;&nbsp;def initialize  
> > &nbsp;&nbsp;&nbsp;&nbsp;@pos = 0  
> > &nbsp;&nbsp;end  
> > &nbsp;&nbsp;def up  
> > &nbsp;&nbsp;&nbsp;&nbsp;@pos += 1  
> > &nbsp;&nbsp;&nbsp;&nbsp;self.odba\_store  
> > &nbsp;&nbsp;&nbsp;&nbsp;@pos  
> > &nbsp;&nbsp;end  
> > &nbsp;&nbsp;def down  
> > &nbsp;&nbsp;&nbsp;&nbsp;@pos -= 1  
> > &nbsp;&nbsp;&nbsp;&nbsp;self.odba\_store  
> > &nbsp;&nbsp;&nbsp;&nbsp;@pos  
> > &nbsp;&nbsp;end  
> > end
> > 
> > Thanks in advance for any feedback that comes my way!
> > 
> > Cheers Hannes

---

<div class="post-metadata">

**Author:** ![Hannes\_Wyss1](https://avatars.discourse-cdn.com/v4/letter/h/ea666f/32.png) [@Hannes\_Wyss1](https://rubytalk.org/u/Hannes_Wyss1)\
**Post date:** [20 December 2005 14:58 UTC](https://rubytalk.org/t/ann-object-database-access-v-1-0-released/23441/4 "2005-12-20T14:58:11Z")

</div>

Lou

> How would you do a search?

I'll have to eat my own example here: we've only ever been interested in  
string search - i.e. find all users whose last name begins with 'Van':

\<example\>

require 'odba'  
require 'odba/index\_definition'

class User  
&nbsp;&nbsp;attr\_accessor :first\_name, :last\_name  
&nbsp;&nbsp;include ODBA::Persistable  
&nbsp;&nbsp;def initialize(first\_name, last\_name)  
&nbsp;&nbsp;&nbsp;&nbsp;@first\_name = first\_name  
&nbsp;&nbsp;&nbsp;&nbsp;@last\_name = last\_name  
&nbsp;&nbsp;end  
end

index\_def = ODBA::IndexDefinition.new  
index\_def.index\_name = 'users\_by\_last\_name'  
index\_def.origin\_klass = 'User'  
index\_def.target\_klass = 'User'  
index\_def.resolve\_search\_term = 'last\_name.downcase'

ODBA.storage.dbi = DBI.connect('DBI:pg:test', 'test', '')  
ODBA.cache.create\_index(index\_def, Object)

composer = User.new('Ludwig', 'Van Beethoven')  
composer.odba\_store  
painter = User.new('Vincent', 'Van Gogh')  
painter.odba\_store  
scientist = User.new('Albert', 'Einstein')  
scientist.odba\_store

ODBA.cache.retrieve\_from\_index('users\_by\_last\_name', 'van')  
&nbsp;&nbsp;-\> [composer, painter]

\</example\>

> For example, how would you find all Counters with a pos \> 10 but not 13?  
> Is the search done centrally, or must you download all Counters before  
> you can do the search?

The numerical Counter#pos case could be done, but is not implemented..

Hannes

> **···**
>
> On Tue, Dec 20, 2005 at 11:19:44PM +0900, Lou Vanek wrote:
> 
> --  
> Mit freundlichen Grüssen / best regards
> 
> Hannes Wyss  
> Konzeption & Entwicklung
> 
> pub 1024D/60312B5F 2003-10-09 Hannes Wyss \<hwyss@ywesee.com\>  
> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Key fingerprint = 82D1 90C7 3F3D 93DC F715 4F8B 987A 628E 6031 2B5F
> 
> +41 43 540 05 49
> 
> [www.ywesee.com](http://www.ywesee.com) \> intellectual capital connected \> [www.oddb.org](http://www.oddb.org)

---

<div class="post-metadata">

**Author:** ![Lou\_Vanek](https://avatars.discourse-cdn.com/v4/letter/l/c77e96/32.png) [@Lou\_Vanek](https://rubytalk.org/u/Lou_Vanek)\
**Post date:** [20 December 2005 15:58 UTC](https://rubytalk.org/t/ann-object-database-access-v-1-0-released/23441/5 "2005-12-20T15:58:53Z")

</div>

Thanks.

Hannes Wyss wrote:

> **···**
>
> > Lou
> > 
> > On Tue, Dec 20, 2005 at 11:19:44PM +0900, Lou Vanek wrote:
> > 
> > > How would you do a search?
> > 
> > I'll have to eat my own example here: we've only ever been interested in  
> > string search - i.e. find all users whose last name begins with 'Van':
> > 
> > \<example\>
> > 
> > require 'odba'  
> > require 'odba/index\_definition'
> > 
> > class User  
> > &nbsp;&nbsp;attr\_accessor :first\_name, :last\_name  
> > &nbsp;&nbsp;include ODBA::Persistable  
> > &nbsp;&nbsp;def initialize(first\_name, last\_name)  
> > &nbsp;&nbsp;&nbsp;&nbsp;@first\_name = first\_name  
> > &nbsp;&nbsp;&nbsp;&nbsp;@last\_name = last\_name  
> > &nbsp;&nbsp;end  
> > end
> > 
> > index\_def = ODBA::IndexDefinition.new  
> > index\_def.index\_name = 'users\_by\_last\_name'  
> > index\_def.origin\_klass = 'User'  
> > index\_def.target\_klass = 'User'  
> > index\_def.resolve\_search\_term = 'last\_name.downcase'
> > 
> > ODBA.storage.dbi = DBI.connect('DBI:pg:test', 'test', '')  
> > ODBA.cache.create\_index(index\_def, Object)
> > 
> > composer = User.new('Ludwig', 'Van Beethoven')  
> > composer.odba\_store  
> > painter = User.new('Vincent', 'Van Gogh')  
> > painter.odba\_store  
> > scientist = User.new('Albert', 'Einstein')  
> > scientist.odba\_store
> > 
> > ODBA.cache.retrieve\_from\_index('users\_by\_last\_name', 'van') -\> [composer, painter]
> > 
> > \</example\>
> > 
> > > For example, how would you find all Counters with a pos \> 10 but not 13?  
> > > Is the search done centrally, or must you download all Counters before  
> > > you can do the search?
> > 
> > The numerical Counter#pos case could be done, but is not implemented..
> > 
> > Hannes
