📄 faq.pm
字号:
###### $Id: FAQ.pm 9530 2007-05-09 13:05:23Z timbo $###### DBI Frequently Asked Questions POD###### Copyright section reproduced from below.###### This document is Copyright (c)1994-2000 Alligator Descartes, with portions### Copyright (c)1994-2000 their original authors. This module is released under### the 'Artistic' license which you can find in the perl distribution.### ### This document is Copyright (c)1997-2000 Alligator Descartes. All rights reserved.### Permission to distribute this document, in full or in part, via email,### Usenet, ftp archives or http is granted providing that no charges are involved,### reasonable attempt is made to use the most current version and all credits### and copyright notices are retained ( the I<AUTHOR> and I<COPYRIGHT> sections ).### Requests for other distribution rights, including incorporation into ### commercial products, such as books, magazine articles or CD-ROMs should be### made to Alligator Descartes <I<http://www.symbolstone.org/descarte/contact.html>>.### package DBI::FAQ;our $VERSION = sprintf("1.%06d", q$Revision: 9530 $ =~ /(\d+)/o);=head1 NAMEDBI::FAQ -- The Frequently Asked Questions for the Perl5 Database Interface=for html<BODY BGCOLOR="#ffffff" TEXT="#000000" LINK="#3a15ff" ALINK="#ff0000" VLINK="#ff282d"><!--#include virtual="/technology/perl/DBI/templatetop.html" --><CENTER><FONT SIZE="+2">DBI Frequently Asked Questions v.0.38</FONT><BR><FONT SIZE="-1"><I>Last updated: February 8th, 2000</I></FONT></CENTER><P>=head1 SYNOPSIS perldoc DBI::FAQ=head1 VERSIONThis document is currently at version I<0.38>, as of I<February 8th, 2000>.=head1 DESCRIPTIONThis document serves to answer the most frequently asked questions on boththe DBI Mailing Lists and personally to members of the DBI development team.=head1 Basic Information & Information Sources=head2 1.1 What is DBI, DBperl, Oraperl and *perl?To quote Tim Bunce, the architect and author of DBI: ``DBI is a database access Application Programming Interface (API) for the Perl Language. The DBI API Specification defines a set of functions, variables and conventions that provide a consistent database interface independant of the actual database being used.''In simple language, the DBI interface allows users to access multiple databasetypes transparently. So, if you connecting to an Oracle, Informix, mSQL, Sybaseor whatever database, you don't need to know the underlying mechanics of the3GL layer. The API defined by DBI will work on I<all> these database types.A similar benefit is gained by the ability to connect to two I<different>databases of different vendor within the one perl script, I<ie>, I wantto read data from an Oracle database and insert it back into an Informixdatabase all within one program. The DBI layer allows you to do this simplyand powerfully.=for htmlHere's a diagram that demonstrates the principle:<P><CENTER><IMG SRC="img/dbiarch.gif" WIDTH=451 HEIGHT=321 ALT="[ DBI Architecture ]"></CENTER><P>I<DBperl> is the old name for the interface specification. It's usuallynow used to denote perlI<4> modules on database interfacing, such as,I<oraperl>, I<isqlperl>, I<ingperl> and so on. These interfacesdidn't have a standard API and are generally I<not> supported.Here's a list of DBperl modules, their corresponding DBI counterparts andsupport information. I<Please note>, the author's listed here generallyI<do not> maintain the DBI module for the same database. These emailaddresses are unverified and should only be used for queries concerning theperl4 modules listed below. DBI driver queries should be directed to theI<dbi-users> mailing list. Module Name Database Required Author DBI ----------- ----------------- ------ --- Sybperl Sybase Michael Peppler DBD::Sybase <mpeppler@itf.ch> Oraperl Oracle 6 & 7 Kevin Stock DBD::Oracle <dbi-users@perl.org> Ingperl Ingres Tim Bunce & DBD::Ingres Ted Lemon <dbi-users@perl.org> Interperl Interbase Buzz Moschetti DBD::Interbase <buzz@bear.com> Uniperl Unify 5.0 Rick Wargo None <rickers@coe.drexel.edu> Pgperl Postgres Igor Metz DBD::Pg <metz@iam.unibe.ch> Btreeperl NDBM John Conover SDBM? <john@johncon.com> Ctreeperl C-Tree John Conover None <john@johncon.com> Cisamperl Informix C-ISAM Mathias Koerber None <mathias@unicorn.swi.com.sg> Duaperl X.500 Directory Eric Douglas None User AgentHowever, some DBI modules have DBperl emulation layers, so, I<DBD::Oracle>comes with an Oraperl emulation layer, which allows you to run legacy oraperlscripts without modification. The emulation layer translates the oraperl APIcalls into DBI calls and executes them through the DBI switch.Here's a table of emulation layer information: Module Emulation Layer Status ------ --------------- ------ DBD::Oracle Oraperl Complete DBD::Informix Isqlperl Under development DBD::Ingres Ingperl Complete? DBD::Sybase Sybperl Working? ( Needs verification ) DBD::mSQL Msqlperl Experimentally released with DBD::mSQL-0.61The I<Msqlperl> emulation is a special case. I<Msqlperl> is a perl5 driverfor I<mSQL> databases, but does not conform to the DBI Specification. It'suse is being deprecated in favour of I<DBD::mSQL>. I<Msqlperl> may be downloadedfrom CPAN I<via>: http://www.perl.com/cgi-bin/cpan_mod?module=Msqlperl=head2 1.2. Where can I get it from?The Comprehensive Perl Archive Networkresources should be used for retrieving up-to-date versions of the DBIand drivers. CPAN may be accessed I<via> Tom Christiansen's splendid I<CPAN multiplexer> program located at: http://www.perl.com/CPAN/For more specific version information and exact URLs of drivers, please seethe DBI drivers list and the DBI module pages which can be found on: http://dbi.perl.org/ http://www.symbolstone.org/technology/perl/DBIThis list is automatically generated on a nightly basis from CPAN and shouldbe up-to-date.=head2 1.3. Where can I get more information?There are a few information sources on DBI. =over 4=item I<"Programming the Perl DBI">"Programming the Perl DBI" is the I<official> book on the DBI written byAlligator Descartes and Tim Bunce and published by O'Reilly & Associates.The book was released on February 9th, 2000.The table of contents is: Preface 1. Introduction From Mainframes to Workstations Perl DBI in the Real World A Historical Interlude and Standing Stones 2. Basic Non-DBI Databases Storage Managers and Layers Query Languages and Data Functions Standing Stones and the Sample Database Flat-File Databases Putting Complex Data into Flat Files Concurrent Database Access and Locking DBM Files and the Berkeley Database Manager The MLDBM Module Summary 3. SQL and Relational Databases The Relational Database Methodology Datatypes and NULL Values Querying Data Modifying Data Within Tables Creating and Destroying Tables 4. Programming with the DBI DBI Architecture Handles Data Source Names Connection and Disconnection Error Handling Utility Methods and Functions 5. Interacting with the Database Issuing Simple Queries Executing Non-SELECT Statements Binding Parameters to Statements Binding Output Columns do() Versus prepare() Atomic and Batch Fetching 6. Advanced DBI Handle Attributes and Metadata Handling LONG/LOB Data Transactions, Locking, and Isolation 7. ODBC and the DBI ODBC -- Embraced and Extended DBI -- Thrashed and Mutated The Nuts and Bolts of ODBC ODBC from Perl The Marriage of DBI and ODBC Questions and Choices Moving Between Win32::ODBC and the DBI And What About ADO? 8. DBI Shell and Database Proxying dbish -- The DBI Shell Database Proxying A. DBI Specification B. Driver and Database Characteristics C. ASLaN Sacred Site Charter IndexThe book should be available from all good bookshops and can be ordered onlineeither <I>via</I> O'Reilly & Associates http://www.oreilly.com/catalog/perldbior Amazon http://www.amazon.com/exec/obidos/ASIN/1565926994/dbi=item I<POD documentation>I<POD>s are chunks of documentation usually embedded within perl programsthat document the code ``I<in place>'', providing a useful resource forprogrammers and users of modules. POD for DBI and drivers is beginning to become more commonplace, and documentation for these modules can be readwith the C<perldoc> program included with Perl.=over 4 =item The DBI SpecificationThe POD for the DBI Specification can be read with the: perldoc DBIcommand. The Specification also forms Appendix A of "Programming the PerlDBI".=item OraperlUsers of the Oraperl emulation layer bundled with I<DBD::Oracle>, may readup on how to program with the Oraperl interface by typing: perldoc OraperlThis will produce an updated copy of the original oraperl man page written byKevin Stock for perl4. The oraperl API is fully listed and described there.=item DriversUsers of the DBD modules may read about some of the private functionsand quirks of that driver by typing: perldoc <driver>For example, the I<DBD::mSQL> driver is bundled with driver-specific documentation that can be accessed by typing perldoc DBD::mSQL=item Frequently Asked QuestionsThis document, the I<Frequently Asked Questions> is also available as PODdocumentation! You can read this on your own system by typing: perldoc DBI::FAQThis may be more convenient to persons not permanently, or conveniently,connected to the Internet. The I<DBI::FAQ> module should be downloaded andinstalled for the more up-to-date version.The version of I<DBI::FAQ> shipped with the C<DBI> module may be slightly outof date.=item POD in generalInformation on writing POD, and on the philosophy of POD in general, can beread by typing: perldoc perlpodUsers with the Tk module installed may be interested to learn there is aTk-based POD reader available called C<tkpod>, which formats POD in a convenientand readable way. This is available I<via> CPAN as the module called I<Tk::POD> and is highly recommended.=back=item I<Driver and Database Characteristics>The driver summaries that were produced for Appendix B of "Programming thePerl DBI" are available online at: http://dbi.perl.org/ http://www.symbolstone.org/technology/perl/DBIin the driver information table. These summaries contain standardisedinformation on each driver and database which should aid you in selectinga database to use. It will also inform you quickly of any issues within
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -