PEPPLER.ORG
Michael Peppler
Sybase Consulting
Menu
Home
Sybase on Linux
Install Guide for Sybase on Linux
General Sybase Resources
General Perl Resources
Freeware
Sybperl
Sybase::Simple
DBD::Sybase
BCP Tool
Bug Tracker
Mailing List Archive
Downloads Directory
FAQs
Sybase on Linux FAQ
Sybperl FAQ
Personal
Michael Peppler's resume

sybperl-l Archive

Up    Prev    Next    

From: "W dot Phillip Moore" <wpm at ms dot com>
Subject: ANNOUNCE: sybperl 2.09
Date: Feb 20 1998 9:41PM

>>>>> "Michael" == Michael Peppler  writes:

Michael> I have just uploaded sybperl 2.09 to CPAN - it will reach
Michael> your favorite site in a few days. Here's a brief description
Michael> of what has changed in this release:

This release includes a couple of functions I contributed which
Michael was kind enough to integrate.  Well, the patch I fed him
doesn't work with 2.09.  (Today was the first time I bothered
installing 2.09)

nsql(), and the 2 handler routines nsql_message_handler() and
nsql_error_handler() are broken as provided with 2.09.

The patch below fixes these routines as DBlib.pm, and adds a note to
the docs in sybperl.pod

Michael, please integrate this with the baseline source tree for the
next release.

diff -rc sybperl-2.09-orig/DBlib/DBlib.pm sybperl-2.09/DBlib/DBlib.pm
*** sybperl-2.09-orig/DBlib/DBlib.pm	Tue Dec 30 18:24:00 1997
--- sybperl-2.09/DBlib/DBlib.pm	Fri Feb 20 16:29:00 1998
***************
*** 384,392 ****
--- 408,424 ----
  # Enhanced sql routine.
  # 
  sub nsql {
+ 
      my ($db,$sql,$type) = @_;
      my (@res,@data,%data);
  
+     if ( ref $type ) {
+ 	$type = ref $type;
+     }
+     elsif ( not defined $type ) {
+ 	$type = "";
+     }
+ 
      undef $DB_ERROR;
   
      unless ( $db->dbcmd($sql) ) {
***************
*** 431,442 ****
      my ($db, $severity, $error, $os_error, $error_msg, $os_error_msg) = @_;
      # Check the error code to see if we should report this.
  
!     if ( $error != $db->SYBESMSG ) {
        $DB_ERROR = "Sybase error: $error_msg\n";
        $DB_ERROR .= "OS Error: $os_error_msg\n" if defined $os_error_msg;
      }
  
!     $db->INT_CANCEL;
  }
  
  sub nsql_message_handler {
--- 463,474 ----
      my ($db, $severity, $error, $os_error, $error_msg, $os_error_msg) = @_;
      # Check the error code to see if we should report this.
  
!     if ( $error != SYBESMSG ) {
        $DB_ERROR = "Sybase error: $error_msg\n";
        $DB_ERROR .= "OS Error: $os_error_msg\n" if defined $os_error_msg;
      }
  
!     INT_CANCEL;
  }
  
  sub nsql_message_handler {
***************
*** 451,458 ****
        $DB_ERROR .= "Line: $line\n" if defined $line;
        $DB_ERROR .= "Text: $text\n";
  
!       local ($lineno) = 1;
!       foreach $row ( split(/\n/,$db->dbstrcpy) ) {
            $DB_ERROR .= sprintf ("%5d", $lineno ++) . "> $row\n";
        }
      }
--- 483,491 ----
        $DB_ERROR .= "Line: $line\n" if defined $line;
        $DB_ERROR .= "Text: $text\n";
  
!       my ($lineno) = 1;
!       my $row;
!       foreach $row ( split(/\n/,Sybase::DBlib::dbstrcpy($db)) ) {
            $DB_ERROR .= sprintf ("%5d", $lineno ++) . "> $row\n";
        }
      }
diff -rc sybperl-2.09-orig/pod/sybperl.pod sybperl-2.09/pod/sybperl.pod
*** sybperl-2.09-orig/pod/sybperl.pod	Tue Dec 30 19:16:46 1997
--- sybperl-2.09/pod/sybperl.pod	Fri Feb 20 16:29:22 1998
***************
*** 744,749 ****
--- 744,756 ----
      Simple Array (if type eq ARRAY, and a single column is queried
      Boolean True/False value (if type ne ARRAY or HASH)
  
+ Optionally, instead of the words "HASH" or "ARRAY" a reference of the
+ same type can be passed as well.  This is, both of the following are
+ equivalent:
+ 
+     $dbh->nsql("select col1,col2 from table","HASH");
+     $dbh->nsql("select col1,col2 from table",{});
+ 
  For example, the following code will return an array of hash
  references: