Re: Another flat-file insert question
From: Leegold (leegold_at_fastmail.fm)
Date: 05/17/04
- Next message: Tim Bunce: "Re: Res: Res: RE: Problems changing from 1.30 to 1.42"
- Previous message: Michael Peppler: "Re: connecting 5.8.3 Perl to ASE-12.5, connection successful, no dbh returned"
- In reply to: Jeff Zucker: "Re: flat-file insert question"
- Next in thread: Leegold: "DBI pager possible?"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
To: dbi-users@perl.org Date: Mon, 17 May 2004 15:42:00 -0400
Another possibly slightly ignorent question,
though I have learned a lot from this group
please be sure of that.
When I insert a record, the new record is appended.
But given my code below it's added on to the last line/record
of the file instead of being on it's own line.
eg. I get,
f1|f2|f3f1|f2|f3
<eof>
vs. what I'd expect
f1|f2|f3
f1|f2|f3
<eof>
Is the fix just to make sure the last record has one "/n"
ie. one <eoln> before i insert?
Again I could write "file processing" perl code since it's
a flat-file, But is there an SQL or a DBI method that I am
not using or a higher level clean way to remedy?
----------------------------------------
#!/usr/bin/perl -w
use strict;
use DBI;
my $file_name='C:\Documents and
Settings\LGOLD\Desktop\threesharp\datatest.threesharp';
my $table_name='pips';
my $dbh = DBI->connect('dbi:AnyData(RaiseError=1):');
$dbh->func( $table_name, 'ThreeSharp', $file_name, 'ad_catalog');
$dbh->do("INSERT INTO $table_name VALUES ('ocm28999999', 'AZSO alert
notice', 'Bugtussle, KY')");
-- http://www.fastmail.fm - mmm... Fastmail...
- Next message: Tim Bunce: "Re: Res: Res: RE: Problems changing from 1.30 to 1.42"
- Previous message: Michael Peppler: "Re: connecting 5.8.3 Perl to ASE-12.5, connection successful, no dbh returned"
- In reply to: Jeff Zucker: "Re: flat-file insert question"
- Next in thread: Leegold: "DBI pager possible?"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|
|