Rose::DB::Object::Metadata::Column::BigInt - Big integer column metadata.


Rose-DB-Object documentation Contained in the Rose-DB-Object distribution.

Index


Code Index:

NAME

Top

Rose::DB::Object::Metadata::Column::BigInt - Big integer column metadata.

SYNOPSIS

Top

  use Rose::DB::Object::Metadata::Column::BigInt;

  $col = Rose::DB::Object::Metadata::Column::BigInt->new(...);
  $col->make_methods(...);
  ...

DESCRIPTION

Top

Objects of this class store and manipulate metadata for big integer (sometimes called "int8") columns in a database. Values are stored internally and returned as Math::BigInt objects. If the Math::BigInt::GMP module is installed, it will be used transparently for better peformance.

This class inherits from Rose::DB::Object::Metadata::Column::Integer. Inherited methods that are not overridden will not be documented a second time here. See the Rose::DB::Object::Metadata::Column::Integer documentation for more information.

METHOD MAP

Top

If perl is compiled to use 64-bit integers, then the method map is:

get_set

Rose::DB::Object::MakeMethods::Generic, scalar, interface => 'get_set', ...

get

Rose::DB::Object::MakeMethods::Generic, scalar, interface => 'get', ...

get_set

Rose::DB::Object::MakeMethods::Generic, scalar, interface => 'set', ...

Otherwise, the method map is:

get_set

Rose::DB::Object::MakeMethods::Generic, scalar, interface => 'get_set', ...

get

Rose::DB::Object::MakeMethods::Generic, scalar, interface => 'get', ...

get_set

Rose::DB::Object::MakeMethods::Generic, scalar, interface => 'set', ...

See the Rose::DB::Object::Metadata::Column documentation for an explanation of this method map.

OBJECT METHODS

Top

type

Returns "bigint".

AUTHOR

Top

John C. Siracusa (siracusa@gmail.com)

LICENSE

Top

Copyright (c) 2010 by John C. Siracusa. All rights reserved. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.


Rose-DB-Object documentation Contained in the Rose-DB-Object distribution.

package Rose::DB::Object::Metadata::Column::BigInt;

use strict;

use Rose::DB::Object::MakeMethods::BigNum;

use Rose::DB::Object::Metadata::Column::Integer;
our @ISA = qw(Rose::DB::Object::Metadata::Column::Integer);

our $VERSION = '0.788';

INIT_METHOD_MAKER_INFO:
{
  use Config;

  my($class, $type);

  if($Config{'use64bitint'})
  {
    $class = 'Rose::DB::Object::MakeMethods::Generic';
    $type  = 'integer';
  }
  else
  {
    $class = 'Rose::DB::Object::MakeMethods::BigNum';
    $type  = 'bigint';
  }

  __PACKAGE__->method_maker_info
  (
    get_set => 
    {
      class => $class,
      type  => $type,
    },

    get =>
    {
      class => $class,
      type  => $type,
    },

    set =>
    {
      class => $class,
      type  => $type,
    },
  );
}

sub type { 'bigint' }

sub should_inline_value
{
  my($self, $db, $value) = @_;
  no warnings 'uninitialized';
  return (($db->validate_bigint_keyword($value) && $db->should_inline_bigint_keyword($value)) ||
          ($db->keyword_function_calls && $value =~ /^\w+\(.*\)$/)) ? 1 : 0;
}

sub format_value
{
  my($self, $db, $value) = @_;
  return ref $value ? $value->bstr : $value;
}

1;

__END__