+--------+------------------+------+-----+---------+----------------+ | Field | Type | Null | Key | Default | Extra | +--------+------------------+------+-----+---------+----------------+ | id | int(4) unsigned | | PRI | NULL | auto_increment | | name | varchar(64) | | | | | | abbrev | char(2) | | | | | +--------+------------------+------+-----+---------+----------------+The following code uses Geography::States to populate such a table with the 50+ states of the USA:
use DBI; use Geography::States; my $dbh = DBI->connect( ... ); my $sth = $dbh->prepare('INSERT INTO state(abbrev,name) VALUES(?,?)'); my $usa = Geography::States->new('USA'); $sth->execute(@$_) for $usa->state;
jeffa
L-LL-L--L-LL-L--L-LL-L-- -R--R-RR-R--R-RR-R--R-RR B--B--B--B--B--B--B--B-- H---H---H---H---H---H--- (the triplet paradiddle with high-hat)
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Populate Database Table for States
by princepawn (Parson) on Jan 03, 2004 at 10:39 UTC |