Re: Another flat-file insert question

From: Leegold (leegold_at_fastmail.fm)
Date: 05/19/04


To: dbi-users@perl.org
Date: Wed, 19 May 2004 00:17:11 -0400


> ....snip..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"...?

Kind of a problem I had with a flat-file db
when I made an insert. For what it's worth I did
some code that seems to be ok,
....
use Tie::File;
my $file='C:\threesharp\datatest.threesharp';
tie my @array, 'Tie::File', $file;
# remove blanks, other stuff from file end
while (1) {
  if ($array[$#array] =~ m/^\s*$/) { pop (@array); }
  else { last; }
}
# Tie::File's default behavior ensures one "/n" at record end
$array[$#array] = $array[$#array];
untie @array;

-- 
http://www.fastmail.fm - Choose from over 50 domains or use your own


Relevant Pages

  • [PULL REQUEST] md patches for merge window
    ... - raid5 cleanups from Dan Williams ... general code cleanup from Andre Noll ... md: md_ioctl: Fix misleading indentation. ... Don't reject HOT_REMOVE_DISK request for an array that is not yet started. ...
    (Linux-Kernel)
  • Re: JNI with multidimensional Byte Array
    ... First I strongly suggest that you compile ... for a 2-D char array. ... ReleaseCharArrayElements() should be ReleaseByteArrayElements, and ... can't help you fix the code you didn't post. ...
    (comp.lang.java.programmer)
  • Raid 10 Problems?
    ... Created a software raid 10 array. ... fix. ... Checking inodes, blocks, and sizes ...
    (Linux-Kernel)
  • Re: PDO prepared statements
    ... the above code dosn't even substitute 4 for:id. ... the way around it is to send the array with the correct values in ... How comes you are running a query and you don't know what its parameters are? ... Let's assume you're just patching old buggy third-party code: you didn't write it, your boss told you to fix it ASAP, you don't understand how it works and you don't have time to rewrite the whole thing. ...
    (comp.lang.php)
  • patch fix-sys_move_pages-when-a-null-node-list-is-passed.patch queue
    ... Fix sys_move_pages when a NULL node list is passed. ... depends on a marker in the node field of the structure to decide how large ... the array is and this marker is correctly inserted into the last element ...
    (Linux-Kernel)