⚝
One Hat Cyber Team
⚝
Your IP:
216.73.216.133
Server IP:
185.119.109.197
Server:
Linux managedhosting.chostar.me 5.15.0-160-generic #170-Ubuntu SMP Wed Oct 1 10:06:56 UTC 2025 x86_64
Server Software:
Apache
PHP Version:
8.1.33
Buat File
|
Buat Folder
Eksekusi
Dir :
~
/
proc
/
self
/
root
/
usr
/
share
/
ri
/
3.0.0
/
system
/
DBM
/
View File Name :
cdesc-DBM.ri
U:RDoc::NormalClass[iI"DBM:ET@I"Object;To:RDoc::Markup::Document:@parts[o;;[S:RDoc::Markup::Heading: leveli: textI"Introduction;To:RDoc::Markup::BlankLine o:RDoc::Markup::Paragraph;[I"6The DBM class provides a wrapper to a Unix-style ;TI"J{dbm}[https://en.wikipedia.org/wiki/Dbm] or Database Manager library.;T@o; ;[I"LDbm databases do not have tables or columns; they are simple key-value ;TI"Odata stores, like a Ruby Hash except not resident in RAM. Keys and values ;TI"must be strings.;T@o; ;[I"NThe exact library used depends on how Ruby was compiled. It could be any ;TI"of the following:;T@o:RDoc::Markup::List: @type:BULLET:@items[ o:RDoc::Markup::ListItem:@label0;[o; ;[I"6The original ndbm library is released in 4.3BSD. ;TI"KIt is based on dbm library in Unix Version 7 but has different API to ;TI"-support multiple databases in a process.;To;;0;[o; ;[I"G{Berkeley DB}[https://en.wikipedia.org/wiki/Berkeley_DB] versions ;TI"G1 thru 6, also known as BDB and Sleepycat DB, now owned by Oracle ;TI"Corporation.;To;;0;[o; ;[I"PBerkeley DB 1.x, still found in 4.4BSD derivatives (FreeBSD, OpenBSD, etc).;To;;0;[o; ;[I"N{gdbm}[http://www.gnu.org/software/gdbm/], the GNU implementation of dbm.;To;;0;[o; ;[I"E{qdbm}[http://fallabs.com/qdbm/index.html], another open source ;TI"reimplementation of dbm.;T@o; ;[I"EAll of these dbm implementations have their own Ruby interfaces ;TI"8available, which provide richer (but varying) APIs.;T@S; ; i;I" Cautions;T@o; ;[I"MBefore you decide to use DBM, there are some issues you should consider:;T@o;;;;[ o;;0;[o; ;[I"HEach implementation of dbm has its own file format. Generally, dbm ;TI"Flibraries will not read each other's files. This makes dbm files ;TI"$a bad choice for data exchange.;T@o;;0;[o; ;[I"LEven running the same OS and the same dbm implementation, the database ;TI"Lfile format may depend on the CPU architecture. For example, files may ;TI"Mnot be portable between PowerPC and 386, or between 32 and 64 bit Linux.;T@o;;0;[o; ;[I"ODifferent versions of Berkeley DB use different file formats. A change to ;TI"=the OS may therefore break DBM access to existing files.;T@o;;0;[o; ;[ I"MData size limits vary between implementations. Original Berkeley DB was ;TI"Jlimited to 2GB of data. Dbm libraries also sometimes limit the total ;TI"Lsize of a key/value pair, and the total size of all the keys that hash ;TI"Oto the same value. These limits can be as little as 512 bytes. That said, ;TI"Ggdbm and recent versions of Berkeley DB do away with these limits.;T@o; ;[I"QGiven the above cautions, DBM is not a good choice for long term storage of ;TI"Mimportant data. It is probably best used as a fast and easy alternative ;TI"4to a Hash for processing large amounts of data.;T@S; ; i;I"Example;T@o:RDoc::Markup::Verbatim;[I"require 'dbm' ;TI"/db = DBM.open('rfcs', 0666, DBM::WRCREAT) ;TI"Jdb['822'] = 'Standard for the Format of ARPA Internet Text Messages' ;TI"Ndb['1123'] = 'Requirements for Internet Hosts - Application and Support' ;TI"=db['3068'] = 'An Anycast Prefix for 6to4 Relay Routers' ;TI"puts db['822'];T:@format0: @fileI"ext/dbm/dbm.c;T:0@omit_headings_from_table_of_contents_below0;0;0[ [ U:RDoc::Constant[i I"READER;TI"DBM::READER;T:public0o;;[o; ;[I"IIndicates that dbm_open() should open the database in read-only mode;T@;@t;0@t@cRDoc::NormalClass0U;[i I"WRITER;TI"DBM::WRITER;T;0o;;[o; ;[I"JIndicates that dbm_open() should open the database in read/write mode;T@;@t;0@t@@{0U;[i I"WRCREAT;TI"DBM::WRCREAT;T;0o;;[o; ;[I"LIndicates that dbm_open() should open the database in read/write mode, ;TI"/and create it if it does not already exist;T;@t;0@t@@{0U;[i I" NEWDB;TI"DBM::NEWDB;T;0o;;[o; ;[I"LIndicates that dbm_open() should open the database in read/write mode, ;TI"Kcreate it if it does not already exist, and delete all contents if it ;TI"does already exist.;T;@t;0@t@@{0U;[i I"VERSION;TI"DBM::VERSION;T;0o;;[ o; ;[I"%Identifies ndbm library version.;T@o; ;[I"Examples:;T@o;;;;[ o;;0;[o; ;[I""ndbm (4.3BSD)";To;;0;[o; ;[I"+"Berkeley DB 4.8.30: (April 9, 2010)";To;;0;[o; ;[I","Berkeley DB (unknown)" (4.4BSD, maybe);To;;0;[o; ;[I"B"GDBM version 1.8.3. 10/15/2002 (built Jul 1 2011 12:32:45)";To;;0;[o; ;[I""QDBM 1.8.78";T;@t;0@t@@{0[[I"Enumerable;To;;[ ;@t;0I"ext/dbm/dbm.c;T[[I" class;T[[;[[I"new;T@觀I" open;T@觀:protected[ [:private[ [I" instance;T[[;[([I"[];T@觀I"[]=;T@觀I" clear;T@觀I" close;T@觀I"closed?;T@觀I"delete;T@觀I"delete_if;T@觀I" each;T@觀I" each_key;T@觀I"each_pair;T@觀I"each_value;T@觀I"empty?;T@觀I" fetch;T@觀I" has_key?;T@觀I"has_value?;T@觀I" include?;T@觀I"invert;T@觀I"key;T@觀I" key?;T@觀I" keys;T@觀I"length;T@觀I"member?;T@觀I"reject;T@觀I"reject!;T@觀I"replace;T@觀I"select;T@觀I" shift;T@觀I" size;T@觀I" store;T@觀I" to_a;T@觀I"to_hash;T@觀I"update;T@觀I"value?;T@觀I"values;T@觀I"values_at;T@觀;[ [;[ [ [U:RDoc::Context::Section[i 0o;;[ ;0;0[@t@tcRDoc::TopLevel