完善目录结构

完善了目录结构,添加了以前的web段com组件调用的代码(在/测试目录下)(部署没有使用到)
This commit is contained in:
yanshui177
2017-05-17 20:43:16 +08:00
parent ad754709a5
commit 6dcd378738
1246 changed files with 671388 additions and 517 deletions

View File

@@ -0,0 +1,193 @@
#import "C:\Program Files\Common Files\System\ado\msado15.dll" no_namespace rename("EOF","EndOfFile")
#include <vector>
#include <string>
#include <iostream>
#include <windows.h>
#include <iomanip>
#include <stdio.h>
using namespace std;
//string g_db_hostName = "192.168.200.97"; /*全局变量 服务器ip或名称*/
//string g_db_dBName = "purple"; /*全局变量 服务器ODBC数据源*/
//string g_db_userName = "BJSH"; /*全局变量 服务器用户名*/
//string g_db_password = "bjshadmin"; /*全局变量 服务器密码*/
string g_db_hostName = "localhost"; /*全局变量 服务器ip或名称*/
string g_db_dBName = "orcl123"; /*全局变量 服务器ODBC数据源*/
string g_db_userName = "yannsy"; /*全局变量 服务器用户名*/
string g_db_password = "123456"; /*全局变量 服务器密码*/
string g_db_qurry_start = "200906"; /*全局变量 数据库查询_开始日期*/
string g_db_qurry_end = "201610"; /*全局变量 数据库查询_结束日期*/
string g_db_qurry_zone = "0"; /*全局变量 数据库查询_特定区域*/
string g_db_qurry_stu_num = "0"; /*全局变量 数据库查询_特定考号*/
bool g_db_qurry_all = true; /*全局变量 数据库查询_查询全部标记*/
_ConnectionPtr p_conn; /*全局变量 连接对象*/
_RecordsetPtr p_recordset; /*全局变量 记录集对象*/
_CommandPtr p_cmd; /*全局变量 操作集对象*/
string str_conn; /*全局变量 连接字符串设置*/
/**
程序功能: 根据string类的stu【存储学号】搜索出所有此人的考试信息,并分别存储在不同的变量中
@变量 stuNum 学号
@变量 date<vector> 考试时间
@变量 subject<vector> 考试科目
@变量 stuNum<vector> 考号
@返回值 成功1 失败0
*/
int DbImg(string stuNum, vector<string>& dateVec, vector<string>& subjectVec, vector<string>& stuNum2)//搜寻图片
{
/*字符转换,方便使用*/
string userName(g_db_userName.c_str());
string password(g_db_password.c_str());
string hostName(g_db_hostName.c_str());
string dBName(g_db_dBName.c_str());
/*创建链接描述符*/
str_conn = "Provider=OraOLEDB.Oracle.1;Persist Security Info = true;User ID = "; //==================//
str_conn += userName; //===仅初始化一次===//
str_conn += ";Password="; //==================//
str_conn += password;
str_conn += ";Data Source = (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST=";
str_conn += hostName;
str_conn += ")(PORT=1521))(CONNECT_DATA=(SERVICE_NAME=";
str_conn += dBName;
str_conn += ")))";
//构造查询语句 下句注释是sql语句需要构造成这种类型
/*select KS_ZKZ, KSSJ, TJ_KC_DM from ZK.T_BYSQ_KS_KC WHERE KSSJ between '200907' and '201510' and KS_ZKZ = 010207203867*/
/*string sql = "select KS_ZKZ2, KSSJ, TJ_KC_DM from ZK.T_BYSQ_KS_KC WHERE KSSJ between '200907' and '201504' AND KS_ZKZ = ";*/
string sql = "select KS_ZKZ, KSSJ, TJ_KC_DM from YANNSY.T_BYSQ_KS_KC WHERE KSSJ between ";
sql += g_db_qurry_start;
sql += " and ";
sql += g_db_qurry_end;
sql += "AND KS_ZKZ =";
sql += stuNum.c_str();
_bstr_t _vstr_sql(sql.c_str());/* 转换string为_variant_t */
::CoInitialize(NULL);//初始化com组件
/*创建、打开连接*/
try{
p_conn.CreateInstance("ADODB.Connection");//创建连接
p_recordset.CreateInstance("ADODB.Recordset");//创建结果集,也就是实例化
p_cmd.CreateInstance("ADODB.Command");
// p_conn->CursorLocation = adUseClient; //存储过程同时返回记录集和返回值
p_conn->CursorLocation = adUseServer; //存储过程同时返回记录集和返回值
p_conn->Open(_bstr_t(str_conn.c_str()), _bstr_t(userName.c_str()), _bstr_t(password.c_str()), adConnectUnspecified);
p_cmd.CreateInstance("ADODB.Command");
cout<<"执行完毕"<<endl;
p_cmd->ActiveConnection = p_conn;
HRESULT hr = p_recordset->Open(_bstr_t(_vstr_sql),//执行sq语句查询一个学生的所有考试信息
p_conn.GetInterfacePtr(),
adOpenStatic,
adLockOptimistic,
adCmdText);
//将结果集输出到三个vector变量中
if (p_recordset->RecordCount < 1)//结果集为空
{
return 0;//没有信息,直接跳过这个人
}
do{ //将结果集输出到三个vector变量中
dateVec.push_back((string)(_bstr_t)(p_recordset->Fields->GetItem(_variant_t("KSSJ"))->GetValue()));
subjectVec.push_back((string)(_bstr_t)(p_recordset->Fields->GetItem(_variant_t("TJ_KC_DM"))->GetValue()));
stuNum2.push_back((string)(_bstr_t)(p_recordset->Fields->GetItem(_variant_t("KS_ZKZ2"))->GetValue()));
p_recordset->MoveNext();
} while (!p_recordset->EndOfFile);
}
catch (_com_error e){ }
/*关闭查询*/
try { ::CoUninitialize(); }
catch (_com_error e){ printf("%x\n%x", e.Description(),e.ErrorInfo()); }
return 0;
}
/**
程序功能: 更新学生数据库信息,根据学生的鉴定结果,将结果输出到数据库中
@变量 stuNum学号
@变量 subject考试科目
@变量 flagCheat作弊标记
@返回值 成功1失败0
*/
int DbUpdate(string stuNum,
vector<string> dateVec,
vector<string> subjectVec,
vector<string> stuNum2,
vector<string> flagVec)
{
/*字符转换,方便使用*/
string userName(g_db_userName.c_str());
string password(g_db_password.c_str());
string hostName(g_db_hostName.c_str());
string dBName(g_db_dBName.c_str());
/*更新字串设置*/
int count = subjectVec.size();
vector<string > sqlKC; //课程表:作弊第一字段
int ci = 0; //循环
string flagSQL = "0";//标记 机器审核结果表
for (ci = 0; ci < count; ++ci)
{
if (flagVec[ci] == "1")
flagSQL = "1";
/*作弊的*/
string sqlKC1 = "UPDATE YANNSY.T_BYSQ_KS_KC SET BJSH_JG_JQ =";//天津_课程_代码
sqlKC1 += flagVec[ci].c_str();
sqlKC1 += " WHERE KS_ZKZ2=";
sqlKC1 += stuNum2[ci].c_str();
sqlKC1 += " AND TJ_KC_DM=";
sqlKC1 += subjectVec[ci].c_str();
sqlKC1 += " AND KSSJ=";
sqlKC1 += dateVec[ci].c_str();
sqlKC1 += " AND KS_ZKZ=";
sqlKC1 += stuNum.c_str();
sqlKC.push_back(sqlKC1);
}
::CoInitialize(NULL);//初始化com组件
/*更新数据库表*/
try{
p_conn.CreateInstance("ADODB.Connection");//创建连接
p_recordset.CreateInstance("ADODB.Recordset");//创建结果集,也就是实例化
p_cmd.CreateInstance("ADODB.Command");
p_conn->CursorLocation = adUseClient; //存储过程同时返回记录集和返回值
p_conn->Open(_bstr_t(str_conn.c_str()), _bstr_t(userName.c_str()), _bstr_t(password.c_str()), adConnectUnspecified);
p_cmd->ActiveConnection = p_conn;
for (ci = 0; ci < count; ++ci)
{
p_recordset->Open(_bstr_t(sqlKC[ci].c_str()),//更新第二条
p_conn.GetInterfacePtr(),
adOpenStatic,
adLockOptimistic,
adCmdText);
}
}
catch (_com_error e){ }
/*关闭查询*/
try {
::CoUninitialize();
}
catch (_com_error e){ }
return 0;
}

View File

@@ -0,0 +1 @@
Provider=MSDAORA.Oracle.1;Password=123456;User ID=yannsy;Data Source=127.0.0.1:1521/yannsy;Persist Security Info=True

View File

@@ -0,0 +1,22 @@
#include <iostream>
#include <io.h>
#include <windows.h>
#include <string>
#include <iomanip>
#include <vector>
using namespace std;
int DbImg(string, vector<string>&, vector<string>&, vector<string>&);
void main()
{
string num="010209400748";
cout<<"查询的考生学号为:"<<num<<endl;
vector<string> date_vec,subject_vec,stu_num2;
DbImg(num, date_vec, subject_vec, stu_num2);
for (int i = 0; i < date_vec.size();i++)
{
cout << "考生:" << num << subject_vec[i] << " " << date_vec[i] << " " << stu_num2[i] << endl;
}
}

View File

@@ -0,0 +1,104 @@
# Microsoft Developer Studio Project File - Name="oracle" - Package Owner=<4>
# Microsoft Developer Studio Generated Build File, Format Version 6.00
# ** DO NOT EDIT **
# TARGTYPE "Win32 (x86) Console Application" 0x0103
CFG=oracle - Win32 Debug
!MESSAGE This is not a valid makefile. To build this project using NMAKE,
!MESSAGE use the Export Makefile command and run
!MESSAGE
!MESSAGE NMAKE /f "oracle.mak".
!MESSAGE
!MESSAGE You can specify a configuration when running NMAKE
!MESSAGE by defining the macro CFG on the command line. For example:
!MESSAGE
!MESSAGE NMAKE /f "oracle.mak" CFG="oracle - Win32 Debug"
!MESSAGE
!MESSAGE Possible choices for configuration are:
!MESSAGE
!MESSAGE "oracle - Win32 Release" (based on "Win32 (x86) Console Application")
!MESSAGE "oracle - Win32 Debug" (based on "Win32 (x86) Console Application")
!MESSAGE
# Begin Project
# PROP AllowPerConfigDependencies 0
# PROP Scc_ProjName ""
# PROP Scc_LocalPath ""
CPP=cl.exe
RSC=rc.exe
!IF "$(CFG)" == "oracle - Win32 Release"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 0
# PROP BASE Output_Dir "Release"
# PROP BASE Intermediate_Dir "Release"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 0
# PROP Output_Dir "Release"
# PROP Intermediate_Dir "Release"
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
# ADD CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
# ADD BASE RSC /l 0x804 /d "NDEBUG"
# ADD RSC /l 0x804 /d "NDEBUG"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 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 /nologo /subsystem:console /machine:I386
# ADD LINK32 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 /nologo /subsystem:console /machine:I386
!ELSEIF "$(CFG)" == "oracle - Win32 Debug"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 1
# PROP BASE Output_Dir "Debug"
# PROP BASE Intermediate_Dir "Debug"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 1
# PROP Output_Dir "Debug"
# PROP Intermediate_Dir "Debug"
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c
# ADD CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c
# ADD BASE RSC /l 0x804 /d "_DEBUG"
# ADD RSC /l 0x804 /d "_DEBUG"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 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 /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
# ADD LINK32 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 /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
!ENDIF
# Begin Target
# Name "oracle - Win32 Release"
# Name "oracle - Win32 Debug"
# Begin Group "Source Files"
# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
# Begin Source File
SOURCE=.\DB.CPP
# End Source File
# Begin Source File
SOURCE=.\main.cpp
# End Source File
# End Group
# Begin Group "Header Files"
# PROP Default_Filter "h;hpp;hxx;hm;inl"
# End Group
# Begin Group "Resource Files"
# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
# End Group
# End Target
# End Project

View File

@@ -0,0 +1,29 @@
Microsoft Developer Studio Workspace File, Format Version 6.00
# 警告: 不能编辑或删除该工作区文件!
###############################################################################
Project: "oracle"=.\oracle.dsp - Package Owner=<4>
Package=<5>
{{{
}}}
Package=<4>
{{{
}}}
###############################################################################
Global:
Package=<5>
{{{
}}}
Package=<3>
{{{
}}}
###############################################################################

View File

@@ -0,0 +1,16 @@
<html>
<body>
<pre>
<h1>Build Log</h1>
<h3>
--------------------Configuration: oracle - Win32 Debug--------------------
</h3>
<h3>Command Lines</h3>
<h3>Results</h3>
oracle.exe - 0 error(s), 0 warning(s)
</pre>
</body>
</html>