Hi, you can set the quoting character.
https://metacpan.org/module/DBIx::Class::Manual::Cookbook#Setting-quoting-for-the-generated-SQL On 09/24/2013 12:30 PM, William Goedicke wrote: > Dear Y'all - > > Damn it, I sent a broken version. Apologies. The following snippet includes > the missing "while" line. > > ... > $sth = $dbh->prepare("SELECT * FROM $table_name") || die $dbh->errstr; > $sth->execute() || print "$sth->errstr\n\n"; > > while( $r = $sth->fetchrow_hashref) { > my $newrec = $schema->resultset($table_name)->create($r); > $newrec->in_storage(); > } > $sth->finish; > ... > > On Sep 23, 2013, at 1:13 PM, William Goedicke <[email protected]> > wrote: > >> 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]
_______________________________________________ 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]
