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

James FitzGibbon jfitzgibbon at primustel.ca
Mon Mar 13 15:01:47 CET 2006


Oh yes, I forgot to mention this lovely bit of self-flagellating code in the
insert trigger:

CREATE OR REPLACE TRIGGER
    files_in_trig
BEFORE INSERT OR UPDATE OR DELETE ON
    files_in
FOR EACH ROW
BEGIN
    IF INSERTING THEN
        IF( :new.uuid IS NOT NULL ) THEN
            raise_application_error( -20001, 'files_in.uuid is
autogenerated' );
        END IF; 
[...]

So it's not just as easy as switching to UUIDColumns and hoping that they
don't notice.  8-)

-----Original Message-----
From: dbix-class-bounces at lists.rawmode.org
[mailto:dbix-class-bounces at lists.rawmode.org] On Behalf Of James FitzGibbon
Sent: Monday, March 13, 2006 8:24 AM
To: claco at chrislaco.com; dbix-class at lists.rawmode.org
Subject: Re: [Dbix-class] Oracle Auto-PK no longer works afterupgrade
to0.05xxx and conversion to Schema

The way the database is set up (and this is not my choice) is that there is
a package like this:

CREATE OR REPLACE PACKAGE uuid_seq AS

    FUNCTION NEXTUUID RETURN VARCHAR2;
    FUNCTION CURRUUID RETURN VARCHAR2;

END uuid_seq;
/

CREATE OR REPLACE PACKAGE BODY uuid_seq AS

    current_uuid CHAR(36) := NULL;

    FUNCTION new_uuid RETURN VARCHAR2 AS LANGUAGE JAVA
    NAME 'UUIDGenerate.newUUID() return java.lang.String';

    FUNCTION NEXTUUID RETURN VARCHAR2 IS
    BEGIN
        current_uuid := new_uuid;
        RETURN current_uuid;
    END;

    FUNCTION CURRUUID RETURN VARCHAR2 IS
    BEGIN
        IF current_uuid IS NULL THEN
            raise_application_error(
                -20000,
                'uuid_seq.NEXTUUID has not been called yet'
            );

        END IF;
        RETURN current_uuid;
    END;

END uuid_seq;
 
The UUID generation is done using a java library linked into Oracle.

The naming is designed to mimic a built-in Oracle sequence.  It would be
ideal if the functions were called CURRVAL and NEXTVAL, but I believe those
are reserved names and thus unavailable.

I'm not sure what the hang-up is with having some UUIDs come from Data::UUID
and some from the database.  The database is on a different box, so given
that the generator is seeded using the IEEE 802 address, they would be from
two completely different series.  Maybe that's the problem.  Maybe the DBAs
just don’t get the U (first or second) in "UUID".

I'm open to suggestions as to how I can keep them happy without jumping
through all these DBIC hoops though.

-----Original Message-----
From: dbix-class-bounces at lists.rawmode.org
[mailto:dbix-class-bounces at lists.rawmode.org] On Behalf Of Christopher H.
Laco
Sent: Wednesday, March 08, 2006 4:38 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

James FitzGibbon wrote:
> 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.


Interesting. Tell me more.

I was the last to hack through UUIDColumns, and added UUIDMaker that
uses the next available uuid generator, Data::UUID, UUID,
Win32::GUIDGen, etc.

I've never seen NEXTVAL... and I'll assume NEXTUUID is a db level
function....





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

-- 
No virus found in this outgoing message.
Checked by AVG Free Edition.
Version: 7.1.375 / Virus Database: 268.2.1/279 - Release Date: 3/10/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
----------------------------------------------------------------------------


_______________________________________________
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.1/279 - Release Date: 3/10/2006
 

-- 
No virus found in this outgoing message.
Checked by AVG Free Edition.
Version: 7.1.375 / Virus Database: 268.2.1/279 - Release Date: 3/10/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