use SQL::Translator::Producer;
use SQL::Translator::Schema;
-# ----------------------------------------------------------------------
-# The default behavior is to "pass through" values (note that the
-# SQL::Translator instance is the first value ($_[0]), and the stuff
-# to be parsed is the second value ($_[1])
-# ----------------------------------------------------------------------
$DEFAULT_SUB = sub { $_[0]->schema } unless defined $DEFAULT_SUB;
-# ----------------------------------------------------------------------
-# init([ARGS])
-# The constructor.
-#
-# new takes an optional hash of arguments. These arguments may
-# include a parser, specified with the keys "parser" or "from",
-# and a producer, specified with the keys "producer" or "to".
-#
-# The values that can be passed as the parser or producer are
-# given directly to the parser or producer methods, respectively.
-# See the appropriate method description below for details about
-# what each expects/accepts.
-# ----------------------------------------------------------------------
sub init {
my ( $self, $config ) = @_;
#
return $self;
}
-# ----------------------------------------------------------------------
-# add_drop_table([$bool])
-# ----------------------------------------------------------------------
sub add_drop_table {
my $self = shift;
if ( defined (my $arg = shift) ) {
return $self->{'add_drop_table'} || 0;
}
-# ----------------------------------------------------------------------
-# no_comments([$bool])
-# ----------------------------------------------------------------------
sub no_comments {
my $self = shift;
my $arg = shift;
return $self->{'no_comments'} || 0;
}
-
-# ----------------------------------------------------------------------
-# quote_table_names([$bool])
-# ----------------------------------------------------------------------
sub quote_table_names {
my $self = shift;
if ( defined (my $arg = shift) ) {
return $self->{'quote_table_names'} || 0;
}
-# ----------------------------------------------------------------------
-# quote_field_names([$bool])
-# ----------------------------------------------------------------------
sub quote_field_names {
my $self = shift;
if ( defined (my $arg = shift) ) {
return $self->{'quote_field_names'} || 0;
}
-# ----------------------------------------------------------------------
-# producer([$producer_spec])
-#
-# Get or set the producer for the current translator.
-# ----------------------------------------------------------------------
sub producer {
shift->_tool({
name => 'producer',
}, @_);
}
-# ----------------------------------------------------------------------
-# producer_type()
-#
-# producer_type is an accessor that allows producer subs to get
-# information about their origin. This is poptentially important;
-# since all producer subs are called as subroutine references, there is
-# no way for a producer to find out which package the sub lives in
-# originally, for example.
-# ----------------------------------------------------------------------
sub producer_type { $_[0]->{'producer_type'} }
-# ----------------------------------------------------------------------
-# producer_args([\%args])
-#
-# Arbitrary name => value pairs of paramters can be passed to a
-# producer using this method.
-#
-# If the first argument passed in is undef, then the hash of arguments
-# is cleared; all subsequent elements are added to the hash of name,
-# value pairs stored as producer_args.
-# ----------------------------------------------------------------------
sub producer_args { shift->_args("producer", @_); }
-# ----------------------------------------------------------------------
-# parser([$parser_spec])
-# ----------------------------------------------------------------------
sub parser {
shift->_tool({
name => 'parser',
sub parser_args { shift->_args("parser", @_); }
-# ----------------------------------------------------------------------
-# e.g.
-# $sqlt->filters => [
-# sub { },
-# [ "NormalizeNames", field => "lc", tabel => "ucfirst" ],
-# [
-# "DataTypeMap",
-# "TEXT" => "BIGTEXT",
-# ],
-# ],
-# ----------------------------------------------------------------------
sub filters {
my $self = shift;
my $filters = $self->{filters} ||= [];
return @$filters;
}
-# ----------------------------------------------------------------------
sub show_warnings {
my $self = shift;
my $arg = shift;
}
-# filename - get or set the filename
sub filename {
my $self = shift;
if (@_) {
$self->{'filename'};
}
-# ----------------------------------------------------------------------
-# data([$data])
-#
-# if $self->{'data'} is not set, but $self->{'filename'} is, then
-# $self->{'filename'} is opened and read, with the results put into
-# $self->{'data'}.
-# ----------------------------------------------------------------------
sub data {
my $self = shift;
return $self->{'data'};
}
-# ----------------------------------------------------------------------
sub reset {
#
# Deletes the existing Schema object so that future calls to translate
return 1;
}
-# ----------------------------------------------------------------------
sub schema {
#
# Returns the SQL::Translator::Schema object
return $self->{'schema'};
}
-# ----------------------------------------------------------------------
sub trace {
my $self = shift;
my $arg = shift;
return $self->{'trace'} || 0;
}
-# ----------------------------------------------------------------------
-# translate([source], [\%args])
-#
-# translate does the actual translation. The main argument is the
-# source of the data to be translated, which can be a filename, scalar
-# reference, or glob reference.
-#
-# Alternatively, translate takes optional arguements, which are passed
-# to the appropriate places. Most notable of these arguments are
-# parser and producer, which can be used to set the parser and
-# producer, respectively. This is the applications last chance to set
-# these.
-#
-# translate returns a string.
-# ----------------------------------------------------------------------
sub translate {
my $self = shift;
my ($args, $parser, $parser_type, $producer, $producer_type);
return wantarray ? @producer_output : $producer_output;
}
-# ----------------------------------------------------------------------
-# list_parsers()
-#
-# Hacky sort of method to list all available parsers. This has
-# several problems:
-#
-# - Only finds things in the SQL::Translator::Parser namespace
-#
-# - Only finds things that are located in the same directory
-# as SQL::Translator::Parser. Yeck.
-#
-# This method will fail in several very likely cases:
-#
-# - Parser modules in different namespaces
-#
-# - Parser modules in the SQL::Translator::Parser namespace that
-# have any XS componenets will be installed in
-# arch_lib/SQL/Translator.
-#
-# ----------------------------------------------------------------------
sub list_parsers {
return shift->_list("parser");
}
-# ----------------------------------------------------------------------
-# list_producers()
-#
-# See notes for list_parsers(), above; all the problems apply to
-# list_producers as well.
-# ----------------------------------------------------------------------
sub list_producers {
return shift->_list("producer");
}
return undef;
}
-# ----------------------------------------------------------------------
sub format_table_name {
return shift->_format_name('_format_table_name', @_);
}
-# ----------------------------------------------------------------------
sub format_package_name {
return shift->_format_name('_format_package_name', @_);
}
-# ----------------------------------------------------------------------
sub format_fk_name {
return shift->_format_name('_format_fk_name', @_);
}
-# ----------------------------------------------------------------------
sub format_pk_name {
return shift->_format_name('_format_pk_name', @_);
}
return @args ? $self->{$field}->(@args) : $self->{$field};
}
-# ----------------------------------------------------------------------
-# isa($ref, $type)
-#
-# Calls UNIVERSAL::isa($ref, $type). I think UNIVERSAL::isa is ugly,
-# but I like function overhead.
-# ----------------------------------------------------------------------
sub isa($$) {
my ($ref, $type) = @_;
return UNIVERSAL::isa($ref, $type);
}
-# ----------------------------------------------------------------------
-# version
-#
-# Returns the $VERSION of the main SQL::Translator package.
-# ----------------------------------------------------------------------
sub version {
my $self = shift;
return $VERSION;
}
-# ----------------------------------------------------------------------
sub validate {
my ( $self, $arg ) = @_;
if ( defined $arg ) {
!;
-# -------------------------------------------------------------------
sub parse {
my ( $translator, $data ) = @_;
my $parser = Parse::RecDescent->new($GRAMMAR);
$::RD_WARN = 1; # Enable warnings. This will warn on unused rules &c.
$::RD_HINT = 1; # Give out hints to help fix problems.
-# -------------------------------------------------------------------
sub parse {
my ( $translator, $data ) = @_;
my $parser = SQL::Translator::Parser::DB2::Grammar->new();
=cut
-# -------------------------------------------------------------------
-
use strict;
use DBI;
use vars qw($VERSION @EXPORT);
1;
-# -------------------------------------------------------------------
=pod
=head1 AUTHOR
# $VERSION = '1.59';
$DEBUG = 0 unless defined $DEBUG;
-# -------------------------------------------------------------------
sub parse {
my ( $tr, $dbh ) = @_;
$VERSION = '1.59';
$DEBUG = 0 unless defined $DEBUG;
-# -------------------------------------------------------------------
sub parse {
my ( $tr, $dbh ) = @_;
my $schema = $tr->schema;
our $VERSION = '1.59';
-# -------------------------------------------------------------------
sub parse {
my ( $tr, $dbh ) = @_;
d => 'set default',
};
-# -------------------------------------------------------------------
sub parse {
my ( $tr, $dbh ) = @_;
no strict 'refs';
-# -------------------------------------------------------------------
sub parse {
my ( $tr, $dbh ) = @_;
1;
-# -------------------------------------------------------------------
-
=pod
=head1 AUTHOR
$VERSION = '1.59';
$DEBUG = 0 unless defined $DEBUG;
-# -------------------------------------------------------------------
sub parse {
my ( $tr, $dbh ) = @_;
no strict 'refs';
-# -------------------------------------------------------------------
sub parse {
my ( $tr, $dbh ) = @_;
1;
-# -------------------------------------------------------------------
-
=pod
=head1 AUTHOR
return 1;
}
-# -------------------------------------------------------------------
sub ET_to_ST {
my $et = shift;
$ET_to_ST{$et} || $ET_to_ST{'Text'};
END_OF_GRAMMAR
-# -------------------------------------------------------------------
sub parse {
my ( $translator, $data ) = @_;
my $parser = Parse::RecDescent->new($GRAMMAR);
`;
-# -------------------------------------------------------------------
sub parse {
my ( $translator, $data ) = @_;
my $parser = Parse::RecDescent->new($GRAMMAR);
!;
-# -------------------------------------------------------------------
sub parse {
my ( $translator, $data ) = @_;
my $parser = Parse::RecDescent->new($GRAMMAR);
};
-# -------------------------------------------------------------------
sub parse {
my ( $translator, $data ) = @_;
my $parser = Parse::RecDescent->new($GRAMMAR);
!;
-# -------------------------------------------------------------------
sub parse {
my ( $translator, $data ) = @_;
my $parser = Parse::RecDescent->new($GRAMMAR);
1;
-# -------------------------------------------------------------------
-
=pod
=head1 SEE ALSO
};
-# -------------------------------------------------------------------
sub parse {
my ( $translator, $data ) = @_;
my $parser = Parse::RecDescent->new($GRAMMAR);
=cut
-# -------------------------------------------------------------------
-
use strict;
use vars qw[ $VERSION $DEBUG ];
$VERSION = '1.59';
=cut
-# -------------------------------------------------------------------
-
use strict;
use vars qw[ $DEBUG $VERSION @EXPORT_OK ];
return 1;
}
-# -------------------------------------------------------------------
sub get_tagfields {
#
# get_tagfields XP, NODE, NAMESPACE => qw/TAGNAMES/;
1;
-# -------------------------------------------------------------------
-
=pod
=head1 BUGS
=cut
-# -------------------------------------------------------------------
-
use strict;
use vars qw($VERSION @EXPORT);
$VERSION = '1.59';
1;
-# -------------------------------------------------------------------
=pod
=head1 AUTHORS
Oracle => 'Oracle',
);
-# -------------------------------------------------------------------
sub produce {
my $t = shift;
local $DEBUG = $t->debug;
1;
-# -------------------------------------------------------------------
-
=pod
=head1 NAME
DESCRIPTOR LC_CTYPE RESIGNAL
/;
-#------------------------------------------------------------------------------
-
sub produce
{
my ($translator) = @_;
=cut
-# -------------------------------------------------------------------
-
use strict;
use vars qw[ $DEBUG $VERSION @EXPORT_OK ];
1;
-# -------------------------------------------------------------------
-
=pod
=head1 AUTHOR
1;
-# -------------------------------------------------------------------
-
=pod
=head1 AUTHOR
return $out;
}
-# -------------------------------------------------------------------
sub template {
#
# Returns the template to be processed by Template Toolkit
1;
-# -------------------------------------------------------------------
-
=pod
=head1 AUTHOR
=cut
-# -------------------------------------------------------------------
-
use strict;
use vars qw[ $DEBUG $VERSION @EXPORT_OK ];
1;
-# -------------------------------------------------------------------
-
=pod
=head1 AUTHOR
1;
-# -------------------------------------------------------------------
-
=pod
=head1 SEE ALSO
# Quote used to escape table, field, sequence and trigger names
my $quote_char = '"';
-# -------------------------------------------------------------------
sub produce {
my $translator = shift;
$DEBUG = $translator->debug;
return \@create;
}
-# -------------------------------------------------------------------
sub mk_name {
my $basename = shift || '';
my $type = shift || '';
1;
-# -------------------------------------------------------------------
sub quote {
my ($name, $q) = @_;
$q && $name ? "$quote_char$name$quote_char" : $name;
use SQL::Translator::Schema::Constants;
use SQL::Translator::Utils qw(header_comment);
-# -------------------------------------------------------------------
sub produce {
my $t = shift;
my $schema = $t->schema;
=cut
-# -------------------------------------------------------------------
sub produce {
my $translator = shift;
local $DEBUG = $translator->debug;
: join ('', @output);
}
-# -------------------------------------------------------------------
sub mk_name {
my $basename = shift || '';
my $type = shift || '';
=cut
-# -------------------------------------------------------------------
sub produce {
my $translator = shift;
$DEBUG = $translator->debug;
return $output;
}
-# -------------------------------------------------------------------
sub mk_name {
my ($name, $scope, $critical) = @_;
return unreserve($name);
}
-# -------------------------------------------------------------------
sub unreserve { $util->quote($_[0]) }
1;
-# -------------------------------------------------------------------
-
=pod
=head1 SEE ALSO
}
}
-# -------------------------------------------------------------------
sub mk_name {
my ($name, $scope, $critical) = @_;
1;
-# -------------------------------------------------------------------
-
=pod
=head1 AUTHOR
=cut
-# -------------------------------------------------------------------
sub produce {
my $translator = shift;
$DEBUG = $translator->debug;
return $output;
}
-# -------------------------------------------------------------------
sub mk_name {
my $basename = shift || '';
my $type = shift || '';
return $name;
}
-# -------------------------------------------------------------------
sub unreserve {
my $name = shift || '';
my $schema_obj_name = shift || '';
1;
-# -------------------------------------------------------------------
-
=pod
=head1 SEE ALSO
1;
-# -------------------------------------------------------------------
-
=pod
=head1 SYNOPSIS
=cut
-# -------------------------------------------------------------------
-
use strict;
use vars qw[ $DEBUG $VERSION @EXPORT_OK ];
1;
-# -------------------------------------------------------------------
-
=pod
=head1 AUTHOR
=cut
-# -------------------------------------------------------------------
-
use strict;
use vars qw[ $DEBUG $VERSION @EXPORT_OK ];
1;
-# -------------------------------------------------------------------
-
=pod
=head1 AUTHOR
=cut
-# -------------------------------------------------------------------
-
use strict;
use vars qw[ $VERSION $DEBUG ];
$VERSION = '1.59';
use YAML qw(Dump);
-# -------------------------------------------------------------------
sub produce {
my $translator = shift;
my $schema = $translator->schema;
});
}
-# -------------------------------------------------------------------
sub view_table {
my $table = shift;
};
}
-# -------------------------------------------------------------------
sub view_constraint {
my $constraint = shift;
};
}
-# -------------------------------------------------------------------
sub view_field {
my $field = shift;
};
}
-# -------------------------------------------------------------------
sub view_procedure {
my $procedure = shift;
};
}
-# -------------------------------------------------------------------
sub view_trigger {
my $trigger = shift;
};
}
-# -------------------------------------------------------------------
sub view_view {
my $view = shift;
};
}
-# -------------------------------------------------------------------
sub view_index {
my $index = shift;
1;
-# -------------------------------------------------------------------
-
=head1 SEE ALSO
SQL::Translator, YAML, http://www.yaml.org/.
return $self;
}
-# ----------------------------------------------------------------------
sub as_graph {
=pod
translator => $self->translator );
}
-# ----------------------------------------------------------------------
sub as_graph_pm {
=pod
return $g;
}
-# ----------------------------------------------------------------------
sub add_table {
=pod
return $table;
}
-# ----------------------------------------------------------------------
sub drop_table {
=pod
return $table;
}
-# ----------------------------------------------------------------------
sub add_procedure {
=pod
return $procedure;
}
-# ----------------------------------------------------------------------
sub drop_procedure {
=pod
return $proc;
}
-# ----------------------------------------------------------------------
sub add_trigger {
=pod
return $trigger;
}
-# ----------------------------------------------------------------------
sub drop_trigger {
=pod
return $trigger;
}
-# ----------------------------------------------------------------------
sub add_view {
=pod
return $view;
}
-# ----------------------------------------------------------------------
sub drop_view {
=pod
return $view;
}
-# ----------------------------------------------------------------------
sub database {
=pod
return $self->{'database'} || '';
}
-# ----------------------------------------------------------------------
sub is_valid {
=pod
return 1;
}
-# ----------------------------------------------------------------------
sub get_procedure {
=pod
return $self->{'procedures'}{$procedure_name};
}
-# ----------------------------------------------------------------------
sub get_procedures {
=pod
}
}
-# ----------------------------------------------------------------------
sub get_table {
=pod
return $self->{'tables'}{$table_name};
}
-# ----------------------------------------------------------------------
sub get_tables {
=pod
}
}
-# ----------------------------------------------------------------------
sub get_trigger {
=pod
return $self->{'triggers'}{$trigger_name};
}
-# ----------------------------------------------------------------------
sub get_triggers {
=pod
}
}
-# ----------------------------------------------------------------------
sub get_view {
=pod
return $self->{'views'}{$view_name};
}
-# ----------------------------------------------------------------------
sub get_views {
=pod
}
}
-# ----------------------------------------------------------------------
sub make_natural_joins {
=pod
return 1;
}
-# ----------------------------------------------------------------------
sub name {
=pod
return $self->{'name'} || '';
}
-# ----------------------------------------------------------------------
sub translator {
=pod
return $self->{'translator'};
}
-# ----------------------------------------------------------------------
sub DESTROY {
my $self = shift;
undef $_ for values %{ $self->{'tables'} };
1;
-# ----------------------------------------------------------------------
-
=pod
=head1 AUTHOR
1;
-# ----------------------------------------------------------------------
-
=pod
=head1 AUTHOR
NOT_NULL, 1,
);
-# ----------------------------------------------------------------------
-
__PACKAGE__->_attributes( qw/
table name type fields reference_fields reference_table
match_type on_delete on_update expression deferrable
$self->SUPER::init(@_);
}
-# ----------------------------------------------------------------------
sub deferrable {
=pod
return defined $self->{'deferrable'} ? $self->{'deferrable'} : 1;
}
-# ----------------------------------------------------------------------
sub expression {
=pod
return $self->{'expression'} || '';
}
-# ----------------------------------------------------------------------
sub is_valid {
=pod
return 1;
}
-# ----------------------------------------------------------------------
sub fields {
=pod
}
}
-# ----------------------------------------------------------------------
sub field_names {
=head2 field_names
return wantarray ? @{ $self->{'fields'} || [] } : ($self->{'fields'} || '');
}
-# ----------------------------------------------------------------------
sub match_type {
=pod
return $self->{'match_type'} || '';
}
-# ----------------------------------------------------------------------
sub name {
=pod
return $self->{'name'} || '';
}
-# ----------------------------------------------------------------------
sub options {
=pod
}
}
-
-# ----------------------------------------------------------------------
sub on_delete {
=pod
return $self->{'on_delete'} || '';
}
-# ----------------------------------------------------------------------
sub on_update {
=pod
return $self->{'on_update'} || '';
}
-# ----------------------------------------------------------------------
sub reference_fields {
=pod
}
}
-# ----------------------------------------------------------------------
sub reference_table {
=pod
return $self->{'reference_table'} || '';
}
-# ----------------------------------------------------------------------
sub table {
=pod
return $self->{'table'};
}
-# ----------------------------------------------------------------------
sub type {
=pod
return $self->{'type'} || '';
}
-# ----------------------------------------------------------------------
sub equals {
=pod
return 1;
}
-# ----------------------------------------------------------------------
sub DESTROY {
my $self = shift;
undef $self->{'table'}; # destroy cyclical reference
1;
-# ----------------------------------------------------------------------
-
=pod
=head1 AUTHOR
text => SQL_LONGVARCHAR
);
-# ----------------------------------------------------------------------
__PACKAGE__->_attributes( qw/
table name data_type size is_primary_key is_nullable
=cut
-# ----------------------------------------------------------------------
sub comments {
=pod
}
-# ----------------------------------------------------------------------
sub data_type {
=pod
}
-# ----------------------------------------------------------------------
sub default_value {
=pod
return $self->{'default_value'};
}
-# ----------------------------------------------------------------------
=pod
=head2 extra
=cut
-
-# ----------------------------------------------------------------------
sub foreign_key_reference {
=pod
return $self->{'foreign_key_reference'};
}
-# ----------------------------------------------------------------------
sub is_auto_increment {
=pod
return $self->{'is_auto_increment'} || 0;
}
-# ----------------------------------------------------------------------
sub is_foreign_key {
=pod
return $self->{'is_foreign_key'} || 0;
}
-# ----------------------------------------------------------------------
sub is_nullable {
=pod
return defined $self->{'is_nullable'} ? $self->{'is_nullable'} : 1;
}
-# ----------------------------------------------------------------------
sub is_primary_key {
=pod
return $self->{'is_primary_key'} || 0;
}
-# ----------------------------------------------------------------------
sub is_unique {
=pod
return $self->{'is_unique'} || 0;
}
-# ----------------------------------------------------------------------
sub is_valid {
=pod
return 1;
}
-# ----------------------------------------------------------------------
sub name {
=pod
return $self->table.".".$self->name;
}
-# ----------------------------------------------------------------------
sub order {
=pod
return $self->{'order'} || 0;
}
-# ----------------------------------------------------------------------
sub schema {
=head2 schema
return undef;
}
-# ----------------------------------------------------------------------
sub size {
=pod
;
}
-# ----------------------------------------------------------------------
sub table {
=pod
return $self->{parsed_field} || $self;
}
-# ----------------------------------------------------------------------
sub equals {
=pod
return 1;
}
-# ----------------------------------------------------------------------
sub DESTROY {
#
# Destroy cyclical references.
1;
-# ----------------------------------------------------------------------
-
=pod
=head1 AUTHOR
SPATIAL => 1, # MySQL only (?)
);
-# ----------------------------------------------------------------------
-
__PACKAGE__->_attributes( qw/
name type fields table options
/);
=cut
-# ----------------------------------------------------------------------
sub fields {
=pod
return wantarray ? @{ $self->{'fields'} || [] } : $self->{'fields'};
}
-# ----------------------------------------------------------------------
sub is_valid {
=pod
return 1;
}
-# ----------------------------------------------------------------------
sub name {
=pod
return $self->{'name'} || '';
}
-# ----------------------------------------------------------------------
sub options {
=pod
}
}
-# ----------------------------------------------------------------------
sub table {
=pod
return $self->{'table'};
}
-# ----------------------------------------------------------------------
sub type {
=pod
return $self->{'type'} || 'NORMAL';
}
-# ----------------------------------------------------------------------
sub equals {
=pod
return 1;
}
-# ----------------------------------------------------------------------
sub DESTROY {
my $self = shift;
undef $self->{'table'}; # destroy cyclical reference
1;
-# ----------------------------------------------------------------------
-
=pod
=head1 AUTHOR
return $self;
}
-# ----------------------------------------------------------------------
sub extra {
=pod
return wantarray ? %$extra : $extra;
}
-# ----------------------------------------------------------------------
sub remove_extra {
=head2 remove_extra
}
}
-# ----------------------------------------------------------------------
sub equals {
=pod
return 1;
}
-# ----------------------------------------------------------------------
sub _compare_objects {
my $self = shift;
my $obj1 = shift;
return $result;
}
-#=============================================================================
-
1;
=pod
$VERSION = '1.59';
-# ----------------------------------------------------------------------
-
__PACKAGE__->_attributes( qw/
name sql parameters comments owner sql schema order
/);
=cut
-# ----------------------------------------------------------------------
sub parameters {
=pod
return wantarray ? @{ $self->{'parameters'} || [] } : ($self->{'parameters'} || '');
}
-# ----------------------------------------------------------------------
sub name {
=pod
return $self->{'name'} || '';
}
-# ----------------------------------------------------------------------
sub sql {
=pod
return $self->{'sql'} || '';
}
-# ----------------------------------------------------------------------
sub order {
=pod
return $self->{'order'};
}
-# ----------------------------------------------------------------------
sub owner {
=pod
return $self->{'owner'} || '';
}
-# ----------------------------------------------------------------------
sub comments {
=pod
}
}
-# ----------------------------------------------------------------------
sub schema {
=pod
return $self->{'schema'};
}
-# ----------------------------------------------------------------------
sub equals {
=pod
return 1;
}
-# ----------------------------------------------------------------------
sub DESTROY {
my $self = shift;
undef $self->{'schema'}; # destroy cyclical reference
1;
-# ----------------------------------------------------------------------
-
=pod
=head1 AUTHORS
fallback => 1,
;
-# ----------------------------------------------------------------------
-
__PACKAGE__->_attributes( qw/schema name comments options order/ );
=pod
return $self;
}
-
-
-# ----------------------------------------------------------------------
sub add_constraint {
=pod
return $constraint;
}
-# ----------------------------------------------------------------------
sub drop_constraint {
=pod
return $constraint;
}
-# ----------------------------------------------------------------------
sub add_index {
=pod
return $index;
}
-# ----------------------------------------------------------------------
sub drop_index {
=pod
return $index;
}
-# ----------------------------------------------------------------------
sub add_field {
=pod
return $field;
}
-# ----------------------------------------------------------------------
+
sub drop_field {
=pod
return $field;
}
-# ----------------------------------------------------------------------
sub comments {
=pod
}
}
-# ----------------------------------------------------------------------
sub get_constraints {
=pod
}
}
-# ----------------------------------------------------------------------
sub get_indices {
=pod
}
}
-# ----------------------------------------------------------------------
sub get_field {
=pod
return $self->{'fields'}{ $field_name };
}
-# ----------------------------------------------------------------------
sub get_fields {
=pod
}
}
-# ----------------------------------------------------------------------
sub is_valid {
=pod
return 1;
}
-# ----------------------------------------------------------------------
sub is_trivial_link {
=pod
return $self->{'is_data'};
}
-# ----------------------------------------------------------------------
sub can_link {
=pod
return $self->{'can_link'}{ $table1->name }{ $table2->name };
}
-# ----------------------------------------------------------------------
sub name {
=pod
return $self->{'name'} || '';
}
-# ----------------------------------------------------------------------
sub schema {
=pod
return $self->{'schema'};
}
-# ----------------------------------------------------------------------
sub primary_key {
=pod
return;
}
-# ----------------------------------------------------------------------
sub options {
=pod
}
}
-# ----------------------------------------------------------------------
sub order {
=pod
return $self->{'order'} || 0;
}
-# ----------------------------------------------------------------------
sub field_names {
=head2 field_names
}
}
-# ----------------------------------------------------------------------
sub equals {
=pod
return 1;
}
-# ----------------------------------------------------------------------
-
=head1 LOOKUP METHODS
The following are a set of shortcut methods for getting commonly used lists of
return wantarray ? @fields : \@fields;
}
-# ----------------------------------------------------------------------
sub fkey_fields {
my $me = shift;
my @fields;
return wantarray ? @fields : \@fields;
}
-# ----------------------------------------------------------------------
sub nonpkey_fields {
my $me = shift;
my @fields = grep { !$_->is_primary_key } $me->get_fields;
return wantarray ? @fields : \@fields;
}
-# ----------------------------------------------------------------------
sub data_fields {
my $me = shift;
my @fields =
return wantarray ? @fields : \@fields;
}
-# ----------------------------------------------------------------------
sub unique_fields {
my $me = shift;
my @fields;
return wantarray ? @fields : \@fields;
}
-# ----------------------------------------------------------------------
sub unique_constraints {
my $me = shift;
my @cons = grep { $_->type eq UNIQUE } $me->get_constraints;
return wantarray ? @cons : \@cons;
}
-# ----------------------------------------------------------------------
sub fkey_constraints {
my $me = shift;
my @cons = grep { $_->type eq FOREIGN_KEY } $me->get_constraints;
return wantarray ? @cons : \@cons;
}
-# ----------------------------------------------------------------------
sub DESTROY {
my $self = shift;
undef $self->{'schema'}; # destroy cyclical reference
1;
-# ----------------------------------------------------------------------
-
=pod
=head1 AUTHORS
$VERSION = '1.59';
-# ----------------------------------------------------------------------
-
__PACKAGE__->_attributes( qw/
name schema perform_action_when database_events database_event
fields table on_table action order
=cut
-# ----------------------------------------------------------------------
sub perform_action_when {
=pod
return $self->{'perform_action_when'};
}
-# ----------------------------------------------------------------------
sub database_event {
=pod
return $self->database_events( @_ );
}
-# ----------------------------------------------------------------------
sub database_events {
=pod
: $self->{'database_events'};
}
-# ----------------------------------------------------------------------
sub fields {
=pod
return wantarray ? @{ $self->{'fields'} || [] } : $self->{'fields'};
}
-# ----------------------------------------------------------------------
sub table {
=pod
return $self->{table};
}
-# ----------------------------------------------------------------------
sub on_table {
=pod
return $self->table->name;
}
-# ----------------------------------------------------------------------
sub action {
=pod
return $self->{'action'};
}
-# ----------------------------------------------------------------------
sub is_valid {
=pod
return 1;
}
-# ----------------------------------------------------------------------
sub name {
=pod
return $self->{'name'} || '';
}
-# ----------------------------------------------------------------------
sub order {
=pod
return $self->{'order'} || 0;
}
-# ----------------------------------------------------------------------
sub schema {
=pod
return $self->{'schema'};
}
-# ----------------------------------------------------------------------
sub compare_arrays {
=pod
return 1;
}
-# ----------------------------------------------------------------------
sub equals {
=pod
return 1;
}
-# ----------------------------------------------------------------------
sub DESTROY {
my $self = shift;
undef $self->{'schema'}; # destroy cyclical reference
1;
-# ----------------------------------------------------------------------
-
=pod
=head1 AUTHORS
$VERSION = '1.59';
-# ----------------------------------------------------------------------
-
__PACKAGE__->_attributes( qw/
name sql fields schema order
/);
=cut
-# ----------------------------------------------------------------------
sub fields {
=pod
return wantarray ? @{ $self->{'fields'} || [] } : ($self->{'fields'} || '');
}
-# ----------------------------------------------------------------------
sub is_valid {
=pod
return 1;
}
-# ----------------------------------------------------------------------
sub name {
=pod
return $self->{'name'} || '';
}
-# ----------------------------------------------------------------------
sub order {
=pod
return $self->{'order'} || 0;
}
-# ----------------------------------------------------------------------
sub sql {
=pod
return $self->{'sql'} || '';
}
-# ----------------------------------------------------------------------
sub schema {
=pod
return $self->{'schema'};
}
-# ----------------------------------------------------------------------
sub equals {
=pod
return 1;
}
-# ----------------------------------------------------------------------
sub DESTROY {
my $self = shift;
undef $self->{'schema'}; # destroy cyclical reference
1;
-# ----------------------------------------------------------------------
-
=pod
=head1 AUTHOR
);
use constant COLLISION_TAG_LENGTH => 8;
-# ----------------------------------------------------------------------
-# debug(@msg)
-#
-# Will send debugging messages to STDERR, if the caller's $DEBUG global
-# is set.
-#
-# This debug() function has a neat feature: Occurances of the strings
-# PKG, LINE, and SUB in each message will be replaced with elements
-# from caller():
-#
-# debug("PKG: Bad things happened on line LINE!");
-#
-# Will be warned as:
-#
-# [SQL::Translator: Bad things happened on line 643]
-#
-# If called from Translator.pm, on line 643.
-# ----------------------------------------------------------------------
sub debug {
my ($pkg, $file, $line, $sub) = caller(0);
{
}
}
-# ----------------------------------------------------------------------
sub normalize_name {
my $name = shift or return '';
return $name;
}
-# ----------------------------------------------------------------------
sub header_comment {
my $producer = shift || caller;
my $comment_char = shift;
return $header_comment;
}
-# ----------------------------------------------------------------------
-# parse_list_arg
-#
-# Meant to accept a list, an array reference, or a string of
-# comma-separated values. Retuns an array reference of the
-# arguments. Modified to also handle a list of references.
-# ----------------------------------------------------------------------
sub parse_list_arg {
my $list = UNIVERSAL::isa( $_[0], 'ARRAY' ) ? shift : [ @_ ];
}
}
-# ----------------------------------------------------------------------
-# truncate_id_uniquely( $desired_name, $max_symbol_length )
-#
-# Truncates the name $desired_name to the $max_symbol_length by
-# including part of the hash of the full name at the end of the
-# truncated name, giving a high probability that the symbol will be
-# unique.
-# ----------------------------------------------------------------------
sub truncate_id_uniquely {
my ( $desired_name, $max_symbol_length ) = @_;
}
-#---------------------------------------------------------------------
-# parse_mysql_version ( $version_string, $result_target)
-#
-# Attempts to parse an arbitrary string as a mysql version number.
-# Returns either a floating point perl style string, or a mysql style
-# 5 digit string, depending on the supplied $result_target
-#---------------------------------------------------------------------
sub parse_mysql_version {
my ($v, $target) = @_;
}
}
-#---------------------------------------------------------------------
-# parse_dbms_version ( $version_string, $target )
-#
-# Attempts to parse either a native or perl-style version string into
-# a version number format as specified by $target, which can be either
-# 'perl' for a perl-style version number, or 'native' for an X.X.X
-# style version number.
-#---------------------------------------------------------------------
sub parse_dbms_version {
my ($v, $target) = @_;
1;
-# ----------------------------------------------------------------------
-
=pod
=head1 NAME
5.001005 (perl style)
30201 (mysql style)
+=head2 parse_dbms_version
+
+Takes a version string (X.Y.Z) or perl style (XX.YYYZZZ) and a target ('perl'
+or 'native') transforms the string to the given target style.
+to
+
=head1 AUTHORS
Darren Chamberlain E<lt>darren@cpan.orgE<gt>,