📄 db_handle.ec
字号:
/*=============================================================
功能: switch处理模块中的数据库处理
作者:
2001/3/25:王永忠:规范程序设计
2001/4/03:王永忠:删除原来有关EDC参数表部分,该部分内容并入参数
中心。
===============================================================*/
#include <stdio.h>
#include <math.h>
#include "mytools.h"
#include "public.h"
#include "macro_def.h"
#define NT_KEY "55565557"
$include "db_struct.h"
EXEC SQL INCLUDE sqlca;
EXEC SQL WHENEVER SQLERROR CALL error_handler;
EXEC SQL WHENEVER SQLWARNING CALL warning_handler;
EXEC SQL WHENEVER NOT FOUND CONTINUE;
EXEC SQL BEGIN DECLARE SECTION;
extern short indi;
extern S_sys_param G_sys_param;
EXEC SQL END DECLARE SECTION;
/*=============== edc_oper 表 ==============
功能:
取edc操作员信息
ENTRY: op->oper_no
op->oper_pwd
RETURN: -1 FAIL
0 SUCC, RESULT-->op
============================================*/
int select_edc_oper( op )
S_edc_oper *op;
{
EXEC SQL BEGIN DECLARE SECTION;
S_edc_oper ope;
EXEC SQL END DECLARE SECTION;
memcpy( &ope, op, sizeof( S_edc_oper ) );
EXEC SQL SELECT * INTO $ope FROM edc_oper
WHERE oper_no = :ope.oper_no
AND oper_pwd = :ope.oper_pwd
AND oper_flag = 'Y'
AND terminal_id = :ope.terminal_id;
if( SQLCODE ) {
errcall(ERROR, "Sel edc_oper err![%d][%s][%s]", SQLCODE,
op->oper_no, op->oper_pwd );
return -1;
}
del_st_space("edc_oper", &ope);
memcpy( op, &ope, sizeof( S_edc_oper ) );
return 0;
}
/*=============== cur_tran_ls 表 ================================
功能:
往cur_tran_ls表中插入一条记录
ENTRY: po
RETURN: -1, FAIL
0, SUCC
===========================================================*/
int insert_posls( po )
S_tran_ls *po;
{
$S_tran_ls l_tran_ls;
memcpy( &l_tran_ls, po, sizeof( S_tran_ls ));
EXEC SQL INSERT INTO cur_tran_ls VALUES( :l_tran_ls );
if( SQLCODE ) {
errcall(ERROR, "插当前交易流水表失败[%d]", SQLCODE);
return -1;
}
return 0;
}
int Is_headquarter ()
{
$int cnt;
$short indi;
$select count(*) into $cnt:indi from bank_info
where adm_bank_id = $G_sys_param.bank_id and
adm_host_id = $G_sys_param.host_id;
if ( SQLCODE < 0 ) {
errcall(ERROR,
"Unable select count(*) from bank_info !(%d)", SQLCODE);
return -1;
}
if ( indi == -1 || cnt == 0 ) {
return 0;
}
if ( cnt > 0 ) {
return 1;
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -