| 1 | package Rose::DB::Object::Metadata::Column::BigInt; | ||
| 2 | |||
| 3 | use strict; | ||
| 4 | |||
| 5 | use Rose::DB::Object::MakeMethods::BigNum; | ||
| 6 | |||
| 7 | use Rose::DB::Object::Metadata::Column::Integer; | ||
| 8 | our @ISA = qw(Rose::DB::Object::Metadata::Column::Integer); | ||
| 9 | |||
| 10 | our $VERSION = '0.788'; | ||
| 11 | |||
| 12 | INIT_METHOD_MAKER_INFO: | ||
| 13 | { | ||
| 14 | use Config; | ||
| 15 | |||
| 16 | my($class, $type); | ||
| 17 | |||
| 18 | if($Config{'use64bitint'}) | ||
| 19 | { | ||
| 20 | $class = 'Rose::DB::Object::MakeMethods::Generic'; | ||
| 21 | $type = 'integer'; | ||
| 22 | } | ||
| 23 | else | ||
| 24 | { | ||
| 25 | $class = 'Rose::DB::Object::MakeMethods::BigNum'; | ||
| 26 | $type = 'bigint'; | ||
| 27 | } | ||
| 28 | |||
| 29 | __PACKAGE__->method_maker_info | ||
| 30 | ( | ||
| 31 | get_set => | ||
| 32 | { | ||
| 33 | class => $class, | ||
| 34 | type => $type, | ||
| 35 | }, | ||
| 36 | |||
| 37 | get => | ||
| 38 | { | ||
| 39 | class => $class, | ||
| 40 | type => $type, | ||
| 41 | }, | ||
| 42 | |||
| 43 | set => | ||
| 44 | { | ||
| 45 | class => $class, | ||
| 46 | type => $type, | ||
| 47 | }, | ||
| 48 | ); | ||
| 49 | } | ||
| 50 | |||
| 51 | sub type { 'bigint' } | ||
| 52 | |||
| 53 | sub should_inline_value | ||
| 54 | { | ||
| 55 | my($self, $db, $value) = @_; | ||
| 56 | no warnings 'uninitialized'; | ||
| 57 | return (($db->validate_bigint_keyword($value) && $db->should_inline_bigint_keyword($value)) || | ||
| 58 | ($db->keyword_function_calls && $value =~ /^\w+\(.*\)$/)) ? 1 : 0; | ||
| 59 | } | ||
| 60 | |||
| 61 | sub format_value | ||
| 62 | { | ||
| 63 | my($self, $db, $value) = @_; | ||
| 64 | return ref $value ? $value->bstr : $value; | ||
| 65 | } | ||
| 66 | |||
| 67 | 1; | ||
| 68 | |||
| 69 | __END__ |