Beefy Boxes and Bandwidth Generously Provided by pair Networks
"be consistent"
 
PerlMonks  

Re^3: Relational table with perl DBI

by poj (Curate)
on Mar 14, 2013 at 10:43 UTC ( #1023455=note: print w/ replies, xml ) Need Help??


in reply to Re^2: Relational table with perl DBI
in thread Relational table with perl DBI

It looks to me like this code has the potential to give you the same event more than once in the event table each with a different id.

if ($_ =~ /=E-(.*)=event/){ $event = $1; push @event_prepare, $event; }
It would be much simpler to forget using numerical keys and just use the $event itself as the primary key. Use a hash to eliminate duplicates like this ;
if ($_ =~ /=E-(.*)=event/){ $event_prepare{$1} = 1; }
With regard to the article table, I would use the n value from the filename outputcondord.n.txt as the primary key thus avoiding sorting and synchronising problems as well as making the data in the table more human readable. Your article_event_index would then just need to contain the n value from the filename and the text from the events in that file.

poj


Comment on Re^3: Relational table with perl DBI
Select or Download Code

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1023455]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others avoiding work at the Monastery: (6)
As of 2014-07-13 08:27 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    When choosing user names for websites, I prefer to use:








    Results (248 votes), past polls