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: "Brittingham, John" <john dot brittingham at attws dot com>
Subject: Problem with dbnextrow
Date: Apr 26 2003 1:43AM

Received: (from majordomo@localhost)
	by troll.peppler.org (8.11.6/8.11.6) id h3Q1i6m14855
	for sybperl-l-outgoing; Fri, 25 Apr 2003 18:44:06 -0700
Received: from redmailwall4.attws.com (redmailwall4.attws.com [67.98.173.54])
	by troll.peppler.org (8.11.6/8.11.6) with ESMTP id h3Q1i0914848
	for ; Fri, 25 Apr 2003 18:44:00 -0700
Received: from viruswall.entp.attws.com (viruswall.entp.attws.com [135.214.42.163])
	by redmailwall4.attws.com (8.12.9/8.12.6) with ESMTP id h3Q1hnm8018611
	for ; Fri, 25 Apr 2003 18:43:49 -0700 (PDT)
Received: from neastmail.entp.attws.com by viruswall.entp.attws.com (8.11.7+Sun/AT&T Wireless Services, Inc.)
	id h3Q1hhL20090; Fri, 25 Apr 2003 18:43:43 -0700 (PDT)
Received: from WA-MSGBH02-BTH.wireless.attws.com (wa-msgbh02-bth.wireless.attws.com [135.214.49.58])
	by neastmail.entp.attws.com (8.8.8p2+Sun/8.8.8) with ESMTP id SAA00204
	for ; Fri, 25 Apr 2003 18:43:43 -0700 (PDT)
Received: from WA-MSG07-BTH.wireless.attws.com ([135.214.49.117]) by WA-MSGBH02-BTH.wireless.attws.com with Microsoft SMTPSVC(5.0.2195.5329);
	 Fri, 25 Apr 2003 18:43:43 -0700
X-MimeOLE: Produced By Microsoft Exchange V6.0.6375.0
content-class: urn:content-classes:message
MIME-Version: 1.0
Content-Type: multipart/related;
	type="multipart/alternative";
	boundary="----_=_NextPart_001_01C30B95.451B56B9"
Subject: Problem with dbnextrow
Date: Fri, 25 Apr 2003 18:43:43 -0700
Message-ID: <47AB1611568F5344B30736563AAA895C015F792B@WA-MSG07-BTH.wireless.attws.com>
X-MS-Has-Attach: yes
Thread-Topic: Problem with dbnextrow
Thread-Index: AcMLlYD/lfQoKG62Q3ua/tz8WvOaBA==
From: "Brittingham, John" 
To: 
X-OriginalArrivalTime: 26 Apr 2003 01:43:43.0639 (UTC) FILETIME=[45407270:01C30B95]
X-Spam-Status: No, hits=1.5 required=5.0
	tests=EXTRA_MPART_TYPE,HTML_40_50,HTML_FONT_FACE_ODD,HTML_MESSAGE
	version=2.50
X-Spam-Level: *
X-Spam-Checker-Version: SpamAssassin 2.50 (1.173-2003-04-18-exp)
Sender: owner-sybperl-l@peppler.org
Precedence: bulk

This is a multi-part message in MIME format.

------_=_NextPart_001_01C30B95.451B56B9
Content-Type: multipart/alternative;
	boundary="----_=_NextPart_002_01C30B95.451B56B9"

------_=_NextPart_002_01C30B95.451B56B9
Content-Type: text/plain;
	charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

Having problems with dbnextrow. I know the query is valid: I also know that=
 it returns 1 if I use $dbh->dbresults. The problem is that it returns noth=
ing for $dbh->dbnextrow. Anyone have any idea why this would be happening?

#########################################################
# GetDistrictDBInfoFromAxysGlobalWithMarket
# Parameter
# 	String Market name
# Returns=20
# 	char* errmsg   // if empty then success
#	char* AxysDBServer // District SQL server for the Market
#	char* AxysDBDatabase // Database name of axysdb. (includes suffix)
#########################################################
sub GetDistrictDBInfoFromAxysGlobalWithMarket
{
   	local ($market) =3D @_;
	$market =3D~ s/ //g;
   	local ($sqlcmd,$msg,@info,$sqlserver);
	&Log("GetDistrictDBInfoFromAxysGlobalWithMarket $market\n",3);
=20
    Log("\nTIMESTAMP|axys_lib.GetDistrictDBInfoFromAxysGlobalWithMarket|Sta=
rt|".localtime()."\n", 2);

   #
   # Register functions to capture Messages from Sybase (includes Errors).
   #
   &dbmsghandle ("_dbMessageHandler");
   &dberrhandle ("_dbErrorHandler");

   $dbh =3D Sybase::DBlib->dblogin(	$NavDBUsername, $NavDBPassword,=20
							$NavDBServer, $AppName);
   &Log("$NavDBUsername, $NavDBPassword, $NavDBServer, $AppName\n",3);
   if (! $dbh)
   {
      return ("AXYSDOWN:Error Logging into Nav database",());
   }
	&Log("GetDistrictDB dbh is $dbh\n",3);=09

   $sqlcmd =3D "select NSS.name, NPDB.name from PFWUtil..NavAreaPhysicalDbS=
qlServer NAPDBSS, ".=20
	"PFWUtil..NavAreaLogicalDb NALDB, PFWUtil..NavLogicalDb NLDB, PFWUtil..Nav=
PhysicalDb NPDB, ".=20=20
	"PFWUtil..NavSqlServer NSS, PFWUtil..NavArea NA where  NPDB.oid =3D NAPDBS=
S.oidPhysicalDb ".=20=20
	"and  NSS.oid =3D NAPDBSS.oidSqlServer  and  NLDB.oid =3D NALDB.oidLogical=
Db ".=20=20
	"and  NALDB.oidAreaPhysicalDbSqlServer =3D NAPDBSS.oid and  NALDB.oidArea =
=3D NA.oid ".=20=20
	"and  NLDB.name =3D 'AXYSDB' and lower(NA.name) like lower('$market%')";

   &Log("GETAXYSDB :: $sqlcmd  :: GETAXYSDB\n",3);

   $errorCode =3D $dbh->dbcmd("$sqlcmd\n");
   if ($errorCode !=3D 1)
   {
      &Log("GETAXYSDB ::AXYSDOWN:Error submitting the following query:\n$sq=
lcmd\n",2);
      return ("AXYSDOWN:Error submitting the following query:\n$sqlcmd\n",(=
));
   }

   $SybaseErrorFlag =3D 0;

   $errorCode =3D $dbh->dbsqlexec;# || &InternalErrorPage;
   if ($errorCode !=3D 1)
   {
      &Log("GETAXYSDB ::BADMARKET:Error executing the following query:\n$sq=
lcmd\n",2);
      return("BADMARKET:Error executing the following query:\n$sqlcmd\n",()=
);
   }
=20=20=20
   if ($SybaseErrorFlag)
   {
      &Log("BADMARKET\n",3);
	  return("BADMARKET:$SybaseErrorMessage $SybaseMessage\n",());
=09=20=20
   }
# Try to get the name of the server and database
   &Log("I am here\n",3);
   &Log("While I am here\n",3);
   @info =3D $dbh->dbnextrow();
   &Log("info =3D @info\n",3);
=20=20=20
   if ($#info < 1)
   {
      # we don't appear to have enough info returned... probably bad Market
	  &Log("we don't appear to have enough info returned... probably bad marke=
t\n",3);
	  return("BADMARKET:",());
=09=20=20
   }
=20=20=20
   ($AxysDBServer, $AxysDBDatabase) =3D @info;
	&Log("GETAXYSDB :: $AxysDBServer, $AxysDBDatabase  :: GETAXYSDB\n",3);
   $dbh->dbclose;
   &Log("GETAXYSDB :: @info  :: GETAXYSDB\n",3);
   &Log("\nTIMESTAMP|axys_lib.GetDistrictDBInfoFromAxysGlobalWithMarket|Don=
e|".localtime()."\n", 2);
   &Log("Return '',$AxysDBServer, $AxysDBDatabase\n",3);
	return ('',$AxysDBServer, $AxysDBDatabase);
}
John Brittingham
Developer 1
AT&T Wireless Services
Bothell 7
Cell: 206-484-2042
---------------------------------------------------------------
"Non est mea culpa!!!!"
 <>=20


------_=_NextPart_002_01C30B95.451B56B9
Content-Type: text/html;
	charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable






Problem with dbnextrow




Having problems with dbnextrow. I know the= query is valid: I also know that it returns 1 if I use $dbh->dbresults.= The problem is that it returns nothing for $dbh->dbnextrow. Anyone have= any idea why this would be happening?

##########################################= ###############
# GetDistrictDBInfoFromAxysGlobalWithMark= et
# Parameter
#       String M= arket name
# Returns
#       char* er= rmsg   // if empty then success
#       cha= r* AxysDBServer // District SQL server for the Market
#       cha= r* AxysDBDatabase // Database name of axysdb. (includes suffix)
#########################################= ################
sub GetDistrictDBInfoFromAxysGlobalWithMa= rket
{
        loc= al ($market) =3D @_;
        $market =3D~ s/ //g;
        loc= al ($sqlcmd,$msg,@info,$sqlserver);
        &Log("GetDistrictDBInfoFromAxysGlobalWithMarket $market\n",= 3);
 
    Log("\nTIMESTAMP|= axys_lib.GetDistrictDBInfoFromAxysGlobalWithMarket|Start|".localtime()= ."\n", 2);

   #
   # Register functions to capt= ure Messages from Sybase (includes Errors).
   #
   &dbmsghandle ("_dbM= essageHandler");
   &dberrhandle ("_dbE= rrorHandler");

   $dbh =3D Sybase::DBlib->db= login(       $NavDBUsername, $NavDBPassword, =
            &nbs= p;              = ;              =              &n= bsp; $NavDBServer, $AppName);
   &Log("$NavDBUsernam= e, $NavDBPassword, $NavDBServer, $AppName\n",3);
   if (! $dbh)
   {
      return (&q= uot;AXYSDOWN:Error Logging into Nav database",());
   }
        &Log("GetDistrictDB dbh is $dbh\n",3); 

   $sqlcmd =3D "select NSS.= name, NPDB.name from PFWUtil..NavAreaPhysicalDbSqlServer NAPDBSS, ". <= /FONT>
        "PFWUtil..NavAreaLogicalDb NALDB, PFWUtil..NavLogicalDb NLDB, PFWUti= l..NavPhysicalDb NPDB, ". 
        "PFWUtil..NavSqlServer NSS, PFWUtil..NavArea NA where  NPDB.oid= =3D NAPDBSS.oidPhysicalDb ". 
        "and  NSS.oid =3D NAPDBSS.oidSqlServer  and  NLDB.oid= =3D NALDB.oidLogicalDb ". 
        "and  NALDB.oidAreaPhysicalDbSqlServer =3D NAPDBSS.oid and = ; NALDB.oidArea =3D NA.oid ". 
        "and  NLDB.name =3D 'AXYSDB' and lower(NA.name) like lower('$ma= rket%')";

   &Log("GETAXYSDB :: $= sqlcmd  :: GETAXYSDB\n",3);

   $errorCode =3D $dbh->dbcmd= ("$sqlcmd\n");
   if ($errorCode !=3D 1)
   {
      &Log(&= quot;GETAXYSDB ::AXYSDOWN:Error submitting the following query:\n$sqlcmd\n&= quot;,2);
      return (&q= uot;AXYSDOWN:Error submitting the following query:\n$sqlcmd\n",());
   }

   $SybaseErrorFlag =3D 0;

   $errorCode =3D $dbh->dbsql= exec;# || &InternalErrorPage;
   if ($errorCode !=3D 1)
   {
      &Log(&= quot;GETAXYSDB ::BADMARKET:Error executing the following query:\n$sqlcmd\n&= quot;,2);
      return(&qu= ot;BADMARKET:Error executing the following query:\n$sqlcmd\n",());
   }
  
   if ($SybaseErrorFlag)
   {
      &Log(&= quot;BADMARKET\n",3);
          return("BADMARKET:$SybaseErrorMessage $SybaseMessage\n",= ());
         
   }
# Try to get the name of the server and d= atabase
   &Log("I am here\n&q= uot;,3);
   &Log("While I am he= re\n",3);
   @info =3D $dbh->dbnextrow= ();
   &Log("info =3D @inf= o\n",3);
  
   if ($#info < 1)
   {
      # we don't= appear to have enough info returned... probably bad Market
          &Log("we don't appear to have enough info returned... pro= bably bad market\n",3);
          return("BADMARKET:",());
         
   }
  
   ($AxysDBServer, $AxysDBDatab= ase) =3D @info;
        &Log("GETAXYSDB :: $AxysDBServer, $AxysDBDatabase  :: GETAX= YSDB\n",3);
   $dbh->dbclose;
   &Log("GETAXYSDB :: = @info  :: GETAXYSDB\n",3);
   &Log("\nTIMESTAMP|a= xys_lib.GetDistrictDBInfoFromAxysGlobalWithMarket|Done|".localtime().&= quot;\n", 2);
   &Log("Return '',$Ax= ysDBServer, $AxysDBDatabase\n",3);
        return ('',$AxysDBServer, $AxysDBDatabase);
}
John Brittingham
Developer 1
AT&T Wireless Services
Bothell 7
Cell: 206-484-2042
-----------------------------------= ----------------------------
"Non est mea culpa!!!!"=
3D"ole0.bmp"

------_=_NextPart_002_01C30B95.451B56B9-- ------_=_NextPart_001_01C30B95.451B56B9 Content-Type: image/bmp; name="ole0.bmp" Content-Transfer-Encoding: base64 Content-Description: ole0.bmp Content-Location: No%20AttachName Qk3WAQAAAAAAAFYAAAAoAAAAGAAAACAAAAABAAQAAAAAAAAAAAAAAAAAAAAA AAgAAAAAAAAAAAAAABEAAAAAAP8A/8wzAP///wAAzP8AM8z/AGbM/wAAAAAA AAAAAABEREREAAAAAAAAAAREREREAAAAAAAAAERERERERAAAAAAABERERERE RAAABEREBEREREREREQAREAAAAREREREREQARAAABAREREREREQAQAAAQERE REREREQAQAAAAAAAAEREREQARABERERERABEREQAREREREREREBERABERERE RERERARERABEREREREREQEREREQAREQAAARAAEREREQEREBEREBERAREREQE RAREREQERARERABERARAREQAAERERABERAREREQERARERARERAREREQEBARE RAREREBEREBERAREAEREREQAAAREQEREAEREREREREAABEREBERERERERERA REREBEREREREREQEREQAREREREREREQEREQAREREREREREBEREQABERERERE REBEREREAAREREREREBEREREBAAERERERARERERERAQABERERAREREREREQE AAAAAAREREREREREBAQEBAREREQ= ------_=_NextPart_001_01C30B95.451B56B9--