...
This commit is contained in:
@@ -0,0 +1,4 @@
|
||||
|
||||
#include "AppParameters.h"
|
||||
|
||||
UserInfo * pStaffInfo = nullptr;
|
@@ -0,0 +1,7 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <iostream>
|
||||
#include "../Datastructure/UserInfo/UserInfo.h"
|
||||
|
||||
extern UserInfo * pStaffInfo;
|
@@ -21,12 +21,12 @@ UserInfo queryUserInfo( const string & userName,
|
||||
int returnCode = 0;
|
||||
|
||||
|
||||
otext szSqlQueryStaff[] =
|
||||
string sqlQueryStaff =
|
||||
"SELECT a.staff_p13, a.staff_name, b.staff_post \n"
|
||||
"FROM staff_info a, \n"
|
||||
"staff_post_code b \n"
|
||||
"WHERE a.staff_post_code = b.staff_post_code \n"
|
||||
"AND a.staff_p13 = :p13 ";
|
||||
"AND a.staff_p13 = :p13";
|
||||
|
||||
returnCode = OCI_Initialize( l_error_handler, nullptr, OCI_ENV_DEFAULT );
|
||||
|
||||
@@ -56,16 +56,16 @@ UserInfo queryUserInfo( const string & userName,
|
||||
{
|
||||
pStmt = OCI_StatementCreate( pConn );
|
||||
|
||||
OCI_Prepare(pStmt, sqlQueryStaff.c_str());
|
||||
OCI_AllowRebinding( pStmt, true );
|
||||
OCI_Prepare( pStmt, szSqlQueryStaff );
|
||||
|
||||
OCI_BindString( pStmt, ":p13", const_cast<otext*>(staffP13.c_str()), staffP13.size() );
|
||||
|
||||
OCI_Execute( pStmt );
|
||||
|
||||
|
||||
pResult = OCI_GetResultset( pStmt );
|
||||
|
||||
//检查结果集,如果没有返回,则说明没有此用户
|
||||
if ( OCI_FetchFirst( pResult ) == false )
|
||||
if ( OCI_FetchNext( pResult ) == false )
|
||||
{
|
||||
throw runtime_error( "用户不存在!" );
|
||||
}
|
||||
|
@@ -2,4 +2,9 @@
|
||||
#pragma once
|
||||
|
||||
#include <iostream>
|
||||
#include "../Datastructure/UserInfo/UserInfo.h"
|
||||
|
||||
UserInfo queryUserInfo( const std::string & userName,
|
||||
const std::string & password,
|
||||
const std::string & tnsName,
|
||||
const std::string & staffP13 );
|
||||
|
Reference in New Issue
Block a user