| 1 | package SPOPS::Import::DBI::TableTransform; | ||
| 2 | |||
| 3 | # $Id: TableTransform.pm,v 3.7 2004/06/02 00:48:23 lachoy Exp $ | ||
| 4 | |||
| 5 | use strict; | ||
| 6 | use base qw( Class::Factory ); | ||
| 7 | use SPOPS::Exception; | ||
| 8 | |||
| 9 | $SPOPS::Import::DBI::TableTransform::VERSION = sprintf("%d.%02d", q$Revision: 3.7 $ =~ /(\d+)\.(\d+)/); | ||
| 10 | |||
| 11 | sub transform { | ||
| 12 | my ( $self, $sql ) = @_; | ||
| 13 | $self->increment( $sql ); | ||
| 14 | $self->increment_type( $sql ); | ||
| 15 | $self->datetime( $sql ); | ||
| 16 | } | ||
| 17 | |||
| 18 | my %TYPES = ( | ||
| 19 | mysql => 'SPOPS::Import::DBI::TableTransform::MySQL', | ||
| 20 | MySQL => 'SPOPS::Import::DBI::TableTransform::MySQL', | ||
| 21 | oracle => 'SPOPS::Import::DBI::TableTransform::Oracle', | ||
| 22 | Oracle => 'SPOPS::Import::DBI::TableTransform::Oracle', | ||
| 23 | pg => 'SPOPS::Import::DBI::TableTransform::Pg' , | ||
| 24 | Pg => 'SPOPS::Import::DBI::TableTransform::Pg' , | ||
| 25 | postgres => 'SPOPS::Import::DBI::TableTransform::Pg', | ||
| 26 | asany => 'SPOPS::Import::DBI::TableTransform::Sybase', | ||
| 27 | ASAny => 'SPOPS::Import::DBI::TableTransform::Sybase', | ||
| 28 | MSSQL => 'SPOPS::Import::DBI::TableTransform::Sybase', | ||
| 29 | mssql => 'SPOPS::Import::DBI::TableTransform::Sybase', | ||
| 30 | sybase => 'SPOPS::Import::DBI::TableTransform::Sybase', | ||
| 31 | Sybase => 'SPOPS::Import::DBI::TableTransform::Sybase', | ||
| 32 | sqlite => 'SPOPS::Import::DBI::TableTransform::SQLite', | ||
| 33 | SQLite => 'SPOPS::Import::DBI::TableTransform::SQLite', | ||
| 34 | interbase => 'SPOPS::Import::DBI::TableTransform::InterBase', | ||
| 35 | InterBase => 'SPOPS::Import::DBI::TableTransform::InterBase', | ||
| 36 | Firebird => 'SPOPS::Import::DBI::TableTransform::InterBase', | ||
| 37 | ); | ||
| 38 | |||
| 39 | sub class_initialize { | ||
| 40 | while ( my ( $type, $class ) = each %TYPES ) { | ||
| 41 | __PACKAGE__->register_factory_type( $type, $class ); | ||
| 42 | } | ||
| 43 | } | ||
| 44 | |||
| 45 | class_initialize(); | ||
| 46 | |||
| 47 | 1; | ||
| 48 | |||
| 49 | __END__ |