DBD-Unify
view release on metacpan or search on metacpan
lib/DBD/Unify.pm view on Meta::CPAN
=item AutoCommit
It is recommended that the C<connect> call ends with the attributes
S<{ AutoCommit => 0 }>, although it is not implemented (yet).
If you don't want to check for errors after B<every> call use
S<{ AutoCommit => 0, RaiseError => 1 }> instead. This will C<die> with
an error message if any DBI call fails.
=item Unicode
By default, this driver is completely Unicode unaware: what you put into
the database will be returned to you without the encoding applied.
To enable automatic decoding of UTF-8 when fetching from the database,
set the C<uni_unicode> attribute to a true value for the database handle
(statement handles will inherit) or to the statement handle.
$dbh->{uni_unicode} = 1;
When CHAR or TEXT fields are retrieved and the content fetched is valid
UTF-8, the value will be marked as such.
=item re-connect
Though both the syntax and the module support connecting to different
databases, even at the same time, the Unify libraries seem to quit
connecting to a new database, even if the old one is closed following
every rule of precaution.
To be safe in closing a handle of all sorts, undef it after it is done with,
it will than be destroyed. (As of 0.12 this is tried internally for handles
that proved to be finished)
explicit:
my $dbh = DBI->connect (...);
my $sth = $dbh->prepare (...);
:
$sth->finish; undef $sth;
$dbh->disconnect; undef $dbh;
or implicit:
{ my $dbh = DBI->connect (...);
{ my $sth = $dbh->prepare (...);
while (my @data = $sth->fetchrow_array) {
:
}
} # $sth implicitly destroyed by end-of-scope
$dbh->disconnect;
} # $dbh implicitly destroyed by end-of-scope
=item do
$dbh->do ($statement)
This is implemented as a call to 'EXECUTE IMMEDIATE' with all the
limitations that this implies.
=item commit and rollback invalidates open cursors
DBD::Unify does warn when a commit or rollback is issued on a $dbh
with open cursors.
Possibly a commit/rollback/disconnect should also undef the $sth's.
(This should probably be done in the DBI-layer as other drivers will
have the same problems).
After a commit or rollback the cursors are all ->finish'ed, i.e. they
are closed and the DBI/DBD will warn if an attempt is made to fetch
from them.
A future version of DBD::Unify might re-prepare the statement.
=back
=head2 Stuff implemented in perl
=over 2
=item driver
Just here for DBI. No use in telling the end-user what to do with it :)
=item connect
=item data_sources
There is no way for Unify to tell what data sources might be available.
There is no central files (like F</etc/oratab> for Oracle) that lists all
available sources, so this method will always return an empty list.
=item quote_identifier
As DBI's C<quote_identifier ()> gladly accepts the empty string as a
valid identifier, I have to override this method to translate empty
strings to undef, so the method behaves properly. Unify does not allow
to select C<NULL> as a constant as in:
select NULL, foo from bar;
=item prepare ($statement [, \%attr])
The only attribute currently supported is the C<dbd_verbose> (or its
alias C<uni_verbose>) level. See "trace" below.
=item table_info ($;$$$$)
=item columne_info ($$$$)
=item foreign_key_info ($$$$$$;$)
=item link_info ($;$$$$)
=item primary_key ($$$)
=item uni_clear_cache ()
Note that these five get their info by accessing the C<SYS> schema which
is relatively extremely slow. e.g. Getting all the primary keys might well
run into seconds, rather than milliseconds.
This is work-in-progress, and we hope to find faster ways to get to this
information. Also note that in order to keep it fast across multiple calls,
some information is cached, so when you alter the data dictionary after a
call to one of these, that cached information is not updated.
For C<column_info ()>, the returned C<DATA_TYPE> is deduced from the
C<TYPE_NAME> returned from C<SYS.ACCESSIBLE_COLUMNS>. The type is in
( run in 1.734 second using v1.01-cache-2.11-cpan-39bf76dae61 )