Home » Developer & Programmer » Forms » proc/c++ with c++ class
proc/c++ with c++ class [message #77556] Fri, 05 October 2001 01:14 Go to next message
yongjian
Messages: 1
Registered: October 2001
Junior Member
if i write a class in proc/c++,and compile the .pc into cpp, but how can i include the .h file in another pure c++ class ?

look forward to any guide!

----------------------------------------------------------------------
Re: proc/c++ with c++ class [message #77563 is a reply to message #77556] Mon, 08 October 2001 00:31 Go to previous message
vvk
Messages: 4
Registered: October 2001
Junior Member
You must be carefull that all member variable cannot be host variables.

In the ProC file, the #include "header.h" must be declared out of the DECLARE SECTION.

Example:
// File SqlConnect.pc
#include "SqlConnect.h"

EXEC SQL BEGIN DECLARE SECTION;
EXEC SQL INCLUDE "SqlConstant.h";
EXEC SQL END DECLARE SECTION;

CSqlConnect::CSqlConnect()
{
connected = false;
}

CSqlConnect::~CSqlConnect()
{
if (connected)
{
Disconnect();
}
}

bool CSqlConnect::Connect(const char* _string)
{
EXEC SQL BEGIN DECLARE SECTION;
char vSQLConnect[[SZ_CONNECT]];
EXEC SQL END DECLARE SECTION;
strncpy(vSQLConnect, _string, SZ_CONNECT);

EXEC SQL WHENEVER SQLERROR GOTO Err;
EXEC SQL WHENEVER SQLWARNING GOTO Err;
EXEC SQL CONNECT :vSQLConnect;
connected = true;
return true;
Err:
connected = false;
SqlTrace();
return false;
}

// other methods to define

// SqlConnect.h file
class CSqlConnect
{
bool connected;
public:
CSqlConnect();
bool Connect(const char* _string);
bool Disconnect();
bool Commit();
bool Rollback();
void SqlTrace();
}

// SqlConstant.h
#define SZ_CONNECT 100

vvk

----------------------------------------------------------------------
Previous Topic: Re: Run old version FMX in new runtime
Next Topic: Re: free material for oracle
Goto Forum:
  


Current Time: Thu Mar 28 06:59:59 CDT 2024