first commit

main
李建辉 1 month ago
commit 2a8db3b745

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

@ -0,0 +1,29 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 2012
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "JK_itk", "jf_itk\jf_itk.vcxproj", "{AEABC483-FCBD-45F5-9884-8FA4C5A9892D}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Itanium = Debug|Itanium
Debug|Win32 = Debug|Win32
Debug|x64 = Debug|x64
Release|Itanium = Release|Itanium
Release|Win32 = Release|Win32
Release|x64 = Release|x64
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{AEABC483-FCBD-45F5-9884-8FA4C5A9892D}.Debug|Itanium.ActiveCfg = Debug|Win32
{AEABC483-FCBD-45F5-9884-8FA4C5A9892D}.Debug|Win32.ActiveCfg = Debug|Win32
{AEABC483-FCBD-45F5-9884-8FA4C5A9892D}.Debug|Win32.Build.0 = Debug|Win32
{AEABC483-FCBD-45F5-9884-8FA4C5A9892D}.Debug|x64.ActiveCfg = Debug|x64
{AEABC483-FCBD-45F5-9884-8FA4C5A9892D}.Debug|x64.Build.0 = Debug|x64
{AEABC483-FCBD-45F5-9884-8FA4C5A9892D}.Release|Itanium.ActiveCfg = Release|Win32
{AEABC483-FCBD-45F5-9884-8FA4C5A9892D}.Release|Win32.ActiveCfg = Release|Win32
{AEABC483-FCBD-45F5-9884-8FA4C5A9892D}.Release|Win32.Build.0 = Release|Win32
{AEABC483-FCBD-45F5-9884-8FA4C5A9892D}.Release|x64.ActiveCfg = Release|x64
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
EndGlobal

Binary file not shown.

Binary file not shown.

Binary file not shown.

@ -0,0 +1,2 @@
#v4.0:v100
Release|Win32|F:\Connor项目管理\继峰项目\签名\jf_itk\|

@ -0,0 +1,44 @@
生成启动时间为 2015/9/17 16:50:45。
1>项目“F:\Connor项目管理\继峰项目\签名\jf_itk\jf_erp_check_project\jf_erp_check_project.vcxproj”在节点 2 上(build 个目标)。
1>InitializeBuildStatus:
正在对“Release\jf_erp_check_project.unsuccessfulbuild”执行 Touch 任务。
ClCompile:
所有输出均为最新。
所有输出均为最新。
Link:
C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\bin\link.exe /ERRORREPORT:PROMPT /OUT:"F:\Connor项目管理\继峰项目\签名\jf_itk\Release\jf_erp_check_project.dll" /INCREMENTAL:NO /NOLOGO "F:\Teamcenter10.1.0Env\tcbin\lib\*.lib" kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /MANIFEST /ManifestFile:"Release\jf_erp_check_project.dll.intermediate.manifest" /MANIFESTUAC:"level='asInvoker' uiAccess='false'" /DEBUG /PDB:"F:\Connor项目管理\继峰项目\签名\jf_itk\Release\jf_erp_check_project.pdb" /SUBSYSTEM:WINDOWS /OPT:REF /OPT:ICF /LTCG /TLBID:1 /DYNAMICBASE /NXCOMPAT /IMPLIB:"F:\Connor项目管理\继峰项目\签名\jf_itk\Release\jf_erp_check_project.lib" /MACHINE:X86 /DLL Release\common_itk_util.obj
Release\jf3_main.obj
Release\ocilib.obj
Release\string_helper.obj
Release\string_utils.obj
1>common_itk_util.obj : error LNK2001: 无法解析的外部符号 __imp__MEM_alloc
1>common_itk_util.obj : error LNK2001: 无法解析的外部符号 __imp__MEM_free
1>common_itk_util.obj : error LNK2001: 无法解析的外部符号 __imp__TC_write_syslog
1>common_itk_util.obj : error LNK2001: 无法解析的外部符号 __imp__POM_ask_session
1>common_itk_util.obj : error LNK2001: 无法解析的外部符号 __imp__ITK__convert_tag_to_uid
1>common_itk_util.obj : error LNK2001: 无法解析的外部符号 _AM__set_application_bypass
1>ocilib.obj : error LNK2001: 无法解析的外部符号 _OCIStmtPrepare
1>ocilib.obj : error LNK2001: 无法解析的外部符号 _OCILogon
1>ocilib.obj : error LNK2001: 无法解析的外部符号 _OCIHandleFree
1>ocilib.obj : error LNK2001: 无法解析的外部符号 _OCIBindByPos
1>ocilib.obj : error LNK2001: 无法解析的外部符号 _OCIEnvCreate
1>ocilib.obj : error LNK2001: 无法解析的外部符号 _OCIBindByName
1>ocilib.obj : error LNK2001: 无法解析的外部符号 _OCIErrorGet
1>ocilib.obj : error LNK2001: 无法解析的外部符号 _OCILogoff
1>ocilib.obj : error LNK2001: 无法解析的外部符号 _OCIDefineByPos
1>ocilib.obj : error LNK2001: 无法解析的外部符号 _OCIHandleAlloc
1>ocilib.obj : error LNK2001: 无法解析的外部符号 _OCIAttrGet
1>ocilib.obj : error LNK2001: 无法解析的外部符号 _OCIStmtFetch2
1>ocilib.obj : error LNK2001: 无法解析的外部符号 _OCIStmtExecute
1>string_utils.obj : error LNK2001: 无法解析的外部符号 __imp__tc_strncpy
1>string_utils.obj : error LNK2001: 无法解析的外部符号 __imp__tc_strcat
1>string_utils.obj : error LNK2001: 无法解析的外部符号 __imp__STRNG_replace_str
1>string_utils.obj : error LNK2001: 无法解析的外部符号 __imp__tc_strstr
1>string_utils.obj : error LNK2001: 无法解析的外部符号 __imp__tc_strcpy
1>string_utils.obj : error LNK2001: 无法解析的外部符号 __imp__tc_strlen
1>F:\Connor项目管理\继峰项目\签名\jf_itk\Release\jf_erp_check_project.dll : fatal error LNK1120: 25 个无法解析的外部命令
1>已完成生成项目“F:\Connor项目管理\继峰项目\签名\jf_itk\jf_erp_check_project\jf_erp_check_project.vcxproj”(build 个目标)的操作 - 失败。
生成失败。
已用时间 00:00:00.48

@ -0,0 +1,290 @@
/**
* @file common_itk_util.cpp
* @brief itk warpper utility function
* @author James
* @history
* ===================================================================================
* Date Name Description of Change
* 18-July-2008 James
*/
#pragma warning (disable: 4996)
#pragma warning (disable: 4819)
#include <epm/epm.h>
#include <epm/epm_toolkit_tc_utils.h>
#include <ict/ict_userservice.h>
#include <tccore/item.h>
#include <ae/ae.h>
#include <tc/folder.h>
#include <tccore/aom.h>
#include <sa/sa.h>
#include <tccore/aom_prop.h>
#include <property/prop_errors.h>
#include <tccore/workspaceobject.h>
#include <tc/preferences.h>
#include <tccore/imantype.h>
#include <tccore//grm.h>
#include <tccore/grmtype.h>
#include <sa/am.h>
#include <cfm/cfm.h>
#include <bom/bom.h>
#include <tccore/uom.h>
#include <ps/ps.h>
#include <epm/signoff.h>
#include <fclasses/tc_date.h>
//#include <tccore/imantype.h>
//#include <textsrv/textserver.h>
//#include <user_exits/epm_toolkit_utils.h>
//#include <ss/ss_errors.h>
#include <stdlib.h>
//#include <io.h>
#include <stdio.h>
#include <time.h>
//#include <direct.h>
//#include <unistd.h>
#include "error_handling.h"
#include "common_itk_util.h"
#ifdef WIN32
#include <io.h>
#include <direct.h>
#else
#include <unistd.h>
#endif
#define ARGS_LENGTH 200
#define ARGS_NAME_DEBUG "-debug"
#define DEBUG "-debug="
#define MAX_PRINTLINE_LENGTH 2000
#define MAX_PATH_LENGTH 2000
#define MAX_ARGUMENT_LENGTH 400
#define MAX_PARAMNAME_LENGTH 50
#define MAX_FILE_EXT_LENGTH 10
#define TRUE_FLAG 1
#define FALSE_FLAG 0
#define DETAILLOG 1
extern "C" int AM__set_application_bypass(logical bypass);
void ECHO(char *format, ...)
{
//if( !YFJC_OPT_DEBUG )
// return;
char msg[1024];
va_list args;
va_start( args, format );
vsprintf( msg, format, args );
va_end( args );
printf( msg );
TC_write_syslog( msg );
}
FILE* logFile = NULL;
void set_bypass(logical bypass)
{
AM__set_application_bypass(bypass);
}
/*=============================================================================*
* FUNCTION: current_time
* PURPOSE : get the current datetime
* INPUT:
* date_t* date_tag // current date time tag
*
* RETURN:
* void
*============================================================================*/
void current_time( date_t * date_tag )
{
time_t ltime;
struct tm *today ;
// Set time zone from TZ environment variable. If TZ is not set,
// the operating system is queried to obtain the default value
// for the variable.
//
//_tzset();
// Get UNIX-style time and display as number and string.
time( &ltime );
today = localtime( &ltime );
date_tag->year = today->tm_year + 1900 ;
date_tag->month = today->tm_mon ;
date_tag->day = today->tm_mday ;
date_tag->hour = today->tm_hour ;
date_tag->minute = today->tm_min ;
date_tag->second = today->tm_sec ;
}
/*=============================================================================*
* FUNCTION: CreateLogFile
* PURPOSE : create log file
* INPUT:
* char* FunctionName // the funtion which need to create log file
* FILE** logFile // out: the log file pointer
*
* RETURN:
* void
*============================================================================*/
void CreateLogFile(char* FunctionName, char **fullname)
{
int i=0, ifail = ITK_ok;
//date_t status_now;
//char* date_string = NULL;
char date_string[MAX_PATH_LENGTH];
char logFileDir[MAX_PATH_LENGTH];
char logFileName[MAX_PATH_LENGTH];
char* session_uid = NULL;
tag_t session_tag = NULLTAG;
time_t now;
struct tm *p;
time(&now);
logFile = NULL;
//current_time(&status_now);
p=localtime(&now);
memset(date_string, 0, sizeof(date_string));
sprintf(date_string,"%4d%02d%02d%02d%02d%02d",1900+p->tm_year,p->tm_mon+1 ,p->tm_mday ,p->tm_hour,p->tm_min ,p->tm_sec );
//if( DATE_date_to_string( status_now, "%Y%m%d%H%M%S", &date_string) != ITK_ok )
//ifail = ITK_date_to_string (status_now, &date_string );
//if (ifail)
//{
// printf("!*ERROR*!: Failed to get current date time\n");
// goto CLEANUP;
//}
memset(logFileDir, 0, sizeof(logFileDir));
memset(logFileName, 0, sizeof(logFileName));
//get log dir
sprintf(logFileDir, "%s", getenv("TEMP"));
printf("\n log file dir: %s\n", logFileDir);
//try to change dir to TC_USER_LOG_DIR
if(chdir(logFileDir)!=ITK_ok)
{
//not set TC_USER_LOG_DIR
//log in to default TC_LOG
memset(logFileDir, 0, sizeof(logFileDir));
sprintf(logFileDir, "%s", getenv("TC_LOG"));
printf("\n TC_USER_LOG_DIR invalide, log file dir: %s\n", logFileDir);
if(chdir(logFileDir)!=ITK_ok)
{
//still can not change to log dir
printf("!*ERROR*!: Failed to change dir to TC_USER_LOG_DIR\n");
goto CLEANUP;
}
}
//get session_uid to make sure the log file name unique
POM_ask_session(&session_tag);
ITK__convert_tag_to_uid(session_tag, &session_uid);
//get logFileName
sprintf(logFileName, "%s_%s_%s.log", FunctionName, session_uid, date_string);
printf("log file name: %s\n", logFileName);
*fullname = (char *)MEM_alloc(sizeof(char)*512);
sprintf(*fullname,"%s\\%s",logFileDir,logFileName);
//for(i = 0; _access((char *)logFileName, 4) == 0; i++)
/*{
memset(logFileName, 0, sizeof(logFileName));
sprintf(logFileName, "%s_%s_%s_%d.log", FunctionName, session_uid, date_string, i);
}
printf("final log file name: %s\n", logFileName);*/
//create log file
logFile = fopen(logFileName, "w");
CLEANUP:
//DOFREE(date_string);
DOFREE(session_uid);
}
/*=============================================================================*
* FUNCTION: WriteLog
* PURPOSE : write log, if debug log File not null, write log message to log File
* INPUT:
* const char* format // debug message string
*
* RETURN:
* void
*============================================================================*/
void WriteLog(const char* format, ...)
{
va_list arg;
char tmp[MAX_PRINTLINE_LENGTH];
if(logFile)
{
//get the message
memset(tmp, 0, sizeof(tmp));
va_start(arg, format);
vsprintf(tmp, format, arg);
va_end(arg);
//----------print to command window for trace--------//
printf("%s\n", tmp);
//print message to log file
fprintf(logFile, "%s\n", tmp);
fflush(logFile);
}
else
{
printf("*!Error!*: Log File Not Exist\n");
}
}
void CloseLog(void)
{
if(logFile)
{
fclose(logFile);
logFile = NULL;
}
}
//void getTypeinfo(char *type)
//{
// int ulen = 0,i=0,tempcount=0,asd=0;
//
// char temp[128]="";
// ulen = strlen(type);
// asd = ulen-1;
// for(i=0;i < ulen;i++)
// {
// if(type[i] == ';')
// {
// temp[tempcount] = '\0';
// strcpy(excludetypes[typecount].type,temp);
// strcpy(temp,"");
// tempcount = 0;
// typecount = typecount + 1;
// }
// else
// {
//
// temp[tempcount] = type[i];
// tempcount = tempcount + 1;
// if(i==asd)
// {
// temp[tempcount] = '\0';
// strcpy(excludetypes[typecount].type,temp);
// typecount = typecount + 1;
// }
//
// }
//
// }
//}

@ -0,0 +1,42 @@
/**
* @file common_itk_util.h
* @brief itk warpper utility function
* @author James
* @history
* ===================================================================================
* Date Name Description of Change
* 09-July-2008 James
*/
#ifndef COMMON_ITK_UTIL
#define COMMON_ITK_UTIL
#ifdef __cplusplus
extern "C" {
#endif
#define DOFREE(obj) \
{ \
if(obj) \
{ \
MEM_free(obj); \
obj = NULL; \
} \
}
void ECHO(char *format, ...);
void CreateLogFile(char* FunctionName, char **fullname);
void WriteLog(const char* format, ...);
void CloseLog(void);
void set_bypass(logical bypass);
//int FindDatasetReferenceExt( tag_t datasettype, const char *datasettype_ref, char ext[10] );
//int CompareDate( date_t date1, date_t date2 );
//int GetRandomTempFile( char tempFile[256] );
//logical IsItemRevisionType( char object_type[WSO_name_size_c + 1] );
#ifdef __cplusplus
}
#endif
#endif

@ -0,0 +1,160 @@
/*!
* @addtogroup common
* \file error_handling.h
* \brief
* \date 2008/6/10
* \author Ray Li
*/
#ifndef SIMPLE_ERR_H_INCLUDED
#define SIMPLE_ERR_H_INCLUDED
#include <itk/mem.h>
#include <tc/iman.h>
#include <tc/emh.h>
#include <pom/pom/pom_errors.h>
#include <tc/emh_const.h>
#include <tc/tc.h>
#include <pom/pom/pom.h>
#include <stdio.h>
#include <time.h>
#define BUFSIZE 512
//
//#define HANDLER_ARGUMENT_ERROR EMH_USER_error_base + 1
//#define WORKFLOW_NODE_IS_NOT_VALID EMH_USER_error_base + 2
//#define HANDLER_PLACED_INVALID EMH_USER_error_base + 3
//
////user errors define
////<error id="100">在站点文件中缺少 %1$ 配置,或该配置中无数据项</error>
//#define ERROR_PREFERENCE_NOT_FOUND (EMH_USER_error_base + 100)
#define DOFREE(obj) \
{ \
if(obj) \
{ \
MEM_free(obj); \
obj = NULL; \
} \
}
//#define ECHO(X) printf X;
#define SYS_LOG(X) IMAN_write_syslog X;
#define LOG_ECHO(X) printf X; IMAN_write_syslog X;
/*!
* \def CALL(x)
*
*/
#define CALL(x) { \
int stat; \
char *err_string; \
if( (stat = (x)) != ITK_ok) \
{ \
EMH_ask_error_text (stat, &err_string); \
LOG_ECHO( ("ERROR: %d ERROR MSG: %s.\n",stat, err_string) ) \
LOG_ECHO( ("Function: %s FILE: %s LINE: %d\n", #x, __FILE__, __LINE__ ) ) \
MEM_free (err_string); \
return (stat); \
} \
}
/*!
* \def DO(x)
*
*/
#define DO(x) { \
int stat; \
char *err_string; \
if( (stat = (x)) != POM_ok) \
{ \
EMH_ask_error_text (stat, &err_string); \
printf ("ERROR: %d ERROR MSG: %s.\n", stat, err_string); \
printf ("Function: %s FILE: %s LINE: %d\n",#x, __FILE__, __LINE__); \
MEM_free (err_string); \
} \
}
/*!
* \def CALLRNULL(x)
*
*/
#define CALLRNULL(x) { \
int stat; \
char *err_string; \
if( (stat = (x)) != ITK_ok) \
{ \
EMH_ask_error_text (stat, &err_string); \
printf ("ERROR: %d ERROR MSG: %s.\n", stat, err_string); \
printf ("Function: %s FILE: %s LINE: %d\n",#x, __FILE__, __LINE__); \
MEM_free (err_string); \
return ((char *)NULL); \
} \
}
/*!
* \def CALL2(x)
*
*/
#define CALL2(x) { \
int stat, n_ifails, *serverities, *ifails, err_count; \
char *err_string, **texts; \
if( (stat = (x)) != ITK_ok) \
{ \
printf ("Function: %s FILE: %s LINE: %d\n",#x, __FILE__, __LINE__); \
EMH_ask_errors( &n_ifails, (const int**)(&serverities), (const int**)(&ifails), (const char***)(&texts) );\
for( err_count=0; err_count<n_ifails; err_count++ ) \
{ \
printf( "ERROR: %d ERROR MSG: %s.\n", ifails[i], texts[i] ); \
} \
MEM_free( serverities ); \
MEM_free( ifails ); \
MEM_free( texts ); \
return (stat); \
} \
} \
#define CHECK_FILE(x,ret) { \
FILE *stream = NULL; \
if( (stream = fopen(x,"rb")) == NULL ) { \
printf( "%s doesn't exists, please check!\n", x ); \
IMAN_write_syslog( "%s doesn't exists, please check!\n", x) ; \
ret = -1; \
} \
else { \
fclose(stream); \
stream = NULL; \
ret = 0; \
} \
} \
#define CHECK_FILE_NOT_EXISTS(x,ret) { \
FILE *stream = NULL; \
if( (stream = fopen(x,"rb")) != NULL ) { \
fclose(stream); \
stream = NULL; \
printf( "%s exists, please check!\n", x ); \
IMAN_write_syslog( "%s exists, please check!\n", x) ; \
ret = -1; \
} \
else { \
ret = 0; \
} \
} \
#endif

@ -0,0 +1 @@
# include "jf3_main.h"

@ -0,0 +1,225 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="Debug|Itanium">
<Configuration>Debug</Configuration>
<Platform>Itanium</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Debug|Win32">
<Configuration>Debug</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Debug|x64">
<Configuration>Debug</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|Itanium">
<Configuration>Release</Configuration>
<Platform>Itanium</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|Win32">
<Configuration>Release</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|x64">
<Configuration>Release</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
</ItemGroup>
<PropertyGroup Label="Globals">
<ProjectGuid>{5B00E072-1EDF-4670-81F0-555DB0C78516}</ProjectGuid>
<Keyword>Win32Proj</Keyword>
<RootNamespace>jf_erp_check_project</RootNamespace>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Itanium'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Itanium'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings">
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Itanium'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Itanium'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<PropertyGroup Label="UserMacros" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<LinkIncremental>true</LinkIncremental>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Itanium'">
<LinkIncremental>true</LinkIncremental>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<LinkIncremental>true</LinkIncremental>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<LinkIncremental>false</LinkIncremental>
<EmbedManifest>false</EmbedManifest>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Itanium'">
<LinkIncremental>false</LinkIncremental>
<EmbedManifest>false</EmbedManifest>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<LinkIncremental>false</LinkIncremental>
<EmbedManifest>false</EmbedManifest>
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<ClCompile>
<PrecompiledHeader>
</PrecompiledHeader>
<WarningLevel>Level3</WarningLevel>
<Optimization>Disabled</Optimization>
<PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;_USRDLL;JF_ERP_CHECK_PROJECT_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
</ClCompile>
<Link>
<SubSystem>Windows</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Itanium'">
<ClCompile>
<PrecompiledHeader>
</PrecompiledHeader>
<WarningLevel>Level3</WarningLevel>
<Optimization>Disabled</Optimization>
<PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;_USRDLL;JF_ERP_CHECK_PROJECT_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
</ClCompile>
<Link>
<SubSystem>Windows</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<ClCompile>
<PrecompiledHeader>
</PrecompiledHeader>
<WarningLevel>Level3</WarningLevel>
<Optimization>Disabled</Optimization>
<PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;_USRDLL;JF_ERP_CHECK_PROJECT_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
</ClCompile>
<Link>
<SubSystem>Windows</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<PrecompiledHeader>
</PrecompiledHeader>
<Optimization>MaxSpeed</Optimization>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<PreprocessorDefinitions>IPLIB=none;WIN32;NDEBUG;_WINDOWS;_USRDLL;JF_ERP_CHECK_PROJECT_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<AdditionalIncludeDirectories>F:\Teamcenter10.1.0Env\OCI\include;F:\Teamcenter10.1.0Env\tcbin\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
</ClCompile>
<Link>
<SubSystem>Windows</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
<AdditionalDependencies>F:\Teamcenter10.1.0Env\tcbin\lib\*.lib;kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies)</AdditionalDependencies>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Itanium'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<PrecompiledHeader>
</PrecompiledHeader>
<Optimization>MaxSpeed</Optimization>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<PreprocessorDefinitions>IPLIB=none;WIN32;NDEBUG;_WINDOWS;_USRDLL;JF_ERP_CHECK_PROJECT_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<AdditionalIncludeDirectories>F:\Teamcenter10.1.0Env\OCI\include;F:\Teamcenter10.1.0Env\tcbin\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
</ClCompile>
<Link>
<SubSystem>Windows</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
<AdditionalDependencies>F:\Teamcenter10.1.0Env\tcbin\lib\*.lib;kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies)</AdditionalDependencies>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<PrecompiledHeader>
</PrecompiledHeader>
<Optimization>MaxSpeed</Optimization>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<PreprocessorDefinitions>IPLIB=none;WIN32;NDEBUG;_WINDOWS;_USRDLL;JF_ERP_CHECK_PROJECT_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<AdditionalIncludeDirectories>F:\Teamcenter10.1.0Env\OCI\include;F:\Teamcenter10.1.0Env\tcbin\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
</ClCompile>
<Link>
<SubSystem>Windows</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
<AdditionalDependencies>F:\Teamcenter10.1.0Env\tcbin\lib\*.lib;kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies)</AdditionalDependencies>
</Link>
</ItemDefinitionGroup>
<ItemGroup>
<ClCompile Include="common_itk_util.c" />
<ClCompile Include="jf3_main.cpp" />
<ClCompile Include="ocilib.cxx" />
<ClCompile Include="string_helper.cpp" />
<ClCompile Include="string_utils.cxx" />
</ItemGroup>
<ItemGroup>
<ClInclude Include="common_itk_util.h" />
<ClInclude Include="error_handling.h" />
<ClInclude Include="jf3_main.h" />
<ClInclude Include="ocilib.h" />
<ClInclude Include="string_helper.h" />
<ClInclude Include="string_utils.h" />
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
</Project>

@ -0,0 +1,57 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
<Filter Include="源文件">
<UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
<Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
</Filter>
<Filter Include="头文件">
<UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
<Extensions>h;hpp;hxx;hm;inl;inc;xsd</Extensions>
</Filter>
<Filter Include="资源文件">
<UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
<Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions>
</Filter>
<Filter Include="common">
<UniqueIdentifier>{65de63f5-1c56-4dd5-8613-cf9edb74ee2c}</UniqueIdentifier>
</Filter>
</ItemGroup>
<ItemGroup>
<ClCompile Include="jf3_main.cpp">
<Filter>源文件</Filter>
</ClCompile>
<ClCompile Include="common_itk_util.c">
<Filter>common</Filter>
</ClCompile>
<ClCompile Include="ocilib.cxx">
<Filter>common</Filter>
</ClCompile>
<ClCompile Include="string_helper.cpp">
<Filter>common</Filter>
</ClCompile>
<ClCompile Include="string_utils.cxx">
<Filter>common</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="jf3_main.h">
<Filter>头文件</Filter>
</ClInclude>
<ClInclude Include="common_itk_util.h">
<Filter>common</Filter>
</ClInclude>
<ClInclude Include="ocilib.h">
<Filter>common</Filter>
</ClInclude>
<ClInclude Include="string_helper.h">
<Filter>common</Filter>
</ClInclude>
<ClInclude Include="string_utils.h">
<Filter>common</Filter>
</ClInclude>
<ClInclude Include="error_handling.h">
<Filter>common</Filter>
</ClInclude>
</ItemGroup>
</Project>

@ -0,0 +1,3 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
</Project>

@ -0,0 +1,440 @@
/*=====================================================================================================================
Copyright(c) 2012 ORIGIN.
Unpublished - All rights reserved
=======================================================================================================================
File description:
Filename: ocilib.cxx
Module : OCI
This file describes OCI library Package.
=======================================================================================================================
Date Name Description of Change
1-Feb-2015 Ray li Initialize creation
$HISTORY$
=====================================================================================================================*/
#include "ocilib.h"
#include <stdlib.h>
#define NUM 100
#define USERNAME "infodba"
#define PASSWORD "infodba"
#define DBNAME "tc"
// 定义句柄结构
typedef struct{
OCIEnv *p_env; //OCI environment handle 环境句柄
OCIError *p_err; //OCI error handle 错误句柄
OCISvcCtx *p_svc; //OCI service context handel 服务上下文句柄
OCIServer *p_ser; //OCI server handle 服务器句柄
OCISession *p_usr; //OCI user session handle 用户会话句柄
OCIStmt *p_sql; //OCI statement handle 语句句柄
OCIDefine *p_dfn; //OCI define handle 定义句柄
OCIBind *p_bnd; //OCI bind handle 绑定句柄
}OCIHandleInfo;
// 定义错误句柄结构
typedef struct{
OCIEnv *p_env;
OCIError *p_err;
OCISvcCtx *p_svc;
OCIStmt *p_sql;
OCIDefine *p_dfn;
OCIBind *p_bnd;
}OCIDATA;
// 定义执行语句时候的输入参数
typedef struct{
char value[NUM][NUM];
char type[NUM][NUM];
}SqlField;
// 定义查询语句时候的输入,输出参数
typedef struct{
int naIntValue[NUM];
int nIntNum;
char caCharValue[500][500];
int nCharNum;
}SqlSelField;
OCIHandleInfo *ociHandle = NULL;
OCIHandleInfo ociHand;
int InitHandle();
int _ExeSQL(char *SQL,char ** inputValue,int inputValueCount);
int _QuerySQL(char *SQL, SqlSelField *pOutField, SqlSelField *pSelField);
int GetDataFromQuery(int *pRc, SqlSelField *pOutField);
void QuitFreeHandle();
/****************************************************************************************************************************************
*****************************************************************************************************************************************/
// 初始化Handler
int InitHandle()
{
int swResult;
ociHandle = &ociHand;
/*create OCI environment*/
if(swResult = OCIEnvCreate(&ociHandle->p_env,OCI_DEFAULT,NULL,NULL,NULL,NULL,0,NULL)) //环境句柄
{
printf("environment create error!\n\n");
return -1;
}
else
{
printf("environment create success!\n\n");
//return 0;
}
/*init handle*/
if(swResult = OCIHandleAlloc(ociHandle->p_env,(dvoid **)&ociHandle->p_ser,OCI_HTYPE_SERVER,0,NULL)) //服务器句柄
{
printf("init server handle error!\n\n");
return -1;
}
if(swResult = OCIHandleAlloc(ociHandle->p_env,(dvoid **)&ociHandle->p_err,OCI_HTYPE_ERROR,0,NULL)) //错误句柄
{
printf("init error handle error!\n\n");
return -1;
}
if(swResult = OCIHandleAlloc(ociHandle->p_env,(dvoid **)&ociHandle->p_usr,OCI_HTYPE_SESSION,0,NULL)) //事务句柄
{
printf("init session handle error!\n\n");
return -1;
}
if(swResult = OCIHandleAlloc(ociHandle->p_env,(dvoid **)&ociHandle->p_svc,OCI_HTYPE_SVCCTX,0,NULL)) //上下文句柄
{
printf("init service context handle error!\n\n");
return -1;
}
if(swResult = OCIHandleAlloc(ociHandle->p_env,(dvoid **)&ociHandle->p_sql,OCI_HTYPE_STMT,0,NULL)) //SQL语句句柄
{
printf("init statement handle error!\n\n");
return -1;
}
printf("init handle success!\n\n");
return 0;
}
// 连接数据库服务器
int ConnServer(char *username,char *password,char *dbname)
{
int swResult;
char errbuf[100]={0};
int errcode;
if(InitHandle() == -1)//初始化句柄
return -1;
if(swResult = OCILogon(ociHandle->p_env,ociHandle->p_err,&ociHandle->p_svc,(text *)username,strlen(username),(text *)password,strlen(password),(text *)dbname,strlen(dbname)))
{
OCIErrorGet((dvoid *)ociHandle->p_err, (ub4) 1, (text *) NULL, &errcode, (ub1 *)errbuf, (ub4) sizeof(errbuf), OCI_HTYPE_ERROR);
printf("Error - %.*s/n", 512, errbuf);
return -1;
}
else
printf("数据库连接成功!\n\n");
return 0;
}
// SQL语句的陈述(执行SQL语句)
int _ExeSQL(char *SQL,char ** inputValue,int inputValueCount)
{
int swResult,i;
int errcode;
//设置绑定变量
OCIBind *p_bndp[100];
//准备SQL语句
if(swResult = OCIStmtPrepare(ociHandle->p_sql,ociHandle->p_err,(text *)SQL,strlen(SQL),OCI_NTV_SYNTAX,OCI_DEFAULT))
{
printf("prepare SQL statements error!\n\n");
}
else
{
printf("prepare SQL statements success!\n\n");
}
// 绑定输入变量
for(i=0;i<inputValueCount;i++)
{
char errbuf[100]={0};
if(swResult = OCIBindByPos(ociHandle->p_sql,&p_bndp[i],ociHandle->p_err,i+1,(dvoid *)inputValue[i],(sb4)strlen(inputValue[i])+1,SQLT_STR, (dvoid *) 0, (ub2 *) 0, (ub2 *) 0, (ub4) 0, (ub4 *) 0, OCI_DEFAULT))
{
OCIErrorGet((dvoid *)ociHandle->p_err, (ub4) 1, (text *) NULL, &errcode, (ub1 *)errbuf, (ub4) sizeof(errbuf), OCI_HTYPE_ERROR);
printf("Bind Error - %.*s/n", 512, errbuf);
return -1;
}
}
//执行SQL statements
if(swResult = OCIStmtExecute(ociHandle->p_svc,ociHandle->p_sql,ociHandle->p_err,1,0,NULL,NULL,OCI_DEFAULT))
{
char errbuf[100]={0};
OCIErrorGet((dvoid *)ociHandle->p_err, (ub4) 1, (text *) NULL, &errcode, (ub1 *)errbuf, (ub4) sizeof(errbuf), OCI_HTYPE_ERROR);
printf("execute SQL statement Error - %.*s\n", 512, errbuf);
return -1;
}
else
{
printf("execute SQL statement success!\n\n");
}
return 0;
}
// 查询SQL
int _QuerySQL(char *SQL, SqlSelField *pOutField, SqlSelField *pSelField )
{
sword status;
int rc= 0,ret=0;
char errbuf[100]={0};
int maxNum = 2048;
char chTag[8];
int iIndex = 0;
int outputColumn = 0;
int errcode=0;
char nullValue = '\0'; //
sb2 sb2aInd[30] = {'\0'};
// 准备SQL语句
status = OCIStmtPrepare(ociHandle->p_sql, ociHandle->p_err, (text *)SQL,(ub4)strlen(SQL), (ub4)OCI_NTV_SYNTAX, (ub4)OCI_DEFAULT);
if (status != OCI_SUCCESS)
{
printf("SQL Preparing failed/n");
return -1;
}
// 绑定int类型的, 定义SQL语句时 :1,:2, 定义输入变量
for (iIndex=0; iIndex<pSelField->nIntNum; iIndex++)
{
memset(chTag, 0, 8);
sprintf(chTag, ":%d", iIndex+1);
if(rc = OCIBindByName(ociHandle->p_sql, (OCIBind **)&ociHandle->p_dfn, ociHandle->p_err, (text *)chTag,(sb4)strlen((char *)chTag),(dvoid *) &pSelField->naIntValue[iIndex], sizeof(int), SQLT_INT,(dvoid *) 0,(ub2 *) 0, (ub2 *) 0, (ub4) 0, (ub4 *) 0, OCI_DEFAULT))
{
OCIErrorGet((dvoid *)ociHandle->p_err, (ub4) 1, (text *) NULL, &errcode, (ub1 *)errbuf, (ub4) sizeof(errbuf), OCI_HTYPE_ERROR);
printf("BindByPos Error of ociHandle->p_sql - %.*s\n", 512, errbuf);
return -1;
}
}
// 绑定char *类型的, 定义SQL语句时 :3,:4, 定义输入变量
for (iIndex=0; iIndex<pSelField->nCharNum; iIndex++)
{
int n=0;
memset(chTag, 0, 8);
n = pSelField->nIntNum + iIndex +1;
sprintf(chTag, ":%d", n);
if(rc = OCIBindByName(ociHandle->p_sql, (OCIBind **)&ociHandle->p_dfn, ociHandle->p_err, (text *)chTag,(sb4)strlen((char *)chTag),(dvoid *) &pSelField->caCharValue[iIndex], NUM, SQLT_STR,(dvoid *) 0,(ub2 *) 0, (ub2 *) 0, (ub4) 0, (ub4 *) 0, OCI_DEFAULT))
{
OCIErrorGet((dvoid *)ociHandle->p_err, (ub4) 1, (text *) NULL, &errcode, (ub1 *)errbuf, (ub4) sizeof(errbuf), OCI_HTYPE_ERROR);
printf("BindByPos Error of ociHandle->p_sql - %.*s\n", 512, errbuf);
return -1;
}
}
// 执行SQL语句
if (rc = OCIStmtExecute(ociHandle->p_svc, ociHandle->p_sql, ociHandle->p_err, (ub4) 0, (ub4) 0,(CONST OCISnapshot *) NULL, (OCISnapshot *) NULL, OCI_STMT_SCROLLABLE_READONLY))
{
OCIErrorGet((dvoid *)ociHandle->p_err, (ub4) 1, (text *) NULL, &errcode, (ub1 *)errbuf, (ub4) sizeof(errbuf), OCI_HTYPE_ERROR);
printf("execute SQL Error - %.*s\n", 512, errbuf);
return -1;
}
else
{
printf("execute SQL success!\n\n");
}
if (ret = OCIAttrGet (ociHandle->p_sql, (ub4)OCI_HTYPE_STMT, (dvoid *) &outputColumn, (ub4 *) 0, (ub4)OCI_ATTR_PARAM_COUNT, ociHandle->p_err))
{
OCIErrorGet((dvoid *)ociHandle->p_err, (ub4) 1, (text *) NULL, &errcode, (ub1 *)errbuf, (ub4) sizeof(errbuf), OCI_HTYPE_ERROR);
printf("Get OCIAttr Error of ociHandle->p_sql - %.*s\n", 512, errbuf);
return -1;
}
// 绑定int类型的, 定义SQL语句时 :1,:2, 定义输出变量
for (iIndex=0; iIndex<pOutField->nIntNum; iIndex++)
{
if(rc = OCIDefineByPos(ociHandle->p_sql, &ociHandle->p_dfn, ociHandle->p_err, iIndex+1, (dvoid *)&pOutField->naIntValue[iIndex], sizeof(int), SQLT_INT, (dvoid *) 0, (ub2 *)0,(ub2 *)0, OCI_DEFAULT))
{
OCIErrorGet((dvoid *)ociHandle->p_err, (ub4) 1, (text *) NULL, &errcode, (ub1 *)errbuf, (ub4) sizeof(errbuf), OCI_HTYPE_ERROR);
printf("DefineByPos Error of ociHandle->p_sql - %.*s\n", 512, errbuf);
return -1;
}
}
// 绑定char *类型的, 定义SQL语句时 :1,:2, 定义输出变量
for (iIndex=0; iIndex<outputColumn; iIndex++)
{
int n = iIndex+1 ;
if (rc = OCIDefineByPos(ociHandle->p_sql, &ociHandle->p_dfn, ociHandle->p_err, n, (dvoid *)&pOutField->caCharValue[iIndex], 1000*sizeof(char), SQLT_STR, (dvoid *) 0, (ub2 *)0,(ub2 *)0, OCI_DEFAULT))
{
OCIErrorGet((dvoid *)ociHandle->p_err, (ub4) 1, (text *) NULL, &errcode, (ub1 *)errbuf, (ub4) sizeof(errbuf), OCI_HTYPE_ERROR);
printf("DefineByPos Error of ociHandle->p_sql - %.*s\n", 512, errbuf);
return -1;
}
}
return 0;
}
// 释放Handler
void QuitFreeHandle()
{
// 退出服务器
OCILogoff(ociHandle->p_svc,ociHandle->p_err);
printf("Quit success!\n");
// 释放句柄
OCIHandleFree(ociHandle->p_ser,OCI_HTYPE_SERVER); //释放服务器句柄
OCIHandleFree(ociHandle->p_err,OCI_HTYPE_ERROR); //释放错误句柄
OCIHandleFree(ociHandle->p_usr,OCI_HTYPE_SESSION); //释放事务句柄
OCIHandleFree(ociHandle->p_svc,OCI_HTYPE_SVCCTX); //释放上下文句柄
OCIHandleFree(ociHandle->p_sql,OCI_HTYPE_STMT); //释放SQL语句句柄
}
// 执行类操作
int ExecuteSQL(char *SQL,int valueCount,char **value)
{
int i=0;
if(i=_ExeSQL(SQL,value,valueCount))
{
QuitFreeHandle();
return -1;
}
return 0;
}
// 有输入参数的查询
int QuerySQL(char *SQL, int inputValueCount, char ** inputValue, int * outputColumn, int * outputValueCount, char **** outputValue)
{
int i = 0, j=0 ,ret =0;
int times = 0, temp=0;
SqlSelField infield;
SqlSelField outField;
// 初始化参数结构
infield.nCharNum = inputValueCount;
infield.nIntNum = 0;
outField.nCharNum = 0;
outField.nIntNum = 0;
* outputColumn = 0;
* outputValueCount = 0;
for(i=0;i<inputValueCount;i++)
{
strcpy(infield.caCharValue[i],inputValue[i]);
}
// 执行查询语句
if (ret = _QuerySQL(SQL,&outField,&infield))
{
printf("SQL查询失败!\n");
QuitFreeHandle();
return -1;
}
// 获取结果列数
ret= OCIAttrGet (ociHandle->p_sql, (ub4)OCI_HTYPE_STMT, (dvoid *) outputColumn, (ub4 *) 0, (ub4)OCI_ATTR_PARAM_COUNT, ociHandle->p_err);
// 提取最后一行,便于去行数
ret = OCIStmtFetch2(ociHandle->p_sql, ociHandle->p_err,1, OCI_FETCH_LAST,0, OCI_DEFAULT);
// 获取结果行数
ret= OCIAttrGet (ociHandle->p_sql, (ub4)OCI_HTYPE_STMT, (dvoid *) outputValueCount, (ub4 *) 0, (ub4)OCI_ATTR_ROW_COUNT, ociHandle->p_err);
if(*outputValueCount == 0)
return 0;
// 开始分配内存并且存储
ret = OCIStmtFetch2(ociHandle->p_sql, ociHandle->p_err,1, OCI_FETCH_FIRST,0, OCI_DEFAULT);
*outputValue = (char ***) calloc ((*outputValueCount)+1,sizeof(char**));
do
{
(*outputValue)[i] = (char **) calloc ((*outputColumn)+1,sizeof(char *));
for(j=0;j<(*outputColumn);j++)
{
(*outputValue)[i][j] = (char *) calloc (1000,sizeof(char));
strcpy((*outputValue)[i][j],outField.caCharValue[j]);
//printf("outValue[%d][%d] = %s , 地址=%d, 所指向地址= %d\n ",i,j,(*outputValue)[i][j],&(*outputValue)[i][j],(*outputValue)[i][j]);
}
i++;
}
while((ret = OCIStmtFetch2(ociHandle->p_sql, ociHandle->p_err,1, OCI_FETCH_NEXT, 1, OCI_DEFAULT)!= OCI_NO_DATA));
return 0;
}
// 无输入参数的查询
int QuerySQLNoInputParam(char *SQL, int * outputColumn, int * outputValueCount, char **** outputValue)
{
return QuerySQL(SQL,0,NULL,outputColumn,outputValueCount,outputValue);
}
// 无参数操作
int ExecuteSQLNoInputParam(char *SQL)
{
return ExecuteSQL(SQL,0,NULL);
}
// 断开连接
void DisConnServer()
{
if(ociHandle != NULL)
QuitFreeHandle();
}

@ -0,0 +1,98 @@
/*=====================================================================================================================
Copyright(c) 2012 ORIGIN.
Unpublished - All rights reserved
=======================================================================================================================
File description:
Filename: ocilib.h
Module : OCI
This Header file of OCI library Package.
=======================================================================================================================
Date Name Description of Change
1-Feb-2015 Ray Initialize creation
$HISTORY$
=====================================================================================================================*/
#include <oci.h>
#include <stdio.h>
#include <memory.h>
#include <string.h>
#include <malloc.h>
//#include <limits.h>
#define OCI_FAIL 1
#define OCI_OK 0
#ifdef __cplusplus
extern "C"
{
#endif
/**
* .
* @param username - <I>
* @param password - <I>
* @param dbname - <I> SID
* @return - OCI_OK or error code
*
* ORACLE
*/
extern int ConnServer(char *username,char *password,char *dbname);
/**
* SQL.
* @param SQL - <I> SQL
* @return - OCI_OK or error code
*
* ORACLE
*/
extern int ExecuteSQLNoInputParam(char *SQL);
/**
* SQL.
* @param SQL - <I> SQL
* @param inputValueCount - <I>
* @param inputValue - <I>
* @return - OCI_OK or error code
*
* ORACLE
*/
extern int ExecuteSQL(char *SQL,int inputValueCount,char **inputValue);
/**
* SQL.
* @param SQL - <I> SQL
* @param outputColumn - <O>
* @param outputValueCount - <O>
* @param outputValue - <O>
* @return - OCI_OK or error code
*
* ORACLE
*/
extern int QuerySQLNoInputParam(char *SQL, int * outputColumn, int * outputValueCount, char **** outputValue);
/**
* SQL.
* @param SQL - <I> SQL
* @param inputValueCount - <I>
* @param inputValue - <I>
* @param outputColumn - <O>
* @param outputValueCount - <O>
* @param outputValue - <O>
* @return - OCI_OK or error code
*
* ORACLE
*/
extern int QuerySQL(char *SQL, int inputValueCount, char ** inputValue, int * outputColumn, int * outputValueCount, char **** outputValue);
/**
* .
*
* ORACLE
*/
extern void DisConnServer();
#ifdef __cplusplus
}
#endif

@ -0,0 +1,146 @@
/**
* @file string_helper.cpp
* @brief string utility functions' implemention
* @author James
* @history
* ===================================================================================
* Date Name Description of Change
* 09-July-2008 James
* 14-Jau-2009 James modify Split functions, add trim blank characters
*/
#pragma warning(disable:4996)
//
//#include <stdio.h>
//#include <iostream>
//#include <windows.h>
#include "string_helper.h"
string TrimString( string strArg )
{
size_t index1 = 0;
index1 = strArg.find_first_not_of( ' ');
if( index1 != string::npos )
strArg.erase( strArg.begin(), strArg.begin()+index1 );
index1 = strArg.find_last_not_of( ' ');
if( index1 != string::npos )
strArg.erase( strArg.begin() + index1 + 1 );
return strArg;
}
void Split( string strArg, char spliter, vector<string> &ans )
{
ans.clear();
size_t index0 = 0;
string one_arg;
if ( strArg.find_first_not_of(' ') == string::npos )
strArg = "";
while( strArg.size()>0 )
{
index0 = strArg.find_first_of( spliter );
if( index0 != string::npos )
{
one_arg = strArg.substr( 0,index0 );
strArg = strArg.substr( index0 + 1 );
ans.push_back( one_arg );
}
else
{
ans.push_back( strArg );
break;
}
}
}
void Split( string strArg, string spliter, vector<string> &ans )
{
ans.clear();
size_t index0;
string one_arg;
if ( strArg.find_first_not_of(" ") == string::npos )
strArg = "";
while( strArg.size()>0 )
{
index0 = strArg.find(spliter);
if( index0 != string::npos )
{
one_arg = strArg.substr( 0, index0 );
strArg = strArg.substr( index0 + spliter.size() );
ans.push_back( one_arg );
}
else
{
ans.push_back( strArg );
break;
}
}
}
void RemoveLiner( string &in, string &out )
{
char buf[BUFSIZ] = "";
for( int i=0; i<(int)in.size(); i++ )
{
if( in[i] == '\n')
continue;
else
sprintf( buf,"%s%c", buf, in[i] );
}
out.assign(buf);
}
////Converting a WChar string to a Ansi string
//std::string WChar2Ansi(LPCWSTR pwszSrc)
//{
// int nLen = WideCharToMultiByte(CP_ACP, 0, pwszSrc, -1, NULL, 0, NULL, NULL);
//
// if (nLen<= 0) return std::string("");
//
// char* pszDst = new char[nLen];
// if (NULL == pszDst) return std::string("");
//
// WideCharToMultiByte(CP_ACP, 0, pwszSrc, -1, pszDst, nLen, NULL, NULL);
// pszDst[nLen -1] = 0;
//
// std::string strTemp(pszDst);
// delete [] pszDst;
//
// return strTemp;
//}
//
//string ws2s(wstring& inputws){ return WChar2Ansi(inputws.c_str()); }
//
////Converting a Ansi string to WChar string
//std::wstring Ansi2WChar(LPCSTR pszSrc, int nLen)
//{
// int nSize = MultiByteToWideChar(CP_ACP, 0, (LPCSTR)pszSrc, nLen, 0, 0);
// if(nSize <= 0) return NULL;
//
// WCHAR *pwszDst = new WCHAR[nSize+1];
// if( NULL == pwszDst) return NULL;
//
// MultiByteToWideChar(CP_ACP, 0,(LPCSTR)pszSrc, nLen, pwszDst, nSize);
// pwszDst[nSize] = 0;
//
// if( pwszDst[0] == 0xFEFF) // skip Oxfeff
// for(int i = 0; i < nSize; i ++)
// pwszDst[i] = pwszDst[i+1];
//
// wstring wcharString(pwszDst);
// delete pwszDst;
//
// return wcharString;
//}
//
//std::wstring s2ws(const string& s){ return Ansi2WChar(s.c_str(),s.size());}

@ -0,0 +1,25 @@
/**
* @file string_helper.h
* @brief string utilities to help dealing with string
* @author James
* @history
* ===================================================================================
* Date Name Description of Change
* 09-July-2008 James
*/
#ifndef STRING_HELPER
#define STRING_HELPER
#include <string>
#include <vector>
using namespace std;
string TrimString( string strArg );
void Split( string strArg, char spliter, vector<string> &ans );
void Split( string strArg, string spliter, vector<string> &ans );
void RemoveLiner( string &in, string &out );
//string ws2s(wstring& inputws);
//wstring s2ws(const string& s);
#endif

@ -0,0 +1,253 @@
/*==================================================================================================================
Copyright(c) 2012 ORIGIN.
Unpublished - All rights reserved
====================================================================================================================
File description:
Filename: string_utils.c
Module : Common module.
This file includes some operations of the string.
====================================================================================================================
Date Name Description of Change
3-Feb-2015 Ray li Initialize creation
$HISTORY$
===================================================================================================================*/
#ifndef _cplusplus
#ifndef _CRT_SECURE_NO_DEPRECATE
#define _CRT_SECURE_NO_DEPRECATE
#endif
#endif
#include <fclasses/tc_string.h>
#include <tc/tc_util.h>
#include <itk/mem.h>
#include <tccore/workspaceobject.h>
#include <stdlib.h>
#include <ctype.h>
#include "string_utils.h"
//void Split( string strArg, string spliter, vector<string> &ans )
//{
// ans.clear();
// size_t index0;
// string one_arg;
// if ( strArg.find_first_not_of(' ') == string::npos )
// strArg = "";
// while( strArg.size()>0 )
// {
// index0 = strArg.find(spliter);
// if( index0 != string::npos )
// {
// one_arg = strArg.substr( 0, index0 );
// strArg = strArg.substr( index0 + spliter.size() );
// ans.push_back( one_arg );
// }
// else
// {
// ans.push_back( strArg );
// break;
// }
// }
//}
char* GSTR_clone( char **dst, const char *src )
{
char *retVal = NULL;
int srcLen = 0;
*dst = NULL;
if (src == NULL)
return NULL;
srcLen = (int)tc_strlen( src ) + 1;
*dst = (char*)MEM_alloc( srcLen * sizeof(char) );
retVal = tc_strncpy( *dst, src, srcLen );
(*dst)[srcLen - 1] = '\0';
return retVal;
}
char* GSTR_copy( char *dst, const char *src, int dstSize )
{
char *retVal = tc_strncpy( dst, src, dstSize );
dst[dstSize - 1] = '\0';
return retVal;
}
char* GSTR_int_to_string( char **dst, int value )
{
char strVal[128 + 1];
*dst = NULL;
memset( strVal, 0, sizeof(strVal)/sizeof(char) );
sprintf( strVal, "%d", value );
return GSTR_clone( dst, strVal );
}
void GSTR_format_int_to_string( char *dst, int digitNum, int value )
{
char sNum[WSO_desc_size_c + 1];
sprintf( sNum, "%%0%dd", digitNum );
sprintf( dst, sNum, value );
}
void GSTR_format_string( const char *dst, int m, const char *fill_char, char **out )
{
char sNum[WSO_name_size_c + 1] = {0};
char sNew[WSO_name_size_c + 1] = {0};
sprintf( sNum, "%%%d.%ds", m, m );
sprintf( sNew, sNum, dst );
STRNG_replace_str( sNew, " ", fill_char, out );
}
char* GSTR_string_append( const char *s1, const char *s2 )
{
char *s = NULL;
if (s1 == NULL || s2 == NULL)
{
GSTR_clone(&s, s1 == NULL ? (s2 == NULL ? "" : s2) : s1 );
}
else
{
int size = (int)tc_strlen(s1) + (int)tc_strlen(s2) + 1;
s = (char *)MEM_alloc( size );
tc_strcpy( s, s1 );
tc_strcat( s, s2 );
s[size - 1] = '\0';
}
return s;
}
logical GSTR_is_float(const char *str)
{
logical isfloat = true;
char *pStr = (char *)str;
logical hasPositive = false;
logical hasMinus = false;
logical hasDot = false;
if (str == NULL)
return false;
while (*pStr != '\0' && isfloat == true)
{
if ( (*pStr >= '0' && *pStr <= '9'))
{
//continue;
}
else if ( *pStr == '+' )
{
isfloat = (hasPositive ? false : (hasPositive = true));
}
else if ( *pStr == '-' )
{
isfloat = (hasMinus ? false : (hasMinus = true));
}
else if ( *pStr == '.' )
{
isfloat = (hasDot ? false : (hasDot = true));
}
else
isfloat = false;
pStr ++;
}
return isfloat;
}
logical GSTR_is_number(const char *str)
{
logical is_number = true;
char *pStr = (char *)str;
if (str == NULL)
return false;
while (*pStr != '\0')
{
if ( !( (*pStr >= '0' && *pStr <= '9') || *pStr == '-' ) )
{
is_number = false;
break;
}
pStr ++;
}
return is_number;
}
logical GSTR_is_ascii(char ch)
{
return ((unsigned int)ch) < 128;
}
int GSTR_trim_l( char *str, char s )
{
int count = 0;
char *pointer = str, *poffset = NULL;
if (str == NULL || str[0] == '\0')
return 0;
while ( *pointer != '\0' )
{
if ( *pointer != s )
{
break;
}
count++;
pointer++;
}
if (count == 0)
return 0;
poffset = str + count;
pointer = str;
while ( *poffset != '\0' )
{
*pointer = *poffset;
pointer ++;
poffset ++;
}
*pointer = '\0';
return count;
}
int GSTR_trim_r( char *str, char s )
{
int count = 0;
char *pointer = NULL;
if (str == NULL || str[0] == '\0')
return 0;
pointer = str + ((int) strlen(str) - 1);
while ( pointer != str )
{
if ( *pointer != s )
{
break;
}
*pointer = '\0';
count++;
pointer--;
}
return count;
}
void GSTR_trim_float( char *floatValue )
{
if ( !IS_EMPTY(floatValue) && tc_strstr(floatValue, ".") != NULL )
{
int len = 0;
GSTR_trim_r(floatValue, '0');
len = (int)tc_strlen(floatValue);
if (floatValue[ len - 1 ] == '.')
floatValue[ len - 1 ] = '\0';
}
}

@ -0,0 +1,125 @@
/*=====================================================================================================================
Copyright(c) 2005 ORIGIN PLM Software Corp. All rights reserved.
Unpublished - All rights reserved
=======================================================================================================================
File description:
Filename: string_utils.h
Module : Common module.
This file includes some operations of the string.
=======================================================================================================================
Date Name Description of Change
14-Jul-2009 Ray Li Initialize creation
$HISTORY$
=====================================================================================================================*/
#ifndef STRING_UTILS_H
#define STRING_UTILS_H
#include <string>
#include <map>
#include <vector>
using namespace std;
#ifdef __cplusplus
extern "C"
{
#endif
// @{{ String assister
#define IS_NULL(S) ((S)==NULL)
#define IS_EMPTY(S) (((S)==NULL) || !(*(S)))
// @}}
void Split( string strArg, string spliter, vector<string> &ans );
/**
* Clones the string.
* @param dst - <OF> the output string.
* @param src - <I> the string to be cloned.
* @return - the destinatin string pointer.
*/
extern char* GSTR_clone( char **dst, const char *src );
/**
* Copy safely the string with null end.
* @param dst - <O> the output string.
* @param src - <I> the string to be cloned.
* @param dstSize - <I> the size of output string.
* @return - the destinatin string pointer.
*/
extern char *GSTR_copy( char *dst, const char *src, int dstSize );
/**
* Converts int to string.
* @param dst - <OF> the output string.
* @param value - <I> the int to be cloned.
* @return - the destinatin string pointer.
*/
extern char* GSTR_int_to_string( char **dst, int value );
/**
* Formats the int/string value as string.
* @param dst - <O> the destination string.
* @param digitNum - <I> the digit number of the value.
* @param value - <I> the value to be converted.
* @return - N/A.
*/
extern void GSTR_format_int_to_string( char *dst, int digitNum, int value );
extern void GSTR_format_string( const char *dst, int m, const char *fill_char, char **out );
/**
* Appends the strings( never null returned )
* @param s1 - <I> string 1
* @param s2 - <I> string 2
* @return - <OF> new string
*/
extern char* GSTR_string_append( const char *s1, const char *s2 );
/**
* Whether the string is float type
* @param str - <I> The string
*
* NOTE: it's only check whether each word is in "+-.0123456789", not care the float with "E" or the float rule,
* like "00-1.+01", it will return true.
* @return - return true if it is one.
*/
extern logical GSTR_is_float(const char *str);
/**
* Whether all char of the string are number
* @param str - <I> The string
*
* NOTE: it's only check whether each word is in "0123456789"
* @return - return true if it is one.
*/
extern logical GSTR_is_number(const char *str);
/**
* Is ascii char
* @param ch - <I> ascii char
* @return - return true if it is.
*/
extern logical GSTR_is_ascii(char ch);
/**
* Trims the string's prefix.
* @param str - <I> The string
* @param s - <I> The char
*
* @return - count.
*/
extern int GSTR_trim_l( char *str, char s );
extern int GSTR_trim_r( char *str, char s );
/**
* Remove the zero.
* For Example:
* floatValue="50.00" -> = "50"
* floatValue="50.0100" -> = "50.01"
* @return - count.
*/
extern void GSTR_trim_float( char *floatValue );
#ifdef __cplusplus
}
#endif
#endif //STRING_UTILS_H

@ -0,0 +1,10 @@
<?xml version='1.0' encoding='UTF-8' standalone='yes'?>
<assembly xmlns='urn:schemas-microsoft-com:asm.v1' manifestVersion='1.0'>
<trustInfo xmlns="urn:schemas-microsoft-com:asm.v3">
<security>
<requestedPrivileges>
<requestedExecutionLevel level='asInvoker' uiAccess='false' />
</requestedPrivileges>
</security>
</trustInfo>
</assembly>

@ -0,0 +1,2 @@
#v4.0:v100
Release|x64|F:\Connor项目管理\继峰项目\签名\jf_itk\|

@ -0,0 +1,46 @@
生成启动时间为 2015/9/17 17:59:45。
1>项目“F:\Connor项目管理\继峰项目\签名\jf_itk\jf_erp_check_project\jf_erp_check_project.vcxproj”在节点 2 上(build 个目标)。
1>InitializeBuildStatus:
正在创建“x64\Release\jf_erp_check_project.unsuccessfulbuild”因为已指定“AlwaysCreate”。
ClCompile:
C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\bin\x86_amd64\CL.exe /c /IF:\Teamcenter10.1.0Env\OCI\include /IF:\Teamcenter10.1.0Env\tcbin\include /Zi /nologo /W3 /WX- /O2 /Oi /GL /D IPLIB=none /D WIN32 /D NDEBUG /D _WINDOWS /D _USRDLL /D JF_ERP_CHECK_PROJECT_EXPORTS /D _WINDLL /D _UNICODE /D UNICODE /Gm- /EHsc /MD /GS /Gy /fp:precise /Zc:wchar_t /Zc:forScope /Fo"x64\Release\\" /Fd"x64\Release\vc100.pdb" /Gd /TC /errorReport:prompt common_itk_util.c
common_itk_util.c
1>F:\Teamcenter10.1.0Env\tcbin\include\tc/emh_const.h(61): warning C4995: “TC_include_tc_emh_const_h_deprecated”: 名称被标记为 #pragma deprecated
1>common_itk_util.c(91): warning C4013: “AM__set_application_bypass”未定义假设外部返回 int
C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\bin\x86_amd64\CL.exe /c /IF:\Teamcenter10.1.0Env\OCI\include /IF:\Teamcenter10.1.0Env\tcbin\include /Zi /nologo /W3 /WX- /O2 /Oi /GL /D IPLIB=none /D WIN32 /D NDEBUG /D _WINDOWS /D _USRDLL /D JF_ERP_CHECK_PROJECT_EXPORTS /D _WINDLL /D _UNICODE /D UNICODE /Gm- /EHsc /MD /GS /Gy /fp:precise /Zc:wchar_t /Zc:forScope /Fo"x64\Release\\" /Fd"x64\Release\vc100.pdb" /Gd /TP /errorReport:prompt jf3_main.cpp ocilib.cxx string_helper.cpp string_utils.cxx
jf3_main.cpp
ocilib.cxx
1>ocilib.cxx(158): warning C4267: “参数”: 从“size_t”转换到“ub4”可能丢失数据
1>ocilib.cxx(158): warning C4267: “参数”: 从“size_t”转换到“ub4”可能丢失数据
1>ocilib.cxx(158): warning C4267: “参数”: 从“size_t”转换到“ub4”可能丢失数据
1>ocilib.cxx(181): warning C4267: “参数”: 从“size_t”转换到“ub4”可能丢失数据
1>ocilib.cxx(249): warning C4996: 'sprintf': This function or variable may be unsafe. Consider using sprintf_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details.
C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\stdio.h(371) : 参见“sprintf”的声明
1>ocilib.cxx(264): warning C4996: 'sprintf': This function or variable may be unsafe. Consider using sprintf_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details.
C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\stdio.h(371) : 参见“sprintf”的声明
1>ocilib.cxx(377): warning C4996: 'strcpy': This function or variable may be unsafe. Consider using strcpy_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details.
C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\string.h(105) : 参见“strcpy”的声明
1>ocilib.cxx(411): warning C4996: 'strcpy': This function or variable may be unsafe. Consider using strcpy_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details.
C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\string.h(105) : 参见“strcpy”的声明
string_helper.cpp
string_utils.cxx
1>F:\Teamcenter10.1.0Env\tcbin\include\pom/pom/pom_errors.h : warning C4819: 该文件包含不能在当前代码页(936)中表示的字符。请将该文件保存为 Unicode 格式以防止数据丢失
Link:
C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\bin\x86_amd64\link.exe /ERRORREPORT:PROMPT /OUT:"F:\Connor项目管理\继峰项目\签名\jf_itk\x64\Release\jf_erp_check_project.dll" /INCREMENTAL:NO /NOLOGO "F:\Teamcenter10.1.0Env\tcbin\lib\*.lib" kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /MANIFEST /ManifestFile:"x64\Release\jf_erp_check_project.dll.intermediate.manifest" /MANIFESTUAC:"level='asInvoker' uiAccess='false'" /DEBUG /PDB:"F:\Connor项目管理\继峰项目\签名\jf_itk\x64\Release\jf_erp_check_project.pdb" /SUBSYSTEM:WINDOWS /OPT:REF /OPT:ICF /LTCG /TLBID:1 /DYNAMICBASE /NXCOMPAT /IMPLIB:"F:\Connor项目管理\继峰项目\签名\jf_itk\x64\Release\jf_erp_check_project.lib" /MACHINE:X64 /DLL x64\Release\common_itk_util.obj
x64\Release\jf3_main.obj
x64\Release\ocilib.obj
x64\Release\string_helper.obj
x64\Release\string_utils.obj
正在生成代码
已完成代码的生成
jf_erp_check_project.vcxproj -> F:\Connor项目管理\继峰项目\签名\jf_itk\x64\Release\jf_erp_check_project.dll
Manifest:
C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\bin\mt.exe /nologo /verbose /out:"F:\Connor项目管理\继峰项目\签名\jf_itk\x64\Release\jf_erp_check_project.dll.manifest" /manifest x64\Release\jf_erp_check_project.dll.intermediate.manifest
FinalizeBuildStatus:
正在删除文件“x64\Release\jf_erp_check_project.unsuccessfulbuild”。
正在对“x64\Release\jf_erp_check_project.lastbuildstate”执行 Touch 任务。
1>已完成生成项目“F:\Connor项目管理\继峰项目\签名\jf_itk\jf_erp_check_project\jf_erp_check_project.vcxproj”(build 个目标)的操作。
生成成功。
已用时间 00:00:02.88

@ -0,0 +1,2 @@
#v4.0:v100
Release|Win32|F:\Connor项目管理\继峰项目\签名\jf_itk\|

@ -0,0 +1,59 @@
生成启动时间为 2015/9/17 17:55:52。
1>项目“F:\Connor项目管理\继峰项目\签名\jf_itk\jf_erp_project\jf_erp_project.vcxproj”在节点 2 上(build 个目标)。
1>InitializeBuildStatus:
正在对“Release\jf_erp_project.unsuccessfulbuild”执行 Touch 任务。
ClCompile:
C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\bin\CL.exe /c /IF:\Teamcenter10.1.0Env\OCI\include /IF:\Teamcenter10.1.0Env\tcbin\include /Zi /nologo /W3 /WX- /O2 /Oi /Oy- /GL /D IPLIB=none /D WIN32 /D NDEBUG /D _CONSOLE /D _UNICODE /D UNICODE /Gm- /EHsc /MD /GS /Gy /fp:precise /Zc:wchar_t /Zc:forScope /Fo"Release\\" /Fd"Release\vc100.pdb" /Gd /TC /analyze- /errorReport:prompt common_itk_util.c
common_itk_util.c
1>F:\Teamcenter10.1.0Env\tcbin\include\tc/emh_const.h(61): warning C4995: “TC_include_tc_emh_const_h_deprecated”: 名称被标记为 #pragma deprecated
1>common_itk_util.c(91): warning C4013: “AM__set_application_bypass”未定义假设外部返回 int
C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\bin\CL.exe /c /IF:\Teamcenter10.1.0Env\OCI\include /IF:\Teamcenter10.1.0Env\tcbin\include /Zi /nologo /W3 /WX- /O2 /Oi /Oy- /GL /D IPLIB=none /D WIN32 /D NDEBUG /D _CONSOLE /D _UNICODE /D UNICODE /Gm- /EHsc /MD /GS /Gy /fp:precise /Zc:wchar_t /Zc:forScope /Fo"Release\\" /Fd"Release\vc100.pdb" /Gd /TP /analyze- /errorReport:prompt ocilib.cxx string_helper.cpp string_utils.cxx
ocilib.cxx
1>ocilib.cxx(249): warning C4996: 'sprintf': This function or variable may be unsafe. Consider using sprintf_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details.
C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\stdio.h(371) : 参见“sprintf”的声明
1>ocilib.cxx(264): warning C4996: 'sprintf': This function or variable may be unsafe. Consider using sprintf_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details.
C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\stdio.h(371) : 参见“sprintf”的声明
1>ocilib.cxx(377): warning C4996: 'strcpy': This function or variable may be unsafe. Consider using strcpy_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details.
C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\string.h(105) : 参见“strcpy”的声明
1>ocilib.cxx(411): warning C4996: 'strcpy': This function or variable may be unsafe. Consider using strcpy_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details.
C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\string.h(105) : 参见“strcpy”的声明
string_helper.cpp
string_utils.cxx
1>F:\Teamcenter10.1.0Env\tcbin\include\pom/pom/pom_errors.h : warning C4819: 该文件包含不能在当前代码页(936)中表示的字符。请将该文件保存为 Unicode 格式以防止数据丢失
Link:
C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\bin\link.exe /ERRORREPORT:PROMPT /OUT:"F:\Connor项目管理\继峰项目\签名\jf_itk\Release\jf_erp_project.exe" /INCREMENTAL:NO /NOLOGO "F:\Teamcenter10.1.0Env\tcbin\lib\*.lib" kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /MANIFEST /ManifestFile:"Release\jf_erp_project.exe.intermediate.manifest" /MANIFESTUAC:"level='asInvoker' uiAccess='false'" /DEBUG /PDB:"F:\Connor项目管理\继峰项目\签名\jf_itk\Release\jf_erp_project.pdb" /SUBSYSTEM:CONSOLE /OPT:REF /OPT:ICF /LTCG /TLBID:1 /DYNAMICBASE /NXCOMPAT /IMPLIB:"F:\Connor项目管理\继峰项目\签名\jf_itk\Release\jf_erp_project.lib" /MACHINE:X86 Release\common_itk_util.obj
Release\ocilib.obj
Release\string_helper.obj
Release\string_utils.obj
1>common_itk_util.obj : error LNK2001: 无法解析的外部符号 __imp__MEM_alloc
1>common_itk_util.obj : error LNK2001: 无法解析的外部符号 __imp__MEM_free
1>common_itk_util.obj : error LNK2001: 无法解析的外部符号 __imp__TC_write_syslog
1>common_itk_util.obj : error LNK2001: 无法解析的外部符号 __imp__POM_ask_session
1>common_itk_util.obj : error LNK2001: 无法解析的外部符号 __imp__ITK__convert_tag_to_uid
1>common_itk_util.obj : error LNK2001: 无法解析的外部符号 _AM__set_application_bypass
1>ocilib.obj : error LNK2001: 无法解析的外部符号 _OCIStmtPrepare
1>ocilib.obj : error LNK2001: 无法解析的外部符号 _OCILogon
1>ocilib.obj : error LNK2001: 无法解析的外部符号 _OCIHandleFree
1>ocilib.obj : error LNK2001: 无法解析的外部符号 _OCIBindByPos
1>ocilib.obj : error LNK2001: 无法解析的外部符号 _OCIEnvCreate
1>ocilib.obj : error LNK2001: 无法解析的外部符号 _OCIBindByName
1>ocilib.obj : error LNK2001: 无法解析的外部符号 _OCIErrorGet
1>ocilib.obj : error LNK2001: 无法解析的外部符号 _OCILogoff
1>ocilib.obj : error LNK2001: 无法解析的外部符号 _OCIDefineByPos
1>ocilib.obj : error LNK2001: 无法解析的外部符号 _OCIHandleAlloc
1>ocilib.obj : error LNK2001: 无法解析的外部符号 _OCIAttrGet
1>ocilib.obj : error LNK2001: 无法解析的外部符号 _OCIStmtFetch2
1>ocilib.obj : error LNK2001: 无法解析的外部符号 _OCIStmtExecute
1>string_utils.obj : error LNK2001: 无法解析的外部符号 __imp__tc_strncpy
1>string_utils.obj : error LNK2001: 无法解析的外部符号 __imp__tc_strcat
1>string_utils.obj : error LNK2001: 无法解析的外部符号 __imp__STRNG_replace_str
1>string_utils.obj : error LNK2001: 无法解析的外部符号 __imp__tc_strstr
1>string_utils.obj : error LNK2001: 无法解析的外部符号 __imp__tc_strcpy
1>string_utils.obj : error LNK2001: 无法解析的外部符号 __imp__tc_strlen
1>MSVCRT.lib(crtexe.obj) : error LNK2001: 无法解析的外部符号 _main
1>F:\Connor项目管理\继峰项目\签名\jf_itk\Release\jf_erp_project.exe : fatal error LNK1120: 26 个无法解析的外部命令
1>已完成生成项目“F:\Connor项目管理\继峰项目\签名\jf_itk\jf_erp_project\jf_erp_project.vcxproj”(build 个目标)的操作 - 失败。
生成失败。
已用时间 00:00:02.69

Binary file not shown.

Binary file not shown.

@ -0,0 +1,291 @@
/**
* @file common_itk_util.cpp
* @brief itk warpper utility function
* @author James
* @history
* ===================================================================================
* Date Name Description of Change
* 18-July-2008 James
*
*/
#pragma warning (disable: 4996)
#pragma warning (disable: 4819)
#include <epm/epm.h>
#include <epm/epm_toolkit_tc_utils.h>
#include <ict/ict_userservice.h>
#include <tccore/item.h>
#include <ae/ae.h>
#include <tc/folder.h>
#include <tccore/aom.h>
#include <sa/sa.h>
#include <tccore/aom_prop.h>
#include <property/prop_errors.h>
#include <tccore/workspaceobject.h>
#include <tc/preferences.h>
#include <tccore/imantype.h>
#include <tccore//grm.h>
#include <tccore/grmtype.h>
#include <sa/am.h>
#include <cfm/cfm.h>
#include <bom/bom.h>
#include <tccore/uom.h>
#include <ps/ps.h>
#include <epm/signoff.h>
#include <fclasses/tc_date.h>
//#include <tccore/imantype.h>
//#include <textsrv/textserver.h>
//#include <user_exits/epm_toolkit_utils.h>
//#include <ss/ss_errors.h>
#include <stdlib.h>
//#include <io.h>
#include <stdio.h>
#include <time.h>
//#include <direct.h>
//#include <unistd.h>
#include "error_handling.h"
#include "common_itk_util.h"
#ifdef WIN32
#include <io.h>
#include <direct.h>
#else
#include <unistd.h>
#endif
#define ARGS_LENGTH 200
#define ARGS_NAME_DEBUG "-debug"
#define DEBUG "-debug="
#define MAX_PRINTLINE_LENGTH 2000
#define MAX_PATH_LENGTH 2000
#define MAX_ARGUMENT_LENGTH 400
#define MAX_PARAMNAME_LENGTH 50
#define MAX_FILE_EXT_LENGTH 10
#define TRUE_FLAG 1
#define FALSE_FLAG 0
#define DETAILLOG 1
int AM__set_application_bypass(logical bypass);
void ECHO(char *format, ...)
{
//if( !YFJC_OPT_DEBUG )
// return;
char msg[1024];
va_list args;
va_start( args, format );
vsprintf( msg, format, args );
va_end( args );
printf( msg );
TC_write_syslog( msg );
}
FILE* logFile = NULL;
void set_bypass(logical bypass)
{
AM__set_application_bypass(bypass);
}
/*=============================================================================*
* FUNCTION: current_time
* PURPOSE : get the current datetime
* INPUT:
* date_t* date_tag // current date time tag
*
* RETURN:
* void
*============================================================================*/
void current_time( date_t * date_tag )
{
time_t ltime;
struct tm *today ;
// Set time zone from TZ environment variable. If TZ is not set,
// the operating system is queried to obtain the default value
// for the variable.
//
//_tzset();
// Get UNIX-style time and display as number and string.
time( &ltime );
today = localtime( &ltime );
date_tag->year = today->tm_year + 1900 ;
date_tag->month = today->tm_mon ;
date_tag->day = today->tm_mday ;
date_tag->hour = today->tm_hour ;
date_tag->minute = today->tm_min ;
date_tag->second = today->tm_sec ;
}
/*=============================================================================*
* FUNCTION: CreateLogFile
* PURPOSE : create log file
* INPUT:
* char* FunctionName // the funtion which need to create log file
* FILE** logFile // out: the log file pointer
*
* RETURN:
* void
*============================================================================*/
void CreateLogFile(char* FunctionName, char **fullname)
{
int i=0, ifail = ITK_ok;
//date_t status_now;
//char* date_string = NULL;
char date_string[MAX_PATH_LENGTH];
char logFileDir[MAX_PATH_LENGTH];
char logFileName[MAX_PATH_LENGTH];
char* session_uid = NULL;
tag_t session_tag = NULLTAG;
time_t now;
struct tm *p;
time(&now);
logFile = NULL;
//current_time(&status_now);
p=localtime(&now);
memset(date_string, 0, sizeof(date_string));
sprintf(date_string,"%4d%02d%02d%02d%02d%02d",1900+p->tm_year,p->tm_mon+1 ,p->tm_mday ,p->tm_hour,p->tm_min ,p->tm_sec );
//if( DATE_date_to_string( status_now, "%Y%m%d%H%M%S", &date_string) != ITK_ok )
//ifail = ITK_date_to_string (status_now, &date_string );
//if (ifail)
//{
// printf("!*ERROR*!: Failed to get current date time\n");
// goto CLEANUP;
//}
memset(logFileDir, 0, sizeof(logFileDir));
memset(logFileName, 0, sizeof(logFileName));
//get log dir
sprintf(logFileDir, "%s", getenv("TEMP"));
printf("\n log file dir: %s\n", logFileDir);
//try to change dir to TC_USER_LOG_DIR
if(chdir(logFileDir)!=ITK_ok)
{
//not set TC_USER_LOG_DIR
//log in to default TC_LOG
memset(logFileDir, 0, sizeof(logFileDir));
sprintf(logFileDir, "%s", getenv("TC_LOG"));
printf("\n TC_USER_LOG_DIR invalide, log file dir: %s\n", logFileDir);
if(chdir(logFileDir)!=ITK_ok)
{
//still can not change to log dir
printf("!*ERROR*!: Failed to change dir to TC_USER_LOG_DIR\n");
goto CLEANUP;
}
}
//get session_uid to make sure the log file name unique
POM_ask_session(&session_tag);
ITK__convert_tag_to_uid(session_tag, &session_uid);
//get logFileName
sprintf(logFileName, "%s_%s_%s.log", FunctionName, session_uid, date_string);
printf("log file name: %s\n", logFileName);
*fullname = (char *)MEM_alloc(sizeof(char)*512);
sprintf(*fullname,"%s\\%s",logFileDir,logFileName);
//for(i = 0; _access((char *)logFileName, 4) == 0; i++)
/*{
memset(logFileName, 0, sizeof(logFileName));
sprintf(logFileName, "%s_%s_%s_%d.log", FunctionName, session_uid, date_string, i);
}
printf("final log file name: %s\n", logFileName);*/
//create log file
logFile = fopen(logFileName, "w");
CLEANUP:
//DOFREE(date_string);
DOFREE(session_uid);
}
/*=============================================================================*
* FUNCTION: WriteLog
* PURPOSE : write log, if debug log File not null, write log message to log File
* INPUT:
* const char* format // debug message string
*
* RETURN:
* void
*============================================================================*/
void WriteLog(const char* format, ...)
{
va_list arg;
char tmp[MAX_PRINTLINE_LENGTH];
if(logFile)
{
//get the message
memset(tmp, 0, sizeof(tmp));
va_start(arg, format);
vsprintf(tmp, format, arg);
va_end(arg);
//----------print to command window for trace--------//
printf("%s\n", tmp);
//print message to log file
fprintf(logFile, "%s\n", tmp);
fflush(logFile);
}
else
{
printf("*!Error!*: Log File Not Exist\n");
}
}
void CloseLog(void)
{
if(logFile)
{
fclose(logFile);
logFile = NULL;
}
}
//void getTypeinfo(char *type)
//{
// int ulen = 0,i=0,tempcount=0,asd=0;
//
// char temp[128]="";
// ulen = strlen(type);
// asd = ulen-1;
// for(i=0;i < ulen;i++)
// {
// if(type[i] == ';')
// {
// temp[tempcount] = '\0';
// strcpy(excludetypes[typecount].type,temp);
// strcpy(temp,"");
// tempcount = 0;
// typecount = typecount + 1;
// }
// else
// {
//
// temp[tempcount] = type[i];
// tempcount = tempcount + 1;
// if(i==asd)
// {
// temp[tempcount] = '\0';
// strcpy(excludetypes[typecount].type,temp);
// typecount = typecount + 1;
// }
//
// }
//
// }
//}

@ -0,0 +1,40 @@
/**
* @file common_itk_util.h
* @brief itk warpper utility function
* @author James
* @history
* ===================================================================================
* Date Name Description of Change
* 09-July-2008 James
*/
#ifndef COMMON_ITK_UTIL
#define COMMON_ITK_UTIL
#ifdef __cplusplus
extern "C" {
#endif
#define DOFREE(obj) \
{ \
if(obj) \
{ \
MEM_free(obj); \
obj = NULL; \
} \
}
void ECHO(char *format, ...);
void CreateLogFile(char* FunctionName, char **fullname);
void WriteLog(const char* format, ...);
void CloseLog(void);
void set_bypass(logical bypass);
//int FindDatasetReferenceExt( tag_t datasettype, const char *datasettype_ref, char ext[10] );
//int CompareDate( date_t date1, date_t date2 );
//int GetRandomTempFile( char tempFile[256] );
//logical IsItemRevisionType( char object_type[WSO_name_size_c + 1] );
#ifdef __cplusplus
}
#endif
#endif

@ -0,0 +1,160 @@
/*!
* @addtogroup common
* \file error_handling.h
* \brief
* \date 2008/6/10
* \author Ray Li
*/
#ifndef SIMPLE_ERR_H_INCLUDED
#define SIMPLE_ERR_H_INCLUDED
#include <itk/mem.h>
#include <tc/iman.h>
#include <tc/emh.h>
#include <pom/pom/pom_errors.h>
#include <tc/emh_const.h>
#include <tc/tc.h>
#include <pom/pom/pom.h>
#include <stdio.h>
#include <time.h>
#define BUFSIZE 512
//
//#define HANDLER_ARGUMENT_ERROR EMH_USER_error_base + 1
//#define WORKFLOW_NODE_IS_NOT_VALID EMH_USER_error_base + 2
//#define HANDLER_PLACED_INVALID EMH_USER_error_base + 3
//
////user errors define
////<error id="100">在站点文件中缺少 %1$ 配置,或该配置中无数据项</error>
//#define ERROR_PREFERENCE_NOT_FOUND (EMH_USER_error_base + 100)
#define DOFREE(obj) \
{ \
if(obj) \
{ \
MEM_free(obj); \
obj = NULL; \
} \
}
//#define ECHO(X) printf X;
#define SYS_LOG(X) IMAN_write_syslog X;
#define LOG_ECHO(X) printf X; IMAN_write_syslog X;
/*!
* \def CALL(x)
*
*/
#define CALL(x) { \
int stat; \
char *err_string; \
if( (stat = (x)) != ITK_ok) \
{ \
EMH_ask_error_text (stat, &err_string); \
LOG_ECHO( ("ERROR: %d ERROR MSG: %s.\n",stat, err_string) ) \
LOG_ECHO( ("Function: %s FILE: %s LINE: %d\n", #x, __FILE__, __LINE__ ) ) \
MEM_free (err_string); \
return (stat); \
} \
}
/*!
* \def DO(x)
*
*/
#define DO(x) { \
int stat; \
char *err_string; \
if( (stat = (x)) != POM_ok) \
{ \
EMH_ask_error_text (stat, &err_string); \
printf ("ERROR: %d ERROR MSG: %s.\n", stat, err_string); \
printf ("Function: %s FILE: %s LINE: %d\n",#x, __FILE__, __LINE__); \
MEM_free (err_string); \
} \
}
/*!
* \def CALLRNULL(x)
*
*/
#define CALLRNULL(x) { \
int stat; \
char *err_string; \
if( (stat = (x)) != ITK_ok) \
{ \
EMH_ask_error_text (stat, &err_string); \
printf ("ERROR: %d ERROR MSG: %s.\n", stat, err_string); \
printf ("Function: %s FILE: %s LINE: %d\n",#x, __FILE__, __LINE__); \
MEM_free (err_string); \
return ((char *)NULL); \
} \
}
/*!
* \def CALL2(x)
*
*/
#define CALL2(x) { \
int stat, n_ifails, *serverities, *ifails, err_count; \
char *err_string, **texts; \
if( (stat = (x)) != ITK_ok) \
{ \
printf ("Function: %s FILE: %s LINE: %d\n",#x, __FILE__, __LINE__); \
EMH_ask_errors( &n_ifails, (const int**)(&serverities), (const int**)(&ifails), (const char***)(&texts) );\
for( err_count=0; err_count<n_ifails; err_count++ ) \
{ \
printf( "ERROR: %d ERROR MSG: %s.\n", ifails[i], texts[i] ); \
} \
MEM_free( serverities ); \
MEM_free( ifails ); \
MEM_free( texts ); \
return (stat); \
} \
} \
#define CHECK_FILE(x,ret) { \
FILE *stream = NULL; \
if( (stream = fopen(x,"rb")) == NULL ) { \
printf( "%s doesn't exists, please check!\n", x ); \
IMAN_write_syslog( "%s doesn't exists, please check!\n", x) ; \
ret = -1; \
} \
else { \
fclose(stream); \
stream = NULL; \
ret = 0; \
} \
} \
#define CHECK_FILE_NOT_EXISTS(x,ret) { \
FILE *stream = NULL; \
if( (stream = fopen(x,"rb")) != NULL ) { \
fclose(stream); \
stream = NULL; \
printf( "%s exists, please check!\n", x ); \
IMAN_write_syslog( "%s exists, please check!\n", x) ; \
ret = -1; \
} \
else { \
ret = 0; \
} \
} \
#endif

@ -0,0 +1,12 @@
# include "common_itk_util.h"
# include "error_handling.h"
# include "ocilib.h"
# include "string_helper.h"
# include "string_utils.h"
int ITK_user_main(int argc, char* argv[])
{
printf("1111\n");
}

@ -0,0 +1,176 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="Debug|Itanium">
<Configuration>Debug</Configuration>
<Platform>Itanium</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Debug|Win32">
<Configuration>Debug</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Debug|x64">
<Configuration>Debug</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|Itanium">
<Configuration>Release</Configuration>
<Platform>Itanium</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|Win32">
<Configuration>Release</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|x64">
<Configuration>Release</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
</ItemGroup>
<PropertyGroup Label="Globals">
<ProjectGuid>{375BE822-1125-4D9E-A589-08243D1FF487}</ProjectGuid>
<Keyword>Win32Proj</Keyword>
<RootNamespace>jf_erp_project</RootNamespace>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Itanium'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Itanium'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings">
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Itanium'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Itanium'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<PropertyGroup Label="UserMacros" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<LinkIncremental>true</LinkIncremental>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Itanium'">
<LinkIncremental>true</LinkIncremental>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<LinkIncremental>false</LinkIncremental>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Itanium'">
<LinkIncremental>false</LinkIncremental>
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<ClCompile>
<PrecompiledHeader>
</PrecompiledHeader>
<WarningLevel>Level3</WarningLevel>
<Optimization>Disabled</Optimization>
<PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Itanium'">
<ClCompile>
<PrecompiledHeader>
</PrecompiledHeader>
<WarningLevel>Level3</WarningLevel>
<Optimization>Disabled</Optimization>
<PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<PrecompiledHeader>
</PrecompiledHeader>
<Optimization>MaxSpeed</Optimization>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<PreprocessorDefinitions>IPLIB=none;WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<AdditionalIncludeDirectories>F:\Teamcenter10.1.0Env\OCI\include;F:\Teamcenter10.1.0Env\tcbin\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
<AdditionalDependencies>F:\Teamcenter10.1.0Env\tcbin\lib\*.lib;%(AdditionalDependencies)</AdditionalDependencies>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Itanium'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<PrecompiledHeader>
</PrecompiledHeader>
<Optimization>MaxSpeed</Optimization>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<PreprocessorDefinitions>IPLIB=none;WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<AdditionalIncludeDirectories>F:\Teamcenter10.1.0Env\OCI\include;F:\Teamcenter10.1.0Env\tcbin\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
<AdditionalDependencies>F:\Teamcenter10.1.0Env\tcbin\lib\*.lib;%(AdditionalDependencies)</AdditionalDependencies>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<ClCompile>
<AdditionalIncludeDirectories>F:\Teamcenter10.1.0Env\OCI\include;F:\Teamcenter10.1.0Env\tcbin\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>IPLIB=none;%(PreprocessorDefinitions)</PreprocessorDefinitions>
</ClCompile>
<Link>
<AdditionalDependencies>F:\Teamcenter10.1.0Env\tcbin\lib\*.lib;F:\Teamcenter10.1.0Env\tcbin\lib\itk_main.obj;%(AdditionalDependencies)</AdditionalDependencies>
</Link>
</ItemDefinitionGroup>
<ItemGroup>
<ClCompile Include="common_itk_util.c" />
<ClCompile Include="jf_erp_project.cpp" />
<ClCompile Include="ocilib.cxx" />
<ClCompile Include="string_helper.cpp" />
<ClCompile Include="string_utils.cxx" />
</ItemGroup>
<ItemGroup>
<ClInclude Include="common_itk_util.h" />
<ClInclude Include="error_handling.h" />
<ClInclude Include="jf_erp_project.h" />
<ClInclude Include="ocilib.h" />
<ClInclude Include="string_helper.h" />
<ClInclude Include="string_utils.h" />
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
</Project>

@ -0,0 +1,57 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
<Filter Include="源文件">
<UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
<Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
</Filter>
<Filter Include="头文件">
<UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
<Extensions>h;hpp;hxx;hm;inl;inc;xsd</Extensions>
</Filter>
<Filter Include="资源文件">
<UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
<Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions>
</Filter>
<Filter Include="common">
<UniqueIdentifier>{695e5212-e914-4315-a83f-087109122c06}</UniqueIdentifier>
</Filter>
</ItemGroup>
<ItemGroup>
<ClCompile Include="common_itk_util.c">
<Filter>common</Filter>
</ClCompile>
<ClCompile Include="string_helper.cpp">
<Filter>common</Filter>
</ClCompile>
<ClCompile Include="ocilib.cxx">
<Filter>common</Filter>
</ClCompile>
<ClCompile Include="string_utils.cxx">
<Filter>common</Filter>
</ClCompile>
<ClCompile Include="jf_erp_project.cpp">
<Filter>源文件</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="common_itk_util.h">
<Filter>common</Filter>
</ClInclude>
<ClInclude Include="error_handling.h">
<Filter>common</Filter>
</ClInclude>
<ClInclude Include="ocilib.h">
<Filter>common</Filter>
</ClInclude>
<ClInclude Include="string_helper.h">
<Filter>common</Filter>
</ClInclude>
<ClInclude Include="string_utils.h">
<Filter>common</Filter>
</ClInclude>
<ClInclude Include="jf_erp_project.h">
<Filter>头文件</Filter>
</ClInclude>
</ItemGroup>
</Project>

@ -0,0 +1,3 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
</Project>

@ -0,0 +1,440 @@
/*=====================================================================================================================
Copyright(c) 2012 ORIGIN.
Unpublished - All rights reserved
=======================================================================================================================
File description:
Filename: ocilib.cxx
Module : OCI
This file describes OCI library Package.
=======================================================================================================================
Date Name Description of Change
1-Feb-2015 Ray li Initialize creation
$HISTORY$
=====================================================================================================================*/
#include "ocilib.h"
#include <stdlib.h>
#define NUM 100
#define USERNAME "infodba"
#define PASSWORD "infodba"
#define DBNAME "tc"
// 定义句柄结构
typedef struct{
OCIEnv *p_env; //OCI environment handle 环境句柄
OCIError *p_err; //OCI error handle 错误句柄
OCISvcCtx *p_svc; //OCI service context handel 服务上下文句柄
OCIServer *p_ser; //OCI server handle 服务器句柄
OCISession *p_usr; //OCI user session handle 用户会话句柄
OCIStmt *p_sql; //OCI statement handle 语句句柄
OCIDefine *p_dfn; //OCI define handle 定义句柄
OCIBind *p_bnd; //OCI bind handle 绑定句柄
}OCIHandleInfo;
// 定义错误句柄结构
typedef struct{
OCIEnv *p_env;
OCIError *p_err;
OCISvcCtx *p_svc;
OCIStmt *p_sql;
OCIDefine *p_dfn;
OCIBind *p_bnd;
}OCIDATA;
// 定义执行语句时候的输入参数
typedef struct{
char value[NUM][NUM];
char type[NUM][NUM];
}SqlField;
// 定义查询语句时候的输入,输出参数
typedef struct{
int naIntValue[NUM];
int nIntNum;
char caCharValue[500][500];
int nCharNum;
}SqlSelField;
OCIHandleInfo *ociHandle = NULL;
OCIHandleInfo ociHand;
int InitHandle();
int _ExeSQL(char *SQL,char ** inputValue,int inputValueCount);
int _QuerySQL(char *SQL, SqlSelField *pOutField, SqlSelField *pSelField);
int GetDataFromQuery(int *pRc, SqlSelField *pOutField);
void QuitFreeHandle();
/****************************************************************************************************************************************
*****************************************************************************************************************************************/
// 初始化Handler
int InitHandle()
{
int swResult;
ociHandle = &ociHand;
/*create OCI environment*/
if(swResult = OCIEnvCreate(&ociHandle->p_env,OCI_DEFAULT,NULL,NULL,NULL,NULL,0,NULL)) //环境句柄
{
printf("environment create error!\n\n");
return -1;
}
else
{
printf("environment create success!\n\n");
//return 0;
}
/*init handle*/
if(swResult = OCIHandleAlloc(ociHandle->p_env,(dvoid **)&ociHandle->p_ser,OCI_HTYPE_SERVER,0,NULL)) //服务器句柄
{
printf("init server handle error!\n\n");
return -1;
}
if(swResult = OCIHandleAlloc(ociHandle->p_env,(dvoid **)&ociHandle->p_err,OCI_HTYPE_ERROR,0,NULL)) //错误句柄
{
printf("init error handle error!\n\n");
return -1;
}
if(swResult = OCIHandleAlloc(ociHandle->p_env,(dvoid **)&ociHandle->p_usr,OCI_HTYPE_SESSION,0,NULL)) //事务句柄
{
printf("init session handle error!\n\n");
return -1;
}
if(swResult = OCIHandleAlloc(ociHandle->p_env,(dvoid **)&ociHandle->p_svc,OCI_HTYPE_SVCCTX,0,NULL)) //上下文句柄
{
printf("init service context handle error!\n\n");
return -1;
}
if(swResult = OCIHandleAlloc(ociHandle->p_env,(dvoid **)&ociHandle->p_sql,OCI_HTYPE_STMT,0,NULL)) //SQL语句句柄
{
printf("init statement handle error!\n\n");
return -1;
}
printf("init handle success!\n\n");
return 0;
}
// 连接数据库服务器
int ConnServer(char *username,char *password,char *dbname)
{
int swResult;
char errbuf[100]={0};
int errcode;
if(InitHandle() == -1)//初始化句柄
return -1;
if(swResult = OCILogon(ociHandle->p_env,ociHandle->p_err,&ociHandle->p_svc,(text *)username,strlen(username),(text *)password,strlen(password),(text *)dbname,strlen(dbname)))
{
OCIErrorGet((dvoid *)ociHandle->p_err, (ub4) 1, (text *) NULL, &errcode, (ub1 *)errbuf, (ub4) sizeof(errbuf), OCI_HTYPE_ERROR);
printf("Error - %.*s/n", 512, errbuf);
return -1;
}
else
printf("数据库连接成功!\n\n");
return 0;
}
// SQL语句的陈述(执行SQL语句)
int _ExeSQL(char *SQL,char ** inputValue,int inputValueCount)
{
int swResult,i;
int errcode;
//设置绑定变量
OCIBind *p_bndp[100];
//准备SQL语句
if(swResult = OCIStmtPrepare(ociHandle->p_sql,ociHandle->p_err,(text *)SQL,strlen(SQL),OCI_NTV_SYNTAX,OCI_DEFAULT))
{
printf("prepare SQL statements error!\n\n");
}
else
{
printf("prepare SQL statements success!\n\n");
}
// 绑定输入变量
for(i=0;i<inputValueCount;i++)
{
char errbuf[100]={0};
if(swResult = OCIBindByPos(ociHandle->p_sql,&p_bndp[i],ociHandle->p_err,i+1,(dvoid *)inputValue[i],(sb4)strlen(inputValue[i])+1,SQLT_STR, (dvoid *) 0, (ub2 *) 0, (ub2 *) 0, (ub4) 0, (ub4 *) 0, OCI_DEFAULT))
{
OCIErrorGet((dvoid *)ociHandle->p_err, (ub4) 1, (text *) NULL, &errcode, (ub1 *)errbuf, (ub4) sizeof(errbuf), OCI_HTYPE_ERROR);
printf("Bind Error - %.*s/n", 512, errbuf);
return -1;
}
}
//执行SQL statements
if(swResult = OCIStmtExecute(ociHandle->p_svc,ociHandle->p_sql,ociHandle->p_err,1,0,NULL,NULL,OCI_DEFAULT))
{
char errbuf[100]={0};
OCIErrorGet((dvoid *)ociHandle->p_err, (ub4) 1, (text *) NULL, &errcode, (ub1 *)errbuf, (ub4) sizeof(errbuf), OCI_HTYPE_ERROR);
printf("execute SQL statement Error - %.*s\n", 512, errbuf);
return -1;
}
else
{
printf("execute SQL statement success!\n\n");
}
return 0;
}
// 查询SQL
int _QuerySQL(char *SQL, SqlSelField *pOutField, SqlSelField *pSelField )
{
sword status;
int rc= 0,ret=0;
char errbuf[100]={0};
int maxNum = 2048;
char chTag[8];
int iIndex = 0;
int outputColumn = 0;
int errcode=0;
char nullValue = '\0'; //
sb2 sb2aInd[30] = {'\0'};
// 准备SQL语句
status = OCIStmtPrepare(ociHandle->p_sql, ociHandle->p_err, (text *)SQL,(ub4)strlen(SQL), (ub4)OCI_NTV_SYNTAX, (ub4)OCI_DEFAULT);
if (status != OCI_SUCCESS)
{
printf("SQL Preparing failed/n");
return -1;
}
// 绑定int类型的, 定义SQL语句时 :1,:2, 定义输入变量
for (iIndex=0; iIndex<pSelField->nIntNum; iIndex++)
{
memset(chTag, 0, 8);
sprintf(chTag, ":%d", iIndex+1);
if(rc = OCIBindByName(ociHandle->p_sql, (OCIBind **)&ociHandle->p_dfn, ociHandle->p_err, (text *)chTag,(sb4)strlen((char *)chTag),(dvoid *) &pSelField->naIntValue[iIndex], sizeof(int), SQLT_INT,(dvoid *) 0,(ub2 *) 0, (ub2 *) 0, (ub4) 0, (ub4 *) 0, OCI_DEFAULT))
{
OCIErrorGet((dvoid *)ociHandle->p_err, (ub4) 1, (text *) NULL, &errcode, (ub1 *)errbuf, (ub4) sizeof(errbuf), OCI_HTYPE_ERROR);
printf("BindByPos Error of ociHandle->p_sql - %.*s\n", 512, errbuf);
return -1;
}
}
// 绑定char *类型的, 定义SQL语句时 :3,:4, 定义输入变量
for (iIndex=0; iIndex<pSelField->nCharNum; iIndex++)
{
int n=0;
memset(chTag, 0, 8);
n = pSelField->nIntNum + iIndex +1;
sprintf(chTag, ":%d", n);
if(rc = OCIBindByName(ociHandle->p_sql, (OCIBind **)&ociHandle->p_dfn, ociHandle->p_err, (text *)chTag,(sb4)strlen((char *)chTag),(dvoid *) &pSelField->caCharValue[iIndex], NUM, SQLT_STR,(dvoid *) 0,(ub2 *) 0, (ub2 *) 0, (ub4) 0, (ub4 *) 0, OCI_DEFAULT))
{
OCIErrorGet((dvoid *)ociHandle->p_err, (ub4) 1, (text *) NULL, &errcode, (ub1 *)errbuf, (ub4) sizeof(errbuf), OCI_HTYPE_ERROR);
printf("BindByPos Error of ociHandle->p_sql - %.*s\n", 512, errbuf);
return -1;
}
}
// 执行SQL语句
if (rc = OCIStmtExecute(ociHandle->p_svc, ociHandle->p_sql, ociHandle->p_err, (ub4) 0, (ub4) 0,(CONST OCISnapshot *) NULL, (OCISnapshot *) NULL, OCI_STMT_SCROLLABLE_READONLY))
{
OCIErrorGet((dvoid *)ociHandle->p_err, (ub4) 1, (text *) NULL, &errcode, (ub1 *)errbuf, (ub4) sizeof(errbuf), OCI_HTYPE_ERROR);
printf("execute SQL Error - %.*s\n", 512, errbuf);
return -1;
}
else
{
printf("execute SQL success!\n\n");
}
if (ret = OCIAttrGet (ociHandle->p_sql, (ub4)OCI_HTYPE_STMT, (dvoid *) &outputColumn, (ub4 *) 0, (ub4)OCI_ATTR_PARAM_COUNT, ociHandle->p_err))
{
OCIErrorGet((dvoid *)ociHandle->p_err, (ub4) 1, (text *) NULL, &errcode, (ub1 *)errbuf, (ub4) sizeof(errbuf), OCI_HTYPE_ERROR);
printf("Get OCIAttr Error of ociHandle->p_sql - %.*s\n", 512, errbuf);
return -1;
}
// 绑定int类型的, 定义SQL语句时 :1,:2, 定义输出变量
for (iIndex=0; iIndex<pOutField->nIntNum; iIndex++)
{
if(rc = OCIDefineByPos(ociHandle->p_sql, &ociHandle->p_dfn, ociHandle->p_err, iIndex+1, (dvoid *)&pOutField->naIntValue[iIndex], sizeof(int), SQLT_INT, (dvoid *) 0, (ub2 *)0,(ub2 *)0, OCI_DEFAULT))
{
OCIErrorGet((dvoid *)ociHandle->p_err, (ub4) 1, (text *) NULL, &errcode, (ub1 *)errbuf, (ub4) sizeof(errbuf), OCI_HTYPE_ERROR);
printf("DefineByPos Error of ociHandle->p_sql - %.*s\n", 512, errbuf);
return -1;
}
}
// 绑定char *类型的, 定义SQL语句时 :1,:2, 定义输出变量
for (iIndex=0; iIndex<outputColumn; iIndex++)
{
int n = iIndex+1 ;
if (rc = OCIDefineByPos(ociHandle->p_sql, &ociHandle->p_dfn, ociHandle->p_err, n, (dvoid *)&pOutField->caCharValue[iIndex], 1000*sizeof(char), SQLT_STR, (dvoid *) 0, (ub2 *)0,(ub2 *)0, OCI_DEFAULT))
{
OCIErrorGet((dvoid *)ociHandle->p_err, (ub4) 1, (text *) NULL, &errcode, (ub1 *)errbuf, (ub4) sizeof(errbuf), OCI_HTYPE_ERROR);
printf("DefineByPos Error of ociHandle->p_sql - %.*s\n", 512, errbuf);
return -1;
}
}
return 0;
}
// 释放Handler
void QuitFreeHandle()
{
// 退出服务器
OCILogoff(ociHandle->p_svc,ociHandle->p_err);
printf("Quit success!\n");
// 释放句柄
OCIHandleFree(ociHandle->p_ser,OCI_HTYPE_SERVER); //释放服务器句柄
OCIHandleFree(ociHandle->p_err,OCI_HTYPE_ERROR); //释放错误句柄
OCIHandleFree(ociHandle->p_usr,OCI_HTYPE_SESSION); //释放事务句柄
OCIHandleFree(ociHandle->p_svc,OCI_HTYPE_SVCCTX); //释放上下文句柄
OCIHandleFree(ociHandle->p_sql,OCI_HTYPE_STMT); //释放SQL语句句柄
}
// 执行类操作
int ExecuteSQL(char *SQL,int valueCount,char **value)
{
int i=0;
if(i=_ExeSQL(SQL,value,valueCount))
{
QuitFreeHandle();
return -1;
}
return 0;
}
// 有输入参数的查询
int QuerySQL(char *SQL, int inputValueCount, char ** inputValue, int * outputColumn, int * outputValueCount, char **** outputValue)
{
int i = 0, j=0 ,ret =0;
int times = 0, temp=0;
SqlSelField infield;
SqlSelField outField;
// 初始化参数结构
infield.nCharNum = inputValueCount;
infield.nIntNum = 0;
outField.nCharNum = 0;
outField.nIntNum = 0;
* outputColumn = 0;
* outputValueCount = 0;
for(i=0;i<inputValueCount;i++)
{
strcpy(infield.caCharValue[i],inputValue[i]);
}
// 执行查询语句
if (ret = _QuerySQL(SQL,&outField,&infield))
{
printf("SQL查询失败!\n");
QuitFreeHandle();
return -1;
}
// 获取结果列数
ret= OCIAttrGet (ociHandle->p_sql, (ub4)OCI_HTYPE_STMT, (dvoid *) outputColumn, (ub4 *) 0, (ub4)OCI_ATTR_PARAM_COUNT, ociHandle->p_err);
// 提取最后一行,便于去行数
ret = OCIStmtFetch2(ociHandle->p_sql, ociHandle->p_err,1, OCI_FETCH_LAST,0, OCI_DEFAULT);
// 获取结果行数
ret= OCIAttrGet (ociHandle->p_sql, (ub4)OCI_HTYPE_STMT, (dvoid *) outputValueCount, (ub4 *) 0, (ub4)OCI_ATTR_ROW_COUNT, ociHandle->p_err);
if(*outputValueCount == 0)
return 0;
// 开始分配内存并且存储
ret = OCIStmtFetch2(ociHandle->p_sql, ociHandle->p_err,1, OCI_FETCH_FIRST,0, OCI_DEFAULT);
*outputValue = (char ***) calloc ((*outputValueCount)+1,sizeof(char**));
do
{
(*outputValue)[i] = (char **) calloc ((*outputColumn)+1,sizeof(char *));
for(j=0;j<(*outputColumn);j++)
{
(*outputValue)[i][j] = (char *) calloc (1000,sizeof(char));
strcpy((*outputValue)[i][j],outField.caCharValue[j]);
//printf("outValue[%d][%d] = %s , 地址=%d, 所指向地址= %d\n ",i,j,(*outputValue)[i][j],&(*outputValue)[i][j],(*outputValue)[i][j]);
}
i++;
}
while((ret = OCIStmtFetch2(ociHandle->p_sql, ociHandle->p_err,1, OCI_FETCH_NEXT, 1, OCI_DEFAULT)!= OCI_NO_DATA));
return 0;
}
// 无输入参数的查询
int QuerySQLNoInputParam(char *SQL, int * outputColumn, int * outputValueCount, char **** outputValue)
{
return QuerySQL(SQL,0,NULL,outputColumn,outputValueCount,outputValue);
}
// 无参数操作
int ExecuteSQLNoInputParam(char *SQL)
{
return ExecuteSQL(SQL,0,NULL);
}
// 断开连接
void DisConnServer()
{
if(ociHandle != NULL)
QuitFreeHandle();
}

@ -0,0 +1,98 @@
/*=====================================================================================================================
Copyright(c) 2012 ORIGIN.
Unpublished - All rights reserved
=======================================================================================================================
File description:
Filename: ocilib.h
Module : OCI
This Header file of OCI library Package.
=======================================================================================================================
Date Name Description of Change
1-Feb-2015 Ray Initialize creation
$HISTORY$
=====================================================================================================================*/
#include <oci.h>
#include <stdio.h>
#include <memory.h>
#include <string.h>
#include <malloc.h>
//#include <limits.h>
#define OCI_FAIL 1
#define OCI_OK 0
#ifdef __cplusplus
extern "C"
{
#endif
/**
* .
* @param username - <I>
* @param password - <I>
* @param dbname - <I> SID
* @return - OCI_OK or error code
*
* ORACLE
*/
extern int ConnServer(char *username,char *password,char *dbname);
/**
* SQL.
* @param SQL - <I> SQL
* @return - OCI_OK or error code
*
* ORACLE
*/
extern int ExecuteSQLNoInputParam(char *SQL);
/**
* SQL.
* @param SQL - <I> SQL
* @param inputValueCount - <I>
* @param inputValue - <I>
* @return - OCI_OK or error code
*
* ORACLE
*/
extern int ExecuteSQL(char *SQL,int inputValueCount,char **inputValue);
/**
* SQL.
* @param SQL - <I> SQL
* @param outputColumn - <O>
* @param outputValueCount - <O>
* @param outputValue - <O>
* @return - OCI_OK or error code
*
* ORACLE
*/
extern int QuerySQLNoInputParam(char *SQL, int * outputColumn, int * outputValueCount, char **** outputValue);
/**
* SQL.
* @param SQL - <I> SQL
* @param inputValueCount - <I>
* @param inputValue - <I>
* @param outputColumn - <O>
* @param outputValueCount - <O>
* @param outputValue - <O>
* @return - OCI_OK or error code
*
* ORACLE
*/
extern int QuerySQL(char *SQL, int inputValueCount, char ** inputValue, int * outputColumn, int * outputValueCount, char **** outputValue);
/**
* .
*
* ORACLE
*/
extern void DisConnServer();
#ifdef __cplusplus
}
#endif

@ -0,0 +1,146 @@
/**
* @file string_helper.cpp
* @brief string utility functions' implemention
* @author James
* @history
* ===================================================================================
* Date Name Description of Change
* 09-July-2008 James
* 14-Jau-2009 James modify Split functions, add trim blank characters
*/
#pragma warning(disable:4996)
//
//#include <stdio.h>
//#include <iostream>
//#include <windows.h>
#include "string_helper.h"
string TrimString( string strArg )
{
size_t index1 = 0;
index1 = strArg.find_first_not_of( ' ');
if( index1 != string::npos )
strArg.erase( strArg.begin(), strArg.begin()+index1 );
index1 = strArg.find_last_not_of( ' ');
if( index1 != string::npos )
strArg.erase( strArg.begin() + index1 + 1 );
return strArg;
}
void Split( string strArg, char spliter, vector<string> &ans )
{
ans.clear();
size_t index0 = 0;
string one_arg;
if ( strArg.find_first_not_of(' ') == string::npos )
strArg = "";
while( strArg.size()>0 )
{
index0 = strArg.find_first_of( spliter );
if( index0 != string::npos )
{
one_arg = strArg.substr( 0,index0 );
strArg = strArg.substr( index0 + 1 );
ans.push_back( one_arg );
}
else
{
ans.push_back( strArg );
break;
}
}
}
void Split( string strArg, string spliter, vector<string> &ans )
{
ans.clear();
size_t index0;
string one_arg;
if ( strArg.find_first_not_of(" ") == string::npos )
strArg = "";
while( strArg.size()>0 )
{
index0 = strArg.find(spliter);
if( index0 != string::npos )
{
one_arg = strArg.substr( 0, index0 );
strArg = strArg.substr( index0 + spliter.size() );
ans.push_back( one_arg );
}
else
{
ans.push_back( strArg );
break;
}
}
}
void RemoveLiner( string &in, string &out )
{
char buf[BUFSIZ] = "";
for( int i=0; i<(int)in.size(); i++ )
{
if( in[i] == '\n')
continue;
else
sprintf( buf,"%s%c", buf, in[i] );
}
out.assign(buf);
}
////Converting a WChar string to a Ansi string
//std::string WChar2Ansi(LPCWSTR pwszSrc)
//{
// int nLen = WideCharToMultiByte(CP_ACP, 0, pwszSrc, -1, NULL, 0, NULL, NULL);
//
// if (nLen<= 0) return std::string("");
//
// char* pszDst = new char[nLen];
// if (NULL == pszDst) return std::string("");
//
// WideCharToMultiByte(CP_ACP, 0, pwszSrc, -1, pszDst, nLen, NULL, NULL);
// pszDst[nLen -1] = 0;
//
// std::string strTemp(pszDst);
// delete [] pszDst;
//
// return strTemp;
//}
//
//string ws2s(wstring& inputws){ return WChar2Ansi(inputws.c_str()); }
//
////Converting a Ansi string to WChar string
//std::wstring Ansi2WChar(LPCSTR pszSrc, int nLen)
//{
// int nSize = MultiByteToWideChar(CP_ACP, 0, (LPCSTR)pszSrc, nLen, 0, 0);
// if(nSize <= 0) return NULL;
//
// WCHAR *pwszDst = new WCHAR[nSize+1];
// if( NULL == pwszDst) return NULL;
//
// MultiByteToWideChar(CP_ACP, 0,(LPCSTR)pszSrc, nLen, pwszDst, nSize);
// pwszDst[nSize] = 0;
//
// if( pwszDst[0] == 0xFEFF) // skip Oxfeff
// for(int i = 0; i < nSize; i ++)
// pwszDst[i] = pwszDst[i+1];
//
// wstring wcharString(pwszDst);
// delete pwszDst;
//
// return wcharString;
//}
//
//std::wstring s2ws(const string& s){ return Ansi2WChar(s.c_str(),s.size());}

@ -0,0 +1,25 @@
/**
* @file string_helper.h
* @brief string utilities to help dealing with string
* @author James
* @history
* ===================================================================================
* Date Name Description of Change
* 09-July-2008 James
*/
#ifndef STRING_HELPER
#define STRING_HELPER
#include <string>
#include <vector>
using namespace std;
string TrimString( string strArg );
void Split( string strArg, char spliter, vector<string> &ans );
void Split( string strArg, string spliter, vector<string> &ans );
void RemoveLiner( string &in, string &out );
//string ws2s(wstring& inputws);
//wstring s2ws(const string& s);
#endif

@ -0,0 +1,253 @@
/*==================================================================================================================
Copyright(c) 2012 ORIGIN.
Unpublished - All rights reserved
====================================================================================================================
File description:
Filename: string_utils.c
Module : Common module.
This file includes some operations of the string.
====================================================================================================================
Date Name Description of Change
3-Feb-2015 Ray li Initialize creation
$HISTORY$
===================================================================================================================*/
#ifndef _cplusplus
#ifndef _CRT_SECURE_NO_DEPRECATE
#define _CRT_SECURE_NO_DEPRECATE
#endif
#endif
#include <fclasses/tc_string.h>
#include <tc/tc_util.h>
#include <itk/mem.h>
#include <tccore/workspaceobject.h>
#include <stdlib.h>
#include <ctype.h>
#include "string_utils.h"
//void Split( string strArg, string spliter, vector<string> &ans )
//{
// ans.clear();
// size_t index0;
// string one_arg;
// if ( strArg.find_first_not_of(' ') == string::npos )
// strArg = "";
// while( strArg.size()>0 )
// {
// index0 = strArg.find(spliter);
// if( index0 != string::npos )
// {
// one_arg = strArg.substr( 0, index0 );
// strArg = strArg.substr( index0 + spliter.size() );
// ans.push_back( one_arg );
// }
// else
// {
// ans.push_back( strArg );
// break;
// }
// }
//}
char* GSTR_clone( char **dst, const char *src )
{
char *retVal = NULL;
int srcLen = 0;
*dst = NULL;
if (src == NULL)
return NULL;
srcLen = (int)tc_strlen( src ) + 1;
*dst = (char*)MEM_alloc( srcLen * sizeof(char) );
retVal = tc_strncpy( *dst, src, srcLen );
(*dst)[srcLen - 1] = '\0';
return retVal;
}
char* GSTR_copy( char *dst, const char *src, int dstSize )
{
char *retVal = tc_strncpy( dst, src, dstSize );
dst[dstSize - 1] = '\0';
return retVal;
}
char* GSTR_int_to_string( char **dst, int value )
{
char strVal[128 + 1];
*dst = NULL;
memset( strVal, 0, sizeof(strVal)/sizeof(char) );
sprintf( strVal, "%d", value );
return GSTR_clone( dst, strVal );
}
void GSTR_format_int_to_string( char *dst, int digitNum, int value )
{
char sNum[WSO_desc_size_c + 1];
sprintf( sNum, "%%0%dd", digitNum );
sprintf( dst, sNum, value );
}
void GSTR_format_string( const char *dst, int m, const char *fill_char, char **out )
{
char sNum[WSO_name_size_c + 1] = {0};
char sNew[WSO_name_size_c + 1] = {0};
sprintf( sNum, "%%%d.%ds", m, m );
sprintf( sNew, sNum, dst );
STRNG_replace_str( sNew, " ", fill_char, out );
}
char* GSTR_string_append( const char *s1, const char *s2 )
{
char *s = NULL;
if (s1 == NULL || s2 == NULL)
{
GSTR_clone(&s, s1 == NULL ? (s2 == NULL ? "" : s2) : s1 );
}
else
{
int size = (int)tc_strlen(s1) + (int)tc_strlen(s2) + 1;
s = (char *)MEM_alloc( size );
tc_strcpy( s, s1 );
tc_strcat( s, s2 );
s[size - 1] = '\0';
}
return s;
}
logical GSTR_is_float(const char *str)
{
logical isfloat = true;
char *pStr = (char *)str;
logical hasPositive = false;
logical hasMinus = false;
logical hasDot = false;
if (str == NULL)
return false;
while (*pStr != '\0' && isfloat == true)
{
if ( (*pStr >= '0' && *pStr <= '9'))
{
//continue;
}
else if ( *pStr == '+' )
{
isfloat = (hasPositive ? false : (hasPositive = true));
}
else if ( *pStr == '-' )
{
isfloat = (hasMinus ? false : (hasMinus = true));
}
else if ( *pStr == '.' )
{
isfloat = (hasDot ? false : (hasDot = true));
}
else
isfloat = false;
pStr ++;
}
return isfloat;
}
logical GSTR_is_number(const char *str)
{
logical is_number = true;
char *pStr = (char *)str;
if (str == NULL)
return false;
while (*pStr != '\0')
{
if ( !( (*pStr >= '0' && *pStr <= '9') || *pStr == '-' ) )
{
is_number = false;
break;
}
pStr ++;
}
return is_number;
}
logical GSTR_is_ascii(char ch)
{
return ((unsigned int)ch) < 128;
}
int GSTR_trim_l( char *str, char s )
{
int count = 0;
char *pointer = str, *poffset = NULL;
if (str == NULL || str[0] == '\0')
return 0;
while ( *pointer != '\0' )
{
if ( *pointer != s )
{
break;
}
count++;
pointer++;
}
if (count == 0)
return 0;
poffset = str + count;
pointer = str;
while ( *poffset != '\0' )
{
*pointer = *poffset;
pointer ++;
poffset ++;
}
*pointer = '\0';
return count;
}
int GSTR_trim_r( char *str, char s )
{
int count = 0;
char *pointer = NULL;
if (str == NULL || str[0] == '\0')
return 0;
pointer = str + ((int) strlen(str) - 1);
while ( pointer != str )
{
if ( *pointer != s )
{
break;
}
*pointer = '\0';
count++;
pointer--;
}
return count;
}
void GSTR_trim_float( char *floatValue )
{
if ( !IS_EMPTY(floatValue) && tc_strstr(floatValue, ".") != NULL )
{
int len = 0;
GSTR_trim_r(floatValue, '0');
len = (int)tc_strlen(floatValue);
if (floatValue[ len - 1 ] == '.')
floatValue[ len - 1 ] = '\0';
}
}

@ -0,0 +1,125 @@
/*=====================================================================================================================
Copyright(c) 2005 ORIGIN PLM Software Corp. All rights reserved.
Unpublished - All rights reserved
=======================================================================================================================
File description:
Filename: string_utils.h
Module : Common module.
This file includes some operations of the string.
=======================================================================================================================
Date Name Description of Change
14-Jul-2009 Ray Li Initialize creation
$HISTORY$
=====================================================================================================================*/
#ifndef STRING_UTILS_H
#define STRING_UTILS_H
#include <string>
#include <map>
#include <vector>
using namespace std;
#ifdef __cplusplus
extern "C"
{
#endif
// @{{ String assister
#define IS_NULL(S) ((S)==NULL)
#define IS_EMPTY(S) (((S)==NULL) || !(*(S)))
// @}}
void Split( string strArg, string spliter, vector<string> &ans );
/**
* Clones the string.
* @param dst - <OF> the output string.
* @param src - <I> the string to be cloned.
* @return - the destinatin string pointer.
*/
extern char* GSTR_clone( char **dst, const char *src );
/**
* Copy safely the string with null end.
* @param dst - <O> the output string.
* @param src - <I> the string to be cloned.
* @param dstSize - <I> the size of output string.
* @return - the destinatin string pointer.
*/
extern char *GSTR_copy( char *dst, const char *src, int dstSize );
/**
* Converts int to string.
* @param dst - <OF> the output string.
* @param value - <I> the int to be cloned.
* @return - the destinatin string pointer.
*/
extern char* GSTR_int_to_string( char **dst, int value );
/**
* Formats the int/string value as string.
* @param dst - <O> the destination string.
* @param digitNum - <I> the digit number of the value.
* @param value - <I> the value to be converted.
* @return - N/A.
*/
extern void GSTR_format_int_to_string( char *dst, int digitNum, int value );
extern void GSTR_format_string( const char *dst, int m, const char *fill_char, char **out );
/**
* Appends the strings( never null returned )
* @param s1 - <I> string 1
* @param s2 - <I> string 2
* @return - <OF> new string
*/
extern char* GSTR_string_append( const char *s1, const char *s2 );
/**
* Whether the string is float type
* @param str - <I> The string
*
* NOTE: it's only check whether each word is in "+-.0123456789", not care the float with "E" or the float rule,
* like "00-1.+01", it will return true.
* @return - return true if it is one.
*/
extern logical GSTR_is_float(const char *str);
/**
* Whether all char of the string are number
* @param str - <I> The string
*
* NOTE: it's only check whether each word is in "0123456789"
* @return - return true if it is one.
*/
extern logical GSTR_is_number(const char *str);
/**
* Is ascii char
* @param ch - <I> ascii char
* @return - return true if it is.
*/
extern logical GSTR_is_ascii(char ch);
/**
* Trims the string's prefix.
* @param str - <I> The string
* @param s - <I> The char
*
* @return - count.
*/
extern int GSTR_trim_l( char *str, char s );
extern int GSTR_trim_r( char *str, char s );
/**
* Remove the zero.
* For Example:
* floatValue="50.00" -> = "50"
* floatValue="50.0100" -> = "50.01"
* @return - count.
*/
extern void GSTR_trim_float( char *floatValue );
#ifdef __cplusplus
}
#endif
#endif //STRING_UTILS_H

@ -0,0 +1,2 @@
#v4.0:v100
Release|x64|F:\Connor项目管理\继峰项目\签名\jf_itk\|

@ -0,0 +1,23 @@
生成启动时间为 2015/9/17 19:47:48。
1>项目“F:\Connor项目管理\继峰项目\签名\jf_itk\jf_erp_project\jf_erp_project.vcxproj”在节点 2 上(build 个目标)。
1>InitializeBuildStatus:
正在对“x64\Release\jf_erp_project.unsuccessfulbuild”执行 Touch 任务。
ClCompile:
C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\bin\x86_amd64\CL.exe /c /IF:\Teamcenter10.1.0Env\OCI\include /IF:\Teamcenter10.1.0Env\tcbin\include /Zi /nologo /W1 /WX- /O2 /D IPLIB=none /Gm- /EHsc /MD /GS /fp:precise /Zc:wchar_t /Zc:forScope /Fo"x64\Release\\" /Fd"x64\Release\vc100.pdb" /Gd /TC /errorReport:prompt common_itk_util.c
common_itk_util.c
C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\bin\x86_amd64\CL.exe /c /IF:\Teamcenter10.1.0Env\OCI\include /IF:\Teamcenter10.1.0Env\tcbin\include /Zi /nologo /W1 /WX- /O2 /D IPLIB=none /Gm- /EHsc /MD /GS /fp:precise /Zc:wchar_t /Zc:forScope /Fo"x64\Release\\" /Fd"x64\Release\vc100.pdb" /Gd /TP /errorReport:prompt jf_erp_project.cpp
jf_erp_project.cpp
1>f:\connor项目管理\继峰项目\签名\jf_itk\jf_erp_project\common_itk_util.h(30): error C2065: “logical”: 未声明的标识符
1>f:\connor项目管理\继峰项目\签名\jf_itk\jf_erp_project\common_itk_util.h(30): error C2146: 语法错误: 缺少“)”(在标识符“bypass”的前面)
1>f:\connor项目管理\继峰项目\签名\jf_itk\jf_erp_project\common_itk_util.h(30): error C2182: “set_bypass”: 非法使用“void”类型
1>f:\connor项目管理\继峰项目\签名\jf_itk\jf_erp_project\common_itk_util.h(30): error C2059: 语法错误:“)”
1>F:\Teamcenter10.1.0Env\tcbin\include\pom/pom/pom_errors.h : warning C4819: 该文件包含不能在当前代码页(936)中表示的字符。请将该文件保存为 Unicode 格式以防止数据丢失
1>F:\Teamcenter10.1.0Env\tcbin\include\pom/pom/pom_errors.h : warning C4819: 该文件包含不能在当前代码页(936)中表示的字符。请将该文件保存为 Unicode 格式以防止数据丢失
1>F:\Teamcenter10.1.0Env\tcbin\include\pom/pom/pom_errors.h : warning C4819: 该文件包含不能在当前代码页(936)中表示的字符。请将该文件保存为 Unicode 格式以防止数据丢失
1>f:\connor项目管理\继峰项目\签名\jf_itk\jf_erp_project\string_utils.h(31): error C2732: 链接规范与“Split”的早期规范冲突
f:\connor项目管理\继峰项目\签名\jf_itk\jf_erp_project\string_utils.h(31) : 参见“Split”的声明
1>已完成生成项目“F:\Connor项目管理\继峰项目\签名\jf_itk\jf_erp_project\jf_erp_project.vcxproj”(build 个目标)的操作 - 失败。
生成失败。
已用时间 00:00:00.96

Some files were not shown because too many files have changed in this diff Show More

Loading…
Cancel
Save