+# EQ_CALLING
+#+--------------+------------------+------+-----+---------+-------+
+#| Field | Type | Null | Key | Default | Extra |
+#+--------------+------------------+------+-----+---------+-------+
+#| indiv_id | int(16) unsigned | YES | | NULL | |
+#| name | varchar(30) | YES | | NULL | |
+#| organization | varchar(30) | YES | | NULL | |
+#| position | varchar(30) | YES | | NULL | |
+#| sequence | int(16) unsigned | YES | | NULL | |
+#| sustained | date | YES | | NULL | |
+#+--------------+------------------+------+-----+---------+-------+
+sub update_eq_calling_table()
+{
+ print "-> Updating eq_calling table\n";
+
+ #print "-> Organization Data Dump\n\n";
+ #&print_hash(\%organization_data);
+
+ # Delete all records from the calling table. We have no history to
+ # save here. Just re-populate with the latest calling information.
+ $sth = $dbh->prepare("delete from eq_calling ");
+ $sth->execute or die "-E- DB error: $DBI::errstr\n";
+
+ foreach $index (keys %organization_data)
+ {
+ $indiv_id = $organization_data{$index}{'Indiv ID'};
+ $name = $organization_data{$index}{'Indiv Name'};
+ $name =~ s/\'/\\'/g; #'
+ $organization = $organization_data{$index}{'Organization'};
+ $position = $organization_data{$index}{'Position'};
+ $sequence = $organization_data{$index}{'Org Seq'};
+ $sustained = $organization_data{$index}{'Sustained'};
+ $sustained =~ /(\S+) (\d+)/; $month=$1; $year=$2;
+ if($name eq "") { next; }
+ print " Adding new Calling: $name -> $position\n";
+ $sth = $dbh->prepare("insert into eq_calling values ('$indiv_id','$name','$organization','$position','$sequence','$month $year')");
+ $sth->execute or die "-E- DB error: $DBI::errstr\n";
+ }
+}
+