当前位置: 技术问答>linux和unix
关于.pc文件编译后会多产生些代码吗?请帮我看看这段代码
来源: 互联网 发布时间:2016-01-21
本文导语: .pc的内容: #include #include #include #include #include #include #define CHAR_SP 'n' EXEC SQL INCLUDE sqlca; EXEC SQL INCLUDE sqlda; /* Second connect to database */ int connectDb(char *sUser, char *sPwd, char *sTns, char *sPlat) { int nRet...
.pc的内容:
#include
#include
#include
#include
#include
#include
#define CHAR_SP 'n'
EXEC SQL INCLUDE sqlca;
EXEC SQL INCLUDE sqlda;
/* Second connect to database */
int connectDb(char *sUser, char *sPwd, char *sTns, char *sPlat)
{
int nRet;
EXEC SQL BEGIN DECLARE SECTION;
VARCHAR UserName[30];
VARCHAR PassWord[30];
VARCHAR HostName[30];
VARCHAR PlatCode[30];
EXEC SQL END DECLARE SECTION;
strcpy((char *) PlatCode.arr, sPlat);
PlatCode.len = strlen((char *) PlatCode.arr);
if( connDB(sUser, sPwd, sTns) != 0 )
{
printf( "ERROR: First Connect to DB.n" );
exit(-1);
}
printf( "nFirst Connected to ORACLE success.n" );
if( PlatCode.len == 0 ) /* Do not need second connect to DB */
return 0;
EXEC SQL SELECT LOGIN_SERVERNAME,LOGIN_USERNAME,LOGIN_PASSWORD
into :HostName, :UserName, :PassWord
from PLAT_LOGIN_USER
WHERE PLAT_CODE= :PlatCode;
if( sqlca.sqlcode 0 )
{
printf( "ERROR: Read plat info from DB.n" );
EXEC SQL ROLLBACK WORK RELEASE;
exit(-1);
}
/* EXEC SQL ROLLBACK WORK RELEASE; */
HostName.arr[HostName.len] = '';
UserName.arr[UserName.len] = '';
PassWord.arr[PassWord.len] = '';
nRet = EncodeAndDecode( (char *)PassWord.arr );
PassWord.len = strlen((char *) PassWord.arr);
nRet = HandleDbName( (char *)HostName.arr );
HostName.len = strlen((char *) HostName.arr);
if( connDB((char *)UserName.arr, (char *)PassWord.arr,
(char *)HostName.arr) != 0 )
{
printf( "ERROR: Connect to Second DB.n" );
return -1;
}
printf( "Second Connected to ORACLE success.n" );
return 0;
}
/* Connect Database */
int connDB( char *sUser, char *sPwd, char *sTns)
{
EXEC SQL BEGIN DECLARE SECTION;
VARCHAR vUserName[32];
VARCHAR vPassWord[32];
VARCHAR vDataBase[32];
EXEC SQL END DECLARE SECTION;
strcpy( (char *)vUserName.arr, sUser);
vUserName.len = strlen( (char *)vUserName.arr );
strcpy( (char *)vPassWord.arr, sPwd);
vPassWord.len = strlen( (char *)vPassWord.arr );
strcpy( (char *)vDataBase.arr, sTns);
vDataBase.len = strlen( (char *)vDataBase.arr );
EXEC SQL CONNECT :vUserName IDENTIFIED BY :vPassWord USING :vDataBase;
if( sqlca.sqlcode
#include
#include
#include
#include
#include
#include
#define CHAR_SP 'n'
EXEC SQL INCLUDE sqlca;
EXEC SQL INCLUDE sqlda;
/* Second connect to database */
int connectDb(char *sUser, char *sPwd, char *sTns, char *sPlat)
{
int nRet;
EXEC SQL BEGIN DECLARE SECTION;
VARCHAR UserName[30];
VARCHAR PassWord[30];
VARCHAR HostName[30];
VARCHAR PlatCode[30];
EXEC SQL END DECLARE SECTION;
strcpy((char *) PlatCode.arr, sPlat);
PlatCode.len = strlen((char *) PlatCode.arr);
if( connDB(sUser, sPwd, sTns) != 0 )
{
printf( "ERROR: First Connect to DB.n" );
exit(-1);
}
printf( "nFirst Connected to ORACLE success.n" );
if( PlatCode.len == 0 ) /* Do not need second connect to DB */
return 0;
EXEC SQL SELECT LOGIN_SERVERNAME,LOGIN_USERNAME,LOGIN_PASSWORD
into :HostName, :UserName, :PassWord
from PLAT_LOGIN_USER
WHERE PLAT_CODE= :PlatCode;
if( sqlca.sqlcode 0 )
{
printf( "ERROR: Read plat info from DB.n" );
EXEC SQL ROLLBACK WORK RELEASE;
exit(-1);
}
/* EXEC SQL ROLLBACK WORK RELEASE; */
HostName.arr[HostName.len] = '';
UserName.arr[UserName.len] = '';
PassWord.arr[PassWord.len] = '';
nRet = EncodeAndDecode( (char *)PassWord.arr );
PassWord.len = strlen((char *) PassWord.arr);
nRet = HandleDbName( (char *)HostName.arr );
HostName.len = strlen((char *) HostName.arr);
if( connDB((char *)UserName.arr, (char *)PassWord.arr,
(char *)HostName.arr) != 0 )
{
printf( "ERROR: Connect to Second DB.n" );
return -1;
}
printf( "Second Connected to ORACLE success.n" );
return 0;
}
/* Connect Database */
int connDB( char *sUser, char *sPwd, char *sTns)
{
EXEC SQL BEGIN DECLARE SECTION;
VARCHAR vUserName[32];
VARCHAR vPassWord[32];
VARCHAR vDataBase[32];
EXEC SQL END DECLARE SECTION;
strcpy( (char *)vUserName.arr, sUser);
vUserName.len = strlen( (char *)vUserName.arr );
strcpy( (char *)vPassWord.arr, sPwd);
vPassWord.len = strlen( (char *)vPassWord.arr );
strcpy( (char *)vDataBase.arr, sTns);
vDataBase.len = strlen( (char *)vDataBase.arr );
EXEC SQL CONNECT :vUserName IDENTIFIED BY :vPassWord USING :vDataBase;
if( sqlca.sqlcode