Class BDB1::Common
In: bdb1.rb
Parent: Object
Methods
append    both?    byteswapped?    clear    close    create    db_append    db_close    db_del    db_get    db_put    delete    delete_if    duplicates    each    each_dup    each_dup_value    each_key    each_pair    each_value    empty?    fetch    get    get_byteswapped    has_both?    has_key?    has_value?    include?    index    indexes    key?    keys    length    member?    new    open    put    reject    reject!    reverse_each    reverse_each_key    reverse_each_pair    reverse_each_value    self    self    size    store    to_a    to_hash    truncate    type    type    value?    values   
Public Class methods
type([hash])

create a new temporary db file, populated with the given object

type([bdb1])

same than type[hash]

create([name, flags, mode, options])

open the database

new([name, flags, mode, options])

same than create

open([name, flags, mode, options])

same than create

Public Instance methods
self([key])

Returns the value corresponding the key

db_get(key [, flags])

Returns the value correspondind the key

get(key [, flags])

same than db_get

fetch(key [, flags])

same than db_get

self([key] = value)

Stores the value associating with key

return value

db_put(key, value [, flags])

Stores the value associating with key

Return the value correspondind the key

flags can have the value DBD::NOOVERWRITE, in this case it will return nil if the specified key exist, otherwise true

put(key, value [, flags])

same than db_put

store(key, value [, flags])

same than db_put

append(key, value)

Append the value associating with key

db_append(key, value)

same than append

byteswapped?()

Return if the underlying database is in host order

get_byteswapped()

same than byteswapped?

close([flags])

Closes the file.

db_close([flags])

same than close

delete(key)

Removes the association from the key.

It return the object deleted or nil if the specified key don't exist.

db_del(key)

same than delete

delete_if([set]) {|key, value| ...}

Deletes associations if the evaluation of the block returns true.

Only for BDB1::Btree

reject!([set]) {|key, value| ...}

same than delete_if

duplicates(key [, assoc = true])

Return an array of all duplicate associations for key

if assoc is false return only the values.

Only for BDB1::Btree

each() {|key, value| ...}

Iterates over associations.

each_pair() {|key, value| ...}

same than each { |key, value| ... }

each_dup(key) {|key, value| ...}

Iterates over each duplicate associations for key

Only for BDB1::Btree

each_dup_value(key) {|value| ...}

Iterates over each duplicate values for key

Only for BDB1::Btree

each_key() {|key| ...}

Iterates over keys.

each_value() {|value| ...}

Iterates over values.

empty?()

Returns true if the database is empty.

has_key?(key)

Returns true if the association from the key exists.

key?(key)

same than has_key?

include?(key)

same than has_key?

member?(key)

same than has_key?

has_both?(key, value)

Returns true if the association from key is value

both?(key, value)

same than has_both?

has_value?(value)

Returns true if the association to the value exists.

value?(value)

same than has_value?

index(value)

Returns the first key associated with value

indexes(value1, value2, )

Returns the keys associated with value1, value2, ...

keys()

Returns the array of the keys in the database

length()

Returns the number of association in the database.

size()

same than length

reject() {|key, value| ...}

Create an hash without the associations if the evaluation of the block returns true.

reverse_each() {|key, value| ...}

Iterates over associations in reverse order

Only for BDB1::Btree

reverse_each_pair() {|key, value| ...}

same than reverse_each { |key, value| ... }

reverse_each_key() {|key| ...}

Iterates over keys in reverse order

Only for BDB1::Btree

reverse_each_value() {|value| ...}

Iterates over values in reverse order.

Only for BDB1::Btree

to_a()

Return an array of all associations [key, value]

to_hash()

Return an hash of all associations {key => value}

truncate()

Empty a database

clear()

same than truncate

values()

Returns the array of the values in the database.