Michael Peppler
Sybase Consulting
Sybase on Linux
Install Guide for Sybase on Linux
General Sybase Resources
General Perl Resources
BCP Tool
Bug Tracker
Mailing List Archive
Downloads Directory
Sybase on Linux FAQ
Sybperl FAQ
Michael Peppler's resume

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. wrote:
>> For his next trick, Michael Peppler will institute a script for world
>> peace.

to which 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)) {

# 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)!;

$ins_str = qq!INSERT INTO solved (issue) VALUES ('$key_to_peace')!;


Needless to say, this is untested code.... :)

giving people something to look at other than the output of "make test"