DBD-IngresII
view release on metacpan or search on metacpan
IngresII.pm view on Meta::CPAN
=head2 commit and rollback invalidate open cursors
DBD::IngresII should warn when a commit or rollback is isssued on a $dbh
with open cursors.
Possibly a commit/rollback 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::IngresII wil possibly re-prepare the statement.
This is needed for
=head2 Cached statements
A new feature in DBI that is not implemented in DBD::IngresII.
=head2 bind_param_inout (Procedure calls)
It is possible to call database procedures from DBD::IngresII. It is B<NOT>
possible to get return values from the procedure.
A solution is underway for support for procedure calls from the DBI.
Until that is defined procedure calls can be implemented as a
DB::Ingres-specific function (like L<get_event>) if the need arises and
someone is willing to do it.
=head1 UNICODE FAQ
In this section I will answer some questions about Unicode and Ingres.
Q: What is Unicode, and what is UTF-8, are these different words for same
thing?
A: Please read perlunitut, especially the "Definitions" section. To read it
run "perldoc perlunitut" command or type "perlunitut" in your web search
engine of choice.
Q: Is it possible to change II_CHARSET after installation of Ingres?
A: No, it would corrupt database. You need to reinstall Ingres, this time
with other II_CHARSET.
Q: I tried your examples and all I get is some garbage.
A: There are few possibilites what went wrong:
- You have created database with "createdb -n dbname", not
"createdb -i dbname".
- You are printing string to console without encoding it to console
charset. For example, for polish Windows you need to encode it to
cp852 encoding.
=head1 UNICODE EXAMPLES
You want to store or retrieve unicode string from Ingres database? Like
with everything in Perl, there's more than one way to do it (TMTOWTDI).
Here are some examples:
# Example number one, it uses NVARCHAR, and assumes that II_CHARSET is set
# to UTF8
# Database must be created with "createdb -i dbname"
use utf8;
use Encode;
my $dbh = DBI->connect("DBI:IngresII:dbname");
my $sth = $dbh->prepare("CREATE TABLE foobar (str nvarchar(10))");
$sth->execute;
$sth = $dbh->prepare("INSERT INTO foobar values (?)");
$sth->execute(encode('utf-8', 'Ä
ÅÄ')); # Instead of utf-8 use charset
# that is specified in II_CHARSET
$sth = $dbh->prepare("SELECT * FROM foobar");
$sth->execute;
my $hashref = $sth->fetchrow_hashref;
my $variable = decode('utf-16le', $hashref->{str});
Second one:
# Example number two, it uses VARCHAR, it will work only with II_CHARSET
# set to UTF8.
# Database must be created with "createdb -i dbname"
use utf8;
use Encode;
my $dbh = DBI->connect("DBI:IngresII:dbname");
my $sth = $dbh->prepare("CREATE TABLE foobar (str varchar(10))");
$sth->execute;
$sth = $dbh->prepare("INSERT INTO foobar values (?)");
$sth->execute('Ä
ÅÄ');
$sth = $dbh->prepare("SELECT * FROM foobar");
$sth->execute;
my $hashref = $sth->fetchrow_hashref;
my $variable = decode('utf-8', $hashref->{str});
Third:
# Example number three, it uses VARCHAR, it will work only with II_CHARSET
# set to UTF8.
# Now we will use automatic UTF-8 handling.
# Database must be created with "createdb -i dbname"
use utf8;
use Encode;
( run in 1.756 second using v1.01-cache-2.11-cpan-39bf76dae61 )