convert($table_name)
DBIx::MSAccess:Convert2Db
- Convert an MS Access database into a MySQL/Postgres/Other database
use DBIx::MSAccess:Convert2Db;
my($obj) = DBIx::MSAccess:Convert2Db -> new ( access_dsn => 'in', db_username => ($^O eq 'MSWin32') ? 'root' : 'postgres', db_password => ($^O eq 'MSWin32') ? 'pass' : '', db_name => 'out', driver => ($^O eq 'MSWin32') ? 'mysql' : 'Pg', lower_case => 1, null_to_blank => 1, verbose => 1, );
$obj -> do('drop database out'); $obj -> do('create database out');
my($table_name) = $obj -> get_access_table_names(['table a', 'table b']);
$obj -> convert($_) for @$table_name;
DBIx::MSAccess:Convert2Db
is a pure Perl module.
It can convert an MS Access database into one in MySQL/Postgres/Other format.
The conversion is mindless. In particular, this version does not even use the Date::MSAccess module to convert dates.
Hopefully, this means the output database is an exact copy of the input one, apart from perhaps some column truncation.
Things to note:
get_access_table_names()
an array ref
of the names of those tables you wish to output.
my($table_name) = $obj -> get_access_table_names();
returns an array ref of all table names in the MS Access database, so all table names will be passed to convert().
my($table_name) = $obj -> get_access_table_names(['table a', 'table b']);
returns an array ref of table names to be passed to convert(), with tables called 'table a' and 'table b' being the only ones included in the list.
The only known case (20-Jan-2004) is any column named 'Order', which will be called '_order' in the output database.
varchar(255)
This module is available both as a Unix-style distro (*.tgz) and an ActiveState-style distro (*.ppd). The latter is shipped in a *.zip file.
See http://savage.net.au/Perl-modules.html for details.
See http://savage.net.au/Perl-modules/html/installing-a-module.html for help on unpacking and installing each type of distro.
new(...)
returns a DBIx::MSAccess:Convert2Db
object.
This is the class's contructor.
Usage: DBIx::MSAccess:Convert2Db -> new().
This option takes a set of options.
To start creating a DSN under Win2K, say, go to Start/Settings/Control Panel/Admin tools/Data Source (ODBC)/System DSN.
Note: A System DSN is preferred because it is visible to all users, not just the currently logged in user.
This option is mandatory.
This might be something like
($^O eq 'MSWin32') ? 'root' : 'postgres'
if you are using MySQL under Windows and Postgres under Unix.
The default is the empty string.
This might be something like
($^O eq 'MSWin32') ? 'pass' : ''
if you are using MySQL under Windows and Postgres under Unix.
The default is the empty string.
This option is mandatory.
This might be something like
($^O eq 'MSWin32') ? 'mysql' : 'Pg'
This option is mandatory.
The default is 0.
The default is 0.
The default is 0.
The output disk file name is determined by this code:
$$self{'_temp'} = ($^O eq 'MSWin32') ? 'temp' : 'tmp'; $$self{'_log_file_name'} = "/$$self{'_temp'}/msaccess2db.log";
Returns an array ref of table name to be passed to convert().
convert($table_name)
Returns nothing.
Converts one table from MS Access format to MySQL/Postgres/Other format.
It's normally called like this:
my($table_name) = $obj -> get_access_table_names();
$obj -> convert($_) for @$table_name;
See the examples/ directory in the distro.
Note: The example uses a module called Error.
Note: Activestate-style distros do not contain this directory :-(.
Carp, DBI, DBD::ODBD, DBIx::SQLEngine.
See Changes.txt.
DBIx::MSAccess:Convert2Db
was written by Ron Savage <ron@savage.net.au> in 2004.
Home page: http://savage.net.au/index.html
Australian copyright (c) 2004, Ron Savage. All rights reserved.
All Programs of mine are 'OSI Certified Open Source Software'; you can redistribute them and/or modify them under the terms of The Artistic License, a copy of which is available at: http://www.opensource.org/licenses/index.html