[Dbix-class] Oracle Auto-PK no longer works after upgrade to0.05xxx and conversion to Schema

James FitzGibbon jfitzgibbon at primustel.ca
Wed Mar 8 22:28:34 CET 2006


Yep, it was the version of C3.  Upgrading to 0.11 fixed it.  Or at, least,
it now breaks further on, but that's probably an artifact of my conversion
from DB to Schema. 

However, the version requirement is not in the DBIC code:

package DBIx::Class::Componentised;
use Class::C3;

...only in Build.PL.  My module build system is driven off of RPM, so it
gets it's version requirements from the code, not the build scripts.  It
probably flashed a warning at me (that I missed, to be sure), but the
install succeeded because there was no min version attacked to the
requirement in the RPM file.

I looked at the head of PK::Auto on the -current branch.  It looks like it
will do what I need, but I will still have to override last_insert_id and
get_autoinc_seq in some places.  I have some tables that use UUIDs instead
of sequences for primary keys, but the generation is done in the database,
so DBIC::UUIDColumns doesn't work for me.  Because the function that
populates the column is named NEXTUUID instead of NEXTVAL, I have to load a
component that overrides both methods, changing what is looked for and what
is selected.

Perhaps an overrideable class accessor for both of these would make life
easier.  Something along the lines of:

my $schema = MySchema->connect( ... );
$schema->storage->sequence_re( m!(\w+)\.next(uuid|val)!i );
$schema->storage->sequence_function_re( "curr$1" );

Yeah, I know there's some hand-waving with the $1 there.  Just scribbling
thoughts at this point.

Regards

-----Original Message-----
From: dbix-class-bounces at lists.rawmode.org
[mailto:dbix-class-bounces at lists.rawmode.org] On Behalf Of Brandon Black
Sent: Wednesday, March 08, 2006 3:52 PM
To: dbix-class at lists.rawmode.org
Subject: Re: [Dbix-class] Oracle Auto-PK no longer works after upgrade
to0.05xxx and conversion to Schema

On 3/8/06, James FitzGibbon <jfitzgibbon at primustel.ca> wrote:
> I can't find any reference to this on the PK::Auto page.  In fact, the
> documentation seems to point the other way:
>
> "load the appropriate one for your database, e.g. PK::Auto::SQLite, in
your
> table classes"
>
> "for example, if you have different databases and need to determine the
> appropriate PK::Auto class at runtime"
>

In the stable releases on CPAN that is still true (0.0500x).  There is
a seperate branch of new development called "DBIx-Class-current" which
has a number of improvements, but which hasn't stabilized enough for
an official release.  One of those improvements is that you just use
the component "PK::Auto", and the database-specific part is worked out
for you by DBIx::Class internally, based on the storage subclass,
which is in turn based on the DBI driver in your dsn string.

> unixbeard wrote Class::DBI::BaseDSN, which tried to do this, but I'm not
> sure if it's technique would be compatible with C3.  It inspected the DSN,
> took the DBD out, loaded Class::DBI::$DSN and then re-wrote @ISA to
replace
> Class::DBI::BaseDSN with Class::DBI::$DSN.
>
> If this works in C3, it would require calling Class::C3::reinitialize.  I
> think it's this manipulation of @ISA at runtime that is screwing me up.  I
> did a test with my problematic code, having SPE::DBIx::Class load the
> PK::Auto::Oracle component at compile time and commenting out my load a
> runtime bits.  Now, the correct insert method is called.
>
> I just realized that I'm still using C3 0.09, so I'm going to upgrade to
> 0.11 and see if that fixes things.

IIRC, 0.05007 requires C3 0.11, so this may be your immediate problem.
 It can't hurt in any case.

-- Brandon

_______________________________________________
List: http://lists.rawmode.org/cgi-bin/mailman/listinfo/dbix-class
Wiki: http://dbix-class.shadowcatsystems.co.uk/
IRC: irc.perl.org#dbix-class
SVN: http://dev.catalyst.perl.org/repos/bast/trunk/DBIx-Class/

-- 
No virus found in this incoming message.
Checked by AVG Free Edition.
Version: 7.1.375 / Virus Database: 268.2.0/276 - Release Date: 3/7/2006
 

-- 
No virus found in this outgoing message.
Checked by AVG Free Edition.
Version: 7.1.375 / Virus Database: 268.2.0/276 - Release Date: 3/7/2006
 



-- 
----------------------------------------------------------------------------
This electronic message contains information from Primus Telecommunications
Canada Inc. ("PRIMUS") , which may be legally privileged and confidential.
The information is intended to be for the use of the individual(s) or entity
named above. If you are not the intended recipient, be aware that any
disclosure, copying, distribution or use of the contents of this information
is prohibited. If you have received this electronic message in error, please
notify us by telephone or e-mail (to the number or address above)
immediately. Any views, opinions or advice expressed in this electronic
message are not necessarily the views, opinions or advice of PRIMUS.
It is the responsibility of the recipient to ensure that
any attachments are virus free and PRIMUS bears no responsibility
for any loss or damage arising in any way from the use
thereof.The term "PRIMUS" includes its affiliates.
----------------------------------------------------------------------------
Pour la version en français de ce message, veuillez voir
 http://www.primustel.ca/fr/legal/cs.htm
----------------------------------------------------------------------------




More information about the Dbix-class mailing list