Oracle Consulting Oracle Training Oracle Support Development
Home
Catalog
Oracle Books
SQL Server Books
IT Books
Job Interview Books
eBooks
Rampant Horse Books
911 Series
Pedagogue Books

Oracle Software
image
Write for Rampant
Publish with Rampant
Rampant News
Rampant Authors
Rampant Staff
 Phone
 800-766-1884
Oracle News
Oracle Forum
Oracle Tips
Articles by our Authors
Press Releases
SQL Server Books
image
image

Oracle 11g Books

Oracle tuning

Oracle training

Oracle support

Remote Oracle

STATSPACK Viewer

Privacy Policy

 

   
  SQL Server Tips by Burleson

Implement encapsulation by using C++ classes

To provide a C++ encapsulation of XP’s, the key class provided by the framework is CExtendedStoredProcedure. A specified instance of the class is created in the exporting function using the IMPLEMENT_XP macro. Then the virtual function CExtendedStoredProcedure::main is called with the SRV_PROC pointer as passed to the exported function along with the name of the exported function itself. IMPLEMENT_XP is implemented as:

#define IMPLEMENT_XP(xpName, class) \
extern "C" RETCODE __declspec(dllexport) xpName(SRV_PROC* srvproc) \
{ \
class _xp; \
return _xp.main(srvproc, #xpName); \
}


These values are then stored as member variables in the CExtendedStoredProcedure instance, so that they can be accessed from other methods of the class. To customize the functionality of the XP, various virtual functions are provided so that you can modify the standard behaviour by overriding the appropriate function in a derived class. The two key functions which a derived class should override are BOOL

 CExtendedStoredProcedure::Run() and void

 CExtendedStoredProcedure::DisplayUsage(). ‘Run’ is the method where you should implement the code specific to your XP. Returning TRUE from this function indicates that the XP ran successfully, while FALSE indicates that an error occurred. You should override ‘DisplayUsage’ to display usage information about what parameters your XP takes. The framework calls this function automatically when the XP is called with the incorrect number of parameters.


The above book excerpt is from:

Super SQL Server Systems
Turbocharge Database Performance with C++ External Procedures

ISBN: 0-9761573-2-2
Joseph Gama, P. J. Naughter

 http://www.rampant-books.com/book_2005_2_sql_server_external_procedures.htm  

Linux Oracle commands syntax poster

ION Oracle tuning software

Oracle data dictionary reference poster



Oracle Forum

BC Oracle consulting support training

BC remote Oracle DBA   

 

   

 Copyright © 1996 -2017 by Burleson. All rights reserved.


Oracle® is the registered trademark of Oracle Corporation. SQL Server® is the registered trademark of Microsoft Corporation. 
Many of the designations used by computer vendors to distinguish their products are claimed as Trademarks
 

Hit Counter