Forum: Ruby Object Database Access v 1.0 released

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
94a54a84c17011ceb80a00119717bf6b?d=identicon&s=25 Hannes Wyss (Guest)
on 2005-12-20 11:29
(Received via mailing list)
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
  def initialize
    @pos = 0
  end
  def up
    @pos += 1
    self.odba_store
    @pos
  end
  def down
    @pos -= 1
    self.odba_store
    @pos
  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>
     Key fingerprint = 82D1 90C7 3F3D 93DC F715  4F8B 987A 628E 6031
2B5F

+41 43 540 05 49

www.ywesee.com > intellectual capital connected > www.oddb.org
94a54a84c17011ceb80a00119717bf6b?d=identicon&s=25 Hannes Wyss (Guest)
on 2005-12-20 11:50
(Received via mailing list)
Oops. Where can you get it?

raa:
http://raa.ruby-lang.org/project/odba/
documentation:
http://odba.ywesee.com/
download:
http://odba.ywesee.com/
scm:
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>
     Key fingerprint = 82D1 90C7 3F3D 93DC F715  4F8B 987A 628E 6031
2B5F

+41 43 540 05 49

www.ywesee.com > intellectual capital connected > www.oddb.org
Ce60c4f78a63b0695e4dafc4bd7964f7?d=identicon&s=25 Lou Vanek (Guest)
on 2005-12-20 15:21
(Received via mailing list)
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?
94a54a84c17011ceb80a00119717bf6b?d=identicon&s=25 Hannes Wyss (Guest)
on 2005-12-20 16:00
(Received via mailing list)
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
  attr_accessor :first_name, :last_name
  include ODBA::Persistable
  def initialize(first_name, last_name)
    @first_name = first_name
    @last_name = last_name
  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

--
Mit freundlichen Grüssen / best regards

Hannes Wyss
Konzeption & Entwicklung

pub  1024D/60312B5F 2003-10-09 Hannes Wyss <hwyss@ywesee.com>
     Key fingerprint = 82D1 90C7 3F3D 93DC F715  4F8B 987A 628E 6031
2B5F

+41 43 540 05 49

www.ywesee.com > intellectual capital connected > www.oddb.org
Ce60c4f78a63b0695e4dafc4bd7964f7?d=identicon&s=25 Lou Vanek (Guest)
on 2005-12-20 17:00
(Received via mailing list)
Thanks.
This topic is locked and can not be replied to.