⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 ch14_01.htm

📁 By Tom Christiansen and Nathan Torkington ISBN 1-56592-243-3 First Edition, published August 1998
💻 HTM
📖 第 1 页 / 共 2 页
字号:
HREF="#ch14-pgfId-1000004415">5</A>]</P></TD></TR><TRCLASS="row"VALIGN="TOP"><TDCLASS="entry"ROWSPAN="1"COLSPAN="1"><PCLASS="para">Builds ok on Windows</P></TD><TDCLASS="entry"ROWSPAN="1"COLSPAN="1"><PCLASS="para">N/A</P></TD><TDCLASS="entry"ROWSPAN="1"COLSPAN="1"><PCLASS="para">yes</P></TD><TDCLASS="entry"ROWSPAN="1"COLSPAN="1"><PCLASS="para">yes</P></TD><TDCLASS="entry"ROWSPAN="1"COLSPAN="1"><PCLASS="para">yes[<ACLASS="footnote"HREF="#ch14-pgfId-1000004419">6</A>]</P></TD></TR><TRCLASS="row"VALIGN="TOP"><TDCLASS="entry"ROWSPAN="1"COLSPAN="1"><PCLASS="para">Code size</P></TD><TDCLASS="entry"ROWSPAN="1"COLSPAN="1"><PCLASS="para">[<ACLASS="footnote"HREF="#ch14-pgfId-1000004432">7</A>]</P></TD><TDCLASS="entry"ROWSPAN="1"COLSPAN="1"><PCLASS="para">small</P></TD><TDCLASS="entry"ROWSPAN="1"COLSPAN="1"><PCLASS="para">big</P></TD><TDCLASS="entry"ROWSPAN="1"COLSPAN="1"><PCLASS="para">big[<ACLASS="footnote"HREF="#ch14-pgfId-1000004443">8</A>]</P></TD></TR><TRCLASS="row"VALIGN="TOP"><TDCLASS="entry"ROWSPAN="1"COLSPAN="1"><PCLASS="para">Disk usage</P></TD><TDCLASS="entry"ROWSPAN="1"COLSPAN="1"><PCLASS="para">[<ACLASS="footnote"HREF="#ch14-pgfId-1000004432">7</A>]</P></TD><TDCLASS="entry"ROWSPAN="1"COLSPAN="1"><PCLASS="para">small</P></TD><TDCLASS="entry"ROWSPAN="1"COLSPAN="1"><PCLASS="para">big</P></TD><TDCLASS="entry"ROWSPAN="1"COLSPAN="1"><PCLASS="para">ok</P></TD></TR><TRCLASS="row"VALIGN="TOP"><TDCLASS="entry"ROWSPAN="1"COLSPAN="1"><PCLASS="para">Speed</P></TD><TDCLASS="entry"ROWSPAN="1"COLSPAN="1"><PCLASS="para">[<ACLASS="footnote"HREF="#ch14-pgfId-1000004432">7</A>]</P></TD><TDCLASS="entry"ROWSPAN="1"COLSPAN="1"><PCLASS="para">slow</P></TD><TDCLASS="entry"ROWSPAN="1"COLSPAN="1"><PCLASS="para">ok</P></TD><TDCLASS="entry"ROWSPAN="1"COLSPAN="1"><PCLASS="para">fast</P></TD></TR><TRCLASS="row"VALIGN="TOP"><TDCLASS="entry"ROWSPAN="1"COLSPAN="1"><PCLASS="para">Block size limits</P></TD><TDCLASS="entry"ROWSPAN="1"COLSPAN="1"><PCLASS="para">4k</P></TD><TDCLASS="entry"ROWSPAN="1"COLSPAN="1"><PCLASS="para">1k[<ACLASS="footnote"HREF="#ch14-pgfId-1000004447">9</A>]</P></TD><TDCLASS="entry"ROWSPAN="1"COLSPAN="1"><PCLASS="para">none</P></TD><TDCLASS="entry"ROWSPAN="1"COLSPAN="1"><PCLASS="para">none</P></TD></TR><TRCLASS="row"VALIGN="TOP"><TDCLASS="entry"ROWSPAN="1"COLSPAN="1"><PCLASS="para">Byte-order independent</P></TD><TDCLASS="entry"ROWSPAN="1"COLSPAN="1"><PCLASS="para">no</P></TD><TDCLASS="entry"ROWSPAN="1"COLSPAN="1"><PCLASS="para">no</P></TD><TDCLASS="entry"ROWSPAN="1"COLSPAN="1"><PCLASS="para">no</P></TD><TDCLASS="entry"ROWSPAN="1"COLSPAN="1"><PCLASS="para">yes</P></TD></TR><TRCLASS="row"VALIGN="TOP"><TDCLASS="entry"ROWSPAN="1"COLSPAN="1"><PCLASS="para">User-defined sort order</P></TD><TDCLASS="entry"ROWSPAN="1"COLSPAN="1"><PCLASS="para">no</P></TD><TDCLASS="entry"ROWSPAN="1"COLSPAN="1"><PCLASS="para">no</P></TD><TDCLASS="entry"ROWSPAN="1"COLSPAN="1"><PCLASS="para">no</P></TD><TDCLASS="entry"ROWSPAN="1"COLSPAN="1"><PCLASS="para">yes</P></TD></TR><TRCLASS="row"VALIGN="TOP"><TDCLASS="entry"ROWSPAN="1"COLSPAN="1"><PCLASS="para">Partial key lookups</P></TD><TDCLASS="entry"ROWSPAN="1"COLSPAN="1"><PCLASS="para">no</P></TD><TDCLASS="entry"ROWSPAN="1"COLSPAN="1"><PCLASS="para">no</P></TD><TDCLASS="entry"ROWSPAN="1"COLSPAN="1"><PCLASS="para">no</P></TD><TDCLASS="entry"ROWSPAN="1"COLSPAN="1"><PCLASS="para">yes<ACLASS="indexterm"NAME="ch14-idx-1000004913-0"></A></P></TD></TR></TBODY></TABLE><BLOCKQUOTECLASS="footnote"><DIVCLASS="footnote"><PCLASS="para"><ACLASS="footnote"NAME="ch14-pgfId-1000004358">[1]</A> Using GPLed code in your program places restrictions upon you. See <ACLASS="systemitem.url"HREF="http://www.gnu.org">www.gnu.org</A> for more details.</P></DIV><DIVCLASS="footnote"><PCLASS="para"><ACLASS="footnote"NAME="ch14-pgfId-1000004363">[2]</A> See the DB_File library method. Requires symbolic links.</P></DIV><DIVCLASS="footnote"><PCLASS="para"><ACLASS="footnote"NAME="ch14-pgfId-1000004367">[3]</A> On mixed-universe machines, this may be in the BSD compatibility library, which is often shunned.</P></DIV><DIVCLASS="footnote"><PCLASS="para"><ACLASS="footnote"NAME="ch14-pgfId-1000004372">[4]</A> Except for free Unix ports like Linux, FreeBSD, OpenBSD, and NetBSD.</P></DIV><DIVCLASS="footnote"><PCLASS="para"><ACLASS="footnote"NAME="ch14-pgfId-1000004415">[5]</A> Providing you have an ANSI C compiler.</P></DIV><DIVCLASS="footnote"><PCLASS="para"><ACLASS="footnote"NAME="ch14-pgfId-1000004419">[6]</A> Prior to unification in 5.005, several divergent versions of Perl on Windows systems were widely available, including the standard port built from the normal Perl distribution and several proprietary ports. Like most CPAN modules, DB builds only on the standard port.</P></DIV><DIVCLASS="footnote"><PCLASS="para"><ACLASS="footnote"NAME="ch14-pgfId-1000004432">[7]</A> Depends on how much your vendor has tweaked it.</P></DIV><DIVCLASS="footnote"><PCLASS="para"><ACLASS="footnote"NAME="ch14-pgfId-1000004443">[8]</A> Can be reduced if you compile for one access method.</P></DIV><DIVCLASS="footnote"><PCLASS="para"><ACLASS="footnote"NAME="ch14-pgfId-1000004447">[9]</A> By default, but can be redefined (at the expense of compatibility with older files).</P></DIV></BLOCKQUOTE><PCLASS="para"><ACLASS="indexterm"NAME="ch14-idx-1000004912-0"></A><ACLASS="indexterm"NAME="ch14-idx-1000004912-1"></A><ACLASS="indexterm"NAME="ch14-idx-1000004912-2"></A><ACLASS="indexterm"NAME="ch14-idx-1000004912-3"></A>NDBM comes with most BSD-derived machines. GDBM is a GNU DBM implementation. <ACLASS="indexterm"NAME="ch14-idx-1000004914-0"></A>SDBM is part of the X11 distribution and also the standard Perl source distribution. DB refers to the <ACLASS="indexterm"NAME="ch14-idx-1000004915-0"></A>Berkeley DB library. While the others are essentially reimplementations of the original DB library, the Berkeley DB code gives you three different types of database on disk and attempts to solve many of the disk, speed, and size limitations that hinder the other implementations.</P><PCLASS="para"><ACLASS="indexterm"NAME="ch14-idx-1000004916-0"></A>Code size refers to the size of the compiled libraries. <ACLASS="indexterm"NAME="ch14-idx-1000004917-0"></A>Disk usage refers to the size of the database files it creates. Block size limits refer to the database's maximum key or value size. Byte-order independence refers to whether the database system relies on hardware byte order or whether it instead creates portable files. A user-defined sort order lets you tell the library what order to return lists of keys in. Partial key lookups let you make approximate searches on the database.</P><PCLASS="para">Most Perl programmers prefer the Berkeley DB implementations. Many systems already have this library installed, and Perl can use it. For others, you are advised to fetch and install it from CPAN. It will make your life much easier.</P><PCLASS="para">DBM files provide key/value pairs. In relational database terms, you get a database with one table that has only two columns. <ACLASS="xref"HREF="ch14_09.htm"TITLE="Storing Complex Data in a DBM File">Recipe 14.8</A> shows you how to use the <ACLASS="indexterm"NAME="ch14-idx-1000004918-0"></A>MLDBM module from CPAN to store arbitrarily complex data structures in a DBM file.</P><PCLASS="para">As good as MLDBM is, it doesn't get around the limitation that you only retrieve rows based on one single column, the hash key. If you need complex queries, the difficulties can be overwhelming. In these cases, consider a separate database management system (DBMS). The DBI project provides modules to work with Oracle, Sybase, mSQL, MySQL, Ingres, and others.</P><PCLASS="para">See <ACLASS="systemitem.url"HREF="http://www.hermetica.com/technologia/perl/DBI/index.html">http://www.hermetica.com/technologia/perl/DBI/index.html</A> and <ACLASS="systemitem.url"HREF="http://www.perl.com/CPAN/modules/by-category/07_Database_Interfaces/">http://www.perl.com/CPAN/modules/by-category/07_Database_Interfaces/</A>, which currently contains:</P><PRECLASS="programlisting"><CODECLASS="literal">AsciiDB   DBI Db     MLDBM    OLE    Pg        Sybase</CODE><CODECLASS="literal">CDB_File  DBZ_ File  Fame     Msql   ObjStore  Postgres  XBase</CODE><CODECLASS="literal">DBD       DB_File    Ingperl  MySQL  Oraperl   Sprite</CODE></PRE></DIV></DIV><DIVCLASS="htmlnav"><P></P><HRALIGN="LEFT"WIDTH="684"TITLE="footer"><TABLEWIDTH="684"BORDER="0"CELLSPACING="0"CELLPADDING="0"><TR><TDALIGN="LEFT"VALIGN="TOP"WIDTH="228"><ACLASS="sect1"HREF="ch13_16.htm"TITLE="13.15. Creating Magic Variables with tie"><IMGSRC="../gifs/txtpreva.gif"ALT="Previous: 13.15. Creating Magic Variables with tie"BORDER="0"></A></TD><TDALIGN="CENTER"VALIGN="TOP"WIDTH="228"><ACLASS="book"HREF="index.htm"TITLE="Perl Cookbook"><IMGSRC="../gifs/txthome.gif"ALT="Perl Cookbook"BORDER="0"></A></TD><TDALIGN="RIGHT"VALIGN="TOP"WIDTH="228"><ACLASS="sect1"HREF="ch14_02.htm"TITLE="14.1. Making and Using a DBM File"><IMGSRC="../gifs/txtnexta.gif"ALT="Next: 14.1. Making and Using a DBM File"BORDER="0"></A></TD></TR><TR><TDALIGN="LEFT"VALIGN="TOP"WIDTH="228">13.15. Creating Magic Variables with tie</TD><TDALIGN="CENTER"VALIGN="TOP"WIDTH="228"><ACLASS="index"HREF="index/index.htm"TITLE="Book Index"><IMGSRC="../gifs/index.gif"ALT="Book Index"BORDER="0"></A></TD><TDALIGN="RIGHT"VALIGN="TOP"WIDTH="228">14.1. Making and Using a DBM File</TD></TR></TABLE><HRALIGN="LEFT"WIDTH="684"TITLE="footer"><FONTSIZE="-1"></DIV<!-- LIBRARY NAV BAR --> <img src="../gifs/smnavbar.gif" usemap="#library-map" border="0" alt="Library Navigation Links"><p> <a href="copyrght.htm">Copyright &copy; 2002</a> O'Reilly &amp; Associates. All rights reserved.</font> </p> <map name="library-map"> <area shape="rect" coords="1,0,85,94" href="../index.htm"><area shape="rect" coords="86,1,178,103" href="../lwp/index.htm"><area shape="rect" coords="180,0,265,103" href="../lperl/index.htm"><area shape="rect" coords="267,0,353,105" href="../perlnut/index.htm"><area shape="rect" coords="354,1,446,115" href="../prog/index.htm"><area shape="rect" coords="448,0,526,132" href="../tk/index.htm"><area shape="rect" coords="528,1,615,119" href="../cookbook/index.htm"><area shape="rect" coords="617,0,690,135" href="../pxml/index.htm"></map> </BODY></HTML>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -