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: "Walter Kowash" <walter dot kowsh at prudential dot com>
Subject: Re: dbprocinfo method in MS SQL Server 7.0 DBLIB library
Date: Dec 6 2000 4:01PM


Yes it is MS SQL Server specific please see below:
< BEGIN >
dbprocinfo
Returns information about a DBPROCESS connection.

Syntax
RETCODE dbprocinfo (
PDBPROCESS pdbproc,
LPDBPROCINFO pdbprocinfo );

Arguments
pdbproc
The DBPROCESS structure that is the handle for a particular
workstation/Microsoft® SQL Server? process. It contains all the information that
 DB-Library uses to manage communications and data between the workstation and
SQL Server.
pdbprocinfo
A pointer to a DBPROCINFO structure that DB-Library will fill with information
about the specified connection.
The DBPROCINFO structure is defined as follows:

typedef struct
{
   DBINT  SizeOfStruct;
   BYTE   ServerType;
   USHORT ServerMajor;
   USHORT ServerMinor;
   USHORT ServerRevision;
   CHAR   ServerName[MAXSERVERNAME+1];
   CHAR   NetLibName[MAXNETLIBNAME+1];
   CHAR   NetLibConnStr[MAXNETLIBCONNSTR+1];
} DBPROCINFO, PTR LPDBPROCINFO;



The DBPROCINFO fields are described here.



Field Description
SizeOfStruct Before calling dbprocinfo, set this field equal to the value
returned by the C sizeof function for the DBPROCINFO structure.
ServerType Is one of the following:
SERVTYPE_MICROSOFT if you are connected to a server running SQL Server.

SERVTYPE_UNKNOWN if you are connected to an unknown type of SQL Server.

ServerMajor Is the XX value in the XX.YY.ZZZ version number of the SQL Server
you are connected to. For example, 6.
ServerMinor Is the YY value in the XX.YY.ZZZ version number of the SQL Server
you are connected to. For example, 0.
ServerRevision Is the ZZZ value in the XX.YY.ZZZ version number of the SQL
Server you are connected to. For example, 101.
ServerName Is the name of the SQL Server you are connected to
NetLibName Is the name of the Net-Library DLL used to connect to SQL Server.
NetLibConnStr Is the Net-Library connection string used to connect to SQL
Server.


Returns
SUCCEED or FAIL.

Remarks
Before calling dbprocinfo, set the SizeOfStruct field equal to the value
returned by the C sizeof function for the DBPROCINFO structure. The dbprocinfo
function fills the supplied DBPROCINFO structure with information about the
DBPROCESS connection.

See Also
dbopen




(c) 1988-98 Microsoft Corporation. All Rights Reserved.


My problem has been instantiating the pointer reference to the structure.
Once my code his the ptr->SizeOfStruct or any other structure member reference
it goes south with a run time error.

Here is my code snipet:

     DBPROCINFO          test;                //  allocate a DBPROCINFO
structure to receive informataion from dbprocinfo method
     LPDBPROCINFO   dbinfo;              //   allocate a pointer to the
DBPROCINFO structure\
     DBINT               db_struct_size;           //  storage area of size of
structure

     dbinfo->SizeOfStruct = sizeof(test);          // Point of failure.
     printf("The structure's size is: %d\n", sizeof(DBPROCINFO));
     dbprocinfo(dbproc, dbinfo);

Any help in explaining the error of my ways would be greatly appreciated.