NAME

SPOPS::DBI::Table - Import a DBI table structure

SYNOPSIS

#!/usr/bin/perl

use strict;
use SPOPS::Import;

{
    my $table_import = SPOPS::Import->new( 'table' );
    $table_import->database_type( 'sybase' );
    $table_import->read_table_from_fh( \*DATA );
    $table_import->print_only( 1 );
    $table_import->transforms([ \&table_login ]);
    $table_import->run;
}

sub table_login {
   my ( $transformer, $sql, $importer ) = @_;
   $$sql =~ s/%%LOGIN%%/varchar(25)/g;
}

__DATA__
CREATE TABLE sys_user (
 user_id       %%INCREMENT%%,
 login_name    %%LOGIN%% not null,
 password      varchar(30) not null,
 last_login    datetime null,
 num_logins    int null,
 theme_id      %%INCREMENT_TYPE%% default 1,
 first_name    varchar(50) null,
 last_name     varchar(50) null,
 title         varchar(50) null,
 email         varchar(100) not null,
 language      char(2) default 'en',
 notes         text null,
 removal_date  datetime null,
 primary key   ( user_id ),
 unique        ( login_name )
)

DESCRIPTION

This class allows you to transform and import (or simply display) a DBI table structure.

Transformations are done via two means. The first is the database-specific classes and the standard modifications provided by SPOPS::Import::DBI::TableTransform. The second is custom code that you can write.

METHODS

BUGS

None known.

TO DO

Nothing known.

SEE ALSO

SPOPS::Manual::ImportExport

COPYRIGHT

Copyright (c) 2001 intes.net, inc.. All rights reserved.

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.

AUTHORS

Chris Winters <chris@cwinters.com>