Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home
« Groups Home
perl_class_definition always returns 'scalar' column types
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  9 messages - Collapse all  -  Translate all to Translated (View all originals)
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
Chris  
View profile   Translate to Translated (View Original)
 More options Jul 24 2012, 1:32 pm
From: Chris <ccamp...@gmail.com>
Date: Tue, 24 Jul 2012 10:32:36 -0700 (PDT)
Local: Tues, Jul 24 2012 1:32 pm
Subject: perl_class_definition always returns 'scalar' column types

I have an Oracle table definition :

CREATE* *TABLE* *PRODUCTS(
*  *ID*            *INTEGER,
*  *NAME*          *VARCHAR2(255* *BYTE)*              *NOT* *NULL,
*  *STATUS*        *VARCHAR2(128* *BYTE)*              *DEFAULT* *'inactive'
*            *NOT* *NULL,
*  *DATE_CREATED*  *TIMESTAMP(6)*                    *DEFAULT* *sysdate,
*  *RELEASE_DATE*  *TIMESTAMP(6),
*  *VENDOR_ID*     *INTEGER
);

When calling perl_class_defintion from within my Rose::DB::Object class as
such :

__PACKAGE__->meta->table('PRODUCTS');
__PACKAGE__->meta->auto_initialize();
print __PACKAGE__->meta->perl_class_definition(
    indent => 4,
    braces => 'bsd'
);

It returns all scalar column types :

package TestApp::DB::Object::Product;
use strict;
use base qw(TestApp::DB::Object);

__PACKAGE__->meta->setup
(
    table   => 'PRODUCTS',

    columns =>
    [
        ID           => { type => 'scalar', alias => 'id', length => 38,
not_null => 1 },
        NAME         => { type => 'scalar', alias => 'name', length => 255,
not_null => 1 },
        STATUS       => { type => 'scalar', alias => 'status', default =>
'inactive', length => 128, not_null => 1 },
        DATE_CREATED => { type => 'scalar', alias => 'date_created',
default => 'sysdate', length => 11 },
        RELEASE_DATE => { type => 'scalar', alias => 'release_date', length
=> 11 },
        VENDOR_ID    => { type => 'scalar', alias => 'vendor_id', length =>
38 },
    ],

    primary_key_columns => [ 'ID' ],
);
1;

Also, it doesn't seem to be detecting unique indices as well.  I have a
unique index defined on the 'name'  column but as you can see 'unique_key
=> name' isn't part of the output.

I've scoured the docs (as well as this group) for the answer but to no
avail.

Thoughts?

Thanks.


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
John Siracusa  
View profile  
 More options Jul 24 2012, 1:42 pm
From: John Siracusa <sirac...@gmail.com>
Date: Tue, 24 Jul 2012 13:42:08 -0400
Local: Tues, Jul 24 2012 1:42 pm
Subject: Re: perl_class_definition always returns 'scalar' column types
What versions of Rose::DB::Object, Rose::DB, DBD::Oracle, DBI, and
Oracle are you using?

-John


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Chris  
View profile  
 More options Jul 24 2012, 1:50 pm
From: Chris <ccamp...@gmail.com>
Date: Tue, 24 Jul 2012 10:50:51 -0700 (PDT)
Local: Tues, Jul 24 2012 1:50 pm
Subject: Re: perl_class_definition always returns 'scalar' column types

Rose::DB::Object : 0.798
Rose::DB : 0.769
DBD::Oracle : 1.46
DBI : 1.618
Oracle : 10g


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
John Siracusa  
View profile  
 More options Jul 24 2012, 2:19 pm
From: John Siracusa <sirac...@gmail.com>
Date: Tue, 24 Jul 2012 14:19:54 -0400
Local: Tues, Jul 24 2012 2:19 pm
Subject: Re: perl_class_definition always returns 'scalar' column types

On Tue, Jul 24, 2012 at 1:50 PM, Chris <ccamp...@gmail.com> wrote:
> Rose::DB::Object : 0.798
> Rose::DB : 0.769
> DBD::Oracle : 1.46
> DBI : 1.618
> Oracle : 10g

I don't have access to Oracle 10g here, but if you can throw a
breakpoint into auto_generate_column() in
Rose::DB::Object::Metadata::Auto and see what value $type and
$column_class end up with, that might get you started debugging it.

-John


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Chris  
View profile  
 More options Jul 30 2012, 10:36 am
From: Chris <ccamp...@gmail.com>
Date: Mon, 30 Jul 2012 07:36:55 -0700 (PDT)
Local: Mon, Jul 30 2012 10:36 am
Subject: Re: perl_class_definition always returns 'scalar' column types

Just for other's sake....because Rose::DB::Object::Metadata doesn't support
varchar2 out of the box, I had to add the following method to my Metadata
subclass :

__PACKAGE__->column_type_class(
    varchar2 => 'Rose::DB::Object::Metadata::Column::Varchar',
);

As for my INTEGER field, DBD Oracle returns 'NUMBER' type for any defined
numeric columns in Oracle.  According to the DBD::Oracle POD this is
because Oracle only supports NUMBER fields but does support other numeric
fields as aliases.

Would I be losing any resolution if I just left NUMBER columns as default
scalars (as are ID and VENDOR_ID in my table example above)?  Or should I
bother in trying to map these columns manually with
actual Rose::DB::Object::Metadata::Column types?


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
John Siracusa  
View profile  
 More options Aug 10 2012, 9:24 am
From: John Siracusa <sirac...@gmail.com>
Date: Fri, 10 Aug 2012 09:24:23 -0400
Local: Fri, Aug 10 2012 9:24 am
Subject: Re: perl_class_definition always returns 'scalar' column types

On Mon, Jul 30, 2012 at 10:36 AM, Chris <ccamp...@gmail.com> wrote:
> Just for other's sake....because Rose::DB::Object::Metadata doesn't support
> varchar2 out of the box, I had to add the following method to my Metadata
> subclass :

> __PACKAGE__->column_type_class(
>     varchar2 => 'Rose::DB::Object::Metadata::Column::Varchar',
> );

OK, I'll add that.

> As for my INTEGER field, DBD Oracle returns 'NUMBER' type for any defined
> numeric columns in Oracle.  According to the DBD::Oracle POD this is because
> Oracle only supports NUMBER fields but does support other numeric fields as
> aliases.

What do you think about mapping number to the
Rose::DB::Object::Metadata::Column::Numeric column type?

> Would I be losing any resolution if I just left NUMBER columns as default
> scalars (as are ID and VENDOR_ID in my table example above)?  Or should I
> bother in trying to map these columns manually with actual
> Rose::DB::Object::Metadata::Column types?

I think you should be fine with them as scalar, but maybe
Rose::DB::Object::Metadata::Column::BigInt might be required for very
large integer values.  Test it out with very large values and tell me
if the scalar type works for you.

-John

-John


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Tom Adamo  
View profile  
 More options Sep 26 2012, 4:24 pm
From: Tom Adamo <tad...@gmail.com>
Date: Wed, 26 Sep 2012 13:24:44 -0700 (PDT)
Local: Wed, Sep 26 2012 4:24 pm
Subject: Re: perl_class_definition always returns 'scalar' column types

John,

I like the idea of mapping number
to Rose::DB::Object::Metadata::Column::Numeric, since I'm currently running
into this problem as well (I'm trying to build a validation profile, so I
need to know the datatype of this column numeric). I noticed it's already
in Rose::DB::Object::Metadata, but just commented out.

- Tom


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
John Siracusa  
View profile  
 More options Sep 26 2012, 4:40 pm
From: John Siracusa <sirac...@gmail.com>
Date: Wed, 26 Sep 2012 16:40:25 -0400
Local: Wed, Sep 26 2012 4:40 pm
Subject: Re: perl_class_definition always returns 'scalar' column types

On Wed, Sep 26, 2012 at 4:24 PM, Tom Adamo <tad...@gmail.com> wrote:
> I like the idea of mapping number to
> Rose::DB::Object::Metadata::Column::Numeric, since I'm currently running
> into this problem as well (I'm trying to build a validation profile, so I
> need to know the datatype of this column numeric). I noticed it's already in
> Rose::DB::Object::Metadata, but just commented out.

Just the "number" type name is commented out (and I'm not sure why).
You should be able to use the "numeric" or "num" type names to get the
same result.

-John


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Tom Adamo  
View profile  
 More options Oct 19 2012, 3:57 pm
From: Tom Adamo <tad...@gmail.com>
Date: Fri, 19 Oct 2012 12:57:03 -0700 (PDT)
Local: Fri, Oct 19 2012 3:57 pm
Subject: Re: perl_class_definition always returns 'scalar' column types

Yeah, I'm doing this now and it works fine.

package Local::DB::Object::Metadata;
use base 'Rose::DB::Object::Metadata';

__PACKAGE__->column_type_class(
    number => 'Rose::DB::Object::Metadata::Column::Numeric',
    varchar2 => 'Rose::DB::Object::Metadata::Column::Varchar',
);

Thanks,
- Tom


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions « Newer topic     Older topic »