ralphie has asked for the wisdom of the Perl Monks concerning the following question:
i'm getting long winded - here's the rub. the key that identifies a unique run is the concantenation of three values, id, date, and time (date and time are both ascii representations extracted from the file). as a result, the constructed key can look like "12502-23-0110:13:53". in previous incarnations of the script i had simply issued a select againt the parent table to determine whether the value had previously been stored, but after updating my system to 5.6.1 and the latest Pg driver on cpan i found that a memory leak had been engendered by this scenario. rather than messing around with earlier versions to see if i could fix that, i decided to write a smarter lookup, dumping the keys into a hash and checking for the existence of the key there.
so i did (grin), extracting the keys with
and then checking for the existence of the key with (exists $vals{$key}). the appropriate values are getting in the $vals hash ... i use ptkdb so i can evaluate that and see the values there, as is the $key value. except the exists function always returns "". from what i've read i'm pretty much going by the book implementing the exists function, and $key as a key works perfectly fine for database access ... i've set up a little web page as a query tool and issue queries against a joined view defined in postgresql using the same key field to associate the tables, and that works w/o any glitches.my @keys=$count_stmnt->fetchall_arrayref(); $vals=@keys[0];
i've given some thought that the problem may be associated with the "-"'s and ":"'s in the hash keys, wondering whether they create problems with the way the exists function looks through the hash, although it's clearly possible that i've missed something in how i'm implementing it.
any input would be appreciated.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: hash key lookups failing
by princepawn (Parson) on Nov 11, 2001 at 01:06 UTC | |
|
Re: hash key lookups failing
by Zaxo (Archbishop) on Nov 11, 2001 at 01:10 UTC | |
by ralphie (Friar) on Nov 11, 2001 at 02:39 UTC | |
by Aristotle (Chancellor) on Nov 11, 2001 at 08:04 UTC | |
|
Re: hash key lookups failing - resolution
by ralphie (Friar) on Nov 14, 2001 at 02:13 UTC |