NAME
DBD::Ingres - Ingres access interface for Perl5
SYNOPSIS
$dbh = DBI->connect($dbname, $user, $options, 'Ingres')
$sth = $dbh->prepare($statement)
$sth->execute
@row = $sth->fetchrow
$sth->finish
$dbh->commit
$dbh->rollback
$dbh->disconnect
and many more
DESCRIPTION
DBD::Ingres is an extension to Perl which allows access to Ingres databases. It is built on top of the standard DBI extension an implements the methods that DBI require.
This document describes the differences between the "generic" DBD and DBD::Ingres.
Extensions/Changes
- get_dbevent
-
This non-DBI method calls
GET DBEVENT
andINQUIRE_INGRES
to fetch a pending database event. If called without argument a blockingGET DBEVENT WITH WAIT
is called. A numeric argument results in a call toGET DBEVENT WITH WAIT= :seconds
.In a second step
INQUIRE_INGRES
is called to fetch the related information, wich is returned as a reference to a hash with keysname
,database
,text
,owner
andtime
. The values are thedbevent
* values received from Ingres. If no event was fetched,undef
is returned. See t/event.t for an example of usage.$event_ref = $dbh->func(10, 'get_dbevent') # wait 10 secs at most $event_ref = $dbh->func('get_dbevent') # blocks for (keys %$event_ref) { printf "%-20s = '%s'\n", $_, $event_ref->{$_}; }
- connect
-
connect(dbi:Ingres:dbname[;options] [, user [, password]])
Options to the connection are passed in the datasource argument. This argument should contain the database name possibly followed by a semicolon and the database options.
Options must be given exactly as they would be given an ESQL-connect statement, ie. separated by blanks.
The connect call will result in a connect statement like:
CONNECT dbname IDENTIFIED BY user PASSWORD password OPTIONS=options
Eg.
- local database
-
connect("mydb", "me", "mypassword")
- with options and no password
-
connect("mydb;-Rmyrole/myrolepassword", "me")
- Ingres/Net database
-
connect("thatnode::thisdb;-xw -l", "him", "hispassword") =back
and so on.
- do
-
$dbh->do
This is implemented as a call to 'EXECUTE IMMEDIATE' with all the limitations that this implies.
Placeholders and binding is not supported with
$dbh->do
. - prepare and outerjoins
-
Due to a bug in OpenIngres 1.2 there is no way of determining which fields in an 'outerjoin'select are nullable.
Therefore all fields in outerjoin selects are deemed NULLABLE.
DBD::Ingres tries to determine is a select statement is an outerjoin by (primitively) parsing the select statement. You can override this parsing by adding an attribute to the select-call:
$dbh-E<gt>prepare($statement, %attribs)
$attribs{"ing_outerjoin"}
should contain true for outerjoins and false otherwise.Eg:
$sth = $dbh->prepare("select...left join...", { ing_outerjoin => 1 }); $sth = $dbh->prepare("select...", { ing_outerjoin => 0 });
- ing_statement
-
$sth->{ing_statement} ($)
Contains the text of the SQL-statement. Used mainly for debugging.
- ing_types
-
$sth->{ing_types} (\@)
Returns an array of the "perl"-type of the return fields of a select statement.
The types are represented as:
- 'i': integer
-
All integer types, ie. int1, int2 and int4.
These values are returned as integers. This should not cause loss of precision as the internal Perl integer is at least 32 bit long.
- 'f': float
-
The types float, float8 and money.
These values are returned as floating-point numbers. This may cause loss of precision, but that would occur anyway whenever an application referred to the data (all Ingres tools fetch these values as floating-point numbers)
- 's': string
-
All other supported types, ie. char, varchar, text, date etc.
- ing_lengths
-
$sth->{ing_lengths} (\@)
Returns an array containing the lengths of the fields in Ingres, eg. an int2 will return 2, a varchar(7) 7 and so on.
Note that money and date fields will have length returned as 0.
$sth->{SqlLen}
is the same as$sth->{ing_lengths}
, but the use of it is depreceated. - ing_sqltypes
-
$sth->{ing_sqltypes} (\@)
Returns an array containing the Ingres types of the fields. The types are given as documented in the Ingres SQL Reference Manual.
All values are positive as the nullability of the field is returned in
$sth->{NULLABLE}
.
Not implemented
- state
-
$h->state (undef)
SQLSTATE is not implemented yet. It is planned for the (not so) near future.
- ping
-
$dbh->ping;
Not yet implemented - on the ToDo list.
- updateable cursors
-
It should be possible to do something like this:
$sth = $dbh->prepare("select a,b,c from t", ing_update => "b, c"); $sth->execute; $row = $sth->fetchrow_arrayref; $dbh->do("update t set b='1' where current of $sth->{CursorName}");
The exact syntax is open for discussion (you implement => you decide!).
- disconnect_all
-
Not implemented
- commit and rollback invalidates open cursors
-
DBD::Ingres 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).
- Procedure calls
-
It is not possible to call database procedures from DBD::Ingres.
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 get_event) if the need arises and someone is willing to do it.
- OpenIngres new features
-
The new features of OpenIngres are not (yet) supported in DBD::Ingres.
This includes BLOBS, decimal datatype and spatial datatypes.
Support will be added when the need arises - if you need it you add it ;-)
NOTES
I wonder if I have forgotten something?
SEE ALSO
The DBI documentation in DBI.
AUTHORS
DBI/DBD was developed by Tim Bunce, <Tim.Bunce@ig.co.uk>, who also developed the DBD::Oracle that is the closest we have to a generic DBD implementation.
Henrik Tougaard, <ht@datani.dk> developed the DBD::Ingres extension.
1 POD Error
The following errors were encountered while parsing the POD:
- Around line 314:
You forgot a '=back' before '=head2'