Re: Loading calendar database
Jan Eden <[email protected]>
| Newsgroups | gmane.comp.db.mysql.perl |
|---|---|
| Message-ID | <r02010400-1037-B5666AC6532E11D986BD000A959B4026@[10.149.23.154]> |
Hi Peter,
Peter Pentchev wrote on 21.12.2004:
>On Mon, Dec 20, 2004 at 06:19:09PM +0100, Jan Eden wrote:
>> Jan Eden wrote on 20.12.2004:
>>
>> >Hi,
>> >
>> >I plan to move my Data::Dumper based occupancy table to a real
>> >database. While the database itself is quite, I am not sure how to
>> >load it with the appropriate dates (including February 29, 2008
>> >etc).
>> >
>> >Is there a Perl module or a certain technique for loading fields of
>> >the date type with the appropriate information?
>>
>> I already thought about a loop like
>>
>> for (1..1000) {
>> $dbh->do(INSERT INTO ... VALUES ADDDATE('2004-01-01', INTERVAL $_ DAYS);
>> }
>>
>> But there must be something better.
>
>I think it would really help if you told us how the data is *currently*
>stored :)
Oh, sure. I currently store the data in a file created by Data::Dumper, containing an anonymous hash of arrays of hashes like this:
{
'07' => [
'Juli',
{
'20' => 'frei',
'07' => 'frei',
'01' => 'frei',
'23' => 'frei',
'31' => 'frei',
'29' => 'frei',
'11' => 'frei',
'17' => 'frei',
'19' => 'frei',
'09' => 'frei',
'26' => 'frei',
'28' => 'frei',
'25' => 'frei',
'10' => 'frei',
'04' => 'frei',
'30' => 'frei',
'08' => 'frei',
'24' => 'frei',
'02' => 'frei',
'03' => 'frei',
'12' => 'frei',
'27' => 'frei',
'15' => 'frei',
'06' => 'frei',
'18' => 'frei',
'05' => 'frei',
'14' => 'frei',
'21' => 'frei',
'22' => 'frei',
'16' => 'frei',
'13' => 'frei'
}
],
'01' => [
'Januar',
{
'20' => 'frei',
'07' => 'frei',
'01' => 'frei',
'23' => 'frei',
'31' => 'frei',
'29' => 'frei',
'11' => 'frei',
'17' => 'frei',
'19' => 'frei',
'09' => 'frei',
'26' => 'frei',
'28' => 'frei',
'25' => 'frei',
(continued)
I know this is clumsy and inefficient, that's why I want to switch, ;-)
Cheers,
Jan
--
There are two major products that come out of Berkeley: LSD and UNIX. We don't believe this to be a coincidence. - Jeremy S. Anderson
--
MySQL Perl Mailing List
For list archives: http://lists.mysql.com/perl
To unsubscribe: http://lists.mysql.com/[email protected]