Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl-Sensitive Sunglasses

Re^3: Relational table with perl DBI

by poj (Monsignor)
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.


Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1023455]
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others about the Monastery: (5)
As of 2018-06-20 23:43 GMT
Find Nodes?
    Voting Booth?
    Should cpanminus be part of the standard Perl release?

    Results (117 votes). Check out past polls.