image



Paul Bunyan API Extensions:

The API Extensions below are freeware and meant as samples and 'helpers'.  No warranty, expressed or implied, is provided.

Where applicable, the 'Details' link describes the API extension and its particular usage.  The associated DLL or other file of interest may be downloaded directly by clicking the desired link.  Associated .zip files contain Visual Studio samples or projects for the extensions themselves, so that code may be viewed or modified and rebuilt.

NOTE: Text files (.bas, .h, .rul, .sql, etc. as well as the Details (.htm) pages themselves) may be downloaded and saved by right-clicking on them.

SQL Server Extended Stored Procedure Interface DLL exports a PBLog() entrypoint that is callable by stored procedures within SQL Server - i.e. a 'SQL Server Extended Stored Procedure'.  Details.htm explains how to register the PBLog() entrypoint as an extended stored procedure within SQL Server.  MyStoredProcedure.sql is a simple demonstration of calling syntax. Details
PBFWSSAPI.dll
PBFWSSAPI.zip
RegisterPBLog.sql
MyStoredProcedure.sql
Win32 API DLL exports a Win32 PBLog() entrypoint that is callable from a variety of applications and environments such as Visual Basic, InstallShield, and Sybase.  Interface definition files and similar for the above mentioned applications are available separately below. Details
PBFWAPI.dll
PBFWAPI.zip
Win32 API
(Visual Basic)
PBFWVisualBasic.bas contains interface definition (constants and declaration) for use with Win32 API above. Details
PBFWVisualBasic.bas
PBVBDemo.zip
Win32 API
(InstallShield)
PBFWInstallShield.rul contains interface definition (constants and declaration) for use with Win32 API above. Details
PBFWInstallShield.rul
Setup.rul
Win32 API
(Sybase)
Details.htm explains how to register the Win32 API PBLog() as an internal stored procedure with Sybase.  MyStoredProcedure.sql is a simple demonstration of calling syntax. Details
RegisterPBLog.sql
MyStoredProcedure.sql


Win32 API

The Paul Bunyan Freeware API DLL (PBFWAPI.dll) exports a Win32 entrypoint that can be invoked from a number of applications/environments given the required prototyping and/or registration operations.  Specific information and files necessary to use the PBLog() entrypoint from VisualBasic, InstallShield, and Sybase are referenced in their own sections on the Freeware page.

Note that a number of applications/environments will require PBFWAPI.dll to be on the PATH or to have its location specified in full.  Further, some applications will specifically require that it be in the System32 directory.  As such, it is recommended that the DLL be placed there as that is the one place that satisfies all constraints found thus far.

Note lastly that PBFWAPI.dll is NOT a COM server (i.e. it does not get registered with RegSvr32.exe or with any other mechanism), which is the reason for the location issues discussed above.

Back to top


SQL Stored Procedure Module

Paul Bunyan message logging is made available to SQL Server stored procedures through the implementation of a SQL Server Extended Stored Procedure interface.

Registering the PBLog() Extended Stored Procedure
The Extended Stored Procedure (ESP), PBLog(), must be ‘registered’ with SQL Server before it can be used from within other stored procedures. PBLog() is a SQL Server specific entrypoint exported from PBFWSSAPI.dll (Paul Bunyan Freeware SQL Server API).  As such, SQL Server needs to be told only the name of the entrypoint and the name of the DLL exporting it. The PBLog() ESP can be registered with SQL Server in one of two manners:

Using SQL Server’s ‘sp_addextendedproc’ Command
From within any stored procedure OR within Query Analyzer (screen capture), execute the command:

sp_addextendedproc PBLog, PBFWSSAPI

You may optionally execute this command via the provided stored procedure, RegisterPBLog.sql.

Using SQL Server’s GUI Interface
  • From within Enterprise Manager, right click on 'Extended Stored Procedures' under the 'master' database (screen capture).

  • Choose 'New Extended Stored Procedure'.

  • In the dialog presented, enter 'PBLog' for the name and 'PBFWSSAPI' for the path (screen capture).

NOTE: 1) PBFWSSAPI.dll must be located in the System32 directory for the above instructions to succeed. 2) Extended Stored Procedures may only be added to the 'master' database.


Using PBLog() Within a Stored Procedure
The syntax for PBLog() may be obtained at any time by typing 'PBLog' in the Query Analyzer window.

Syntax:
exec PBLog [@msgtype, @msg, [@component], [@context], [@line]]
Example (see provided MyStoredProcedure.sql or screen capture):
CREATE PROCEDURE PBLogTest AS
    exec PBLog 'V', 'Test message for PBLog().', 'PBLogTest', '', 1
    exec PBLog 'E', 'An error message.'
Back to top




Visual Basic API

Paul Bunyan message logging is made available to Visual Basic through the implementation of a Win32 interface.  While Visual Basic code may also use Paul Bunyan via its formal COM interface it is sometimes more appropriate to use a single-line API.

The PBFWVisualBasic.bas file provided is meant to be added to Visual Basic projects as a standalone module.  It defines constants and declares the prototype for the Win32 PBLog() API entrypoint exported in PBFWAPI.dll (Paul Bunyan Freeware API) which is downloadable from the API Extensions page of the web site.

Usage/syntax is specified in the PBFWVisualBasic.bas file itself with the PBVBDemo project (PBVBDemo.zip) serving as a brief sample.

Back to top




Install Shield API

Paul Bunyan message logging is made available to InstallShield scripts through the implementation of a Win32 interface.  While InstallShield scripts may also use Paul Bunyan via the COM interface it is sometimes more appropriate to use a single-line API.

The PBFWInstallShield.rul file provided is meant to be included into InstallShield scripts via the #include preprocessor directive.  It defines constants and declares the prototype for the Win32 PBLog() API entrypoint exported in PBFWAPI.dll (Paul Bunyan Freeware API) which is downloadable from the API Extensions page of the web site.

Usage/syntax is discussed in the PBFWInstallShield.rul file itself with Setup.rul serving as a brief sample script.

Back to top




Sybase Win32 API

Paul Bunyan message logging is made available to Sybase stored procedures through the implementation of a Win32 interface.

Registering the PBLog() API
The API call, PBLog(), must be ‘registered’ with Sybase before it can be used from within other stored procedures.  PBLog() is a Win32 entrypoint exported from PBFWAPI.dll (Paul Bunyan Freeware API) which is downloadable from the Freeware page of the web site.  As such, Sybase needs to be given the name of the entrypoint, its calling syntax, and the name of the DLL exporting it.  The PBLog() API can be registered with Sybase as follows:
  • Open the administration application Sybase Central.

  • Select 'Procedures & Functions' under the desired database with which to register Paul Bunyan.

  • Choose New | Procedure from the File menu (screen capture).

Once in the Create Procedure dialog choose Open From File... from the File menu and open the provided 'RegisterPBLog.sql' file.

RegisterPBLog.sql may be executed from here and/or saved however there is no need to save it once it is executed as Sybase will persist the status of the PBLog() API (screen capture).

NOTE: PBFWAPI.dll must be located in the System32 directory for the above instructions to succeed.


Using PBLog() Within a Stored Procedure
Syntax:
call PBLog [@msgtype, @msg, [@component], [@context], [@line]]
Example (see provided MyStoredProcedure-sysbase.sql or screen capture):
create procedure MyStoredProcedure(in strCP char(20),
                                   in strCX char(20),
                                   in strArg1 char(10),
                                   in strArg2 char(10))

// First PBLog() call uses default/null values for CP/CX/Line
// Second PBLog() call specifies CP/CX/Line

begin

    //... code

    call PBLog('v', 'In MyStoredProcedure()');

    if (strArg1 = strArg2) then
        call PBLog('e', 'Args are same:' + strArg1 + strArg2, strCP, strCX, 15);
    end if

    //... code

end
Back to top


image
image
image
©Copyright 1997-2010 Diamond Sierra Software All Rights Reserved
For more information feel free to Contact Us

Apollo Beach Internet Web Design and Hosting
©Site Design 2009-2010