On Mon, Jan 12, 2004 at 03:47:56PM +0000, Tim Bunce wrote:
> Plans:
> 
> 1.  Move DBI source code to http://sourceforge.net/projects/dbi/

Actually it'll be http://svn.perl.org/modules/dbi/ as I've decided
to use Subversion (http://subversion.tigris.org/) hosted by perl.org

> 2.  Add a few dbi-dev people as developers who can modify the source.
> 
> 3.  Fork off DBI v1 for maintenance and start work on DBI v2.

Here's the list of changes I'm considering for DBI v2.

Comments welcome. I'll post it to dbi-users in a couple of days.

I'll also be posting news of the "Parrot DBDI" project ;-)

Tim.


*** Changes for DBI v2 ***

--- Changes that may impact applications:

Turning AutoCommit on should trigger rollback not commit.
(ODBC does a commit)

Always taint check the $sql for do() and prepare()
if perl is in taint mode (can't be disabled).
Default TaintIn=>1 in perl taint mode?
Default TaintOut=>1 in perl taint mode but exclude placeholders?

Remove support for "old-style" connect syntax
(where the driver name is the 4th parameter).

Remove undocumented DBI->err and DBI->errstr methods.

Remove old informix fudge in tables() (would only impact people
using very old DBD::Informix versions as it now has it's own).

Minor change to parameters of HandleError callback
(add $err and $state ahead of $return).

Increase size of com struct (requires driver rebuild)
and improve size sanity checks.


--- Additions and other changes visible to applications:

Make ShowErrorStatement=>1 the default

Define expected uft8 behaviour. Basically drivers need to set the
uft8 flag on returned strings themselves when appropriate.
The DBI I<may> define a way for an application to indicate that
a particular column should be flagged as uft8 to help drivers
that are not able to determine that themselves.
The DBI won't support automatic character set conversions.

Change "trace level" to support "topic bits" that can be set
independantly of the current integer "level". In other words
the lowest 4 bits will be used for the "level", as now.
The next 4 bits are reserved. The next 16bits are each
associated with a particular topic defined by the DBI.
The top 8 bits are from for the driver to use.
The topics will be assigned letters which can be used to
set the trace level to make it easier to remember settings.

Ability to remove a handle from the parents cache:
        $sth->uncache;
and     $dbh->uncache; for connect_cached

Add discard_pending_rows() as an alias
for finish() - which will be deprecated.

$sth->{ParamTypes} eg { "1" => SQL_VARCHAR, "2" => { TYPE=>SQL_VARCHAR, ora_type=>99 
}};

$h->{KidsHandles} = ref to cache (array or hash?)
of weakrefs to child handles.

DBI::Profile: some way to get count of 'executions' only, not all method calls.
So avg time is totaltime/executions not totaltime/methodcalls.

Document DbTypeSubclass (ala DBIx::AnyDBD)
Polish up and document _dbtype_names with an external interface and using get_info.

Count do()'s and execute()s (that aren't called by do()s) in imp_dbh.
Make available as an ExecuteCount attribute.
Reset count in commit/rollback.
In $dbh->DESTROY if !AutoCommit don't rollback&warning if count == 0.

FetchHashReuse attrib (=1 or ={}) copy from dbh to sth
and use to optimise fetchrow_hash

--- Changes that may affect driver authors

Add PERL_NO_GET_CONTEXT for multiplicity/threads?
force it for drivers?
And enable xsbypass in dispatch if possible.

Add a handle flag to say that the driver has a hash that maps error
codes into SQLSTATE values. The error event mechanism could check for
the flag and lookup the SQLSTATE value for the error from the hash.
Allow code hook as well. Maybe $dbh->{SQLSTATE_map} = code or hash ref

Add minimum subset of ODBC3 SQLSTATE values that should be supported
(and corresponding ODBC2 values?)

Add more macro hooks to Driver.xst: ping, quote etc.

Add dbh active checks to some more sth methods where reasonable.

Rework handle creation to use methods.
Maybe $h->new_child(\%override_attr)
    dr::connect =>
        $dbh = $drh->new_child(\%attr);
        $dbh->connect(...)
&   db::prepare =>
        $sth = $dbh->new_child(\%attr);
        $sth->prepare($statement)       # once only?
        $sth->close(???)                # to 'reset' before a different prepare()?
need to think through prepare_cached and connect_cached
and relationship to preparse().

Sort out DBIcDBISTATE() and DBIS mess. dDBIS?
Make it cheap to get h from imp_xxh so only imp_xxh needs
to be passed around?

Define consise DBI<>DBD interface with view towards parrot.
        note that parrot will use more method calls instead of
        'sideways' hooks into DBIS and the driver C code.
DBI::DBD::Base module?
Update DBI::DBD with overview and (at least) recommend Driver.xst strongly.
Find XS drivers that don't use it and talk to authors.

Review drivers for handling of multiple result sets
to define common api for all.
$sth->more_results, maybe via $sth->become($sth2) later (or transplant/swap)

#define a large negative number to mean 'error' from st_execute and
change *.xst to treat either that or -2 as an error. (The -2 is
a transition for old drivers.)

--- Other changes

Change $h->DBI::set_err calls to $h->set_err (re subclassing etc)
Check for other $h->DBI::foo calls

$dbh->{Statement} can be wrong because fetch doesn't update value
maybe imp_dbh holds imp_sth (or inner handle) of last sth method
called (if not DESTROY) and sth outer DESTROY clears it (to reduce ref count)
Then $dbh->{LastSth} would work (returning outer handle if valid).
Then $dbh->{Statement} would be the same as $dbh->{LastSth}->{Statement}
Also $dbh->{ParamValues} would be the same as $dbh->{LastSth}->{ParamValues}.

Remove dummy 'Switch' driver.

Sponge behave_like - generalize into new_child()
        copy RaiseError, PrintError, HandleError etc from the specified handle
        but which attributes? LongReadLen, LongTruncOk etc? Presumably all
        as we're acting as a proxy behind the scenes.
        Should behave_like handle be dbh or sth or either or same as parent?

Add per-handle debug file pointer:
        NULL default => h->dbis->tracefp
        if not NULL then dup() via PerlIO for child handles
        close(h->tracefp) at end of DESTROY
        macro to do (h->tracefp || h->dbis->tracefp)

Move TIEHASH etc to XS (and to PurePerl)

Change CachedKids to be a simple attribute cached in the handle hash
to remove FETCH method call overhead in prepare_cached().

--- Other things to consider

Study alternate DBI's:
        ruby
        python
        php
        others?
        ADO object model
identify any features we could usefully support and any incompatibilities etc

Consider closer mapping to SQL3 CLI API for driver API.

Phalanx?

=cut

Reply via email to