Skip Menu |

Preferred bug tracker

Please visit the preferred bug tracker to report your issue.

This queue is for tickets about the DBD-Oracle CPAN distribution.

Report information
The Basics
Id: 42328
Status: resolved
Priority: 0/
Queue: DBD-Oracle

People
Owner: champoux [...] pythian.com
Requestors: tomas.zemres [...] gmail.com
Cc:
AdminCc:

Bug Information
Severity: Normal
Broken in: (no value)
Fixed in: 1.23



Subject: patch for better embedded objects support in DBD::Oracle
There is patch for "extended" embedded objects support this patch is for SVN version: http://svn.perl.org/modules/dbd-oracle/trunk revision 12315 There is added "ora_objects" attribute. without this attribute (default) are embeded objects fetched as array (backward compatible) with this attribute enabled: - embedded objects are returned as DBD::Oracle::Object instances. - each instance contains "type_name" with full oracle type. - each instance contains attributes with their names (as array,hash) - there is better object inheritance support (object type is resolved for each instance - not only for column) - added tests for old and new object interface (t/57objects.t) - fixed bug with object types from another schema I think, that this extended object interface may be useful for some users.
Subject: dbd-oracle-ora_objects.diff.gz

Message body not shown because it is not plain text.

I have applied to patch to trunk and tested it and it seems to work well. I had to make a few little changes (nothing realy) What I would like to see is a simle example on how to use it that I could add to the pod and the names of the programmers so I can this to the changes file you can find your code at http://svn.perl.org/modules/dbd-oracle/trunk
Subject: Re: [rt.cpan.org #42328] patch for better embedded objects support in DBD::Oracle
Date: Thu, 15 Jan 2009 09:17:48 +0100
To: bug-DBD-Oracle [...] rt.cpan.org
From: Tomas Pokorny <tnt [...] netsafe.cz>
Hi, I am author of this patch, my name is Tomas Pokorny. Example may be something like in added test: databse content: CREATE TYPE Person AS OBJECT ( name VARCHAR2(20), age INTEGER ) NOT FINAL; CREATE TYPE Employee UNDER Person ( salary NUMERIC(8,2) ); CREATE TABLE people (id INTEGER, obj Person); INSERT INTO people VALUES (1, Person('Black', 25)); INSERT INTO people VALUES (2, Employee('Smith', 44, 5000)); perl example: use DBI; my $dbh = DBI->connect('dbi:Oracle:TESTDB', 'test/testpw', '', { ora_objects => 1 }); my $sth = $dbh->prepare("select * from people order by id"); $sth->execute(); # object are fetched as instance of DBD::Oracle::Object my ($id1, $obj1) = $sth->fetchrow(); my ($id2, $obj2) = $sth->fetchrow(); # get full type-name of object print $obj1->type_name; # 'TEST.PERSON' is printed print $obj2->type_name; # 'TEST.EMPLOYEE' is printed # get attribute NAME from object print $obj1->attr('NAME'); # 'Black' is printed print $obj2->attr('NAME'); # 'Smith' is printed # get all atributes as hash reference my $h1 = $obj1->attr; # returns {'NAME' => 'Black', 'AGE' => 25} my $h2 = $obj2->attr; # returns {'NAME' => 'Smith', 'AGE' => 44, # 'SALARY' => 5000 } # get all attributes (names and values) as array my @a1 = $obj1->attributes; # returns ('NAME', 'Black', 'AGE', 25) my @a2 = $obj2->attributes; # returns ('NAME', 'Smith', 'AGE', 44, # 'SALARY', 5000 ) -- On Wed, 2009-01-14 at 10:34 -0500, Pythian Remote DBA via RT wrote: Show quoted text
> <URL: https://rt.cpan.org/Ticket/Display.html?id=42328 > > > I have applied to patch to trunk and tested it and it seems to work > well. > > I had to make a few little changes (nothing realy) > > What I would like to see is a simle example on how to use it that I > could add to the pod and the names of the programmers so I can this to > the changes file > > you can find your code at > > http://svn.perl.org/modules/dbd-oracle/trunk >
ok added to trunk will be in the next release