So langsam sind es zuviele Parameter fuer DB in Env.
This commit is contained in:
parent
0078170a23
commit
4cf0388c5b
|
@ -14,8 +14,8 @@ module SBDB
|
||||||
def bdb_object() @db end
|
def bdb_object() @db end
|
||||||
def sync() @db.sync end
|
def sync() @db.sync end
|
||||||
def close( f = nil) @db.close f || 0 end
|
def close( f = nil) @db.close f || 0 end
|
||||||
def []( k) @db.get nil, k, nil, 0 end
|
def []( k) @db.get nil, k.nil? ? nil : k.to_s, nil, 0 end
|
||||||
def []=( k, v) @db.put nil, k, v, 0 end
|
def []=( k, v) @db.put nil, k.nil? ? nil : k.to_s, v.nil? ? nil : v.to_s, 0 end
|
||||||
def cursor( &e) Cursor.new self, &e end
|
def cursor( &e) Cursor.new self, &e end
|
||||||
|
|
||||||
class << self
|
class << self
|
||||||
|
@ -59,47 +59,41 @@ module SBDB
|
||||||
end
|
end
|
||||||
|
|
||||||
class Unknown < DB
|
class Unknown < DB
|
||||||
def self.new *p, &e
|
def self.new file, name, *p, &e
|
||||||
db = super *p[0...2], UNKNOWN, *p[2..-1]
|
db = super file, name, UNKNOWN, *p[2..-1]
|
||||||
case db.bdb_object.get_type
|
case db.bdb_object.get_type
|
||||||
when BTREE then Btree.new *p
|
when BTREE then Btree.new file, name, *p
|
||||||
when HASH then Hash.new *p
|
when HASH then Hash.new file, name *p
|
||||||
when RECNO then Recno.new *p
|
when RECNO then Recno.new file, name, *p
|
||||||
when QUEUE then Queue.new *p
|
when QUEUE then Queue.new file, name, *p
|
||||||
else super *p[0...2], UNKNOWN, *p[2..-1], &e
|
else super file, name, UNKNOWN, *p, &e
|
||||||
end
|
end
|
||||||
ensure db.close
|
ensure db.close
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
class Btree < DB
|
class Btree < DB
|
||||||
def self.new *p, &e
|
def self.new file, name = nil, *p, &e
|
||||||
super *p[0...2], BTREE, *p[2..-1], &e
|
super file, name, BTREE, *p, &e
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
class Hash < DB
|
class Hash < DB
|
||||||
def self.new *p, &e
|
def self.new file, name = nil, *p, &e
|
||||||
super *p[0...2], HASH, *p[2..-1], &e
|
super file, name, HASH, *p, &e
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
class Recno < DB
|
class Recno < DB
|
||||||
def self.new *p, &e
|
def self.new file, name = nil, *p, &e
|
||||||
super *p[0...2], RECNO, *p[2..-1], &e
|
super file, name, RECNO, *p, &e
|
||||||
end
|
end
|
||||||
|
|
||||||
def []( k) super k.to_s end
|
|
||||||
def []=( k, v) super k.to_s end
|
|
||||||
end
|
end
|
||||||
Array = Recno
|
Array = Recno
|
||||||
|
|
||||||
class Queue < DB
|
class Queue < DB
|
||||||
def self.new *p, &e
|
def self.new file, name = nil, *p, &e
|
||||||
super *p[0...2], QUEUE, *p[2..-1], &e
|
super file, name, QUEUE, *p, &e
|
||||||
end
|
end
|
||||||
|
|
||||||
def []( k) super k.to_s end
|
|
||||||
def []=( k, v) super k.to_s end
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue