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

📄 roadmap.pod

📁 视频监控网络部分的协议ddns,的模块的实现代码,请大家大胆指正.
💻 POD
字号:
=head1 NAMEDBI::Roadmap - Planned Enhancements for the DBITim Bunce - 12th November 2004=head1 SYNOPSISThis document gives a high level overview of the future of the PerlDBI module.The DBI module is the standard database interface for Perl applications.It is used worldwide in countless applications, in every kind ofbusiness, and on platforms from clustered super-computers to PDAs.Database interface drivers are available for all common databasesand many not-so-common ones.The planned enhancements cover testing, performance, high availabilityand load balancing, batch statements, Unicode, database portability,and more.Addressing these issues together, in coordinated way, will helpensure maximum future functionality with minimal disruptive(incompatible) upgrades.=head1 SCOPEBroad categories of changes are outlined here along with somerationale, but implementation details and minor planned enhancementsare omitted.  More details can be found in:L<http://svn.perl.org/modules/dbi/trunk/ToDo>=head1 CHANGES AND ENHANCEMENTSThese are grouped into categories and are not listed in any particular order.=head2 PerformanceThe DBI has always treated performance as a priority. Some partsof the implementation, however, remain unoptimized, especially inrelation to threads.* When the DBI is used with a Perl built with thread support enabled(such as for Apache mod_perl 2, and some common Linux distributions)it runs significantly slower. There are two reasons for this andboth can be fixed but require non-trivial changes to both the DBIand drivers.* Connection pooling in a threaded application, such as mod_perl,is difficult because DBI handles cannot be passed between threads.An alternative mechanism for passing connections between threadshas been defined, and an experimental connection pool moduleimplemented using it, but development has stalled.* The majority of DBI handle creation code is implemented in Perl.Moving most of this to C will speed up handle creation significantly.* The popular fetchrow_hashref() method is many times slower thanfetchrow_arrayref(). It has to get the names of the columns, thencreate and load a new hash each time. A $h->{FetchHashReuse} attributewould allow the same hash to be reused each time making fetchrow_hashref()about the same speed as fetchrow_arrayref().* Support for asynchronous (non-blocking) DBI method calls wouldenable applications to continue processing in parallel with databaseactivity.  This is also relevant for GUI and other event-drivenapplications.  The DBI needs to define a standard interface forthis so drivers can implement it in a portable way, where possible.These changes would significantly enhance the performance of theDBI and many applications which use the DBI.=head2 TestingThe DBI has a test suite. Every driver has a test suite.  Each islimited in its scope.  The driver test suite is testing for behaviorthat the driver author I<thinks> the DBI specifies, but may besubtly incorrect.  These test suites are poorly maintained becausethe return on investment for a single driver is too low to providesufficient incentive.A common test suite that can be reused by all the drivers is needed.It would:* Improve the quality of the DBI and drivers.* Ensure all drivers conform to the DBI specification.  Easing theporting of applications between databases, and the implementationof database independent modules layered over the DBI.* Improve the DBI specification by clarifying unclear issues inorder to implement test cases.* Encourage expansion of the test suite as driver authors and otherswill be motivated by the greater benefits of their contributions.* Detect and record optional functionality that a driver has notyet implemented.* Improve the testing of DBI subclassing, DBI::PurePerl and thevarious "transparent" drivers, such as DBD::Proxy and DBD::Multiplex,by automatically running the test suite through them.These changes would improve the quality of all applications usingthe DBI.=head2 High Availability and Load Balancing* The DBD::Multiplex driver provides a framework to enable a widerange of dynamic functionality, including support for high-availability,failover, load-balancing, caching, and access to distributed data.It is currently being enhanced but development has stalled.* The DBD::Proxy module is complex and relatively inefficient becauseit's trying to be a complete proxy for most DBI method calls.  Formany applications a simpler proxy architecture that operates witha single round-trip to the server would be simpler, faster, and moreflexible.New proxy client and server classes are needed, which could besubclassed to support specific client to server transport mechanisms(such as HTTP and Spread::Queue).  Apart from the efficiency gains,this would also enable the use of a load-balanced pool of statelessservers for greater scalability and reliability.* The DBI currently offers no support for distributed transactions.The most useful elements of the standard XA distributed transactioninterface standard could be included in the DBI specification.Drivers for databases which support distributed transactions couldthen be extended to support it.These changes would enable new kinds of DBI applications for criticalenvironments.=head2 UnicodeUse of Unicode with the DBI is growing rapidly. The DBI should domore to help drivers support Unicode and help applications workwith drivers that don't yet support Unicode directly.* Define expected behavior for fetching data and binding parameters.* Provide interfaces to support Unicode issues for XS and pure Perldrivers and applications.* Provide functions for applications to help diagnose inconsistenciesbetween byte string contents and setting of the SvUTF8 flag.These changes would smooth the transition to Unicode for manyapplications and drivers.=head2 Batch StatementsBatch statements are a sequence of SQL statements, or a storedprocedure containing a sequence of SQL statements, which can beexecuted as a whole.Currently the DBI has no standard interface for dealing with multipleresults from batch statements.  After considerable discussion, aninterface design has been agreed upon with driver authors, but hasnot yet been implemented.These changes would enable greater application portability betweendatabases, and greater performance for databases that directlysupport batch statements.=head2 Introspection* The methods of the DBI API are installed dynamically when the DBIis loaded.  The data structure used to define the methods and theirdispatch behavior should be made part of the DBI API. This wouldenable more flexible and correct behavior by modules subclassingthe DBI and by dynamic drivers such as DBD::Proxy and DBD::Multiplex.* Handle attribute information should also be made available, forthe same reasons.* Currently is it not possible to discover all the child statementhandles that belong to a database handle (or all database handlesthat belong to a driver handle).  This makes certain tasks moredifficult, especially some debugging scenarios.  A cache of weakreferences to child handles would solve the problem without creatingreference loops.* It is often useful to know which handle attributes have beenchanged since the handle was created (e.g., in mod_perl where ahandle needs to be reset or cloned). This will become more importantas developers start exploring use of the newly added$h1->swap_inner_handle($h2) method.These changes would simplify and improve the stability of manyadvanced uses of the DBI.=head2 ExtensibilityThe DBI can be extended in three main dimensions: subclassing theDBI, subclassing a driver, and callback hooks. Each has differentpros and cons, each is applicable in different situations, andall need enhancing.* Subclassing the DBI is functional but not well defined and somekey elements are incomplete, particularly the DbTypeSubclass mechanism(that automatically subclasses to a class tree according to thetype of database being used).  It also needs more thorough testing.* Subclassing a driver is undocumented, poorly tested and veryprobably incomplete. However it's a powerful way to embed certainkinds of functionality 'below' applications while avoiding some ofthe side-effects of subclassing the DBI (especially in relation toerror handling).* Callbacks are currently limited to error handling (the HandleErrorand HandleSetError attributes).  Providing callback hooks for moreevents, such as a row being fetched, would enable utility modules,for example, to modify the behavior of a handle independent of anysubclassing in use.These changes would enable cleaner and more powerful integrationbetween applications, layered modules, and the DBI.=head2 Debugability* Enabling DBI trace output at a high level of detail causes a largevolume of output, much of it probably unrelated to the problem beinginvestigated. Trace output should be controlled by the new named-topicmechanism instead of just the trace level.* Calls to XS functions (such as many DBI and driver methods) don'tnormally appear in the call stack.  Optionally enabling that wouldenable more useful diagnostics to be produced.* Integration with the Perl debugger would make it simpler to performactions on a per-handle basis (such as breakpoint on execute,breakpoint on error).These changes would enable more rapid application development andfault finding.=head2 Database Portability* The DBI has not yet addressed the issue of portability among SQLdialects.  This is the main hurdle limiting database portabilityfor DBI applications.The goal is I<not> to fully parse the SQL and rewrite it in adifferent dialect.  That's well beyond the scope of the DBI andshould be left to layered modules.  A simple token rewriting mechanismfor five comment styles, two quoting styles, four placeholder styles,plus the ODBC "{foo ...}" escape syntax, is sufficient to significantlyraise the level of SQL portability.* Another problem area is date/time formatting.  Since version 1.41the DBI has defined a way to express that dates should be fetchedin SQL standard date format (YYYY-MM-DD).  This is one example ofthe more general case where bind_col() needs to be called withparticular attributes on all columns of a particular type.A mechanism is needed whereby an application can specify defaultbind_col() attributes to be applied automatically for each columntype. With a single step, all DATE type columns, for example, canbe set to be returned in the standard format.These changes would enable greater database portability forapplications and greater functionality for layered modules.=head2 Intellectual Property* Clarify current intellectual property status, including a review  of past contributions to ensure the DBI is unemcumbered.* Establish a procedure for vetting future contributions for any  intellectual property issues.These changes are important for companies taking a formal approachto assessing their risks in using Open Source software.=head2 Other Enhancements* Reduce the work needed to create new database interface drivers.* Definition of an interface to support scrollable cursors.=head2 Parrot and Perl 6The current DBI implementation in C code is unlikely to run on Perl 6.Perl 6 will target the Parrot virtual machine and so the internalarchitecture will be radically different from Perl 5.One of the goals of the Parrot project is to be a platform for manydynamic languages (including Python, PHP, Ruby, etc) and to enablethose languages to reuse each others modules. A database interfacefor Parrot is also a database interface for any and all languagesthat run on Parrot.The Perl DBI would make an excellent base for a Parrot databaseinterface because it has more functionality, and is more mature andextensible, than the database interfaces of the other dynamiclanguages.I plan to better define the API between the DBI and the drivers anduse that API as the primary API for the 'raw' Parrot databaseinterface.  This project is known a Parrot DBDI (for "DataBaseDriver Interface").  The announcement can be read in<http://groups.google.com/groups?selm=20040127225639.GF38394@dansat.data-plan.com>The bulk of the work will be translating the DBI C and Perl baseclass code into Parrot PIR, or a suitable language that generatesPIR.  The project stalled, due to Parrot not having key functionalityat the time.  That has been resolved but the project has not yetrestarted.Each language targeting Parrot would implement their own small'thin' language-specific method dispatcher (a "Perl6 DBI", "PythonDBI", "PHP DBI" etc) layered over the common Parrot DBDI interfaceand drivers.The major benefit of the DBDI project is that a much wider communityof developers share the same database drivers. There would be moredevelopers maintaining less code so the benefits of the Open Sourcemodel are magnified.=head1 PRIORITIES=head2 Transition DriversThe first priority is to make all the infrastructure changes thatimpact drivers and make an alpha release available for driver authors.As far as possible, the changes will be implemented in a way thatenables driver authors use the same code base for DBI v1 and DBI v2.The main changes required by driver authors are:* Code changes for PERL_NO_GET_CONTEXT, plus removing PERL_POLLUTEand DBIS* Code changes in DBI/DBD interface (new way to create handles, newcallbacks etc)* Common test suite infrastructure (driver-specific test base class)=head2 Transition ApplicationsA small set of incompatible changes that may impact some applicationswill also be made in v2.0. See http://svn.perl.org/modules/dbi/trunk/ToDo=head2 Incremental DevelopmentsOnce DBI v2.0 is available, the other enhancements can be implementedincrementally on the updated foundations. Priorities for thosechanges have not been set.=head2 DBI v1 DBI v1 will continue to be maintained on a separate branch forbug fixes and any enhancements that ease the transition to DBI v2.=head1 RESOURCES AND CONTRIBUTIONSSee L<http://dbi.perl.org/contributing> for I<how you can help>.If your company has benefited from the DBI, please consider ifit could make a donation to The Perl Foundation "DBI Development"fund at L<http://dbi.perl.org/donate> to secure future development.Alternatively, if your company would benefit from a specific newDBI feature, please consider sponsoring its development through myconsulting company, Data Plan Services. Work is performed rapidlyon a fixed-price payment-on-delivery basis. Contact me for details.Using such targeted financing allows you to contribute to DBIdevelopment and rapidly get something specific and directly valuableto you in return.My company also offers annual support contracts for the DBI, whichprovide another way to support the DBI and get something specificin return. Contact me for details.Thank you.=cut

⌨️ 快捷键说明

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