|
|
sybperl-l Archive
Up Prev Next
From: phil_groce at cmcsmart dot com (Phil Groce)
Subject: Re: sybperl sql batch
Date: May 5 1998 4:01PM
Okay, I'll bite. And I promise this is the most frivolous thing I'll ever
post here.
Keith.Athey@twc.state.tx.us wrote:
>> For his next trick, Michael Peppler will institute a script for world
>> peace.
to which jackc@rabo-bank.com responded:
>dbmopen %world_issues, "/etc/world", 0777 || die "World already gone\n";
>while (($key,$val) = each %world_issues) {
> if (!($val =~ /^peace$/i)) {
> delete($world_issues{$key});
> }
>}
>dbmclose %world_issues;
This is a fine script for cleaning things up, but it's a little incomplete;
it gets rid of all the issues _except_ world peace. Also, there's no
Sybperl element. (We all know that Perl can't really save the world, but
Sybperl can, if you tweak the interfaces file just right.)
So jackc probably accidentally forgot the rest of the script. Given that
the only key left in the hash is the key to world peace (convenient,
n'est-ce pas?), it probably goes something like this:
use Sybase::CTLib;
# Legacy code
dbmopen %world_issues, "/etc/world", 0777 || die "World already gone\n";
while (($key,$val) = each %world_issues) {
if (!($val =~ /^peace$/i)) {
delete($world_issues{$key});
}
}
# We all know who's *really* running things...
$dbh = Sybase::CTLib->ct_connect('hperot', 'JFKwaspoisoned', 'world_iss');
($key_to_peace) = keys %world_issues;
dbmclose %world_issues;
# Why text? Because, of all things, I don't want this truncated.
$db_str = qq!CREATE TABLE solved (issue text not null)!;
$dbh->ct_sql($db_str);
$ins_str = qq!INSERT INTO solved (issue) VALUES ('$key_to_peace')!;
$dbh->ct_sql($ins_str);
__END__
Needless to say, this is untested code.... :)
phil
giving people something to look at other than the output of "make test"
|