DB_File-DB_Database
view release on metacpan or search on metacpan
DB_Database.html view on Meta::CPAN
$table->append_record_hash('jimmy', "age" => 25,
"msg" => 'Nothing is easy!');</PRE>
<P>
<H2><A NAME="using index">Using Index</A></H2>
<P>Index file is stored in DB_File BTREE. Once created, all index files will be automatically
opened when open the database file, and updated automatically when writing the database file.</P>
<DL>
<DT><STRONG><A NAME="item_create_index">create_index</A></STRONG><BR>
<DD>
Create index file for one field. Default permits of the index file is 0640. 'name' is the index
tag name, 'key' is the formula for indexing. For example:
<PRE>
'key' => 'Age' # index by the age, from young to old
'key' => '-Age' # index by the age, from old to young
'key' => '-Age(3)+Name' # index by the age(up to 999),then name; from old to young,then from A to Z
'key' => '-Age(3)+-Name' # index by the age(up to 999),then name; from old to young,then from Z to A</PRE>
<P>'Age(3)' is similar to 'substr(Age,0,3)', only the length of the last field name appeared in
the 'key' can be ommited. '+-' CAN'T be subsituded by '-'.</P>
<PRE>
# Index File name will be dbexample_indexA
print $table->create_index( 'name' => 'indexA' ,
lib/DB_File/DB_Database.pm view on Meta::CPAN
=head2 Using Index
=over 4
Index file is stored in DB_File BTREE. Once created, all index files will be automatically
opened when open the database file, and updated automatically when writing the database file.
=item create_index
Create index file for one field. Default permits of the index file is 0640. 'name' is the index
tag name, 'key' is the formula for indexing. For example:
'key' => 'Age' # index by the age, from young to old
'key' => '-Age' # index by the age, from old to young
'key' => '-Age(3)+Name' # index by the age(up to 999),then name; from old to young,then from A to Z
'key' => '-Age(3)+-Name' # index by the age(up to 999),then name; from old to young,then from Z to A
'Age(3)' is similar to 'substr(Age,0,3)', only the length of the last field name appeared in
the 'key' can be ommited. '+-' CAN'T be subsituded by '-'.
# Index File name will be dbexample_indexA
( run in 0.367 second using v1.01-cache-2.11-cpan-3cd7ad12f66 )