Dear Y'all -
I'm migrating a bunch (100ish) tables from Foxpro 2.6 to MSSQL.
The following code works almost perfectly.
use VB_Temp::Main;
use DBI;
use Data::Dumper;
my $schema = VB_Temp::Main->connect('dbi:ODBC:VB_Temp');
my $dbf_dir = 'C:/users/goedicw/documents/voicebase/voicedb/';
my $dbh = DBI->connect("DBI:XBase:".$dbf_dir) or die $DBI::errstr;
foreach ( keys $schema->{'class_mappings'}) {
/::([^:]+)$/;
my $table_name = $1;
my $vb_temp_rs = $schema->resultset($table_name);
$vb_temp_rs->delete_all;
$sth = $dbh->prepare("SELECT * FROM $table_name") || die $dbh->errstr;
$sth->execute() || print "$sth->errstr\n\n";
my $newrec = $schema->resultset($table_name)->create($r);
$newrec->in_storage();
}
$sth->finish;
}
Except it fails on datetime fields. I see that the insert statement is
constructed to look like:
insert into tbl (key, somedate) values(100, 19930312);
which fails.
insert into tbl (key, somedate) values(100, '199303123')
however works fine, but I can't get my script to generate the field value that
way.
All help is, of course, most appreciated.
- Billy
_______________________________________________
List: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/dbix-class
IRC: irc.perl.org#dbix-class
SVN: http://dev.catalyst.perl.org/repos/bast/DBIx-Class/
Searchable Archive: http://www.grokbase.com/group/[email protected]