diff --git a/code/README b/code/README index 5c04966..57a377f 100644 --- a/code/README +++ b/code/README @@ -1,63 +1,20 @@ ---V1.14 -- -2015-12-29 -修正了common.c中对日志消息队列的操作,其中包括:交换log_prepare与log_writing>队列指针的bug;以及在写入log_prepare队列时未检查已写入消息是否大于队列长度的b -ug。修正了log_path(即日志文件名)不会随时间改变的bug。 ---V1.13 -- -2015-12-23 -修正在记录日志中检查目录时(在函数create_dir中),由于采用线程进行日志记录,多次调用get_nic_info可能会导致的将日志文件路径名变错的问题。在get_nic_info中判断log_path是否被初始化过,如过未初始化,则到共享内存中读取。否则,为初始化过,直接使用该值,并在create_dir中使用局部变量保存该值,在create_dir中使用操作该局部变量,而不去改变该全局变量的值。 - --V1.12 -- -2015-12-23 -修正在程序开始时对IPC变量删除的错误函数调用。 -添加配置项crazyping,当其不为零时,会在每次取网卡信息时进行ping操作。 - - ---V1.11 -- -2015-12-18 -添加在程序开始时对IPC变量是否已存在的判断,如果已存在,则将其删除。 -将宏TESTINTERVAL的定义去除,不然不会调用南瑞的库函数。 - ---V1.10 -- -2015-12-11 -修改IPC信号量的相关操作 - -1)通过对代码的分析发现:在使用信号量时存在错误。在使用进行PV原语操作时,进行了相反的操作,其中加锁操作应减少信号量的计数,而去锁应增加信号量的计数,但库中进行了相反的操作,对其进行了修改。即将get_sem中对信号量的操作改为-1,而在release_sem函数中对信号量的操作变为1(即+1)。同时在init_sem函数中将该信号量的值初始化为1。 - -2)信号量应由网卡监控程序sys_nicmonitor创建,而不应由用户程序创建,对其进行了相应的修改(在创建信号量时在flag中添加IPC_EXCL,并将用户程序引用信号量时的flag中去除IPC_CREATE)。 - -3)在对获取网卡信息函数get_nic_info中添加获取时间的操作后得知,其中对getpwdnam的调用会减慢函数的工作(该函数并非每次都减慢函数很多,多数在30~40ms左右,但在测试中曾达到2s左右)。对其修改为在sys_nicmonitor程序启动时,调用getpwdnam函数,并将得到的用户主目录名写入到一块共享内存中。当用户程序要获得该目录名时,则从该值从共享内存中读取出来,而不需要每次都通过getpwdnam来获取,故可以提高该函数的速度。 - - -=-======update 2015-11-17 -编译前,进入dep目录运行sh run.sh,安装编译依赖文件. - -然后sh build.sh编译1.9版本的sys_nicmonitor#1.9-x86_64-Linx-Rocky4.2.pkg.tar.gz - -调试模式下: -cd sys_nicmonitor-1.9 -make clean -make -make test -make runtest - -版本号变更方法,更新sys_nicmonitor/version.h文件,需要同时修改//后面的和define中的,前者用于pkg包,后者用于sys_nicmonitor程序. -制作pkg包方法: sh build.sh - - - ========= 编译前准备: - 编译前先安装dotconf软件包。 - libman.so拷贝到/usr/lib64/下 - pkgadd dotconf#1.0.13-1.pkg.tar.gz + * 安装dotconf相关软件包。 + * 拷贝libproc_common.so库文件到动态库中 编译说明: 在Rocky 4.2上编译 - - 执行: sh build.sh + 1. 执行 sh 42/run.sh + 2 执行: sh build.sh 将在当前的目录下生成安装包: sys_nicmonitor#1.9-x86_64-Linx-Rocky4.2.pkg.tar.gz + 在Linx 90上编译 + 1. 执行 sh 90/run.sh + 2. 进入到sys_nicmonitor中执行make + 将在sys_nicmonitor中生成libnic_shm.so和sys_nicmonitor + ======== 安装说明: 1)安装,以root的用户执行安装命令: @@ -75,63 +32,20 @@ make runtest ======== 版本说明: ---V1.9 -- - 2013-08-12 - 1)修复问题:占用内存快速累加,导致内存占用很大 - 问题描述:日志线程资源退出时未回收,导致占用内存快速累加 - 解决办法:修改为一个日志线程,并且线程退出时设置为自动回收。 - 将日志写文件的地方放到common.c中,以便动态库和daemon程序使用一个。 - - 2)修复问题:日志文件名在家目录或者var目录下,未在规定位置 - 问题描述:日志文件命名在一个单独的线程进行,导致日志线程和该线程对log_path存在同时访问的情况。 - 导致在换天或者换月时,日志文件名变更一半时,日志写线程此时写日志,用未更新完成的 - log_path创建日志,导致日志文件不再规定的位置。 - 解决办法:增加线程互斥锁pthread_mutex对log_path进行保护,修复该问题。 + 详见sys_nicmonitor目录中的README ---V1.8.1-- - 2013-06-05 - 1)修改BUG:ping_gw函数当PING失败时没有尝试对余下的GW进行PING操作 - 2)增加环境变量SYS_NIC_DEBUG用于调试流量抖动问题。 +=-======update 2015-11-17 +编译前,进入dep目录运行sh run.sh,安装编译依赖文件. ---V1.8 -- - 2013-05-27 -对系统高磁盘IO情况下,应用如果进行IO将可能会被阻塞。本版本为此作出调整。 -cs-fes1上编译测试OK。 +然后sh build.sh编译1.9版本的sys_nicmonitor#1.9-x86_64-Linx-Rocky4.2.pkg.tar.gz -1) 去掉shm和sem的实体文件 -#define SHM_PATH "$D5000_HOME/share/sys_netcard_shm_path" -#define SEM_PATH "$D5000_HOME/share/sys_netcard_sem_path" - -用key=0x1d5200 代替 sem -用key=0x1d5010 代替 shm - - -2)去掉动态库中get_nic_info接口中,判断路径的opendir调用,采用实际路径 - 上层应用每秒可能调用3次这个接口,每判断一个网卡都调用一次,判断都个网卡的状态时就调用多次。 - - 可改进:一次调用get_nic_info接口,可输入多个网卡,一次返回所有网卡状态信息。 - -3) record_log函数为日志函数,每次写一次,都重新打开一次文件。 - 修改为线程模式,当记录日志时,不会被磁盘IO阻塞。 - -4) 安装目录为d5000用户的HOME目录下的lib和bin目录 - ----- - - -V1.6与V1.7差异 -共享内存路径修改: -由/home/d5000/someone/tmp/sys_netcard_shm_path 改为 /home/d5000/someone/share/sys_netcard_shm_path -信号量路径修改: -由/home/d5000/someone/tmp/sys_netcard_sem_path 改为 /home/d5000/someone/share/sys_netcard_sem_path - -注意:在编译过程中,需要动态看libman.so,它存放在目录 tags/下面 ,在进行编译的时候需要将其拷贝到 -/lib64/目录下,编译的基础环境是 Rocky 4.2 系统。 - -pkgmk命令的使用: -将源代码打包成name-version.tar.gz样式,编写Pkgfile文件。 -使用命令: - pkgmk -um #更新软件包的md5值 - pkgmk -kw #制作pkg安装包 +调试模式下: +cd sys_nicmonitor-1.9 +make clean +make +make test +make runtest +版本号变更方法,更新sys_nicmonitor/version.h文件,需要同时修改//后面的和define中的,前者用于pkg包,后者用于sys_nicmonitor程序. +制作pkg包方法: sh build.sh diff --git a/code/dep/42/dotconf#1.0.13-1.pkg.tar.gz b/code/dep/42/dotconf#1.0.13-1.pkg.tar.gz new file mode 100644 index 0000000..a10b81a Binary files /dev/null and b/code/dep/42/dotconf#1.0.13-1.pkg.tar.gz differ diff --git a/code/dep/42/run.sh b/code/dep/42/run.sh new file mode 100644 index 0000000..d9cea83 --- /dev/null +++ b/code/dep/42/run.sh @@ -0,0 +1,2 @@ +pkgadd dotconf#1.0.13-1.pkg.tar.gz +cp ../libproc_common.so /usr/lib64/ diff --git a/code/dep/90/libdotconf-dev_1.3-0.2_amd64.deb b/code/dep/90/libdotconf-dev_1.3-0.2_amd64.deb new file mode 100644 index 0000000..8cb15fd Binary files /dev/null and b/code/dep/90/libdotconf-dev_1.3-0.2_amd64.deb differ diff --git a/code/dep/90/libdotconf-dev_1.3-0.2_arm64.deb b/code/dep/90/libdotconf-dev_1.3-0.2_arm64.deb new file mode 100644 index 0000000..bdec20a Binary files /dev/null and b/code/dep/90/libdotconf-dev_1.3-0.2_arm64.deb differ diff --git a/code/dep/90/libdotconf0_1.3-0.2_amd64.deb b/code/dep/90/libdotconf0_1.3-0.2_amd64.deb new file mode 100644 index 0000000..5b71054 Binary files /dev/null and b/code/dep/90/libdotconf0_1.3-0.2_amd64.deb differ diff --git a/code/dep/90/libdotconf0_1.3-0.2_arm64.deb b/code/dep/90/libdotconf0_1.3-0.2_arm64.deb new file mode 100644 index 0000000..251d8b4 Binary files /dev/null and b/code/dep/90/libdotconf0_1.3-0.2_arm64.deb differ diff --git a/code/dep/90/run.sh b/code/dep/90/run.sh new file mode 100644 index 0000000..b33859e --- /dev/null +++ b/code/dep/90/run.sh @@ -0,0 +1,12 @@ +#!/bin/bash + +arch=`uname -m` +if [ "x$arch" == "x86_64" ]; then +dpkg -i libdotconf0_1.3-0.2_amd64.deb +dpkg -i libdotconf-dev_1.3-0.2_amd64.deb +elif [ "x$arch" == "aarch64" ]; then +dpkg -i libdotconf0_1.3-0.2_arm64.deb +dpkg -i libdotconf-dev_1.3-0.2_arm64.deb +fi + +cp ../libproc_common.so /usr/lib/ diff --git a/code/dep/libproc_common.so b/code/dep/libproc_common.so new file mode 100755 index 0000000..9edae3b Binary files /dev/null and b/code/dep/libproc_common.so differ diff --git a/code/dep/old/libman.so b/code/dep/old/libman.so new file mode 100644 index 0000000..c78c12a Binary files /dev/null and b/code/dep/old/libman.so differ diff --git a/code/dep/proc_common.cpp b/code/dep/proc_common.cpp new file mode 100644 index 0000000..fac43d3 --- /dev/null +++ b/code/dep/proc_common.cpp @@ -0,0 +1,19 @@ +#include +#include "proc_common.h" + + +NS_SYSADMIN::CProcCommon::CProcCommon(int rw) +{ + printf("NS_SYSADMIN::CProcCommon::CProcCommon\n"); +} + +NS_SYSADMIN::CProcCommon::~CProcCommon() +{ + printf("NS_SYSADMIN::CProcCommon::~CProcCommon\n"); +} + +int NS_SYSADMIN::CProcCommon::proc_init(const char* scn_name, const char* subscn_name,char* process_name, const char* label = NULL, const char* subscn_lable = NULL) +{ + printf("NS_SYSADMIN::CProcCommon::proc_init\n"); + return 0; +} diff --git a/code/sys_nicmonitor-code.tar.gz b/code/sys_nicmonitor-code.tar.gz new file mode 100644 index 0000000..f472a21 Binary files /dev/null and b/code/sys_nicmonitor-code.tar.gz differ diff --git a/code/sys_nicmonitor/Makefile b/code/sys_nicmonitor/Makefile index 0650dfc..9d919ad 100644 --- a/code/sys_nicmonitor/Makefile +++ b/code/sys_nicmonitor/Makefile @@ -7,16 +7,17 @@ include $(DEFAULTS) all:sys_nicmonitor libnic_shm.so test #CFLAGS += -D TESTINTERVAL -Wall -Wformat=2 -Wno-format-extra-args -Wformat-security -Wformat-nonliteral -O0 -g -CFLAGS += -Wall -Wformat=2 -Wno-format-extra-args -Wformat-security -Wformat-nonliteral -O0 -g +CFLAGS += -I ./include -Wall -Wformat=2 -Wno-format-extra-args -Wformat-security -Wformat-nonliteral -O0 +#CFLAGS += -I ./include -D USER_NUSP -Wall -Wformat=2 -Wno-format-extra-args -Wformat-security -Wformat-nonliteral -O0 sys_nicmonitor:mnic.o read_netcard.o send_alarm.o - $(CC) -lman -ldotconf -lpthread -o $@ $^ + $(CC) $(CFLAGS) -lproc_common -ldotconf -lpthread -o $@ $^ libnic_shm.so:nicinfo_shm.o $(CC) -fpic -shared -o $@ $^ nicinfo_shm.o:nicinfo_shm.c $(CC) $(CFLAGS) -fPIC -c $^ -test:test.c - gcc -o test test.c -lnic_shm -L=./ -lpthread +test:test.c + gcc -o test test.c -lnic_shm -L./ -lpthread runtest: LD_LIBRARY_PATH=./ ./test bond0 5000 & clean: diff --git a/code/sys_nicmonitor/README b/code/sys_nicmonitor/README index 5f208ab..10d5611 100644 --- a/code/sys_nicmonitor/README +++ b/code/sys_nicmonitor/README @@ -1,3 +1,78 @@ +======== +版本说明: +--V1.22 -- + 2020-07-09 + 1)根本南瑞郭海龙要求进行接口的修改 + 取消之前libman.so动态库和proc_inv.h头文件,改为新的libproc_common.so动态库,同时增加include头文件目录 + 2020-10-22 + 1) 修复sys_nicmonitor进程重启后,再调用get_nic_info接口时出现的大量告警日志问题 + 问题描述:sys_nicmonitor进程重新启动时,调用接口程序会输出告警日志,日志的增长量和调用接口频率成正比增长 + 解决办法:接口程序增加sys_nicmonitor进程状态检测,当sys_nicmonitor进程重启时,接口程序重新获取新信号量的id + +--V1.21 -- + 2019-09-05 + 1)修复问题:monitor_interval参数溢出导致cpu 100% + 问题描述:当monitor_interval参数配置为1000时,出现进程cpu占用100%的问题 + 解决办法:增加对monitor_interval配置的检测和限制 + +--V1.9 -- + 2013-08-12 + 1)修复问题:占用内存快速累加,导致内存占用很大 + 问题描述:日志线程资源退出时未回收,导致占用内存快速累加 + 解决办法:修改为一个日志线程,并且线程退出时设置为自动回收。 + 将日志写文件的地方放到common.c中,以便动态库和daemon程序使用一个。 + + 2)修复问题:日志文件名在家目录或者var目录下,未在规定位置 + 问题描述:日志文件命名在一个单独的线程进行,导致日志线程和该线程对log_path存在同时访问的情况。 + 导致在换天或者换月时,日志文件名变更一半时,日志写线程此时写日志,用未更新完成的 + log_path创建日志,导致日志文件不再规定的位置。 + 解决办法:增加线程互斥锁pthread_mutex对log_path进行保护,修复该问题。 + +--V1.8.1 -- + 2013-06-05 + 1)修改BUG:ping_gw函数当PING失败时没有尝试对余下的GW进行PING操作 + 2)增加环境变量SYS_NIC_DEBUG用于调试流量抖动问题。 + +--V1.8 -- + 2013-05-27 +对系统高磁盘IO情况下,应用如果进行IO将可能会被阻塞。本版本为此作出调整。 +cs-fes1上编译测试OK。 + +1) 去掉shm和sem的实体文件 +#define SHM_PATH "$D5000_HOME/share/sys_netcard_shm_path" +#define SEM_PATH "$D5000_HOME/share/sys_netcard_sem_path" + +用key=0x1d5200 代替 sem +用key=0x1d5010 代替 shm + + +2)去掉动态库中get_nic_info接口中,判断路径的opendir调用,采用实际路径 + 上层应用每秒可能调用3次这个接口,每判断一个网卡都调用一次,判断都个网卡的状态时就调用多次。 + + 可改进:一次调用get_nic_info接口,可输入多个网卡,一次返回所有网卡状态信息。 + +3) record_log函数为日志函数,每次写一次,都重新打开一次文件。 + 修改为线程模式,当记录日志时,不会被磁盘IO阻塞。 + +4) 安装目录为d5000用户的HOME目录下的lib和bin目录 + +--V1.7 -- + +V1.6与V1.7差异 +共享内存路径修改: +由/home/d5000/someone/tmp/sys_netcard_shm_path 改为 /home/d5000/someone/share/sys_netcard_shm_path +信号量路径修改: +由/home/d5000/someone/tmp/sys_netcard_sem_path 改为 /home/d5000/someone/share/sys_netcard_sem_path + +注意:在编译过程中,需要动态看libman.so,它存放在目录 tags/下面 ,在进行编译的时候需要将其拷贝到 +/lib64/目录下,编译的基础环境是 Rocky 4.2 系统。 + +pkgmk命令的使用: +将源代码打包成name-version.tar.gz样式,编写Pkgfile文件。 +使用命令: + pkgmk -um #更新软件包的md5值 + pkgmk -kw #制作pkg安装包 + --V1.14 -- 2015-12-29 修正了common.c中对日志消息队列的操作,其中包括:交换log_prepare与log_writing>队列指针的bug;以及在写入log_prepare队列时未检查已写入消息是否大于队列长度的b @@ -26,118 +101,3 @@ ug。修正了log_path(即日志文件名)不会随时间改变的bug。 2)信号量应由网卡监控程序sys_nicmonitor创建,而不应由用户程序创建,对其进行了相应的修改(在创建信号量时在flag中添加IPC_EXCL,并将用户程序引用信号量时的flag中去除IPC_CREATE)。 3)在对获取网卡信息函数get_nic_info中添加获取时间的操作后得知,其中对getpwdnam的调用会减慢函数的工作(该函数并非每次都减慢函数很多,多数在30~40ms左右,但在测试中曾达到2s左右)。对其修改为在sys_nicmonitor程序启动时,调用getpwdnam函数,并将得到的用户主目录名写入到一块共享内存中。当用户程序要获得该目录名时,则从该值从共享内存中读取出来,而不需要每次都通过getpwdnam来获取,故可以提高该函数的速度。 - - -=-======update 2015-11-17 -编译前,进入dep目录运行sh run.sh,安装编译依赖文件. - -然后sh build.sh编译1.9版本的sys_nicmonitor#1.9-x86_64-Linx-Rocky4.2.pkg.tar.gz - -调试模式下: -cd sys_nicmonitor-1.9 -make clean -make -make test -make runtest - -版本号变更方法,更新sys_nicmonitor/version.h文件,需要同时修改//后面的和define中的,前者用于pkg包,后者用于sys_nicmonitor程序. -制作pkg包方法: sh build.sh - - - -========= -编译前准备: - 编译前先安装dotconf软件包。 - libman.so拷贝到/usr/lib64/下 - pkgadd dotconf#1.0.13-1.pkg.tar.gz - -编译说明: - 在Rocky 4.2上编译 - - 执行: sh build.sh - 将在当前的目录下生成安装包: - sys_nicmonitor#1.9-x86_64-Linx-Rocky4.2.pkg.tar.gz - -======== -安装说明: - 1)安装,以root的用户执行安装命令: - pkgadd sys_nicmonitor#1.9-x86_64-Linx-Rocky4.2.pkg.tar.gz - 如果之前已经安装,则可先卸载旧的然后再安装,或者通过更新方式安装 - 卸载命令: pkgrm sys_nicmonitor - 更新方式安装命令: - pkgadd -u sys_nicmonitor#1.9-x86_64-Linx-Rocky4.2.pkg.tar.gz - - 2)查看安装是否成功 - pkginfo -i|grep sys_nicmonitor - 或者 - 查看d5000用户的目录下lib/libnic_shm.so和bin/sys_nicmonitor的日期是否匹配 - -======== - -版本说明: ---V1.21 -- - 2019-09-05 - 1)修复问题:monitor_interval参数溢出导致cpu 100% - 问题描述:当monitor_interval参数配置为1000时,出现进程cpu占用100%的问题 - 解决办法:增加对monitor_interval配置的检测和限制 - ---V1.9 -- - 2013-08-12 - 1)修复问题:占用内存快速累加,导致内存占用很大 - 问题描述:日志线程资源退出时未回收,导致占用内存快速累加 - 解决办法:修改为一个日志线程,并且线程退出时设置为自动回收。 - 将日志写文件的地方放到common.c中,以便动态库和daemon程序使用一个。 - - 2)修复问题:日志文件名在家目录或者var目录下,未在规定位置 - 问题描述:日志文件命名在一个单独的线程进行,导致日志线程和该线程对log_path存在同时访问的情况。 - 导致在换天或者换月时,日志文件名变更一半时,日志写线程此时写日志,用未更新完成的 - log_path创建日志,导致日志文件不再规定的位置。 - 解决办法:增加线程互斥锁pthread_mutex对log_path进行保护,修复该问题。 - - ---V1.8.1-- - 2013-06-05 - 1)修改BUG:ping_gw函数当PING失败时没有尝试对余下的GW进行PING操作 - 2)增加环境变量SYS_NIC_DEBUG用于调试流量抖动问题。 - ---V1.8 -- - 2013-05-27 -对系统高磁盘IO情况下,应用如果进行IO将可能会被阻塞。本版本为此作出调整。 -cs-fes1上编译测试OK。 - -1) 去掉shm和sem的实体文件 -#define SHM_PATH "$D5000_HOME/share/sys_netcard_shm_path" -#define SEM_PATH "$D5000_HOME/share/sys_netcard_sem_path" - -用key=0x1d5200 代替 sem -用key=0x1d5010 代替 shm - - -2)去掉动态库中get_nic_info接口中,判断路径的opendir调用,采用实际路径 - 上层应用每秒可能调用3次这个接口,每判断一个网卡都调用一次,判断都个网卡的状态时就调用多次。 - - 可改进:一次调用get_nic_info接口,可输入多个网卡,一次返回所有网卡状态信息。 - -3) record_log函数为日志函数,每次写一次,都重新打开一次文件。 - 修改为线程模式,当记录日志时,不会被磁盘IO阻塞。 - -4) 安装目录为d5000用户的HOME目录下的lib和bin目录 - ----- - - -V1.6与V1.7差异 -共享内存路径修改: -由/home/d5000/someone/tmp/sys_netcard_shm_path 改为 /home/d5000/someone/share/sys_netcard_shm_path -信号量路径修改: -由/home/d5000/someone/tmp/sys_netcard_sem_path 改为 /home/d5000/someone/share/sys_netcard_sem_path - -注意:在编译过程中,需要动态看libman.so,它存放在目录 tags/下面 ,在进行编译的时候需要将其拷贝到 -/lib64/目录下,编译的基础环境是 Rocky 4.2 系统。 - -pkgmk命令的使用: -将源代码打包成name-version.tar.gz样式,编写Pkgfile文件。 -使用命令: - pkgmk -um #更新软件包的md5值 - pkgmk -kw #制作pkg安装包 - diff --git a/code/sys_nicmonitor/include/common_types.h b/code/sys_nicmonitor/include/common_types.h new file mode 100644 index 0000000..f8c97a9 --- /dev/null +++ b/code/sys_nicmonitor/include/common_types.h @@ -0,0 +1,95 @@ +#ifndef _COMMON_TYPES_H +#define _COMMON_TYPES_H + +#ifdef _LINUX +#include +#include +#include +#include +#include +#include +#include +#endif + +#include +//support ILP32/LLP64/LP64 +//8bit +typedef signed char cmnInt8; +typedef unsigned char cmnUint8; +typedef cmnUint8 cmnByte; + +//16bit +typedef signed short cmnInt16; +typedef unsigned short cmnUint16; +typedef cmnUint16 cmnWord; + +//32bit +typedef int cmnInt32; +typedef unsigned int cmnUint32; +#define CMN_PRdINT32 "d" +#define CMN_PRuUINT32 "u" +#define CMN_PRxUINT32 "x" +#define CMN_PRXUINT32 "X" + +#ifdef _WINDOWS_ + #if _MSC_VER >= 1400 + typedef long long cmnInt64; + typedef unsigned long long cmnUint64; + #define CMN_PRdINT64 "lld" + #define CMN_PRuUINT64 "llu" + #define CMN_PRxUINT64 "llx" + #define CMN_PRXUINT64 "llX" + #else + typedef __int64 cmnInt64; + typedef unsigned __int64 cmnUint64; + #define CMN_PRdINT64 "I64d" + #define CMN_PRuUINT64 "I64u" + #define CMN_PRxUINT64 "I64x" + #define CMN_PRXUINT64 "I64X" + #endif + #ifdef _WIN64 + typedef cmnInt64 cmnPtInt; + typedef cmnUint64 cmnPtUint; + #define CMN_PRdPTINT CMN_PRdINT64 + #define CMN_PRuPTUINT CMN_PRuUINT64 + #define CMN_PRxPTUINT CMN_PRxUINT64 + #define CMN_PRXPTUINT CMN_PRXUINT64 + #else + typedef cmnInt32 cmnPtInt; + typedef cmnUint32 cmnPtUint; + #define CMN_PRdPTINT CMN_PRdINT32 + #define CMN_PRuPTUINT CMN_PRuUINT32 + #define CMN_PRxPTUINT CMN_PRxUINT32 + #define CMN_PRXPTUINT CMN_PRXUINT32 + #endif +#else + #if defined (__LP64__) || defined (__64BIT__) || defined (_LP64) || (__WORDSIZE == 64) + typedef long cmnInt64; + typedef unsigned long cmnUint64; + typedef cmnInt64 cmnPtInt; + typedef cmnUint64 cmnPtUint; + #define CMN_PRdINT64 "ld" + #define CMN_PRuUINT64 "lu" + #define CMN_PRxUINT64 "lx" + #define CMN_PRXUINT64 "lX" + #define CMN_PRdPTINT CMN_PRdINT64 + #define CMN_PRuPTUINT CMN_PRuUINT64 + #define CMN_PRxPTUINT CMN_PRxUINT64 + #define CMN_PRXPTUINT CMN_PRXUINT64 + #else + typedef long long cmnInt64; + typedef unsigned long long cmnUint64; + typedef cmnInt32 cmnPtInt; + typedef cmnUint32 cmnPtUint; + #define CMN_PRdINT64 "lld" + #define CMN_PRuUINT64 "llu" + #define CMN_PRxUINT64 "llx" + #define CMN_PRXUINT64 "llX" + #define CMN_PRdPTINT CMN_PRdINT32 + #define CMN_PRuPTUINT CMN_PRuUINT32 + #define CMN_PRxPTUINT CMN_PRxUINT32 + #define CMN_PRXPTUINT CMN_PRXUINT32 + #endif +#endif + +#endif diff --git a/code/sys_nicmonitor/include/d5000_err.h b/code/sys_nicmonitor/include/d5000_err.h new file mode 100644 index 0000000..e886810 --- /dev/null +++ b/code/sys_nicmonitor/include/d5000_err.h @@ -0,0 +1,130 @@ +/*3.ʵʱ*/ +/*ERR_RTDB_ errno of rtdb --- wj added on 20090218 */ + +#define ERR_RTDB_ERROR -1 /* error */ +#define ERR_RTDB_PARA -2 /* bad para_parameter */ +#define ERR_RTDB_CHAOS -3 /* innner error */ + +//access +#define ERR_RTDB_ACCESSMETH -3001 /* access_meth is error */ +#define ERR_RTDB_EXIST -3002 /* Db name is exist, cannot creat */ +#define ERR_RTDB_NODB -3003 /* Db name not founded */ +#define ERR_RTDB_INVDBNO -3004 /* Db no is wrong */ +#define ERR_RTDB_INVFNAME -3005 /* Field name not founded */ +#define ERR_RTDB_HASOPENED -3006 /* The db has been opened */ +#define ERR_RTDB_FILE_NOPEN -3007 /* The file cannot open */ +#define ERR_RTDB_READ_FILE -3008 /* The file cannot read */ +#define ERR_RTDB_APP_NO_DB -3009 /* This table isn't in current application */ +#define ERR_RTDB_DB_NONE -3010 /* The table is deleted or hasn't been created*/ + +//lock +#define ERR_RTDB_LOCK -3111 /* The db is locked */ +#define ERR_RTDB_UNLOCK -3112 /* The db isnot locked */ +#define ERR_RTDB_INVUNLOCK -3113 /* locker is not me */ +#define ERR_RTDB_NOINDEX -3114 /* havenot index */ + +#define ERR_RTDB_DIFFSIZE -3121 /* size is different */ +#define ERR_RTDB_NOTCHKEY -3122 /* ?? */ +#define ERR_RTDB_NOCACHE -3123 /* no cache block */ +#define ERR_RTDB_NOTE_NEND -3124 /* NOTE must be last field */ + +#define ERR_RTDB_CTRLFULL -3131 /* The db ctrl table is full */ +#define ERR_RTDB_DBFULL -3132 /* The db is full */ +#define ERR_RTDB_EODB -3133 /* End of Database */ +#define ERR_RTDB_INVSIZE -3134 /* The size is invalid */ +#define ERR_RTDB_DBBEGIN -3135 /* Have reach the begin of db */ +#define ERR_RTDB_DBEND -3136 /* Have reach the end of db */ + +#define ERR_RTDB_INVCCOMM -3137 /* Invalid comparition command */ +#define ERR_RTDB_TMOPEN -3138 /* Too many open */ +#define ERR_RTDB_EMPTY -3139 /* table is empty */ + +////key +#define ERR_RTDB_KEYNOTFIND -3241 /* keyword not founded */ +#define ERR_RTDB_MULTIKEY -3242 /* Multi-keywords */ +#define ERR_RTDB_INVKEY -3243 /* The keyword is invalid */ +#define ERR_RTDB_MKEYFIELD -3244 /* The keyword field can be only one */ +#define ERR_RTDB_KEYFLEN -3245 /* The keyword length must be 4 times*/ +#define ERR_RTDB_DBTYPE -3246 /* Invalid db type */ +#define ERR_RTDB_KEYTYPE -3247 /* Invalid keyword type */ +#define ERR_RTDB_PASSWD -3248 /* Invalid passwd */ + +////table +#define ERR_RTDB_TABLE_NO -3300 /* no match table or no*/ +#define ERR_RTDB_TABLE_STA -3301 /* table status is abnormal */ + +////record +#define ERR_RTDB_EXISTREC -3451 /* Record existed, cannot write */ +#define ERR_RTDB_NEXISTREC -3452 /* Record not existed, cannot modify */ +#define ERR_RTDB_SUPMAX -3453 /* record value too bigger */ +#define ERR_RTDB_BELMIN -3454 /* record value too smaller */ +#define ERR_RTDB_RECSIZE -3455 /* record size wrong */ +#define ERR_RTDB_NOTERASE -3456 /* record not erased */ +#define ERR_RTDB_RECERASE -3457 /* The record is erased */ +#define ERR_RTDB_POINTER -3458 /* record_pointer error */ +#define ERR_RTDB_CONT_ERR -3459 /* condition express error */ +#define ERR_RTDB_NEED_CHK -3460 /* something wrong, need to check record state*/ + +////field +#define ERR_RTDB_DATATYPE -3561 /* field data type is wrong */ +#define ERR_RTDB_DIFFTYPE -3562 /* type is different */ +#define ERR_RTDB_KEYFIELD -3563 /* The field is keyword */ +#define ERR_RTDB_BIGFIELDNO -3564 /* The field no is too big */ +#define ERR_RTDB_DLT_WRITE -3565 /* The direct link hash cannot write */ +#define ERR_RTDB_INVFIELDNO -3566 /* field_no is wrong */ +#define ERR_RTDB_NOTFIND -3567 /* Not find the value */ +#define ERR_RTDB_FIELD_NO -3568 /* no match field name or no */ +#define ERR_RTDB_FIELD_SIZE -3569 /* field length wrong */ +#define ERR_RTDB_NONE_FIELD -3570 /* this table has no field */ + + +//operation +#define ERR_RTDB_INVCOMM -3601 /* Invalid db operater command */ +#define ERR_RTDB_NPERMIT -3602 /* The OP is not permit */ + +#define ERR_RTDB_CONTEXT -3620 /* no context or application */ +#define ERR_RTDB_APP_UNLOAD -3621 /* application isn't loaded */ + + +#define ERR_RTDB_SQL_COMMAND -3631 /*select error*/ +#define ERR_RTDB_SQL_FORM -3632 /*form error*/ +#define ERR_RTDB_SQL_WHERE -3633 /*where condition error*/ +#define ERR_RTDB_SQL_ORDER -3634 /*order by error*/ + +//memory +#define ERR_RTDB_MEMORY -3700 /* Cannot malloc or calloc memory */ +#define ERR_RTDB_BUFFFULL -3701 /* Buffer is full */ +#define ERR_RTDB_MEM_NOALLOC -3702 /* The memory cannot allocation */ + +#define ERR_RTDB_MAP -3710 /* map file error */ +#define ERR_RTDB_SHM -3711 /* get shm error */ + +#define ERR_RTDB_OFLOW_MALLOC -3712 /* malloc error in overflow area */ +#define ERR_RTDB_OFLOW_FREE -3713 /* free error in overflow area */ +#define ERR_RTDB_STG_HASH_SAME_HASH_NUM -3715 /*error when INDEX_STORAGE_HASH_REC_HEAD::same_hash_num<0 */ +#define ERR_RTDB_WRONG_MEM -3716 /* shmget or mmap a wrong memory */ +#define ERR_RTDB_INDEX_MEM_ALLOC_TYPE -3717 /*wrong index memory allocation type */ +//#define ERR_RTDB_PTABFULL -10 /* process tab is full */ + +//sql +#define ERR_RTDB_SQL -3720 /* sql syntax error */ + +#define ERR_RTDB_DBNAMENOTF -3800 /* db_name not founded */ +#define ERR_RTDB_FACNAMENOTF -3801 /* fac_name not founded */ +#define ERR_RTDB_VALNAMENOTF -3802 /* val_name not founded */ +#define ERR_RTDB_FIELDNAMENOTF -3803 /* field_name not founded */ +#define ERR_RTDB_VIEWFIELD -3901 /* view get fieldnum over error */ +#define ERR_RTDB_SYBASE -3902 /* modify sybase error */ +#define ERR_RTDB_INDEXERR -3903 /* index number error */ +#define ERR_RTDB_MODIFYSIZE -3904 /* modify bufsize error */ +#define ERR_RTDB_API_INVCOMM -3905 /* Invalid db operater command */ +#define ERR_RTDB_API_NOAPP -3906 /* App name not founded */ +#define ERR_RTDB_API_NODB -3907 /* Db name not founded */ +#define ERR_RTDB_API_INVDBNO -3908 /* Db no is wrong */ +#define ERR_RTDB_API_NODEOFF -3909 /* node is offline */ +#define ERR_RTDB_API_ERRINIT -3910 /* odbms init error */ +#define ERR_RTDB_API_NEWERR -3911 /* new space error */ +#define ERR_RTDB_API_DATAERR -3912 /* data tye error */ +#define ERR_RTDB_NOSPACE -3915 /* no space left in disk */ + +/* end of ERR_RTDB_ */ diff --git a/code/sys_nicmonitor/include/db_api/DeleteRecorder.h b/code/sys_nicmonitor/include/db_api/DeleteRecorder.h new file mode 100644 index 0000000..b85c4a2 --- /dev/null +++ b/code/sys_nicmonitor/include/db_api/DeleteRecorder.h @@ -0,0 +1,102 @@ +// insert into the odb_table.cpp +#include "common_types.h" +#ifndef _WINDOWS64 +#ifndef _HPUX +#include +#else +#include +#endif + +#include +#include +#include +#include +#include +#include +#include +#else +#include +#include +#include +#include +#include +#include +#include +#endif + +#include +#include +#include "ThreadKit/ThreadKit.h" + +#ifdef _WINDOWS64 +#ifdef ODB_API_LIB_EXPORTS +#define ODB_API_LIB_API __declspec(dllexport) +#else +#define ODB_API_LIB_API __declspec(dllimport) +#endif +#else +#define ODB_API_LIB_API +#endif + + + + +#define LOGLOCK 0x10999 +#define FILEMAXSIZE 30000000 +#define BIGSIZE 90000000 +#define FRESH (int)'6' +#define NOTFRESH (int)'A' + + + + +class ODB_API_LIB_API DeleteRecorder +{ + private: + FILE* _m_file_handle; + int _m_file_size; + int _m_status; + + char processName[256]; + char fileName[256]; + + cmnUint64 processID; + int lockID; + time_t fileTag; + + static DeleteRecorder * _m_instance; +#ifndef _WINDOWS64 + static pthread_mutex_t _m_lock; +#else + // static CRITICAL_SECTION _m_lock; + static THREADKIT::Mutex _m_lock; +#endif + + + DeleteRecorder(const DeleteRecorder &); + void operator = (const DeleteRecorder &); + + int initLock(); + int lockLog(); + int unlockLog(); + + int initLog(); + int checkAndRenameLog(); + int getNameFromPid(); + + public: + static DeleteRecorder * getInstance(); + + DeleteRecorder(); + ~DeleteRecorder(); + + int openLog(); + int writeLog(int app, int tab, cmnInt64 logContent); + // int renameLog(); + int isValid(); + + + +}; + +void WriteLog(int,int,cmnInt64); diff --git a/code/sys_nicmonitor/include/db_api/codb_net.h b/code/sys_nicmonitor/include/db_api/codb_net.h new file mode 100644 index 0000000..27c83fc --- /dev/null +++ b/code/sys_nicmonitor/include/db_api/codb_net.h @@ -0,0 +1,175 @@ +#ifndef __CODB_NET_H__ +#define __CODB_NET_H__ + +#include "db_api/odb_net_m.h" +#include "db_api/odb_define.h" + +#ifndef _WINDOWS64 +#include +#include +#include +#include +#endif + +#include "servicemanage.h" + +#ifdef _WINDOWS64 +#ifdef ODB_API_LIB_EXPORTS +#define ODB_API_LIB_API __declspec(dllexport) +#else +#define ODB_API_LIB_API __declspec(dllimport) +#endif +#else +#define ODB_API_LIB_API +#endif + +namespace RTDB_SERVER +{ + +template +bool serializeProto(const T & message, char * &pret, int & retlen) +{ + std::string output; + if (!message.SerializeToString(&output)) { + return false; + } + retlen = output.size(); + pret = new char[retlen]; + memcpy(pret, output.c_str(), retlen); + return true; +} + +template +bool parseProto(T & ret_message, const char * buf, int len) +{ + if (!ret_message.ParseFromArray(buf, len)) { + return false; + } + return true; +} + + class ODB_API_LIB_API CODB_NET + { + public: + CODB_NET(); + ~CODB_NET(); + + public: + int TableCreate(RTDB_PROTO::REQ_STDB_CREATE& req_create);//1 + int TableDelete(RTDB_PROTO::REQ_STDB_DELETE& req_delete);//2 + + int TableGet(RTDB_PROTO::REQ_READ& read_req, RTDB_PROTO::RSP_READ& read_rsp);//3 + int TableGet(RTDB_PROTO::REQ_READ_OLD& read_req, RTDB_PROTO::RSP_READ& read_rsp);//3 for remote + int TableGet(RTDB_PROTO::REQ_READ& read_req, RTDB_PROTO::RSP_READ& read_rsp, DB_BYTE_T& remote_byte);//3 + int TableGet(RTDB_PROTO::REQ_READ_OLD& read_req, RTDB_PROTO::RSP_READ& read_rsp, DB_BYTE_T& remote_byte);//3 for remote + int TableGetASync(RTDB_PROTO::REQ_READ& read_req); + int TableGet_OPT(RTDB_PROTO::REQ_READ& read_req, char** buf_ptr, int& data_size);//40 + int TableGet_OPT(RTDB_PROTO::REQ_READ_OLD& read_req, char** buf_ptr, int& data_size);//40 for remote + int TableGet_OPT(RTDB_PROTO::REQ_READ& read_req, char** buf_ptr, int& data_size, DB_BYTE_T& remote_byte);//40 + int TableGet_OPT(RTDB_PROTO::REQ_READ_OLD& read_req, char** buf_ptr, int& data_size, DB_BYTE_T& remote_byte);//40 for remote + int TableGet_OPTASync(RTDB_PROTO::REQ_READ& read_req);//40 + int TableGetByName(RTDB_PROTO::REQ_READ& read_req, RTDB_PROTO::RSP_READ& read_rsp);//4 + int TableGetByName(RTDB_PROTO::REQ_READ_OLD& read_req, RTDB_PROTO::RSP_READ& read_rsp);//4 for remote + int TableGetByNameASync(RTDB_PROTO::REQ_READ& read_req);//4 + int TableGetByName_OPT(RTDB_PROTO::REQ_READ& read_req, char** buf_ptr, int& data_size, DB_BYTE_T& remote_byte);//41 + int TableGetByName_OPT(RTDB_PROTO::REQ_READ_OLD& read_req, char** buf_ptr, int& data_size, DB_BYTE_T& remote_byte);//41 + int TableGetByName_OPTASync(RTDB_PROTO::REQ_READ& read_req);//41 + int TableGetByFieldValue(RTDB_PROTO::REQ_CON& read_req, RTDB_PROTO::RSP_CON& read_rsp);//5 + int TableGetByFieldValueASync(RTDB_PROTO::REQ_CON& read_req);//5 + int TableWrite(RTDB_PROTO::REQ_KEY_WRITE& write_req);//6 + int TableWriteASync(RTDB_PROTO::REQ_KEY_WRITE& write_req);//6 + int TableModify(RTDB_PROTO::REQ_MODIFY& modify_req);//7 + int TableModifyASync(RTDB_PROTO::REQ_MODIFY& modify_req);//7 + int TableUpdate(RTDB_PROTO::REQ_UPDATE& update_req);//8 + int TableUpdateASync(RTDB_PROTO::REQ_UPDATE& update_req);//8 + int DeleteRecord(RTDB_PROTO::REQ_KEY_ERASE& delete_req);//9 + int DeleteRecordASync(RTDB_PROTO::REQ_KEY_ERASE& delete_req);//9 + int TableClear(RTDB_PROTO::REQ_TABLE_CLEAR& clear_req);//10 + int TableClearASync(RTDB_PROTO::REQ_TABLE_CLEAR& clear_req);//10 + + int GetTablePara(RTDB_PROTO::REQ_PARAMETER& para_req, RTDB_PROTO::RSP_PARAMETER& para_rsp);//11 + int GetTableParaASync(RTDB_PROTO::REQ_PARAMETER& para_req);//11 +#ifdef _APP_SYS_SUBSTATION + int GetTableParaAll(RTDB_PROTO::REQ_PARAMETER& para_req, RTDB_PROTO::RSP_PARAMETER& para_rsp);//35 + int TableGetAll(RTDB_PROTO::REQ_READ& read_req, RTDB_PROTO::RSP_READ& read_rsp);//36 + int GetTableParaVir(RTDB_PROTO::REQ_VIR_FIELD& para_req, RTDB_PROTO::RSP_VIR_FIELD& para_rsp);//37 +#endif + int GetTableParameter(RTDB_PROTO::REQ_PARAMETER& para_req, RTDB_PROTO::RSP_READ& para_rsp);//12 + int GetAppTableParameter(RTDB_PROTO::REQ_APP_PARAMETER& para_req, RTDB_PROTO::RSP_APP_PARAMETER& para_rsp);//13 + int GetFieldPara(RTDB_PROTO::REQ_FIELD_BASE_INFO& para_req , RTDB_PROTO::RSP_FIELD_BASE_INFO& para_rsp);//14 + + int GetKeyInfo(RTDB_PROTO::RSP_KEYINFO& key_rsp);//15 + int GetKeyInfoSlice(RTDB_PROTO::RSP_KEYINFO_SLICE& key_rsp);//15 + int TableGetBySql(RTDB_PROTO::REQ_SQL& select_req, RTDB_PROTO::RSP_READ& select_rsp);//16 + int TableGetBySqlASync(RTDB_PROTO::REQ_SQL& select_req);//16 + int MenuRead(RTDB_PROTO::REQ_MENU& menu_req, RTDB_PROTO::RSP_MENU& menu_rsp);//17 + int TableReleMenuRead(RTDB_PROTO::REQ_RELE_MENU& rele_req, RTDB_PROTO::RSP_RELE_MENU& rele_rsp);//18 + int GetNameStringByKeyID(RTDB_PROTO::REQ_NAME_STRING& name_req, RTDB_PROTO::RSP_NAME_STRING& name_rsp);//19 + int GetNameStringByKeyIDASync(RTDB_PROTO::REQ_NAME_STRING& name_req);//19 + int GetRefMenuString(RTDB_PROTO::REQ_REF_MENU& ref_req, RTDB_PROTO::RSP_REF_MENU& ref_rsp);//20 + int GetRefMenuStringAsync(RTDB_PROTO::REQ_REF_MENU& ref_req);//20 + int GetNameStringByMultiKeyID(RTDB_PROTO::REQ_MULTI_NAME_STRING& name_req, RTDB_PROTO::RSP_MULTI_NAME_STRING& name_rsp);//21 + int GetNameStringByMultiKeyIDASync(RTDB_PROTO::REQ_MULTI_NAME_STRING& name_req);//21 + + int GraphGetData(RTDB_PROTO::GRAPH_REAL_ODB_REQ& real_req, RTDB_PROTO::GRAPH_REAL_RSP& real_rsp);//22 + int GraphGetData(RTDB_PROTO::GRAPH_REAL_ODB_REQ_OLD& real_req, RTDB_PROTO::GRAPH_REAL_RSP& real_rsp);//22 + int GraphGetDataASync(RTDB_PROTO::GRAPH_REAL_ODB_REQ& real_req); + int GraphGetAppInfo(RTDB_PROTO::GRAPH_ORDER_KEY_REQ& app_req, RTDB_PROTO::GRAPH_ORDER_KEY_RSP& app_rsp);//23 + int GraphGetAppInfoASync(RTDB_PROTO::GRAPH_ORDER_KEY_REQ& app_req);//23 + + int ExchangeNameNo(RTDB_PROTO::REQ_ENTITY& object_req, RTDB_PROTO::RSP_ENTITY& object_rsp);//24 + + int GetFacNameByKeyNo(RTDB_PROTO::REQ_FAC& fac_req, RTDB_PROTO::RSP_FAC& fac_rsp);//25 + int GetFacNameByFacID(RTDB_PROTO::REQ_FAC& fac_req, RTDB_PROTO::RSP_FAC& fac_rsp);//26 + int GetFacNameByFacNo(RTDB_PROTO::REQ_FAC& fac_req, RTDB_PROTO::RSP_FAC& fac_rsp);//27 + + int GetFacIDByFacName(RTDB_PROTO::REQ_FAC& fac_req, RTDB_PROTO::RSP_FAC& fac_rsp);//28 + int GetFacNoByFacName(RTDB_PROTO::REQ_FAC& fac_req, RTDB_PROTO::RSP_FAC& fac_rsp);//29 + + int GetFacIDByFacNo(RTDB_PROTO::REQ_FAC& fac_req, RTDB_PROTO::RSP_FAC& fac_rsp);//30 + int GetFacNoByFacID(RTDB_PROTO::REQ_FAC& fac_req, RTDB_PROTO::RSP_FAC& fac_rsp);//31 + + int GetValueAndStatus(RTDB_PROTO::REQ_VAL_STA& req_key_id, RTDB_PROTO::RSP_INT_VAL_STA* rsp_int_val, RTDB_PROTO::RSP_FLOAT_VAL_STA* rsp_float_val, RTDB_PROTO::RSP_CHAR_VAL_STA* rsp_char_val, RTDB_PROTO::RSP_LONG_VAL_STA* rsp_long_val, RTDB_PROTO::RSP_UNION_VAL_STA* rsp_union_val);//32 + int GetValueAndStatus(RTDB_PROTO::REQ_VAL_STA_OLD& req_key_id, RTDB_PROTO::RSP_INT_VAL_STA* rsp_int_val, RTDB_PROTO::RSP_FLOAT_VAL_STA* rsp_float_val, RTDB_PROTO::RSP_CHAR_VAL_STA* rsp_char_val, RTDB_PROTO::RSP_LONG_VAL_STA* rsp_long_val, RTDB_PROTO::RSP_UNION_VAL_STA* rsp_union_val);//32 + int GetValueAndStatusASync(RTDB_PROTO::REQ_VAL_STA& req_key_id);//32 + int GetValueAndStatus_YCOPT (RTDB_PROTO::REQ_VAL_STA& req_key_id, + std::vector & vec_val, std::vector & vec_status);//42 + int GetValueAndStatus_YXOPT (RTDB_PROTO::REQ_VAL_STA& req_key_id, + std::vector & vec_val, std::vector & vec_status);//43 + + int PingRtdbServer(int req_data , int& rsp_data);//33 + int GraphDataSend(RTDB_PROTO::GRAPH_REAL_ODB_REQ &real_req,Handle &hdl) ;//22 + int GraphDataRecv(RTDB_PROTO::GRAPH_REAL_RSP &real_rsp,Handle &hdl,int &ret); + + int DeleteRecords(RTDB_PROTO::DEL_REQ& delete_req);//34 + int DeleteRecordsASync(RTDB_PROTO::DEL_REQ& delete_req);//34 + int ReadAsyncRsp(char** rsp_buffer, int* rsp_len, int& ret_code, DB_BYTE_T& remote_byte); + int ReadAsyncRsp(char** rsp_buffer, int* rsp_len, int& ret_code); + int ReadAsyncRsp(int& ret_code); + int ReadAsyncRsp(RTDB_PROTO::RSP_INT_VAL_STA* rsp_int_val, RTDB_PROTO::RSP_FLOAT_VAL_STA* rsp_float_val, RTDB_PROTO::RSP_CHAR_VAL_STA* rsp_char_val, RTDB_PROTO::RSP_LONG_VAL_STA* rsp_long_val, RTDB_PROTO::RSP_UNION_VAL_STA* rsp_union_val);//32 + int ReadAsyncRespGraphGetData(RTDB_PROTO::GRAPH_REAL_RSP& real_rsp, int& ret_code); + void FreeAsyncHandle(); + +#ifdef _APP_SYS_SUBSTATION +////add for xdb wuqx ----- 2012-07-11 + int XdbAccess(RTDB_PROTO::REQ_XDB& req, RTDB_PROTO::RSP_XDB& rsp); +#endif + public: + int SetServiceInfo(ServiceInfo& service_info); + int SetDomainInfo(const DomainInfo* p_domain_info); + void SetHandle(const Handle handle); + void ClearHandle(const Handle handle); + static CODB_NET* _narrow(ServiceInfo& serv_info, DomainInfo* p_domain_info = NULL); + + private: + ServiceInfo m_Serviceinfo; + DomainInfo* m_pDomaininfo; + char m_IpAddress[64]; + int m_Port; + public: + Handle m_Handle; + Handle m_Handle_Async; + }; +} + +#endif diff --git a/code/sys_nicmonitor/include/db_api/mc_rtdb_m.h b/code/sys_nicmonitor/include/db_api/mc_rtdb_m.h new file mode 100644 index 0000000..70ad93d --- /dev/null +++ b/code/sys_nicmonitor/include/db_api/mc_rtdb_m.h @@ -0,0 +1,61 @@ +//************************************** +// Generated by mcpp translator +// Version 1.3 +//************************************** + +#ifndef __MC_RTDB_M_H__ +#define __MC_RTDB_M_H__ + +#include"mcode/mvector.h" +#include"mcode/mstring.h" +#include"mcode/mstream.h" +#include"mcode/mclient.h" + + +typedef MLang::VECTOR MC_SEQ_CHAR; +typedef MLang::VECTOR MC_SEQ_INT; +struct MC_SYNC_RT_DATA +{ + int ctx_no; + int byte_tag; + MLang::STRING scn_name; + int scn_inst; + MLang::STRING subscn_name; + int subscn_inst; + int table_no; + int op_type; + int all_field_num; + int one_record_size; + int record_num; + int stage; + int stageall; + MLang::STRING stage_message; + MLang::STRING description; + int map_no; + int run_status; + int zipped; + int unzipped_length; + int zipped_length; + int reserve_para_1; + int reserve_para_2; + int reserve_para_3; + MC_SEQ_INT op_field; + MC_SEQ_CHAR key_buf; + MC_SEQ_CHAR op_buf; + MC_SYNC_RT_DATA(); + MC_SYNC_RT_DATA(const MC_SYNC_RT_DATA&); + MC_SYNC_RT_DATA&operator=(const MC_SYNC_RT_DATA&); + void __write(MLang::OutputStream&__os)const; + void __read(MLang::InputStream&__is); +}; +typedef MLang::VECTOR MC_SEQ_SYNC_RT_DATA; +struct MC_SYNC_RT_DATA_VEC +{ + MC_SEQ_SYNC_RT_DATA sync_rt_data_vec; + MC_SYNC_RT_DATA_VEC(); + MC_SYNC_RT_DATA_VEC(const MC_SYNC_RT_DATA_VEC&); + MC_SYNC_RT_DATA_VEC&operator=(const MC_SYNC_RT_DATA_VEC&); + void __write(MLang::OutputStream&__os)const; + void __read(MLang::InputStream&__is); +}; +#endif diff --git a/code/sys_nicmonitor/include/db_api/mc_rtdb_mng.h b/code/sys_nicmonitor/include/db_api/mc_rtdb_mng.h new file mode 100644 index 0000000..4fe578a --- /dev/null +++ b/code/sys_nicmonitor/include/db_api/mc_rtdb_mng.h @@ -0,0 +1,125 @@ +#ifndef _MC_RTDB_MNG_H_ +#define _MC_RTDB_MNG_H_ + +#ifdef _WINDOWS64 +#ifdef MC_RTDB_MNG_EXPORTS +#define MC_RTDB_MNG_API __declspec(dllexport) +#else +#define MC_RTDB_MNG_API __declspec(dllimport) +#endif +#else +#define MC_RTDB_MNG_API +#endif + +#include +#include + +#include "pub_buf.h" +#include "db_api/mc_rtdb_m.h" + +struct McScnInfo +{ + std::string scn_name; + int scn_inst; + std::string subscn_name; + int subscn_inst; +}; + +struct TableColumnKey +{ + //int app_no; + std::string scn_name; + int scn_inst; + std::string subscn_name; + int subscn_inst; + + int table_no; + std::string column_name; + std::vector keys; +}; + +struct StageStruct +{ + int stage; + char stage_message[512]; + char description[1024]; + int map_no; + int run_status; +}; + +class MC_RTDB_MNG_API McRtdbMng +{ +public: + + McRtdbMng(); + ~McRtdbMng(); + + //ʵʱͬݸϢ + //int SyncSnapShot(const int app_no, std::vector& tck, const struct StageStruct stage_stru); + int SyncSnapShot(const struct McScnInfo& scninfo, std::vector& tck, const struct StageStruct stage_stru); + + //ӦݸϢļڡ/conf/mc_scn£{app_name}.dat + //int SaveSnapShot(const std::string app_name, int stage, const std::string description); + int SaveSnapShot(const struct McScnInfo& scninfo, int stage, const std::string& description); + + //ļָӦݸϢ + //int RecoverSnapShot(const std::string app_name, int stage); + int RecoverSnapShot(const struct McScnInfo& scninfo, int stage); + + //ü׶״̬Ϣ + int SetStage(const struct McScnInfo& scninfo, const struct StageStruct stage_stru); + + //ȡ׶״̬Ϣ (domain = NULLʱȡȡָ) + //int ReadStage(int app_no, std::string& stage_message, std::string& description, int& map_no, int& run_status, char* domain = NULL); + int ReadStage(const struct McScnInfo& scninfo, std::string& stage_message, std::string& description, int& map_no, int& run_status, char* domain = NULL); + + //ȡܽ׶Ϊֵ + //int ReadTotalStage(int app_no); + int ReadTotalStage(const struct McScnInfo& scninfo); + + //üܽ׶ + //int SetTotalStage(int app_no, int stageall); + int SetTotalStage(const struct McScnInfo& scninfo, int stageall); + + //޸ıRunStatus + //int SetRunStatus (int app_no, int run_status); //run_statusֵΪ01 + int SetRunStatus(const struct McScnInfo& scninfo, int run_status); //run_statusֵΪ01 + + //״̬ʹã޸ıRunStatusĵRunStatusֵΪ0 + //int SetRunStatusSync(int app_no, int run_status); + int SetRunStatusSync(const struct McScnInfo& scninfo, int run_status); + + int WriteSnapShotToStandBy (const char* recive_buf, const int buf_len); + +private: + + int read_tck_config(const struct McScnInfo& scninfo, std::vector& tck); + + int read_destination(const std::vector& vec_cluster); + + int read_data(const std::vector& tck, CBuffer& buf, \ + int stage = 0, char* stage_message = NULL, char* description = NULL, \ + int map_no = 0, int run_status = 0, int stageall = 0); + + //int SetStage(const struct McScnInfo& scninfo, const struct StageStruct stage_stru); + + int SetTotalStageToStandBy(const struct McScnInfo& scninfo, int stageall); + + int SetStageToStandBy(const struct McScnInfo& scninfo, const struct StageStruct stage_stru); + + int get_local_name(char* local_name); + + int SetStageSync(const struct McScnInfo& scninfo, int stage); + + int SetMessageSync(const struct McScnInfo& scninfo, const std::string description); + + + //TEST + int ReadTotalStage_Conf(int app_no); + + //TEST + int SetTotalStage_Conf(int app_no, int stageall); + +}; + +#endif diff --git a/code/sys_nicmonitor/include/db_api/odb_apinet.h b/code/sys_nicmonitor/include/db_api/odb_apinet.h new file mode 100644 index 0000000..402b7a9 --- /dev/null +++ b/code/sys_nicmonitor/include/db_api/odb_apinet.h @@ -0,0 +1,269 @@ +/******************************************************************************* +ModuleName: ODB Real Time Database management system +FileName: odb_apinet.h +DESCRIPTION: for class CTableNet of net access +FUNCTION LIST: +COMMENT: for net access +History: +Date Version Modifier Activities +2004-06-25 1.1 add context_no parameter +2003-01-09 1.0 modify +================================================================================ +2003-01-09 1.0 created +*******************************************************************************/ + +#ifndef __ODB_APINET_h__ +#define __ODB_APINET_h__ + +#ifndef __ODB_COMMON_H__ +#include "db_api/odb_common.h" +#endif + +#ifndef __ODB_TABLEBASE_H__ +#include "db_api/odb_tablebase.h" +#endif + +#ifndef __ODB_NETFACTORY_h__ +#include "db_api/odb_netfactory.h" +#endif + +#include "task_service.h" +#include "db_api/odb_net_m.h" +#include "db_api/codb_net.h" + +#ifdef _WINDOWS64 +#ifdef ODB_API_LIB_EXPORTS +#define ODB_API_LIB_API __declspec(dllexport) +#else +#define ODB_API_LIB_API __declspec(dllimport) +#endif +#else +#define ODB_API_LIB_API +#endif + +using namespace std; +//using namespace RTDB_SERVER; +using namespace ODB; + +namespace NET_ODB +{ + //lmj add for GraphGetDataEx + typedef struct + { + cmnInt64 graph_id; + cmnInt64 cal_type; + cmnInt64 req_status; //-1,0��ȡ����,1(����) + Handle hdl; + + } TGraphReq; + + typedef struct + { + std::string scn_name; + std::string subscn_name; + int type; + } TApiNetPriv; + +class ODB_API_LIB_API CApiNet: public CTableBase +{ +public: + CApiNet(); + CApiNet(const int app_no, const short context_no = 0 ); + CApiNet(const int app_no, const int table_no, const short context_no=0); + //CApiNet(const char *hostname); + ~CApiNet(); + +public: + int SetAppNo(const int app_no, const short context_no = 0); + int SetScenario(const std::string& scenario_name, + int scenario_inst_no, + const std::string& sub_scenario_name, + int sub_scenario_inst_no); + int SetScenario(const int scenario_no, + const int scenario_inst_no, + const int sub_scenario_no, + const int sub_scenario_inst_no); + int SetAppNo(const std::string& scenario_name, + int scenario_inst_no, + const std::string& sub_scenario_name, + int sub_scenario_inst_no); + int Open(const std::string& scenario_name, + int scenario_inst_no, + const std::string& sub_scenario_name, + int sub_scenario_inst_no, int table_no); + int SetHostMode(const char* host_name); + + int Open(const int table_no ); + int Open(const int app_no, const int table_no, const short context_no=0); + //int Open(const char* hostname); + +public: + int MenuRead(const char* menu_name, std::vector& vec_menu, const int menu_status=MENU_ON); + + int TableReleMenuRead(const int table_no, std::vector& vec_menu); + + //int GetNameStringByKeyID(const KEY_ID_STRU& keyid_stru, string& ref_string); + //int GetNameStringByKeyIDSplit(const KEY_ID_STRU& keyid_stru, string& ref_string); + //int GetNameStringByKeyID(const std::vector& vec_keyid, std::vector& vec_ref_string); + //int GetNameStringByKeyIDSplit(const std::vector& vec_keyid, std::vector& vec_ref_string); + + int GetRefMenuString(const int table_no, std::vector& vec_menu); + int GetRefMenuStringSplit(const int table_no, std::vector& vec_menu); + + //jinjing 2017-01-17 + int GetRefMenuStringMultiKeys(const int table_no, std::vector& vec_rtdbkeyid, + std::vector& vec_menu); + + //int GetNameStringByID(const cmnInt64 reference_id, string& ref_string); + //int GetNameStringByIDSplit(const long reference_id, string& ref_string); + //int GetNameStringByID(const std::vector& vec_refid, std::vector& vec_ref_string); + //int GetNameStringByIDSplit(const std::vector& vec_refid, std::vector& vec_ref_string); + int GetNameStringBykey(const char* key_ptr, string& ref_string); + int GetNameStringBykeySplit(const char* key_ptr, string& ref_string); + + int GetNameStringByAppKeyID( const std::vector& vec_appkeyid, std::vector& vec_name_string); + int GetNameStringByAppID( const std::vector& vec_appid, std::vector& vec_name_string); + + int GetNameStringByRtdbKeyID(const RTDB_KEY_STRU& rtdb_keyid_stru, string& ref_string); + int GetNameStringByRtdbKeyIDSplit(const RTDB_KEY_STRU& rtdb_keyid_stru, string& ref_string); + int GetNameStringByRtdbKeyID(const std::vector& vec_rtdbkeyid, std::vector& vec_ref_string); + int GetNameStringByRtdbKeyIDSplit(const std::vector& vec_rtdbkeyid, std::vector& vec_ref_string); + + int GraphGetAppInfo(const struct ODB::GRAPH_ORDER_KEY_REQ& graph_req, struct ODB::GRAPH_ORDER_KEY_RSP& graph_rsp); + int GraphGetAppInfoSplit(const struct ODB::GRAPH_ORDER_KEY_REQ& graph_req, struct ODB::GRAPH_ORDER_KEY_RSP& graph_rsp); + int GraphGetData(const struct RTDB_SERVER::GRAPH_REAL_REQ& real_req , RTDB_SERVER::GRAPH_REAL_RSP& real_rsp); + int GraphGetDataSplit(const struct RTDB_PROTO::GRAPH_REAL_REQ& real_req , RTDB_SERVER::GRAPH_REAL_RSP& real_rsp); + int GraphGetDataSplitSimple(const struct RTDB_PROTO::GRAPH_REAL_REQ& real_req , RTDB_SERVER::GRAPH_REAL_RSP& real_rsp); +private: + int GraphGetData(const RTDB_PROTO::GRAPH_REAL_REQ& real_req, RTDB_SERVER::GRAPH_REAL_RSP& real_rsp); + void GraphRealReqConv(const RTDB_SERVER::GRAPH_REAL_REQ &real_req, RTDB_PROTO::GRAPH_REAL_REQ &real_req_inner); + void GraphRealRspConv(const RTDB_PROTO::GRAPH_REAL_RSP &real_rsp_inner, RTDB_SERVER::GRAPH_REAL_RSP &real_rsp); + //int GraphGetDataEx(const struct RTDB_SERVER::GRAPH_REAL_REQ& real_req , RTDB_SERVER::GRAPH_REAL_RSP_out real_rsp, bool is_req=true); + //int GraphDataRecv(const struct RTDB_SERVER::GRAPH_REAL_REQ& real_req , RTDB_SERVER::GRAPH_REAL_RSP_out real_rsp ); + + //int SqlGet(const char* str_sql, char** buf_ptr, int& buf_size); + +public: + int GetFacNameByKeyNo(const int table_no, const char* key_ptr, string& ref_string); + int GetFacNameByFacID(char* fac_name, const RTDB_KEY_STRU fac_id); + int GetFacNameByFacNo(char* fac_name, const int fac_no); + + int GetFacIDByFacName(RTDB_KEY_STRU& fac_id, const char* fac_name); + int GetFacNoByFacName(int& fac_no, const char* fac_name); + + int GetFacIDByFacNo(RTDB_KEY_STRU& fac_id, const int fac_no); + int GetFacNoByFacID( int& fac_no, const RTDB_KEY_STRU fac_id); + + int ColMeasType( const std::vector vec_keyid , std::vector& vec_col_prop ); + +public: + int GetAppNameByNo(char* app_name, const int app_no) { return 0;} + int GetAppNoByName(int& app_no, const char* app_name) { return 0;} + + int GetTableNameByNo(char* table_name, const int table_no, const bool is_eng=true) { return 0;} + int GetTableNoByName(int& table_no, const char* table_name, const bool is_eng=true) { return 0;} + + int GetFieldNameByNo(char* field_name, const int field_no, const bool is_eng=true) { return 0;} + int GetFieldNoByName(int& field_no, const char* field_name, const bool is_eng=true) { return 0;} + +public: + /*int GetValueAndStatus(const std::vector &struVec , std::vector< struct INT_VALUE_STATUS > &KeyIdValVec); //ym + int GetValueAndStatusSplit(const std::vector &struVec , std::vector< struct INT_VALUE_STATUS > &KeyIdValVec); //ym + + int GetValueAndStatus(const std::vector &struVec , std::vector< struct FLOAT_VALUE_STATUS> & KeyIdValVec); //yc + int GetValueAndStatusSplit(const std::vector &struVec , std::vector< struct FLOAT_VALUE_STATUS> & KeyIdValVec); //yc + + int GetValueAndStatus(const std::vector &struVec , std::vector< struct CHAR_VALUE_STATUS > & KeyIdValVec); //yx + int GetValueAndStatusSplit(const std::vector &struVec , std::vector< struct CHAR_VALUE_STATUS > & KeyIdValVec); //yx + + int GetValueAndStatus(const std::vector &struVec , std::vector< struct LONG_VALUE_STATUS > & KeyIdValVec); //long + int GetValueAndStatusSplit(const std::vector &struVec , std::vector< struct LONG_VALUE_STATUS > & KeyIdValVec); //long + + int GetValueAndStatus(const std::vector &struVec , std::vector< struct UNION_VALUE_STATUS> & KeyIdValVec );//union type + */ + int GetValueAndStatus(const std::vector &staStruVec , std::vector< struct INT_VALUE_STATUS> & KeyIdValVec);//ym + int GetValueAndStatusSplit(const std::vector &staStruVec , std::vector< struct INT_VALUE_STATUS> & KeyIdValVec);//ym + + int GetValueAndStatus(const std::vector &staStruVec , std::vector< struct FLOAT_VALUE_STATUS> & KeyIdValVec);//yc + int GetValueAndStatusSplit(const std::vector &staStruVec , std::vector< struct FLOAT_VALUE_STATUS> & KeyIdValVec);//yc + + int GetValueAndStatus(const std::vector &staStruVec , std::vector< struct CHAR_VALUE_STATUS > & KeyIdValVec); //yx + int GetValueAndStatusSplit(const std::vector &staStruVec , std::vector< struct CHAR_VALUE_STATUS > & KeyIdValVec); //yx + + int GetValueAndStatus(const std::vector &staStruVec , std::vector< struct LONG_VALUE_STATUS > & KeyIdValVec); //long + int GetValueAndStatusSplit(const std::vector &staStruVec , std::vector< struct LONG_VALUE_STATUS > & KeyIdValVec); //long + + int GetValueAndStatus(const std::vector &staStruVec , std::vector< struct UNION_VALUE_STATUS> & KeyIdValVec );//union type + + int GetValueAndStatus(const std::vector &struVec , std::vector< struct INT_VALUE_STATUS > &KeyIdValVec); //ym + int GetValueAndStatusSplit(const std::vector &struVec , std::vector< struct INT_VALUE_STATUS > &KeyIdValVec); //ym + int GetValueAndStatus(const std::vector &struVec , std::vector< struct FLOAT_VALUE_STATUS> & KeyIdValVec); //yc + int GetValueAndStatusSplit(const std::vector &struVec , std::vector< struct FLOAT_VALUE_STATUS> & KeyIdValVec); //yc + int GetValueAndStatus(const std::vector &struVec , std::vector< struct CHAR_VALUE_STATUS > & KeyIdValVec); //yx + int GetValueAndStatusSplit(const std::vector &struVec , std::vector< struct CHAR_VALUE_STATUS > & KeyIdValVec); //yx + int GetValueAndStatus(const std::vector &struVec , std::vector< struct LONG_VALUE_STATUS > & KeyIdValVec); //long + int GetValueAndStatusSplit(const std::vector &struVec , std::vector< struct LONG_VALUE_STATUS > & KeyIdValVec); //long + + int GetRefMenuString (int table_no, std::vector& vec_menu, short area_no); + int GetRefMenuStringWithAreaSplit(int table_no, std::vector& vec_menu, short area_no); + int GetRefMenuString(const vector vec_table, std::vector& vec_menu); +public: + int PingRtdbServer(int req_data , int & rep_data); + int GraphDataSend(const struct RTDB_PROTO::GRAPH_REAL_REQ& real_req ); + int GraphDataRecv(RTDB_PROTO::GRAPH_REAL_RSP& real_rsp ); + +public: + int SetDomainName(const char* domain_name); + int SetSecLabel(tSecLabel& sec_label); + void ClearDomainName(); + int SetSliceNo(cmnUint32 slice_no); + +private: + int Start(); + int Refresh(); + int Refresh(int app_no); + int GetSliceByKey(const char* key, cmnUint32& slice_no); + int GetAllSlice(vector& slice_no); + int GetKeyInfo(); + int GetKeyInfoSlice(); + + inline int slice_app_to_no(int slice_app_no){return slice_app_no % 1000;} + inline int slice_no_to_app(int slice_no){return slice_no+AP_SCADA_AREA;} + +private: + CApiNet(const CApiNet&); + CApiNet& operator=(const CApiNet&); + +private: + RTDB_SERVER::CODB_NET* m_OdbNet; + CNetFactory* m_Factory; + //Handle m_Handle; //for service_bus + + std::vector m_VecKey; + std::vector m_IsSliced; + // + short m_ContextNo; + int m_AppNo; + int m_TableNo; + DB_BYTE_T m_ByteTag; + string m_ScenarioName ; + int m_ScenarioInstance ; + string m_SubScenarioName ; + int m_SubScenarioInstance ; + + char m_DomainName[40]; + tSecLabel m_SecLabel; + bool m_IsRemote; + int m_SliceNo; + TaskService* task_service; + + bool m_IsSysAdmHost; + char m_HostName[MAX_NAME_STRING_LEN]; + + TGraphReq *m_pGraphReq; //lmj add for GraphGetDataEx + TApiNetPriv *m_pPrvStru; //lmj add for reserver +}; + +} + +#endif diff --git a/code/sys_nicmonitor/include/db_api/odb_apinet_rtdb_key.h b/code/sys_nicmonitor/include/db_api/odb_apinet_rtdb_key.h new file mode 100644 index 0000000..49a000c --- /dev/null +++ b/code/sys_nicmonitor/include/db_api/odb_apinet_rtdb_key.h @@ -0,0 +1,236 @@ +/******************************************************************************* +ModuleName: ODB Real Time Database management system +FileName: odb_apinet.h +DESCRIPTION: for class CTableNet of net access +FUNCTION LIST: +COMMENT: for net access +History: +Date Version Modifier Activities +2004-06-25 1.1 add context_no parameter +2003-01-09 1.0 modify +================================================================================ +2003-01-09 1.0 created +*******************************************************************************/ + +#ifndef __ODB_APINET_h__ +#define __ODB_APINET_h__ + +#ifndef __ODB_COMMON_H__ +#include "db_api/odb_common.h" +#endif + +#ifndef __ODB_TABLEBASE_H__ +#include "db_api/odb_tablebase.h" +#endif + +#ifndef __ODB_NETFACTORY_h__ +#include "db_api/odb_netfactory.h" +#endif + +#include "task_service.h" +#include "db_api/odb_net_m.h" +#include "db_api/codb_net.h" + +#ifdef _WINDOWS64 +#ifdef ODB_API_LIB_EXPORTS +#define ODB_API_LIB_API __declspec(dllexport) +#else +#define ODB_API_LIB_API __declspec(dllimport) +#endif +#else +#define ODB_API_LIB_API +#endif + +using namespace std; +//using namespace RTDB_SERVER; +using namespace ODB; + +namespace NET_ODB +{ + //lmj add for GraphGetDataEx + typedef struct + { + cmnInt64 graph_id; + cmnInt64 cal_type; + cmnInt64 req_status; //-1,0ȡ,1() + Handle hdl; + + } TGraphReq; + + typedef struct + { + int type; + } TApiNetPriv; + +class ODB_API_LIB_API CApiNet: public CTableBase +{ +public: + CApiNet(); + CApiNet(const int app_no, const short context_no = 0 ); + CApiNet(const int app_no, const int table_no, const short context_no=0); + //CApiNet(const char *hostname); + ~CApiNet(); + +public: + int SetAppNo(const int app_no, const short context_no = 0); + int SetHostMode(const char* host_name); + + int Open(const int table_no ); + int Open(const int app_no, const int table_no, const short context_no=0); + //int Open(const char* hostname); + +public: + int MenuRead(const char* menu_name, std::vector& vec_menu, const int menu_status=MENU_ON); + + int TableReleMenuRead(const int table_no, std::vector& vec_menu); + + int GetNameStringByKeyID(const KEY_ID_STRU& keyid_stru, string& ref_string); + int GetNameStringByKeyIDSplit(const KEY_ID_STRU& keyid_stru, string& ref_string); + int GetNameStringByKeyID(const std::vector& vec_keyid, std::vector& vec_ref_string); + int GetNameStringByKeyIDSplit(const std::vector& vec_keyid, std::vector& vec_ref_string); + + int GetRefMenuString(const int table_no, std::vector& vec_menu); + int GetRefMenuStringSplit(const int table_no, std::vector& vec_menu); + + //jinjing 2017-01-17 + int GetRefMenuStringMultiKeys(const int table_no, std::vector& vec_keyid, + std::vector& vec_menu); + + int GetNameStringByID(const cmnInt64 reference_id, string& ref_string); + int GetNameStringByIDSplit(const long reference_id, string& ref_string); + int GetNameStringByID(const std::vector& vec_refid, std::vector& vec_ref_string); + int GetNameStringByIDSplit(const std::vector& vec_refid, std::vector& vec_ref_string); + int GetNameStringBykey(const char* key_ptr, string& ref_string); + int GetNameStringBykeySplit(const char* key_ptr, string& ref_string); + + int GetNameStringByAppKeyID( const std::vector& vec_appkeyid, std::vector& vec_name_string); + int GetNameStringByAppID( const std::vector& vec_appid, std::vector& vec_name_string); + + int GetNameStringByRtdbKeyID(const RTDB_KEY_STRU& rtdb_keyid_stru, string& ref_string); + int GetNameStringByRtdbKeyID(const std::vector& vec_rtdbkeyid, std::vector& vec_ref_string); + + int GraphGetAppInfo(const struct ODB::GRAPH_ORDER_KEY_REQ& graph_req, struct ODB::GRAPH_ORDER_KEY_RSP& graph_rsp); + int GraphGetAppInfoSplit(const struct ODB::GRAPH_ORDER_KEY_REQ& graph_req, struct ODB::GRAPH_ORDER_KEY_RSP& graph_rsp); + int GraphGetData(const struct RTDB_SERVER::GRAPH_REAL_REQ& real_req, RTDB_SERVER::GRAPH_REAL_RSP& real_rsp); + int GraphGetDataSplit(const struct RTDB_SERVER::GRAPH_REAL_REQ& real_req , RTDB_SERVER::GRAPH_REAL_RSP& real_rsp); + int GraphGetDataSplitSimple(const struct RTDB_SERVER::GRAPH_REAL_REQ& real_req , RTDB_SERVER::GRAPH_REAL_RSP& real_rsp); + //int GraphGetDataEx(const struct RTDB_SERVER::GRAPH_REAL_REQ& real_req , RTDB_SERVER::GRAPH_REAL_RSP_out real_rsp, bool is_req=true); + //int GraphDataRecv(const struct RTDB_SERVER::GRAPH_REAL_REQ& real_req , RTDB_SERVER::GRAPH_REAL_RSP_out real_rsp ); + + //int SqlGet(const char* str_sql, char** buf_ptr, int& buf_size); + +public: + int GetFacNameByKeyNo(const int table_no, const char* key_ptr, string& ref_string); + int GetFacNameByFacID(char* fac_name, const cmnInt64 fac_id); + int GetFacNameByFacNo(char* fac_name, const int fac_no); + + int GetFacIDByFacName(cmnInt64& fac_id, const char* fac_name); + int GetFacNoByFacName(int& fac_no, const char* fac_name); + + int GetFacIDByFacNo(cmnInt64& fac_id, const int fac_no); + int GetFacNoByFacID( int& fac_no, const cmnInt64 fac_id); + + int ColMeasType( const std::vector vec_keyid , std::vector& vec_col_prop ); + +public: + int GetAppNameByNo(char* app_name, const int app_no) { return 0;} + int GetAppNoByName(int& app_no, const char* app_name) { return 0;} + + int GetTableNameByNo(char* table_name, const int table_no, const bool is_eng=true) { return 0;} + int GetTableNoByName(int& table_no, const char* table_name, const bool is_eng=true) { return 0;} + + int GetFieldNameByNo(char* field_name, const int field_no, const bool is_eng=true) { return 0;} + int GetFieldNoByName(int& field_no, const char* field_name, const bool is_eng=true) { return 0;} + +public: + int GetValueAndStatus(const std::vector &struVec , std::vector< struct INT_VALUE_STATUS > &KeyIdValVec); //ym + int GetValueAndStatusSplit(const std::vector &struVec , std::vector< struct INT_VALUE_STATUS > &KeyIdValVec); //ym + + int GetValueAndStatus(const std::vector &struVec , std::vector< struct FLOAT_VALUE_STATUS> & KeyIdValVec); //yc + int GetValueAndStatusSplit(const std::vector &struVec , std::vector< struct FLOAT_VALUE_STATUS> & KeyIdValVec); //yc + + int GetValueAndStatus(const std::vector &struVec , std::vector< struct CHAR_VALUE_STATUS > & KeyIdValVec); //yx + int GetValueAndStatusSplit(const std::vector &struVec , std::vector< struct CHAR_VALUE_STATUS > & KeyIdValVec); //yx + + int GetValueAndStatus(const std::vector &struVec , std::vector< struct LONG_VALUE_STATUS > & KeyIdValVec); //long + int GetValueAndStatusSplit(const std::vector &struVec , std::vector< struct LONG_VALUE_STATUS > & KeyIdValVec); //long + + int GetValueAndStatus(const std::vector &struVec , std::vector< struct UNION_VALUE_STATUS> & KeyIdValVec );//union type + + int GetValueAndStatus(const std::vector &staStruVec , std::vector< struct INT_VALUE_STATUS> & KeyIdValVec);//ym + int GetValueAndStatusSplit(const std::vector &staStruVec , std::vector< struct INT_VALUE_STATUS> & KeyIdValVec);//ym + + int GetValueAndStatus(const std::vector &staStruVec , std::vector< struct FLOAT_VALUE_STATUS> & KeyIdValVec);//yc + int GetValueAndStatusSplit(const std::vector &staStruVec , std::vector< struct FLOAT_VALUE_STATUS> & KeyIdValVec);//yc + + int GetValueAndStatus(const std::vector &staStruVec , std::vector< struct CHAR_VALUE_STATUS > & KeyIdValVec); //yx + int GetValueAndStatusSplit(const std::vector &staStruVec , std::vector< struct CHAR_VALUE_STATUS > & KeyIdValVec); //yx + + int GetValueAndStatus(const std::vector &staStruVec , std::vector< struct LONG_VALUE_STATUS > & KeyIdValVec); //long + int GetValueAndStatusSplit(const std::vector &staStruVec , std::vector< struct LONG_VALUE_STATUS > & KeyIdValVec); //long + + int GetValueAndStatus(const std::vector &staStruVec , std::vector< struct UNION_VALUE_STATUS> & KeyIdValVec );//union type + + int GetValueAndStatus(const std::vector &struVec , std::vector< struct INT_VALUE_STATUS > &KeyIdValVec); //ym + int GetValueAndStatus(const std::vector &struVec , std::vector< struct FLOAT_VALUE_STATUS> & KeyIdValVec); //yc + int GetValueAndStatus(const std::vector &struVec , std::vector< struct CHAR_VALUE_STATUS > & KeyIdValVec); //yx + int GetValueAndStatus(const std::vector &struVec , std::vector< struct LONG_VALUE_STATUS > & KeyIdValVec); //long + + int GetRefMenuString (int table_no, std::vector& vec_menu, short area_no); + int GetRefMenuStringWithAreaSplit(int table_no, std::vector& vec_menu, short area_no); + +public: + int PingRtdbServer(int req_data , int & rep_data); + int GraphDataSend(const struct RTDB_SERVER::GRAPH_REAL_REQ& real_req ); + int GraphDataRecv(RTDB_SERVER::GRAPH_REAL_RSP& real_rsp ); + +public: + int SetDomainName(const char* domain_name); + int SetSecLabel(tSecLabel& sec_label); + void ClearDomainName(); + +private: + int Start(); + int Refresh(); + int Refresh(int app_no); + int GetSliceByKey(const char* key, cmnUint32& slice_no); + int GetAllSlice(vector& slice_no); + int GetKeyInfo(); + int GetKeyInfoSlice(); + + inline int slice_app_to_no(int slice_app_no){return slice_app_no % 1000;} + inline int slice_no_to_app(int slice_no){return slice_no+AP_SCADA_AREA;} + +private: + CApiNet(const CApiNet&); + CApiNet& operator=(const CApiNet&); + +private: + RTDB_SERVER::CODB_NET* m_OdbNet; + CNetFactory* m_Factory; + //Handle m_Handle; //for service_bus + + std::vector m_VecKey; + std::vector m_IsSliced; + // + short m_ContextNo; + int m_AppNo; + int m_TableNo; + DB_BYTE_T m_ByteTag; + + char m_DomainName[40]; + tSecLabel m_SecLabel; + bool m_IsRemote; + int m_SliceNo; + TaskService* task_service; + + bool m_IsSysAdmHost; + char m_HostName[MAX_NAME_STRING_LEN]; + + TGraphReq *m_pGraphReq; //lmj add for GraphGetDataEx + TApiNetPriv *m_pPrvStru; //lmj add for reserver +}; + +} + +#endif diff --git a/code/sys_nicmonitor/include/db_api/odb_apiop.h b/code/sys_nicmonitor/include/db_api/odb_apiop.h new file mode 100644 index 0000000..26b6b65 --- /dev/null +++ b/code/sys_nicmonitor/include/db_api/odb_apiop.h @@ -0,0 +1,233 @@ +/******************************************************************************* +ModuleName: ODB Real Time Database management system +FileName: odb_api.h +DESCRIPTION: general function declaration +FUNCTION LIST: +COMMENT: public application +History: +Date Version Modifier Activities +2004-06-25 1.1 add context_no parameter +2003-05-28 1.0 modify +================================================================================ +2003-05-28 1.0 created +*******************************************************************************/ + +#ifndef __ODB_APIOP_H__ +#define __ODB_APIOP_H__ + +#ifndef __ODB_TABLEOP_H__ +#include "db_api/odb_tableop.h" +#endif + +#ifdef _WINDOWS64 +#ifdef ODB_API_LIB_EXPORTS +#define ODB_API_LIB_API __declspec(dllexport) +#else +#define ODB_API_LIB_API __declspec(dllimport) +#endif +#else +#define ODB_API_LIB_API +#endif + +using namespace std; + +namespace ODB +{ +typedef vector IntVec; + +typedef struct +{ + int slice_no; + int type; + CTableOp *m_pColOp; + CTableOp *m_pMenuOp; + + string m_ScenarioName ; + int m_ScenarioInstance ; + string m_SubScenarioName ; + int m_SubScenarioInstance ; + +} TApiOpPriv; + +class ODB_API_LIB_API CApiOp: public CTableBase +{ +public: + CApiOp(); + CApiOp ( const int app_no , const short context_no = 0); + CApiOp ( const int app_no, const int table_no , const short context_no = 0); + ~CApiOp(); + + int Open (const int app_no, const int table_no, const short context_no = 0); + int Open (const int table_no); + int SetAppNo (const int app_no, const short context_no = 0); + int SetScenario(const std::string& scenario_name, + const int scenario_inst_name, + const std::string& sub_scenario_name, + const int sub_scenario_inst_name); + int SetScenario(const int scenario_no, + const int scenario_inst_no, + const int sub_scenario_no, + const int sub_scenario_inst_no); + int SetAppNo(const std::string& scenario_name, + const int scenario_inst_name, + const std::string& sub_scenario_name, + const int sub_scenario_inst_name); + int SetSliceNo(int slice_no); + +public: + int MenuRead(const char* menu_name, std::vector& vec_menu, const int menu_status=MENU_ON); + int MenuRead(const char* menu_name, char** buf_ptr, int& buf_size, const int menu_status=MENU_ON);//obsolete + + // + int TableReleMenuRead (const int table_no, const int field_no ); + int TableReleMenuRead(const int table_no, const int field_no, std::vector& vec_menu); + int TableReleMenuRead(const int table_no, std::vector& vec_menu); + + int TableReleMenuRead(const int table_no, const int field_no, char** buf_ptr, int& buf_size);//obsolete + int TableReleMenuRead(const int table_no, char** buf_ptr, int& buf_size);//obsolete + + // + int GetRefMenuString(const int table_no, std::vector& vec_menu); + int GetRefMenuString(const vector vec_table, std::vector& vec_menu); + int GetRefMenuString(const int table_no, char*& menu_buf_ptr, int& menu_buf_size);//obsolete + + // + int GetNameStringByID(const cmnInt64 reference_id, std::string& ref_string); + int GetNameStringByID(const cmnInt64 reference_id, char*& referenced_namebuf, int& namebuf_size); + + // + int GetNameStringByID(const std::vector& vec_refid, std::vector& vec_ref_string); + + /* + int GetNameStringByKeyID(const KEY_ID_STRU& keyid_stru, std::string& ref_string); + int GetNameStringByKeyID(const std::vector& vec_keyid, std::vector& vec_ref_string); + + int GetNameStringByKeyID( const KEY_ID_STRU& keyid_stru, char*& referenced_namebuf, int& namebuf_size); + */ + // + int GetNameStringBykey (const char* key_ptr, std::string& ref_string); + int GetNameStringBykey(const char* key_ptr, char*& referenced_namebuf, int& namebuf_size ); + + // + int GetNameStringByAppKeyID( const std::vector& vec_appkeyid, std::vector& vec_name_string); + int GetNameStringByAppID( const std::vector& vec_appid, std::vector& vec_name_string); + + int GetNameStringByRtdbKeyID( const std::vector& vec_rtdbkeyid, std::vector& vec_name_string); + int GetNameStringByRtdbKeyID( const RTDB_KEY_STRU& rtdbkeyid_stru, char*& referenced_namebuf, int& namebuf_size); + int GetNameStringByRtdbKeyID(const RTDB_KEY_STRU rtdbkeyid_stru, std::string& ref_string); + + // + int GetRefFlag (const int table_no, const short field_no); //obsolete + int GetRefFlag (const short field_no); + +public: + int GetFacNameByKeyNo(const int table_no, const char* key_ptr, std::string& ref_string); + int GetFacNameByFacID(char* fac_name, const RTDB_KEY_STRU fac_id); + int GetFacNameByFacNo (char* fac_name, const int fac_no); + + int GetFacIDByFacName(RTDB_KEY_STRU& fac_id, const char* fac_name); + int GetFacNoByFacName (int& fac_no, const char* fac_name); + + int GetFacIDByFacNo(RTDB_KEY_STRU& fac_id, const int fac_no); + int GetFacNoByFacID(int& fac_no, const RTDB_KEY_STRU fac_id); +public: + //int ColMeasType ( const KEY_ID_STRU keyid , int& col_prop ); + int ColMeasType ( const int table_no, const int col_id , int& col_prop ); + + //int ColMeasType( const std::vector vec_keyid , std::vector& vec_col_prop ); + +public: + // + int GraphGetAppInfo(const struct GRAPH_ORDER_KEY_REQ& graph_req, struct GRAPH_ORDER_KEY_RSP& graph_rsp); + int GraphGetValue(); + +public: + int GetAppNameByNo(char* app_name, const int app_no) { return 0;} + int GetAppNoByName(int& app_no, const char* app_name) { return 0;} + + int GetTableNameByNo(char* table_name, const int table_no, const bool is_eng=true) { return 0;} + int GetTableNoByName(int& table_no, const char* table_name, const bool is_eng=true) { return 0;} + + int GetFieldNameByNo(char* field_name, const int field_no, const bool is_eng=true) { return 0;} + int GetFieldNoByName(int& field_no, const char* field_name, const bool is_eng=true) { return 0;} + +public: + //int GetValueAndStatus(const std::vector &struVec , std::vector< struct INT_VALUE_STATUS > &KeyIdValVec); //ym + + //int GetValueAndStatus(const std::vector &struVec , std::vector< struct FLOAT_VALUE_STATUS> & KeyIdValVec); //yc + + //int GetValueAndStatus(const std::vector &struVec , std::vector< struct CHAR_VALUE_STATUS > & KeyIdValVec); //yx + + //int GetValueAndStatus(const std::vector &struVec , std::vector< struct LONG_VALUE_STATUS > & KeyIdValVec); //long + + //int GetValueAndStatus(const std::vector &struVec , std::vector< struct UNION_VALUE_STATUS> & KeyIdValVec );//union type + + //int GetValueAndStatus(const std::vector &struVec , std::vector< struct INT_VALUE_STATUS > &KeyIdValVec, bool order); //ym + + //int GetValueAndStatus(const std::vector &struVec , std::vector< struct FLOAT_VALUE_STATUS> & KeyIdValVec, bool order); //yc + + //int GetValueAndStatus(const std::vector &struVec , std::vector< struct CHAR_VALUE_STATUS > & KeyIdValVec, bool order); //yx + + //int GetValueAndStatus(const std::vector &struVec , std::vector< struct LONG_VALUE_STATUS > & KeyIdValVec, bool order); //long + + //int GetValueAndStatus(const std::vector &struVec , std::vector< struct UNION_VALUE_STATUS> & KeyIdValVec, bool order);//union type + + int GetValueAndStatus(const std::vector &staStruVec , std::vector< struct INT_VALUE_STATUS> & KeyIdValVec);//ym + + int GetValueAndStatus(const std::vector &staStruVec , std::vector< struct FLOAT_VALUE_STATUS> & KeyIdValVec);//yc + int GetValueAndStatus(const std::vector &staStruVec , std::vector< struct CHAR_VALUE_STATUS > & KeyIdValVec); //yx + int GetValueAndStatus(const std::vector &staStruVec , std::vector< struct LONG_VALUE_STATUS > & KeyIdValVec); //long + int GetValueAndStatus(const std::vector &staStruVec , std::vector< struct UNION_VALUE_STATUS> & KeyIdValVec );//union type + //int GetFieldNoFromKeyId(const std::vector &struVec , std::vector &FieldNoVec); + + int ColMeasType( const RTDB_KEY_STRU rtdbkeyid , int& col_prop ); + int ColMeasType( const std::vector vec_rtdbkeyid , std::vector& vec_col_prop ); + int GetFieldNoFromRtdbKeyId(const std::vector &struVec , std::vector &FieldNoVec); + int GetValueAndStatus(const std::vector &struVec , std::vector< struct INT_VALUE_STATUS > &KeyIdValVec); //ym + int GetValueAndStatus(const std::vector &struVec , std::vector< struct FLOAT_VALUE_STATUS> & KeyIdValVec); //yc + int GetValueAndStatus(const std::vector &struVec , std::vector< struct CHAR_VALUE_STATUS > & KeyIdValVec); //yx + int GetValueAndStatus(const std::vector &struVec , std::vector< struct LONG_VALUE_STATUS > & KeyIdValVec); //long +private: + + int GetFieldValueByNo(char** field_value_ptr, int& field_length, const char* record_ptr, const int field_no); + int GetFieldValueByName(char** field_value_ptr, int& field_length, const char* record_ptr, const char* field_name); + + int GetRecordInfo(char** buf_ptr, short& field_num, int& record_num, int& record_size); + int GetRecordInfoByKey(char** buf_ptr, short& field_num, int& record_num, int& record_size, const char* key_ptr); + + int GetMenuStringByValue(const char* menu_name, const int menu_val, const int menu_type, char*& menu_string, int& string_len); + + int get_string(char* total_namestring, const char* read_record_ptr, const struct STDB_FIELD_TAB* mov_field_ptr); + int GetNameString(std::string& total_namestring, const char* read_record_ptr, const struct STDB_FIELD_TAB* mov_field_ptr); + + int Start(); + int SetContext (const short context_no); + + //int GetPosFromKeyIdStru(const std::vector &struVec , vector &errPosVec , vector &posVec); + +private: + CApiOp (const CApiOp&); + CApiOp& operator= (const CApiOp&); + +private: + enum + { + TABLE_COLUMN_INFO = 100002, + TABLE_MENU_INFO = 100005, + TABLE_RELEVANT_MENU = 6, + TABLE_FAC_INFO = 405, + }; + + short m_ContextNo; + int m_AppNo; + int m_TableNo; + + CTableOp* m_TableOp; + //CTableOp* m_ColOp; + + TApiOpPriv *m_pPrvStru; +}; +} + + +#endif diff --git a/code/sys_nicmonitor/include/db_api/odb_apiop.h.old b/code/sys_nicmonitor/include/db_api/odb_apiop.h.old new file mode 100644 index 0000000..e92625c --- /dev/null +++ b/code/sys_nicmonitor/include/db_api/odb_apiop.h.old @@ -0,0 +1,227 @@ +/******************************************************************************* +ModuleName: ODB Real Time Database management system +FileName: odb_api.h +DESCRIPTION: general function declaration +FUNCTION LIST: +COMMENT: public application +History: +Date Version Modifier Activities +2004-06-25 1.1 add context_no parameter +2003-05-28 1.0 modify +================================================================================ +2003-05-28 1.0 created +*******************************************************************************/ + +#ifndef __ODB_APIOP_H__ +#define __ODB_APIOP_H__ + +#ifndef __ODB_TABLEOP_H__ +#include "db_api/odb_tableop.h" +#endif + +#ifdef _WINDOWS64 +#ifdef ODB_API_LIB_EXPORTS +#define ODB_API_LIB_API __declspec(dllexport) +#else +#define ODB_API_LIB_API __declspec(dllimport) +#endif +#else +#define ODB_API_LIB_API +#endif + +using namespace std; + +namespace ODB +{ +typedef vector IntVec; + +typedef struct +{ + int slice_no; + int type; + CTableOp *m_pColOp; + CTableOp *m_pMenuOp; +} TApiOpPriv; + +class ODB_API_LIB_API CApiOp: public CTableBase +{ +public: + CApiOp(); + CApiOp ( const int app_no , const short context_no = 0); + CApiOp ( const int app_no, const int table_no , const short context_no = 0); + ~CApiOp(); + + int Open (const int app_no, const int table_no, const short context_no = 0); + int Open (const int table_no); + int SetAppNo (const int app_no, const short context_no = 0); + int SetScenario(const std::string& scenario_name, + const int scenario_inst_name, + const std::string& sub_scenario_name, + const int sub_scenario_inst_name); + int SetScenario(const int scenario_no, + const int scenario_inst_no, + const int sub_scenario_no, + const int sub_scenario_inst_no); + int SetAppNo(const std::string& scenario_name, + const int scenario_inst_name, + const std::string& sub_scenario_name, + const int sub_scenario_inst_name); + int SetSliceNo(int slice_no); + +public: + int MenuRead(const char* menu_name, std::vector& vec_menu, const int menu_status=MENU_ON); + int MenuRead(const char* menu_name, char** buf_ptr, int& buf_size, const int menu_status=MENU_ON);//obsolete + + // + int TableReleMenuRead (const int table_no, const int field_no ); + int TableReleMenuRead(const int table_no, const int field_no, std::vector& vec_menu); + int TableReleMenuRead(const int table_no, std::vector& vec_menu); + + int TableReleMenuRead(const int table_no, const int field_no, char** buf_ptr, int& buf_size);//obsolete + int TableReleMenuRead(const int table_no, char** buf_ptr, int& buf_size);//obsolete + + // + int GetRefMenuString(const int table_no, std::vector& vec_menu); + int GetRefMenuString(const vector vec_table, std::vector& vec_menu); + int GetRefMenuString(const int table_no, char*& menu_buf_ptr, int& menu_buf_size);//obsolete + + // + int GetNameStringByID(const cmnInt64 reference_id, std::string& ref_string); + int GetNameStringByID(const cmnInt64 reference_id, char*& referenced_namebuf, int& namebuf_size); + + // + int GetNameStringByID(const std::vector& vec_refid, std::vector& vec_ref_string); + + /* + int GetNameStringByKeyID(const KEY_ID_STRU& keyid_stru, std::string& ref_string); + int GetNameStringByKeyID(const std::vector& vec_keyid, std::vector& vec_ref_string); + + int GetNameStringByKeyID( const KEY_ID_STRU& keyid_stru, char*& referenced_namebuf, int& namebuf_size); + */ + // + int GetNameStringBykey (const char* key_ptr, std::string& ref_string); + int GetNameStringBykey(const char* key_ptr, char*& referenced_namebuf, int& namebuf_size ); + + // + int GetNameStringByAppKeyID( const std::vector& vec_appkeyid, std::vector& vec_name_string); + int GetNameStringByAppID( const std::vector& vec_appid, std::vector& vec_name_string); + + int GetNameStringByRtdbKeyID( const std::vector& vec_rtdbkeyid, std::vector& vec_name_string); + int GetNameStringByRtdbKeyID( const RTDB_KEY_STRU& rtdbkeyid_stru, char*& referenced_namebuf, int& namebuf_size); + int GetNameStringByRtdbKeyID(const RTDB_KEY_STRU rtdbkeyid_stru, std::string& ref_string); + + // + int GetRefFlag (const int table_no, const short field_no); //obsolete + int GetRefFlag (const short field_no); + +public: + int GetFacNameByKeyNo(const int table_no, const char* key_ptr, std::string& ref_string); + int GetFacNameByFacID(char* fac_name, const RTDB_KEY_STRU fac_id); + int GetFacNameByFacNo (char* fac_name, const int fac_no); + + int GetFacIDByFacName(RTDB_KEY_STRU& fac_id, const char* fac_name); + int GetFacNoByFacName (int& fac_no, const char* fac_name); + + int GetFacIDByFacNo(RTDB_KEY_STRU& fac_id, const int fac_no); + int GetFacNoByFacID(int& fac_no, const RTDB_KEY_STRU fac_id); +public: + //int ColMeasType ( const KEY_ID_STRU keyid , int& col_prop ); + int ColMeasType ( const int table_no, const int col_id , int& col_prop ); + + //int ColMeasType( const std::vector vec_keyid , std::vector& vec_col_prop ); + +public: + // + int GraphGetAppInfo(const struct GRAPH_ORDER_KEY_REQ& graph_req, struct GRAPH_ORDER_KEY_RSP& graph_rsp); + int GraphGetValue(); + +public: + int GetAppNameByNo(char* app_name, const int app_no) { return 0;} + int GetAppNoByName(int& app_no, const char* app_name) { return 0;} + + int GetTableNameByNo(char* table_name, const int table_no, const bool is_eng=true) { return 0;} + int GetTableNoByName(int& table_no, const char* table_name, const bool is_eng=true) { return 0;} + + int GetFieldNameByNo(char* field_name, const int field_no, const bool is_eng=true) { return 0;} + int GetFieldNoByName(int& field_no, const char* field_name, const bool is_eng=true) { return 0;} + +public: + //int GetValueAndStatus(const std::vector &struVec , std::vector< struct INT_VALUE_STATUS > &KeyIdValVec); //ym + + //int GetValueAndStatus(const std::vector &struVec , std::vector< struct FLOAT_VALUE_STATUS> & KeyIdValVec); //yc + + //int GetValueAndStatus(const std::vector &struVec , std::vector< struct CHAR_VALUE_STATUS > & KeyIdValVec); //yx + + //int GetValueAndStatus(const std::vector &struVec , std::vector< struct LONG_VALUE_STATUS > & KeyIdValVec); //long + + //int GetValueAndStatus(const std::vector &struVec , std::vector< struct UNION_VALUE_STATUS> & KeyIdValVec );//union type + + //int GetValueAndStatus(const std::vector &struVec , std::vector< struct INT_VALUE_STATUS > &KeyIdValVec, bool order); //ym + + //int GetValueAndStatus(const std::vector &struVec , std::vector< struct FLOAT_VALUE_STATUS> & KeyIdValVec, bool order); //yc + + //int GetValueAndStatus(const std::vector &struVec , std::vector< struct CHAR_VALUE_STATUS > & KeyIdValVec, bool order); //yx + + //int GetValueAndStatus(const std::vector &struVec , std::vector< struct LONG_VALUE_STATUS > & KeyIdValVec, bool order); //long + + //int GetValueAndStatus(const std::vector &struVec , std::vector< struct UNION_VALUE_STATUS> & KeyIdValVec, bool order);//union type + + int GetValueAndStatus(const std::vector &staStruVec , std::vector< struct INT_VALUE_STATUS> & KeyIdValVec);//ym + + int GetValueAndStatus(const std::vector &staStruVec , std::vector< struct FLOAT_VALUE_STATUS> & KeyIdValVec);//yc + int GetValueAndStatus(const std::vector &staStruVec , std::vector< struct CHAR_VALUE_STATUS > & KeyIdValVec); //yx + int GetValueAndStatus(const std::vector &staStruVec , std::vector< struct LONG_VALUE_STATUS > & KeyIdValVec); //long + int GetValueAndStatus(const std::vector &staStruVec , std::vector< struct UNION_VALUE_STATUS> & KeyIdValVec );//union type + //int GetFieldNoFromKeyId(const std::vector &struVec , std::vector &FieldNoVec); + + int ColMeasType( const RTDB_KEY_STRU rtdbkeyid , int& col_prop ); + int ColMeasType( const std::vector vec_rtdbkeyid , std::vector& vec_col_prop ); + int GetFieldNoFromRtdbKeyId(const std::vector &struVec , std::vector &FieldNoVec); + int GetValueAndStatus(const std::vector &struVec , std::vector< struct INT_VALUE_STATUS > &KeyIdValVec); //ym + int GetValueAndStatus(const std::vector &struVec , std::vector< struct FLOAT_VALUE_STATUS> & KeyIdValVec); //yc + int GetValueAndStatus(const std::vector &struVec , std::vector< struct CHAR_VALUE_STATUS > & KeyIdValVec); //yx + int GetValueAndStatus(const std::vector &struVec , std::vector< struct LONG_VALUE_STATUS > & KeyIdValVec); //long +private: + + int GetFieldValueByNo(char** field_value_ptr, int& field_length, const char* record_ptr, const int field_no); + int GetFieldValueByName(char** field_value_ptr, int& field_length, const char* record_ptr, const char* field_name); + + int GetRecordInfo(char** buf_ptr, short& field_num, int& record_num, int& record_size); + int GetRecordInfoByKey(char** buf_ptr, short& field_num, int& record_num, int& record_size, const char* key_ptr); + + int GetMenuStringByValue(const char* menu_name, const int menu_val, const int menu_type, char*& menu_string, int& string_len); + + int get_string(char* total_namestring, const char* read_record_ptr, const struct STDB_FIELD_TAB* mov_field_ptr); + int GetNameString(std::string& total_namestring, const char* read_record_ptr, const struct STDB_FIELD_TAB* mov_field_ptr); + + int Start(); + int SetContext (const short context_no); + + //int GetPosFromKeyIdStru(const std::vector &struVec , vector &errPosVec , vector &posVec); + +private: + CApiOp (const CApiOp&); + CApiOp& operator= (const CApiOp&); + +private: + enum + { + TABLE_COLUMN_INFO = 100002, + TABLE_MENU_INFO = 100005, + TABLE_RELEVANT_MENU = 6, + TABLE_FAC_INFO = 405, + }; + + short m_ContextNo; + int m_AppNo; + int m_TableNo; + + CTableOp* m_TableOp; + //CTableOp* m_ColOp; + + TApiOpPriv *m_pPrvStru; +}; +} + + +#endif diff --git a/code/sys_nicmonitor/include/db_api/odb_app2id.h b/code/sys_nicmonitor/include/db_api/odb_app2id.h new file mode 100644 index 0000000..1bd70ea --- /dev/null +++ b/code/sys_nicmonitor/include/db_api/odb_app2id.h @@ -0,0 +1,80 @@ +#ifndef _APPNAME2ID_ +#define _APPNAME2ID_ +#include "common_types.h" +#ifndef _WINDOWS64 +#ifndef _HPUX +#include +#else +#include +#endif +#include +#else +#include +#include +#endif + +#include +#include + +#ifdef _WINDOWS64 +#ifdef ODB_API_LIB_EXPORTS +#define ODB_API_LIB_API __declspec(dllexport) +#else +#define ODB_API_LIB_API __declspec(dllimport) +#endif +#else +#define ODB_API_LIB_API +#endif + + + +#define MAXSIZE 8092 + +struct ID2NameNode +{ + int app_id; + char app_name[32]; + + struct ID2NameNode * next_pointer; +}; + +class ODB_API_LIB_API CAppNameIDTrans +{ + public : + CAppNameIDTrans(); + + CAppNameIDTrans(const CAppNameIDTrans&); + + ~CAppNameIDTrans(); + + //void operator= (const CAppNameIDTrans&); + + private: + + #ifndef _WINDOWS64 + static pthread_mutex_t s_guard; +#else + static CRITICAL_SECTION s_guard; +#endif + static CAppNameIDTrans * s_instance ; + + ID2NameNode * m_hashTable; + ID2NameNode * second; + char* m_InitPtr; + + cmnInt64 * freePos; + cmnInt64 freePointer; + + public: + static CAppNameIDTrans * getInstance(); + + char * getAppNameByID(const int app_id); + + + int createHashTable(); + + int putData2Table(); + + +}; +#endif diff --git a/code/sys_nicmonitor/include/db_api/odb_autolock.h b/code/sys_nicmonitor/include/db_api/odb_autolock.h new file mode 100644 index 0000000..65f010f --- /dev/null +++ b/code/sys_nicmonitor/include/db_api/odb_autolock.h @@ -0,0 +1,138 @@ +#ifndef _PVLOCK +#define _PVLOCK +#include "db_api/odb_common.h" +#include "db_api/odb_define.h" + +#include "ThreadKit/ThreadKit.h" +#ifndef _WINDOWS64 +#ifndef _HPUX +#include +#else +#include +#endif +#else +#include +#endif + +#include "db_api/odb_lock.h" + +#ifdef _WINDOWS64 +typedef int key_t; +#endif + +class PVLock +{ +private: + PVLock(const PVLock&); + PVLock& operator=(const PVLock&); + int m_semid; + int m_semno; +public: + + PVLock(key_t key , int no); + ~PVLock(); +}; + + +class PMutexLock +{ +private: + PMutexLock(const PMutexLock&); + PMutexLock& operator=(const PMutexLock&); +#ifndef _WINDOWS64 + pthread_mutex_t * m_mutex; + +public: + PMutexLock(pthread_mutex_t * out_mutex):m_mutex(out_mutex) + { + if( 0 != pthread_mutex_lock(m_mutex )) + { + printf("Error in pthread mutex lock ...,errno === %d \n" , errno); + } + } + ~PMutexLock() + { + if(0 != pthread_mutex_unlock(m_mutex)) + { + printf("Error in pthread mutex unlock ... errno === %d \n" , errno); + } + } +#else + /* + CRITICAL_SECTION* m_mutex; +public: + PMutexLock(CRITICAL_SECTION* out_mutex):m_mutex(out_mutex) + { + EnterCriticalSection(m_mutex); + } + ~PMutexLock() + { + LeaveCriticalSection(m_mutex); + } + */ + + THREADKIT::Mutex* m_mutex; +public: + PMutexLock(THREADKIT::Mutex* out_mutex):m_mutex(out_mutex) + { + m_mutex->lock(); + } + ~PMutexLock() + { + m_mutex->unlock(); + }; + +#endif +}; + +class CRWLock +{ +private: + struct ODB::LOCK_STRU *m_LockPtr; + DB_LOCK_T m_RWType; + int* m_SemId; + CRWLock(); + CRWLock(const CRWLock& theLock); + CRWLock& operator=(const CRWLock& theLock); +public: + + //jinjing 20120429 + CRWLock(struct ODB::LOCK_STRU *lock_ptr,const DB_LOCK_T lock_type, int& table_semid); + ~CRWLock(); + int ChangeLockType(const DB_LOCK_T lock_type); +// CRWLock(struct ODB::LOCK_STRU *lock_ptr,const DB_LOCK_T lock_type, int& table_semid) +// { +// //jinjing 20120428 +//// ODB::COdbLock::Lock(*lock_ptr, lock_type, table_semid); +//// m_LockPtr = lock_ptr; +//// m_RWType = lock_type; +//// m_SemId = table_semid; +// m_SemId = table_semid; +// TRACE("m_SemId1 = %d\n lock_type = %d", m_SemId, lock_type); +// TRACE("!!!!!Addr_AutoLock.m_SemId = %d\n", &m_SemId); +// ODB::COdbLock::Lock(*lock_ptr, lock_type, m_SemId); +// TRACE("!!!!!Addr_AutoLock.m_SemId2 = %d\n", &m_SemId); +// TRACE("m_SemId2 = %d\n", m_SemId); +// m_LockPtr = lock_ptr; +// m_RWType = lock_type; +// table_semid = m_SemId; +// TRACE("table_semid = %d\n", table_semid); +// } +// ~CRWLock() +// { +// ODB::COdbLock::UnLock(*m_LockPtr, m_RWType, m_SemId); +// } +// +// int ChangeLockType(const DB_LOCK_T lock_type) +// { +// if(lock_type != m_RWType) +// { +// ODB::COdbLock::UnLock(*m_LockPtr,m_RWType, m_SemId); +// ODB::COdbLock::Lock(*m_LockPtr,lock_type, m_SemId); +// m_RWType = lock_type; +// } +// return 0; +// } + +}; +#endif diff --git a/code/sys_nicmonitor/include/db_api/odb_baseindex.h b/code/sys_nicmonitor/include/db_api/odb_baseindex.h new file mode 100644 index 0000000..193ecf5 --- /dev/null +++ b/code/sys_nicmonitor/include/db_api/odb_baseindex.h @@ -0,0 +1,54 @@ +/******************************************************************************* +ModuleName: Real Time Database management system +FileName: rtdb_api.cpp +DESCRIPTION: rtdb api interfaces implementation +FUNCTION LIST: +COMMENT: +History: +Date Version Modifier Activities +2009-01-10 1.1 add net interfaces +================================================================================ +2008-10-30 1.0 created +*******************************************************************************/ +//#include +#include "db_api/odb_prv_struct.h" +#ifndef _CBASEINDEX +#define _CBASEINDEX + +#ifdef _WINDOWS64 +#ifdef ODB_API_LIB_EXPORTS +#define ODB_API_LIB_API __declspec(dllexport) +#else +#define ODB_API_LIB_API __declspec(dllimport) +#endif +#else +#define ODB_API_LIB_API +#endif + +namespace ODB +{ +class ODB_API_LIB_API CBaseIndex +{ +public: + virtual int need_rebuilt(char *existed_table_ptr,struct STDB_TAB *stdb_tab_ptr,struct STDB_FIELD_TAB *stdb_field_tab_ptr,INDEX_DEFINE &index_define,int &shm_id) =0; + virtual int CreateIndex(struct STDB_TAB *stdb_tab_ptr,struct STDB_FIELD_TAB *stdb_field_tab_ptr,INDEX_DEFINE &index_define,int &shm_id,int &shm_size) =0; + virtual int Open(char *index_file_name,int table_id,int index_id)=0; //table_idindex_idINDEX_STDB_TAB::table_idINDEX_STDB_TAB::field_idƥУ + virtual int Open(int index_shmid,int table_id,int index_id) = 0; //table_idindex_idINDEX_STDB_TAB::table_idINDEX_STDB_TAB::field_idƥУ + virtual int SetIndexPtr(char *index_ptr)= 0; //ѻָ븳ֵ࣬ͲʹǰOpen + virtual int GetKeyByIndex(char *index_ptr,std::vector &index_array)=0;//Ƕؼֵֿͬ + virtual int GetKeyPointerByIndex(char *index_ptr, int& pointer)=0;//ֻЧindexõ¼λ + virtual int IndexInsert(char *index_ptr,char *key_ptr)=0; + virtual int BulkIndexInsert(char *bulk_index_key_ptr)=0;//װʱ,˳϶õġ൱ⲿźȻһѰеȫȥ + virtual int Indexdelete(char *index_ptr,char *key_ptr)=0; + virtual int IndexClear()=0; + virtual int GetIdxMthd()=0; + virtual int FreeResource()=0;//Ʃunmapshmdtָ롣 + virtual int DebugDisp(int type)=0;//ãͬtypeʾͬϸ̶ȲͬϢ + virtual int GetIndexRecNum() = 0;//¼ܵĸЧ¼ܺ͡HASHֻǷ0 + virtual DB_STATUS_T GetIndexStatus()=0;//״̬ + virtual void SetIndexStatus(DB_STATUS_T idx_status)=0;//ͷϵ״̬ + virtual ~CBaseIndex(){}; +}; +} + +#endif diff --git a/code/sys_nicmonitor/include/db_api/odb_ckeymanager.h b/code/sys_nicmonitor/include/db_api/odb_ckeymanager.h new file mode 100644 index 0000000..c013946 --- /dev/null +++ b/code/sys_nicmonitor/include/db_api/odb_ckeymanager.h @@ -0,0 +1,64 @@ +#ifndef _CKEYMAN +#define _CKEYMAN +#include "db_api/odb_define.h" +#include "db_api/odb_prv_struct.h" +#ifndef _WINDOWS64 +#include "sys/time.h" +#else +#include +#endif +#include "db_api/odb_autolock.h" + + +#define MAGICLEN 16 + +#define MAX_FIX_INDEX_NUM 100 +struct FIX_INDEX_DEF +{ + short ctx_no; + int app_no; + int table_no; + int idx_seq_no; +}; + +struct KEY_MANAGE_TAB +{ + char magic[MAGICLEN]; + int valid ;// = INVALID; + int shmKey; + int semKey; + time_t createTime; + + int fix_index_num; + struct FIX_INDEX_DEF fix_index_def_array[MAX_FIX_INDEX_NUM]; +}; + + + +class CKeyManager +{ +private: + static struct KEY_MANAGE_TAB* m_ShmManTabPtr; + static CKeyManager * m_KeyManPtr; + static int m_SemId; + + CKeyManager(); + + CKeyManager(const CKeyManager&); + CKeyManager& operator =(const CKeyManager&); + int Init(); + + +public: + int GetShmKey(); + int GetSemKey(); + time_t GetCreateTime(); + + int GetFixIdxDef(struct FIX_INDEX_DEF **fix_idx_array_ptr); + int InsertFixIdxDef(struct FIX_INDEX_DEF &fix_idx_def); + int DeleteFixIdxDef(struct FIX_INDEX_DEF &fix_idx_def); + + static CKeyManager * GetInstance(); +}; + +#endif diff --git a/code/sys_nicmonitor/include/db_api/odb_common.h b/code/sys_nicmonitor/include/db_api/odb_common.h new file mode 100644 index 0000000..8251485 --- /dev/null +++ b/code/sys_nicmonitor/include/db_api/odb_common.h @@ -0,0 +1,202 @@ +/******************************************************************************* +ModuleName: ODB Real Time Database management system +FileName: odb_common.h +DESCRIPTION: common data struct define +FUNCTION LIST: +COMMENT: public application +History: +Date Version Modifier Activities +2002-09-01 1.0 modify +================================================================================ +2002-09-01 1.0 created +*******************************************************************************/ + +#ifndef __ODB_COMMON_H__ +#define __ODB_COMMON_H__ +#include "common_types.h" +#include "db_api/odb_public.h" +//#include "odb_struct.h" +#include "db_api/odb_prv_struct.h" +#include "db_api/odb_app2id.h" + +#ifdef _WINDOWS64 +#ifdef ODB_API_LIB_EXPORTS +#define ODB_API_LIB_API __declspec(dllexport) +#else +#define ODB_API_LIB_API __declspec(dllimport) +#endif +#else +#define ODB_API_LIB_API +#endif + +#ifdef _WINDOWS64 +typedef int key_t; +#endif + +using namespace std; + +namespace ODB +{ + +//ϵͳ +class ODB_API_LIB_API CCommon +{ +public: + CCommon(){}; + ~CCommon(){}; + + //map file // 2002-10-01 + static char* MapFile(const char* file_name, const int stab_total_size, const bool read_only = false); + static char* MapFile(const char* file_name, MAP_FILE_KEY map_id, const int stab_total_size, const bool read_only = false); +#ifdef _WINDOWS64 + static char* MapFile(const char* file_name, const int stab_total_size, const char* uniq_flag, bool read_only = false); + static char* MapFile(const char* file_name, MAP_FILE_KEY map_id, const int stab_total_size, const char* uniq_flag, bool read_only = false); +#endif + static int UmapFile(char* addr_t, const int size); + static int UmapFile(char* addr_t, MAP_FILE_KEY map_id, const int size); + + //sort // 2002-11-20 + //static void QkSort(std::vector& r, int base, int top); + static void QkSort(std::vector& r, const int base, const int top); + static void StlSort(std::vector& r); + + //char + static char* itoa(const int value); + static int str_lwr(char* str_dst, const char* str_src); + static int str_upr(char* str_dst, const char* str_src); + + static bool strip_blank1(char* ptr); + static int strip_blank2(char* str_src); + static bool StripBlank(char* str_src); + //static void str_up(char* str); + //static void str_lower(char* str); + //inline static char* dwcase(char* str); + + //sem 2002-12-28 +#ifndef _WINDOWS64 + static int InitSem(const key_t key, const int nsems=1); + static int p(const int sem_id, const int sem_num=0); + static int v(const int sem_id, const int sem_num=0); + static int GetValue(const int sem_id, const int sem_num=0); +#else + static int p(const char* sem_name, const int sem_num); + static int v(const char* sem_name, const int sem_num = 1, const int release_num=1); +#endif + + //shm + static char* GetShmPtr(const key_t key, const int size); + static int GetShmID(const key_t key, const int size); + static char* GetShmPtrByID(const int shm_id); + static int GetShmSizeByID(const int shm_id); + + //time + static void TimevalSub(struct timeval* end, struct timeval* start); + + static bool IsApplication(const char* app_name); + static bool IsApplication(const int app_no); + + static void* Malloc(const int buf_size); + static void Free(void* pointer); + + static int GetOdbId(const char* odb_id_sysfile); + + static int TransTime(time_t cur_time, char* time_str); + +public: + static int ExchangeData(char* buf_ptr, const int buf_size, const std::vector& vec_offset, const DB_BYTE_T& remote_byte); + static int ExchangeByteOrder(char* buf_ptr, const int len); + static DB_BYTE_T GetByteTag(); + + static int GetSize(std::vector& vec_member); + +public: + static int PrintCtrlTab(const struct DB_CTRL_TAB* ctrl_tab_ptr); + static int PrintStdbTab(const struct STDB_TAB* stdb_tab_ptr); + static int PrintStabField(const struct STDB_FIELD_TAB* stdb_field_tab_ptr); + static int PrintField(const int data_type, const char* field_data_ptr); + +private: + //static void QkPass(std::vector& r, int start, int tend, int& i); + static void QkPass(std::vector& r, const int start, const int tend, int& i); + + static int CheckSize(std::vector& m_vecMember); + static int MakeOffset(std::vector& m_vecMember); + static int AssignOffset(int& index_pos, const int assign_val); + +public: + static void keyid_to_long(struct KEY_STRU *key_stru_ptr,cmnUint64* key_id_ptr); + static void long_to_keyid(cmnUint64 key_id,struct KEY_STRU *key_stru_ptr); + + static void long_to_tableNo(cmnUint64 key_id,short *table_no_ptr); + static void long_to_field_id(cmnUint64 key_id,short *field_id_ptr); + static void long_to_key(cmnUint64 key_id,int *key_ptr); + + static void key_id_to_long(int key,short field_id,short table_id,cmnUint64*key_id_ptr); + static void long_to_key_id(cmnUint64 key_id,int *key_ptr,short *field_id_ptr,short *table_id_ptr); + + static int long_to_area_no(const cmnInt64 key_id); + static void long_to_key_in_area(const cmnInt64 key_id, int& key_inarea); + static void area_key_id_to_long(int area_no, int key, short field_id, short table_id, cmnInt64& key_id); + static void long_to_long_without_area(const cmnInt64 id_with_area, cmnInt64& id_without_area); + + /* + static unsigned int rtdb_keyid_to_area_id(struct RTDB_KEY_STRU rtdb_key_id); + static unsigned int rtdb_keyid_to_table_id(struct RTDB_KEY_STRU rtdb_key_id); + static unsigned int rtdb_keyid_to_serial_no(struct RTDB_KEY_STRU rtdb_key_id); + static unsigned int rtdb_keyid_to_column_id(struct RTDB_KEY_STRU rtdb_key_id); + static void set_rtdb_keyid_area_id(struct RTDB_KEY_STRU& rtdb_key_id, unsigned int area_id); + static void set_rtdb_keyid_table_id(struct RTDB_KEY_STRU& rtdb_key_id, unsigned int table_id); + static void set_rtdb_keyid_serial_no(struct RTDB_KEY_STRU& rtdb_key_id, unsigned int serial_no); + static void set_rtdb_keyid_column_id(struct RTDB_KEY_STRU& rtdb_key_id, unsigned int column_id); + static void rtdb_keyid_to_long(unsigned int area_id, unsigned int table_id, unsigned int serial_no, unsigned int column_id, struct RTDB_KEY_STRU& rtdb_key_id); + static void rtdb_keyid_to_sgid(string& sgid, const struct RTDB_KEY_STRU& rtdb_key_id); + */ + static int find_max_prime(int value); + + static int hash33(char * code , int len , int max); + static int hash37(char * code , int len , int max); + static int hash_string(char * code , int len , int max); + static int hash_int(char * code , int len , int max); + static int hash_long(char * code , int len , int max); + static int ShmDetach(char *& shm_ptr , int size); + static int ShmRemove(int shm_id,int type); + static int Equal(char *,char *,int length); + static int MemCpy(char *dst,char *src,int length); + static void FormatAppKeyStru(char* app_key_stru_ptr); + static int FieldCompare(char *src_ptr,char *dst_ptr,int type,int length); //return val : 0 means equal , others means not equal + //static int NeedFixIndex(int ctx_no,int app_no,int table_no,int index_seq_no);//index_seq_noڱͷ˳012....,жID + //int RCDCmp(const void *ee1,const void *ee2); + +// //nothing +// static void do_nothing1(int nn); +// static void do_nothing2(int nn); + static int compare_keyword(const char* keyword1_ptr, const char* keyword2_ptr, const ODB::KEYWORD_STRU& key); + +#ifndef _WINDOWS64 + static int addItem(struct CMmapList& m_list, char* file_ptr, unsigned int map_size, const char* file_name, MAP_FILE_KEY map_id); + static char* getMapPtr(struct CMmapList& m_list, const char* file_name, MAP_FILE_KEY map_id); + static int shrinkList(struct CMmapList& m_list); + static int reduceCounter(struct CMmapList& m_list, char* file_ptr, const int size, MAP_FILE_KEY map_id); + static int recoveryList(struct CMmapList& m_list); + static void PrintList(struct CMmapList& m_list); + + static CAppNameIDTrans* getAppNameIdTransPtr(); + ////////////////////// using map for file mapping cache /////////////////////////// + static int addMapItem(MMapInfoList& m_list, char* file_ptr, unsigned int map_size, const char* file_name, MAP_FILE_KEY map_id); + static char* getMapPtr(MMapInfoList& m_list, const char* file_name, MAP_FILE_KEY map_id); + static int shrinkMapList(MMapInfoList& m_list); + static int reduceMapCounter(MMapInfoList& m_list, char* file_ptr, const int size, MAP_FILE_KEY map_id); + static void PrintMapList(MMapInfoList& m_list); + + +#endif + static void setMapFlag(int m_flag); + static void setMapID(MAP_FILE_KEY& map_id, int ctx_no, int app_no, short tab_no, int area_no); + static int parseAppNameFromFileName(char* app_name, const char* app_file_name); + +}; + +} + +#endif + diff --git a/code/sys_nicmonitor/include/db_api/odb_define.h b/code/sys_nicmonitor/include/db_api/odb_define.h new file mode 100644 index 0000000..1e9dd1b --- /dev/null +++ b/code/sys_nicmonitor/include/db_api/odb_define.h @@ -0,0 +1,563 @@ +/******************************************************************************* +ModuleName: ODB Real Time Database management system +FileName: odb_define.h +DESCRIPTION: macro define and error no +FUNCTION LIST: +COMMENT: +History: +Date Version Modifier Activities +2002-09-01 1.0 modify +================================================================================ +2002-09-01 1.0 created +*******************************************************************************/ +#include "system.h" +#include "d5000_err.h" +#include "common_types.h" +#include "logclient.h" +#ifdef _WINDOWS64 +#pragma warning(disable: 4996) +#pragma warning(disable: 4267) +#endif + +#ifndef __ODB_DEFINE_H__ +#define __ODB_DEFINE_H__ + +#ifndef _SHARE_MEMORY +#define DEF_SHMMEM 0 +#else +#define DEF_SHMMEM 1 +#endif + +//const struct LogInfo ODBLOG = {2, "***", "***", "***", "odb_lib"}; + +//const long COLUMN_NO_FACTOR = 100000000; //wqx 2018-08-01 +//const long SERILA_NO_FACTOR = 100000000; //wqx 2018-08-01 +//const long AREA_NO_FACTOR = 1000000; //wqx 2018-09-10 +//const long COLUMN_NO_FACTOR = AREA_NO_FACTOR * SERILA_NO_FACTOR;//wqx 2018-09-10 +const long COLUMN_NO_FACTOR = 10000;//2018-10-08 +const int MAX_DB_NUMBER = 999999;//16000; +const int MAX_AREA_NUM = 256; + // 2002-10-17 +const int MAX_APP_TABLE = 256; //for each application +const int MAX_CONTEXT_NUM = 64; +const int MAX_APP_NUM = 256; +const int MAX_TABLE_FIELD = 512; //512 +const short MAX_CONTEXT_NO = 16384; +/*----------------------------------------------------------------------------*/ + +const int MAX_SUBKEY_NUMBER = 10; + +const unsigned int MAX_KEY_LEN = 40; +const unsigned int MAX_FILE_PATH_LEN = 40; +const unsigned int MAX_NAME_STRING_LEN = 40; +const unsigned int MAX_DATAFIELD_LEN = 16; +const unsigned int MAX_PASSWD_LEN = 8; + +const unsigned int MAX_SUB_SCENARIO_INST_PER_ALLOC = 99; +const unsigned int MAX_SUB_SCENARIO_PER_ALLOC = 99; +const unsigned int MAX_SCENARIO_INST_ALLOC = 99; + +const unsigned int ENG_NAME_LEN = 32; +const unsigned int CHN_NAME_LEN = 64; + +const unsigned int ORIGIN_MENU_NAME_LEN = 40; +const unsigned int MENU_NAME_LEN = 64; +const unsigned int MENU_DISPLAY_LEN = 40; +const unsigned int DEFAULT_VALUE_LEN = 20; +const unsigned int ARRAY_NAME_LEN = 32; +const unsigned int DESCRIPTION_LEN = 100; +/*----------------------------------------------------------------------------*/ + +const unsigned int RECORD_HEAD_LEN = 4; +const unsigned int MV_SIZE = 1024; +const unsigned int INT_ADDRESS_ASSIGN = 4; + +const unsigned int MAX_PHY_RECORD_LEN = 15000; + +const int RTDB_APP_MOD = AF_AP_MOD; //change from 100 at 2004-07-14 +const int ORB_TRY_TIMES = 3 ; //initial 20 +/*----------------------------------------------------------------------------*/ + +const int RTDB_SYSTEM_SEM_KEY = 0x20000; +const int RTDB_APP_SEM_KEY = 0x20010; +//const int RTDB_TABLE_SEM_KEY = 0x3200; +const int RTDB_TABLE_SEM_KEY = 0x201; + +/***************for CKeyManager SHMKEY and SEMKEY Begin******************************/ +const int RTDB_TABLE_SHM_KEY = 0x8000; +const int RTDB_TABLE_SHAREMEMORY_SHM_KEY = 0x90000; +const int RTDB_KEY_MANAGE_SHM_KEY = 0x7999; +const int RTDB_KEY_MANAGE_SEM_KEY = 0x20001; +/***************for CKeyManager SHMKEY and SEMKEY End *******************************/ + +const int MAX_SEM_NUM = 25; +const int RTDB_SEM_NUM = 12; +/*----------------------------------------------------------------------------*/ +const short ENTITY_APP = 1; +const short ENTITY_TABLE = 2; +const short ENTITY_FIELD = 3; + +const unsigned char MODE_CHN = 0; +const unsigned char MODE_ENG = 1; + +const unsigned char MODE_NAME_BY_NO = 0; +const unsigned char MODE_NO_BY_NAME = 1; +/*----------------------------------------------------------------------------*/ + + +const char PATH_VIRGULE = '/'; + +//#else +// +//const char PATH_VIRGULE = '\'; +// +//#endif + +/*----------------------------------------------------------------------------*/ +const int MODE_API = 1; + + +// CONDITION_TYPE: condition_type +/*----------------------------------------------------------------------------*/ + + +const short SIMPLE_CON = 0; +const short MULTI_CON = 1; +const short HIS_SIMPLE_CON = 2; +const short HIS_MULTI_CON = 3; +const short XY_CURVE_CON = 4; +const short TABLE_CON = 5; +const short STATISTIC_CON = 6; + +/* ---------------------------------------------------------------------------*/ +/* Db data type */ +typedef unsigned char DATA_TYPES_T; //ԿΪenum + +/* ----------------------------------------------------------- + DB_OBJECT_T: 2002-10-22 + ---------------------------------------------------------- */ +enum DB_OBJECT_T +{ + OBJECT_NONE = 0, + OBJECT_SYSTEM = 1, + OBJECT_APP = 2, + OBJECT_TABLE = 3 +}; +/* ----------------------------------------------------------- + DB_LOCK_T: 2002-10-22 + ---------------------------------------------------------- */ +enum DB_LOCK_T +{ + DB_LOCK_NONE = 0, + DB_LOCK_READ = 1, + DB_LOCK_WRITE = 2, + DB_LOCK_INTEND = 3 +}; + +/* ----------------------------------------------------------- + DB_BYTE_T: 2002-10-22 + ---------------------------------------------------------- */ +enum DB_BYTE_T +{ + BYTE_LITTLE_ENDIAN = 0, + BYTE_BIG_ENDIAN, + BYTE_OTHER +}; + +/* ----------------------------------------------------------- + DB_CONTEXT_T: 2002-10-18 + ---------------------------------------------------------- */ +enum DB_CONTEXT_T +{ + CONTEXT_REAL_TIME = 0, + CONTEXT_RESEARCH, + CONTEXT_INSTRUCT, + CONTEXT_HISTORY = 3, + CONTEXT_NONE = 4 +}; + +/* ----------------------------------------------------------- + DB_STATUS_T: 2002-10-16 + ---------------------------------------------------------- */ +enum DB_STATUS_T +{ + TABLE_INIT = 0, //ϵͳʼ,δ + TABLE_NORMAL = 1, //Ѿ + TABLE_DELETED = 2, //ɾ + TABLE_ERROR =3 ,//ִҪ޸ + TABLE_DOWNLOADING = 4 //װװ״̬óTABLE_NORMAL +}; + +/* ----------------------------------------------------------- + DB_CLASS_T: db_class + ---------------------------------------------------------- */ +enum DB_CLASS_T +{ + STDB = 0, + VIEW = 1 +}; + +/* ----------------------------------------------------------- + DB_TYPES_T: db_type + ---------------------------------------------------------- */ +enum DB_TYPES_T +{ + DATA = 0, + INDEX = 1 +}; +/* ----------------------------------------------------------- + DB_MEDIA_T: db_media + ---------------------------------------------------------- */ +enum DB_MEDIA_T +{ + MEMORY = 0, + DISK = 1 +}; +/* ----------------------------------------------------------- + INDEX_TYPE_T: index_type + ---------------------------------------------------------- */ +enum INDEX_TYPE_T +{ + KEYWORD = 0, + RECORD_POINTER = 1 +}; + +const int RTDB_NOT_USED = 0; +const int RTDB_USED = 1; + + +/* --------------------------------------------------------- + DATA_TYPES_T: db data type + --------------------------------------------------------- */ + +const int C_STRING_TYPE = 1; +const int C_UCHAR_TYPE = 2; +const int C_SHORT_TYPE = 3; +const int C_INT_TYPE = 4; +const int C_DATETIME_TYPE = 5; +const int C_FLOAT_TYPE = 6; +const int C_DOUBLE_TYPE = 7; +const int C_KEYID_TYPE = 8; +const int C_BINARY_TYPE = 9; +const int C_TEXT_TYPE = 10; +const int C_IMAGE_TYPE = 11; +const int C_APPKEY_TYPE = 12; +const int C_APPID_TYPE = 13; +const int C_UINT_TYPE = 14; +const int C_LONG_TYPE = 15; +const int C_RTDBKEY_TYPE = 16; +const int C_MEASRTDBKEY_TYPE = 17; +const int C_APPRTDBKEY_TYPE = 18; +const int C_SCNRTDBKEY_TYPE = 19; + + +/* --------------------------------------------------------- + DATA_TYPES_DISPLAY: db data type + --------------------------------------------------------- */ +enum DATA_DISPLAY_T +{ + D_CHAR_TYPE = 1, + D_UCHAR_TYPE = 2, + D_SHORT_TYPE = 3, + D_INT_TYPE = 4, + D_LONG_TYPE = 5, + D_FLOAT_TYPE = 6, + D_DOUBLE_TYPE = 7, + D_SINGLEMENU_TYPE = 8, + D_MUTIMENU_TYPE = 9, + D_STRING_TYPE = 10, + D_DATE_TYPE = 11, + D_TIME_TYPE = 12, + D_DATETIME_TYPE = 13, + D_MULTISTRING_TYPE = 14, + D_KEYID_TYPE = 15, + D_BINARY_TYPE = 16, + D_PASSWORD_TYPE = 17, + D_TEXT_TYPE = 18, + D_IMAGE_TYPE = 19, + D_FORMULASTRING_TYPE = 20, + D_FIELD_NAME_STRING_TYPE = 21 +}; + +const int MENU_ALL = 2; +const int MENU_OFF = 1; +const int MENU_ON = 0; + +/* ------------------------------------------------------------- + ACCESS_METHODS_T: db storage methods + ------------------------------------------------------------- */ +enum ACCESS_METHODS_T +{ + ACCESS_SEQUENT = 0, + ACCESS_DIRECT = 1, + ACCESS_HASH = 2, + ACCESS_DIRECT_HASH = 3, + ACCESS_HASH_INDEX = 4, + ACCESS_DIRECTINDEX_HASH = 5, + ACCESS_FLOW = 6, + ACCESS_NAMEID_HASH = 7, + ACCESS_DIRECTINDEX_FLOW = 8, + ACCESS_FIELD_SEQUENT_HASH = 9 +}; + +/* ------------------------------------------------------------- + PHY_ACCESS_METHODS_T: db physical storage methods + ------------------------------------------------------------- */ +enum PHY_ACCESS_METHODS_T +{ + PHY_SEQUENT_ACCESS = 0, + PHY_LINK_ACCESS = 1, + PHY_BLOCKLINK_ACCESS = 2 +}; + +/* ------------------------------------------------------------- + sequent order + ------------------------------------------------------------- */ + +#define ASC 0 +//#define DEC 1 +#define ODB_DEC 1 + +/* ------------------------------------------------------------ + db open mode + ------------------------------------------------------------ */ + +#define READ_OPEN 0 +#define WRITE_OPEN 1 +#define RDWR_OPEN 2 + +/* ------------------------------------------------------------ + db record head status + ------------------------------------------------------------ */ + +#define RECORD_EMPTY 0 +#define RECORD_EXIST 1 +#define RECORD_ERASED 3 + + +/* ------------------------------------------------------------ + db lock type + ------------------------------------------------------------ */ + +#define RECORD_LOCK 0x01 +#define FIELD_LOCK 0x02 + +/* ------------------------------------------------------------ + db lock status + ------------------------------------------------------------ */ + +#define UNLOCK 0 +#define LOCK 1 + + +/*------------------------------------------------------------------------------ + keyword type +------------------------------------------------------------------------------*/ +const int INT_KEY = 1; +const int STRING_KEY = 2; +const int INT_STRING_KEY = 3; +const int KEYID_KEY = 4; +const int APPKEY_KEY = 5; +const int APPID_KEY = 6; +const int LONG_KEY = 7; +const int RTDBKEY_KEY = 8; +const int MEASRTDBKEY_KEY = 9; + + + +/* ------------------------------------------------------------- + ------------------------------------------------------------- */ +#define ALL_FIELD -1 +#define ALL_RECORD -1 + +/*------------------------------------------------------------------------------ + real time dbms error retcode 2002-10-14 +------------------------------------------------------------------------------*/ +const int DB_OK = 0; /* success */ +const int DB_ERROR = ERR_RTDB_ERROR; /* error */ +const int DBE_PARA = ERR_RTDB_PARA; /* bad para_parameter */ +const int DBE_CHAOS = ERR_RTDB_CHAOS; /* inner error */ +const int DBE_BLOCK = -7; + +//access +const int DBE_ACCESSMETH = ERR_RTDB_ACCESSMETH; /* access_meth is error */ +const int DBE_EXIST = ERR_RTDB_EXIST; /* Db name is exist, cannot creat */ +const int DBE_NODB = ERR_RTDB_NODB; /* Db name not founded */ +const int DBE_INVDBNO = ERR_RTDB_INVDBNO; /* Db no is wrong */ +const int DBE_INVFNAME = ERR_RTDB_INVFNAME; /* Field name not founded */ +const int DBE_HASOPENED = ERR_RTDB_HASOPENED; /* The db has been opened */ +const int DBE_FILE_NOPEN = ERR_RTDB_FILE_NOPEN; /* The file cannot open */ +const int DBE_READ_FILE = ERR_RTDB_READ_FILE; /* The file cannot read */ +const int DBE_APP_NO_DB = ERR_RTDB_APP_NO_DB; /* This table isn't in current application */ +const int DBE_DB_NONE = ERR_RTDB_DB_NONE; /* The table is deleted or hasn't been created*/ + +//lock +const int DBE_LOCK = ERR_RTDB_LOCK; /* The db is locked */ +const int DBE_UNLOCK = ERR_RTDB_UNLOCK; /* The db isnot locked */ +const int DBE_INVUNLOCK = ERR_RTDB_INVUNLOCK; /* locker is not me */ +const int DBE_NOINDEX = ERR_RTDB_NOINDEX; /* havenot index */ + +const int DBE_DIFFSIZE = ERR_RTDB_DIFFSIZE; /* size is different */ +const int DBE_NOTCHKEY = ERR_RTDB_NOTCHKEY; /* ?? */ +const int DBE_NOCACHE = ERR_RTDB_NOCACHE; /* no cache block */ +const int DBE_NOTE_NEND = ERR_RTDB_NOTE_NEND; /* NOTE must be last field */ + +const int DBE_CTRLFULL = ERR_RTDB_CTRLFULL; /* The db ctrl table is full */ +const int DBE_DBFULL = ERR_RTDB_DBFULL; /* The db is full */ +const int DBE_EODB = ERR_RTDB_EODB; /* End of Database */ +const int DBE_INVSIZE = ERR_RTDB_INVSIZE; /* The size is invalid */ +const int DBE_DBBEGIN = ERR_RTDB_DBBEGIN; /* Have reach the begin of db */ +const int DBE_DBEND = ERR_RTDB_DBEND; /* Have reach the end of db */ + +const int DBE_INVCCOMM = ERR_RTDB_INVCCOMM; /* Invalid comparition command */ +const int DBE_TMOPEN = ERR_RTDB_TMOPEN; /* Too many open */ + +////key +const int DBE_KEYNOTFIND = ERR_RTDB_KEYNOTFIND; /* keyword not founded */ +const int DBE_MULTIKEY = ERR_RTDB_MULTIKEY; /* Multi-keywords */ +const int DBE_INVKEY = ERR_RTDB_INVKEY; /* The keyword is invalid */ +const int DBE_MKEYFIELD = ERR_RTDB_MKEYFIELD; /* The keyword field can be only one */ +const int DBE_KEYFLEN = ERR_RTDB_KEYFLEN; /* The keyword length must be 4 times*/ +const int DBE_DBTYPE = ERR_RTDB_DBTYPE; /* Invalid db type */ +const int DBE_KEYTYPE = ERR_RTDB_KEYTYPE; /* Invalid keyword type */ +const int DBE_PASSWD = ERR_RTDB_PASSWD; /* Invalid passwd */ + +////table +const int DBE_TABLE_NO = ERR_RTDB_TABLE_NO; /* no match table or no*/ +const int DBE_TABLE_STA = ERR_RTDB_TABLE_STA; /* table status is abnormal */ + +////record +const int DBE_EXISTREC = ERR_RTDB_EXISTREC; /* Record existed, cannot write */ +const int DBE_NEXISTREC = ERR_RTDB_NEXISTREC; /* Record not existed, cannot modify */ +const int DBE_SUPMAX = ERR_RTDB_SUPMAX; /* record value too bigger */ +const int DBE_BELMIN = ERR_RTDB_BELMIN; /* record value too smaller */ +const int DBE_RECSIZE = ERR_RTDB_RECSIZE; /* record size wrong */ +const int DBE_NOTERASE = ERR_RTDB_NOTERASE; /* record not erased */ +const int DBE_RECERASE = ERR_RTDB_RECERASE; /* The record is erased */ +const int DBE_POINTER = ERR_RTDB_POINTER; /* record_pointer error */ +const int DBE_CONT_ERR = ERR_RTDB_CONT_ERR; /* condition express error */ +const int DBE_NEED_CHK = ERR_RTDB_NEED_CHK; /* something wrong, need to check record state*/ + +////field +const int DBE_DATATYPE = ERR_RTDB_DATATYPE; /* field data type is wrong */ +const int DBE_DIFFTYPE = ERR_RTDB_DIFFTYPE; /* type is different */ +const int DBE_KEYFIELD = ERR_RTDB_KEYFIELD; /* The field is keyword */ +const int DBE_BIGFIELDNO = ERR_RTDB_BIGFIELDNO; /* The field no is too big */ +const int DBE_DLT_WRITE = ERR_RTDB_DLT_WRITE; /* The direct link hash cannot write */ +const int DBE_INVFIELDNO = ERR_RTDB_INVFIELDNO; /* field_no is wrong */ +const int DBE_NOTFIND = ERR_RTDB_NOTFIND; /* Not find the value */ +const int DBE_FIELD_NO = ERR_RTDB_FIELD_NO; /* no match field name or no */ +const int DBE_FIELD_SIZE = ERR_RTDB_FIELD_SIZE; /* field length wrong */ +const int DBE_NONE_FIELD = ERR_RTDB_NONE_FIELD; /* this table has no field */ + + +//operation +const int DBE_INVCOMM = ERR_RTDB_INVCOMM; /* Invalid db operater command */ +const int DBE_NPERMIT = ERR_RTDB_NPERMIT; /* The OP is not permit */ + +const int DBE_CONTEXT = ERR_RTDB_CONTEXT; /* no context or application */ +const int DBE_APP_UNLOAD = ERR_RTDB_APP_UNLOAD; /* application isn't loaded */ + + +const int DBE_SQL_COMMAND = ERR_RTDB_SQL_COMMAND; /*select error*/ +const int DBE_SQL_FORM = ERR_RTDB_SQL_FORM; /*form error*/ +const int DBE_SQL_WHERE = ERR_RTDB_SQL_WHERE; /*where condition error*/ +const int DBE_SQL_ORDER = ERR_RTDB_SQL_ORDER; /*order by error*/ + + + +//memory +const int DBE_MEMORY = ERR_RTDB_MEMORY; /* Cannot malloc or calloc memory */ +const int DBE_BUFFFULL = ERR_RTDB_BUFFFULL; /* Buffer is full */ +const int DBE_MEM_NOALLOC = ERR_RTDB_MEM_NOALLOC; /* The memory cannot allocation */ + +const int DBE_MAP = ERR_RTDB_MAP; /* map file error */ + +//const int DBE_PTABFULL = -10; /* process tab is full */ + +//sql +const int DBE_SQL = ERR_RTDB_SQL; /* sql syntax error */ + + + +// +const int DBE_DBNAMENOTF = ERR_RTDB_DBNAMENOTF; /* db_name not founded */ +const int DBE_FACNAMENOTF = ERR_RTDB_FACNAMENOTF; /* fac_name not founded */ +const int DBE_VALNAMENOTF = ERR_RTDB_VALNAMENOTF; /* val_name not founded */ +const int DBE_FIELDNAMENOTF = ERR_RTDB_FIELDNAMENOTF; /* field_name not founded */ + +// +const int DBE_VIEWFIELD = ERR_RTDB_VIEWFIELD; /* view get fieldnum over error */ +const int DBE_SYBASE = ERR_RTDB_SYBASE; /* modify sybase error */ +const int DBE_INDEXERR = ERR_RTDB_INDEXERR; /* index number error */ +const int DBE_MODIFYSIZE = ERR_RTDB_MODIFYSIZE; /* modify bufsize error */ + +const int API_INVCOMM = ERR_RTDB_API_INVCOMM; /* Invalid db operater command */ +const int API_NOAPP = ERR_RTDB_API_NOAPP; /* App name not founded */ +const int API_NODB = ERR_RTDB_API_NODB; /* Db name not founded */ +const int API_INVDBNO = ERR_RTDB_API_INVDBNO; /* Db no is wrong */ + +const int API_NODEOFF = ERR_RTDB_API_NODEOFF; /* node is offline */ +const int API_ERRINIT = ERR_RTDB_API_ERRINIT; /* odbms init error */ +const int API_NEWERR = ERR_RTDB_API_NEWERR; /* new space error */ +const int API_DATAERR = ERR_RTDB_API_DATAERR; /* data tye error */ +const int DBE_NOSPACE = ERR_RTDB_NOSPACE; /* no space left in disk */ + + + +/* ----------------------------------------------------------- + for sql query: 2002-10-31 + ---------------------------------------------------------- */ +enum CONDITION_OPERATOR_T +{ + SQL_COND_LSC = 10, /* < */ + SQL_COND_LEC = 11, /* <= */ + SQL_COND_EQC = 12, /* == */ + SQL_COND_GEC = 13, /* >= */ + SQL_COND_GTC = 14, /* > */ + SQL_COND_NEQ = 15 /* != */ +}; + +enum LOGICAL_OPERATOR_T +{ + SQL_LOG_AND = 16, /* && */ + SQL_LOG_OR = 17, /* || */ + SQL_LOG_NOT = 18, /* ~ */ + SQL_LOG_NONE= 20 +}; + + +enum SQL_METHOD_T +{ + METHOD_SELECT = 1, + METHOD_UPDATE = 2, + METHOD_DELETE = 3, + METHOD_CREATE = 4 +}; + +#define DEF_SHMMEM 0 + +//SLICED_DB +const int TBL_SLICED = 1; +const int TBL_UNSLICED = 0; + +//for DSCADA & SCADA +//app_area_no +#define DRTDB_APP_AREA AP_DSCADA_AREA +//app_area_no +//#define DRTDB_APP_NO AP_DMS_SCADA +#define DRTDB_APP_NO AP_SCADA +//dscada 1, scada 0 +#define DRTDB_DMS 1 + +/****************************************************************************** +* debug display option * +******************************************************************************/ +#define DBG_INDEX_STDB_TAB 1 +#define DBG_INDEX_STDB_FIELD_TAB 2 +#define DBG_STDB_INDEX_HASH 3 +#define DBG_FREE_POINTER 4 +#define DBG_INDEX_STG 5 +#define DBG_INDEX_OVERFLOW 6 +#define DBG_ALL 7 +#endif diff --git a/code/sys_nicmonitor/include/db_api/odb_double_overflow_hashindex.h b/code/sys_nicmonitor/include/db_api/odb_double_overflow_hashindex.h new file mode 100644 index 0000000..82faf46 --- /dev/null +++ b/code/sys_nicmonitor/include/db_api/odb_double_overflow_hashindex.h @@ -0,0 +1,84 @@ +/******************************************************************************* +ModuleName: Real Time Database management system +FileName: rtdb_api.cpp +DESCRIPTION: rtdb api interfaces implementation +FUNCTION LIST: +COMMENT: +History: +Date Version Modifier Activities +2009-01-10 1.1 add net interfaces +================================================================================ +2008-10-30 1.0 created +*******************************************************************************/ +#include "db_api/odb_baseindex.h" +#ifndef _CDOUBLEOVERFLOWHASHINDEX +#define _CDOUBLEOVERFLOWHASHINDEX + +namespace ODB +{ +class CDoubleOverFlowHashIndex:public CBaseIndex +{ +public: + virtual int need_rebuilt(char *existed_table_ptr,struct STDB_TAB *stdb_tab_ptr,struct STDB_FIELD_TAB *stdb_field_tab_ptr,INDEX_DEFINE &index_define,int &shm_id); + virtual int CreateIndex(struct STDB_TAB *stdb_tab_ptr,struct STDB_FIELD_TAB *stdb_field_tab_ptr,INDEX_DEFINE &index_define,int &shm_id,int &shm_size); + virtual int Open(char *index_file_name,int table_id,int index_id); //table_idindex_idINDEX_STDB_TAB::table_idINDEX_STDB_TAB::field_idƥУ + virtual int Open(int index_shmid,int table_id,int index_id); //table_idindex_idINDEX_STDB_TAB::table_idINDEX_STDB_TAB::field_idƥУ + virtual int SetIndexPtr(char *index_ptr); //ѻָ븳ֵ࣬ͲʹǰOpen + virtual int GetKeyByIndex(char *index_ptr,std::vector &index_array); + virtual int GetKeyPointerByIndex(char *index_ptr, int& pointer);//ֻЧindexõ¼λ + virtual int IndexInsert(char *index_ptr,char *key_ptr); + virtual int BulkIndexInsert(char *bulk_index_key_ptr);//װʱ + virtual int Indexdelete(char *index_ptr,char *key_ptr); + virtual int IndexClear(); + virtual int GetIdxMthd(); + virtual int FreeResource();//Ʃunmapshmdtָ롣 + virtual int DebugDisp(int type);//ãͬtypeʾͬϸ̶ȲͬϢ + virtual int GetIndexRecNum();//¼ܵĸЧ¼ܺ͡HASHֻǷ0 + virtual DB_STATUS_T GetIndexStatus()//״̬ + { + return m_IndexStdbPtr->index_status; + } + virtual void SetIndexStatus(DB_STATUS_T idx_status)//ͷϵ״̬ + { + m_IndexStdbPtr->index_status = idx_status; + } + + ~CDoubleOverFlowHashIndex();//FreeResource() + +private: + int malloc_chunk(int &new_record_pointer); + int pri_malloc_chunk(int &new_record_pointer); + int free_chunk(struct INDEX_STORAGE_HASH_DOVERFLOW_REC_HEAD* root_index_stg_head_ptr, int unused_record_pointer); + int free_chunk(struct INDEX_STORAGE_HASH_DOVERFLOW_REC_HEAD* root_index_stg_head_ptr, struct PRIMARY_OVERFLOW_STORAGE_HASH_REC_HEAD* pri_ofl_stg_head_ptr, int unused_record_pointer); + int pri_free_chunk(struct INDEX_STORAGE_HASH_DOVERFLOW_REC_HEAD* root_index_stg_head_ptr, int unused_record_pointer); + int index_equal(char *outer_index_ptr,char *inner_index_ptr); + +private: + int disp_index_stdb_tab(); + int disp_index_stdb_field_tab(); + int disp_stdb_index_hash_doverflow(); + int disp_free_pointer(); + int disp_index_stg(); + int disp_index_overflow(); + int disp_index_pri_overflow(); + int disp_all(); + int disp_index_contents(char *index_ptr); + int disp_key_contents(char *key_ptr); + + //int test_insert(); + +private: + struct INDEX_STDB_TAB *m_IndexStdbPtr; + struct INDEX_STDB_FIELD_TAB *m_IndexStdbFieldPtr; + struct STDB_INDEX_HASH_DOVERFLOW *m_StdbIndexHashPtr; + int *m_FreePointer;//malloc_chunkfree_chunkʹá + int *m_PriFreePointer;// pri_malloc_chunkpri_free_chunkʹá + char *m_IndexStgHashPtr; + char *m_PriOverflowStgHashPtr; + char *m_OverflowStgHashPtr; + int (*hash_func_ptr)(char *index,int length,int hash_prime); +}; +} + +#endif + diff --git a/code/sys_nicmonitor/include/db_api/odb_field.h b/code/sys_nicmonitor/include/db_api/odb_field.h new file mode 100644 index 0000000..debbdc4 --- /dev/null +++ b/code/sys_nicmonitor/include/db_api/odb_field.h @@ -0,0 +1,85 @@ +/******************************************************************************* +ModuleName: ODB Real Time Database management system +FileName: odb_field.h +DESCRIPTION: class table struct define +FUNCTION LIST: +COMMENT: field struct define +History: +Date Version Modifier Activities +2002-10-10 1.0 modify +================================================================================ +2002-10-10 1.0 created +*******************************************************************************/ +#ifndef __ODB_FIELD_H__ +#define __ODB_FIELD_H__ + +#include "db_api/odb_public.h" +//#include "odb_struct.h" +#include "db_api/odb_prv_struct.h" +#include "db_api/odb_common.h" + + +using namespace std; + +namespace ODB +{ + +//ֶη +class COdbField +{ +public: + COdbField(); + COdbField(const char* db_area_ptr); //ͷλ + COdbField(const char* db_area_ptr, int r_field_no); //ͷλ + ֶκ + COdbField(const char* db_area_ptr, char* field_name); + ~COdbField(); + + int SetFieldTabPtr(const char* db_area_ptr);//ñֶοϢ + + int SetRecordPtr(char* record_ptr); //ñĵǰ¼λ + + //ƶֶָλ + int MoveTo(const int r_field_no); //field_noλǰapp,tableSTDB_FIELD_TAB + int MoveTo(const char* field_name); + int MoveToByChn(const char* field_name); + + //ѯ + char* GetFieldName(); //return a pointer + int GetFieldName(char* field_name); //get_fieldname_by_fieldno()//copy to a array + int GetFieldChnName(char* field_name); + int SetFieldName(const char* field_name); //set chinese field name + int GetFieldNo(bool is_real = false); //get_fieldno_by_fieldname() + + int GetFieldPara(int& data_type, int& offset, int& field_length, int& is_keyword); //get_field_para_byno() + int GetFieldLength(int& field_length); + + int GetLimitValue(char* field_value_ptr, const int buf_size); //limited data length + int GetFieldValue(char** field_value_ptr); + int GetFieldValue(char** field_value_ptr, int& field_length); + int GetFieldValue(char** field_value_ptr, int& field_length, const int r_field_no); + int SetFieldValue(const char* modify_field_ptr, const int modify_field_length); + +private: + COdbField(const COdbField& odb_field); + COdbField& operator=(const COdbField& odb_field); + +private: +// struct STDB_TAB* stdb_tab_ptr; //ָ +// struct STDB_FIELD_TAB* stdb_field_tab_ptr; //ֶ׿Ϣ,OdbTableõ +// struct STDB_FIELD_TAB* cur_field_tab_ptr; //ǰֶοϢ +// char* cur_record_ptr; //ǰ¼ + + struct STDB_TAB* m_StdbTabPtr; //ָ + struct STDB_FIELD_TAB* m_StdbFieldTabPtr; //ֶ׿Ϣ,OdbTableõ + struct STDB_FIELD_TAB* m_CurFieldTabPtr; //ǰֶοϢ + char* m_CurRecordPtr; //ǰ¼ +#ifdef _APP_SYS_SUBSTATION + struct STDB_VIR_FIELD_TAB* m_StdbVirFieldTabPtr; //ֶ׿Ϣ,OdbTableõ + struct STDB_VIR_FIELD_TAB* m_CurVirFieldTabPtr; //ǰֶ׿Ϣ + bool m_CurIsVirtual; //ǰŶӦţҪȡֵ +#endif +}; + +} + +#endif diff --git a/code/sys_nicmonitor/include/db_api/odb_hashindex.h b/code/sys_nicmonitor/include/db_api/odb_hashindex.h new file mode 100644 index 0000000..5c5f200 --- /dev/null +++ b/code/sys_nicmonitor/include/db_api/odb_hashindex.h @@ -0,0 +1,72 @@ +/******************************************************************************* +ModuleName: Real Time Database management system +FileName: rtdb_api.cpp +DESCRIPTION: rtdb api interfaces implementation +FUNCTION LIST: +COMMENT: +History: +Date Version Modifier Activities +2009-01-10 1.1 add net interfaces +================================================================================ +2008-10-30 1.0 created +*******************************************************************************/ +#include "db_api/odb_baseindex.h" +#include "db_api/odb_ckeymanager.h" +#ifndef _CHASHINDEX +#define _CHASHINDEX + +namespace ODB +{ +class CHashIndex:public CBaseIndex +{ +public: + virtual int need_rebuilt(char *existed_table_ptr,struct STDB_TAB *stdb_tab_ptr,struct STDB_FIELD_TAB *stdb_field_tab_ptr,INDEX_DEFINE &index_define,int &shm_id); + virtual int CreateIndex(struct STDB_TAB *stdb_tab_ptr,struct STDB_FIELD_TAB *stdb_field_tab_ptr,INDEX_DEFINE &index_define,int &shm_id,int &shm_size); + virtual int Open(char *index_file_name,int table_id,int index_id); //table_idindex_idINDEX_STDB_TAB::table_idINDEX_STDB_TAB::field_idƥУ + virtual int Open(int index_shmid,int table_id,int index_id); //table_idindex_idINDEX_STDB_TAB::table_idINDEX_STDB_TAB::field_idƥУ + virtual int SetIndexPtr(char *index_ptr); //ѻָ븳ֵ࣬ͲʹǰOpen + virtual int GetKeyByIndex(char *index_ptr,std::vector &index_array); + virtual int GetKeyPointerByIndex(char *index_ptr, int& pointer);//ֻЧindexõ¼λ + virtual int IndexInsert(char *index_ptr,char *key_ptr); + virtual int BulkIndexInsert(char *bulk_index_key_ptr);//װʱ + virtual int Indexdelete(char *index_ptr, char* key); + virtual int IndexClear(); + virtual int GetIdxMthd(); + virtual int FreeResource();//Ʃunmapshmdtָ롣 + virtual int DebugDisp(int type);//ãͬtypeʾͬϸ̶ȲͬϢ + virtual int GetIndexRecNum();//¼ܵĸЧ¼ܺ͡HASHֻǷ0 + virtual DB_STATUS_T GetIndexStatus()//״̬ + { + return m_IndexStdbPtr->index_status; + } + virtual void SetIndexStatus(DB_STATUS_T idx_status)//ͷϵ״̬ + { + m_IndexStdbPtr->index_status = idx_status; + } + + ~CHashIndex();//FreeResource() + + char * next2Ptr(int next); + int freeChunk(int pointer); + char* mallocChunk(int & pos); + + int keycmp(char * key1 , char * key2);//{return 0;} + + int index_equal(char * outer , char * innter); + + int DebugDisp(int type , char * ptr); + +private: + struct INDEX_STDB_TAB *m_IndexStdbPtr; + struct INDEX_STDB_FIELD_TAB *m_IndexStdbFieldPtr; + struct STDB_INDEX_HASH *m_StdbIndexHashPtr; + int *m_FreePointer;//malloc_chunkfree_chunkʹá + char *m_IndexStgHashPtr; + char *m_OverflowStgHashPtr; + int (*hash_func_ptr)(char *index,int length,int hash_prime); + + int idxLenFlag ; +}; +} + +#endif diff --git a/code/sys_nicmonitor/include/db_api/odb_hashpk.h b/code/sys_nicmonitor/include/db_api/odb_hashpk.h new file mode 100644 index 0000000..f2f0942 --- /dev/null +++ b/code/sys_nicmonitor/include/db_api/odb_hashpk.h @@ -0,0 +1,73 @@ +/******************************************************************************* +ModuleName: Real Time Database management system +FileName: rtdb_api.cpp +DESCRIPTION: rtdb api interfaces implementation +FUNCTION LIST: +COMMENT: +History: +Date Version Modifier Activities +2009-01-10 1.1 add net interfaces +================================================================================ +2008-10-30 1.0 created +*******************************************************************************/ +#include "db_api/odb_baseindex.h" +#ifndef _CHASHPK +#define _CHASHPK + +namespace ODB +{ +class CHashPK:public CBaseIndex +{ +public: + virtual int need_rebuilt(char *existed_table_ptr,struct STDB_TAB *stdb_tab_ptr,struct STDB_FIELD_TAB *stdb_field_tab_ptr,INDEX_DEFINE &index_define,int &shm_id); + virtual int CreateIndex(struct STDB_TAB *stdb_tab_ptr,struct STDB_FIELD_TAB *stdb_field_tab_ptr,INDEX_DEFINE &index_define,int &shm_id,int &shm_size); + virtual int Open(char *index_file_name,int table_id,int index_id); //table_idindex_idINDEX_STDB_TAB::table_idINDEX_STDB_TAB::field_idƥУ + virtual int Open(int index_shmid,int table_id,int index_id); //table_idindex_idINDEX_STDB_TAB::table_idINDEX_STDB_TAB::field_idƥУ + virtual int SetIndexPtr(char *index_ptr); //ѻָ븳ֵ࣬ͲʹǰOpen + virtual int GetKeyByIndex(char *index_ptr,std::vector &index_array); + virtual int GetKeyPointerByIndex(char *index_ptr, int& pointer);//ֻЧindexõ¼λ + virtual int IndexInsert(char *index_ptr,char *key_ptr); + virtual int BulkIndexInsert(char *bulk_index_key_ptr);//װʱ + virtual int Indexdelete(char *index_ptr,char *key_ptr); + virtual int IndexClear(); + virtual int GetIdxMthd(); + virtual int FreeResource();//Ʃunmapshmdtָ롣 + virtual int DebugDisp(int type);//ãͬtypeʾͬϸ̶ȲͬϢ + virtual int GetIndexRecNum();//¼ܵĸЧ¼ܺ͡HASHֻǷ0 + virtual DB_STATUS_T GetIndexStatus()//״̬ + { + return m_IndexStdbPtr->index_status; + } + + virtual void SetIndexStatus(DB_STATUS_T idx_status)//ͷϵ״̬ + { + m_IndexStdbPtr->index_status = idx_status; + } + + //virtual int ModifyIndex(char *pk_ptr, int pos); + ~CHashPK();//FreeResource() +private: + struct INDEX_STDB_TAB *m_IndexStdbPtr; + struct INDEX_STDB_FIELD_TAB *m_IndexStdbFieldPtr; + struct STDB_INDEX_HASH *m_StdbIndexHashPtr; + int *m_FreePointer;//malloc_chunkfree_chunkʹá + char *m_IndexStgHashPtr; + char *m_OverflowStgHashPtr; + int (*hash_func_ptr)(char *index,int length,int hash_prime); + int index_equal(char *outer_index_ptr,char *inner_index_ptr); + int malloc_chunk(int &new_record_pointer); + int free_chunk(struct INDEX_STORAGE_HASH_REC_HEAD *root_index_stg_head_ptr,int unused_record_pointer); + int assign_index(char *dest_index_ptr,char *sour_index_ptr); + int disp_index_stdb_tab(); + int disp_index_stdb_field_tab(); + int disp_stdb_index_hash(); + int disp_free_pointer(); + int disp_index_stg(); + int disp_index_overflow(); + int disp_all(); + int disp_index_contents(char *index_ptr); + int disp_key_contents(char *key_ptr); +}; +} +#endif + diff --git a/code/sys_nicmonitor/include/db_api/odb_intel_ptr.h b/code/sys_nicmonitor/include/db_api/odb_intel_ptr.h new file mode 100644 index 0000000..ba115be --- /dev/null +++ b/code/sys_nicmonitor/include/db_api/odb_intel_ptr.h @@ -0,0 +1,66 @@ +#ifndef _ODB_INTEL_PTR +#define _ODB_INTEL_PTR + +#include + +template class CIntelPtr +{ +private: + T *m_Ptr; + CIntelPtr(const CIntelPtr &); + CIntelPtr& operator=(const CIntelPtr &); +public: + CIntelPtr(){m_Ptr = NULL;} + void SetPtr(T* t_ptr) + { + if(m_Ptr !=NULL) + { + delete m_Ptr; + } + m_Ptr = t_ptr; + } + ~CIntelPtr() + { + delete m_Ptr; + } +}; + +template class CIntelPtrArray +{ +private: + std::vectorm_PtrArray; + CIntelPtrArray(const CIntelPtrArray &); + CIntelPtrArray& operator =(const CIntelPtrArray&); +public: + CIntelPtrArray(){} + void push_back(T* t_ptr) + { + m_PtrArray.push_back(t_ptr); + return; + } + ~CIntelPtrArray() + { + int i; + int vec_size = m_PtrArray.size(); + + for(i=0;i=0 && pos<(int)(m_PtrArray.size())) + return m_PtrArray[pos]; + else + return NULL; + } + + int GetSize() + { + return m_PtrArray.size(); + } +}; + +#endif diff --git a/code/sys_nicmonitor/include/db_api/odb_lock.h b/code/sys_nicmonitor/include/db_api/odb_lock.h new file mode 100644 index 0000000..0dc11ed --- /dev/null +++ b/code/sys_nicmonitor/include/db_api/odb_lock.h @@ -0,0 +1,67 @@ + /******************************************************************************* +ModuleName: ODB +FileName: odb_lock.h +DESCRIPTION: +History: +Date Version Modifier Activities +2002-10-22 1.0 modify +================================================================================ +2002-10-22 1.0 created +*******************************************************************************/ + +#ifndef __ODB_LOCK_H__ +#define __ODB_LOCK_H__ + +//#include "odb_struct.h" +#include "db_api/odb_prv_struct.h" +#include "db_api/odb_public.h" + + +namespace ODB +{ +class COdbLock +{ +public: + COdbLock(){}; + ~COdbLock(){}; + + static int InitLock(struct LOCK_STRU& lock); + static int ClnLock(struct LOCK_STRU& lock); + + static bool CtlLock(const struct LOCK_STRU& lock, const DB_LOCK_T& lock_type); + static bool CtlUnLock(const struct LOCK_STRU& lock, const DB_LOCK_T& lock_type); + + //static bool DtLock(const struct LOCK_STRU& lock, const DB_LOCK_T& lock_type); + //static bool DtUnLock(const struct LOCK_STRU& lock, const DB_LOCK_T& lock_type); + + //static bool NpLock(struct LOCK_STRU& lock, const DB_LOCK_T& lock_type); + //static bool NpUnLock(struct LOCK_STRU& lock, const DB_LOCK_T& lock_type); + + static bool Lock(struct LOCK_STRU& lock, const DB_LOCK_T& lock_type); + static bool UnLock(struct LOCK_STRU& lock, const DB_LOCK_T& lock_type); + + static bool Lock(struct LOCK_STRU& lock, const DB_LOCK_T& lock_type, int& table_semid); //for OPTLOCK + static bool UnLock(struct LOCK_STRU& lock, const DB_LOCK_T& lock_type, int& table_semid); //for OPTLOCK + +private: + + static bool CtlLock(const struct LOCK_STRU& lock); + static bool CtlUnLock(const struct LOCK_STRU& lock); + + static bool CtlLock(const struct LOCK_STRU& lock, int& table_semid); //for OPTLOCK + static bool CtlUnLock(const struct LOCK_STRU& lock, int& table_semid); //for OPTLOCK + + //static bool DtLock(const struct LOCK_STRU& lock); + //static bool DtUnLock(const struct LOCK_STRU& lock); + + static bool TryLock(struct LOCK_STRU& lock, const DB_LOCK_T& lock_type); + static bool TryLock(struct LOCK_STRU& lock, const DB_LOCK_T& lock_type, int& table_semid); //for OPTLOCK + +#ifdef _WINDOWS64 + static bool WinLock(const char* sem_name, const int sem_num=1); + static bool WinUnLock(const char* sem_name); +#endif +}; + +} +#endif diff --git a/code/sys_nicmonitor/include/db_api/odb_net.h b/code/sys_nicmonitor/include/db_api/odb_net.h new file mode 100644 index 0000000..8b06b2a --- /dev/null +++ b/code/sys_nicmonitor/include/db_api/odb_net.h @@ -0,0 +1,993 @@ +/******************************************************************************* +ModuleName: ODB Real Time Database management system +FileName: odb_tablenet.h +DESCRIPTION: RTDBMS NET ACCESS INTERFACE +FUNCTION LIST: +COMMENT: +History: +Date Version Modifier Activities +================================================================================ +2009-06-09 1.0 wj created +*******************************************************************************/ + + const short C_DATATYPE_STRING = 1; + const short C_DATATYPE_UCHAR = 2; + const short C_DATATYPE_SHORT = 3; + const short C_DATATYPE_INT = 4; + const short C_DATATYPE_DATETIME = 5; + const short C_DATATYPE_FLOAT = 6; + const short C_DATATYPE_DOUBLE = 7; + const short C_DATATYPE_KEYID = 8; + const short C_DATATYPE_BINARY = 9; + const short C_DATATYPE_TEXT = 10; + const short C_DATATYPE_IMAGE = 11; + + const short C_DATATYPE_APPKEYID = 12; + const short C_DATATYPE_APPID = 13; + const short C_DATATYPE_UINT = 14; + const short C_DATATYPE_LONG = 15; + const short C_RTDBKEY_TYPE = 16; + + typedef vector SEQ_STRING; + typedef binary SEQ_CHAR; + typedef vector SEQ_FLOAT; + typedef vector SEQ_LONG; + typedef vector SEQ_LONGLONG; +/*------------------------------------------------------------------------------ + 1. RTDBMS NET ACCESS for create and delete a table + but only used by down load until now 2003-02-28 +------------------------------------------------------------------------------*/ + + /* --------------------------------------------------------------------- + create a table + ----------------------------------------------------------------------*/ + + typedef cmnInt64 KEYID_STRUCT; + typedef cmnUint64 unsigned long; + + struct RTDB_KEY_STRU + { + cmnUint64 key_id1; //indicate table_id && column_id + cmnUint64 key_id2; //indicate area_id && serial_no/ + }; + + struct APPKEY_STRUCT + { + int app_id; + KEYID_STRUCT key_id; + }; + + typedef APPKEY_STRUCT APPID_STRUCT; + + struct KEYID_STATUS_STRUCT + { + KEYID_STRUCT key_id; + short status; + }; + + typedef vector SEQ_KEY_ID; + typedef vector SEQ_APPKEY_ID; + typedef vector SEQ_APP_ID; + typedef vector SEQ_KEY_ID_STA; + + struct union_data_type + { + int type; + union + { + varchar c_char; //C_DATATYPE_STRING + unsigned char c_uchar; //C_DATATYPE_UCHAR + short c_short; //C_DATATYPE_SHORT + int c_int; //C_DATATYPE_INT + cmnInt64 c_time; //C_DATATYPE_DATETIME + float c_float; //C_DATATYPE_FLOAT + double c_double; //C_DATATYPE_DOUBLE + KEYID_STRUCT c_keyid; //C_DATATYPE_KEYID + SEQ_CHAR c_binary; //C_DATATYPE_BINARY + SEQ_CHAR c_text; //C_DATATYPE_TEXT + SEQ_CHAR c_image; //C_DATATYPE_IMAGE + APPKEY_STRUCT c_appkeyid; //C_DATATYPE_APPKEYID + APPID_STRUCT c_appid; //C_DATATYPE_APPID + unsigned int c_uint; //C_DATATYPE_UINT + cmnInt64 c_long; //C_DATATYPE_LONG + struct RTDB_KEY_STRU c_rtdb_key; //C_C_RTDBKEY_TYPE + }val; + }; + + typedef vector SEQ_COMMON_DATA; + + struct TABLE_STRU + { + int table_no; // RDBMS + short app_no; + short column_num; + varchar table_name_eng; + varchar table_name_chn; + short record_length; + int record_num; + int max_record_num; + unsigned char is_auto_generate; + unsigned char is_record_app; + }; + + struct COLUMN_STRU + { + short field_no; // RDBMS + varchar field_name_eng; + varchar field_name_chn; + short data_length; + unsigned char data_type; + + unsigned char allow_null; + unsigned char is_display; + unsigned char display_type; + short display_length; + unsigned char display_precision; + + varchar menu_name; + unsigned char reference_flag; + unsigned char is_key; + unsigned char is_index; + unsigned char sort_order_no; + + unsigned char reference_display; + unsigned char is_input; + unsigned char is_fix; + + varchar init_value; + varchar min_value; + varchar max_value; + + int reference_table; + short reference_column; + int column_special; + }; + + typedef vector SEQ_COLUMN_INFO; + + + //from download idl //OutStruct + struct REQ_STDB_CREATE + { + //short app_no; //Ӧú + //int table_no; // RDBMS + //int record_num; //¼ + //int field_num; // + + TABLE_STRU table_info; //Ϣ + SEQ_COLUMN_INFO column_info; //Ϣ + SEQ_COMMON_DATA data_value; //ֵ + }; + + /* --------------------------------------------------------------------- + delete a table + ----------------------------------------------------------------------*/ + struct REQ_STDB_DELETE + { + short app_no; + int table_no; + varchar passwd; + }; + +/*------------------------------------------------------------------------------ + 2. RTDBMS NET ACCESS for get table and field parameter +------------------------------------------------------------------------------*/ + + /* --------------------------------------------------------------------- + table parameter + ----------------------------------------------------------------------*/ + struct TABLE_PARAMETER + { + varchar table_name_eng; + varchar table_name_chn; + int table_no; //RDBMS + int key_len; + int subkey_num; + + short field_sum; + int record_number; + int record_size; + + unsigned char is_auto_generated; + +// int table_type; //for graph, etc +// unsigned char is_system_table; //Added 2003-09-01 +// unsigned char is_record_app; +// unsigned char is_record_lock; +// unsigned char is_record_resp; +// +// int reserved_1; +// int reserved_2; +// int reserved_3; +// int reserved_4; +// int reserved_5; + }; + + /* --------------------------------------------------------------------- + field parameter, more 3 elements than struct COLUMN_STRU + ----------------------------------------------------------------------*/ + struct FIELD_PARAMETER + { + short field_no; + short r_field_no; // + short field_id; ////// + short column_id; ////// + + varchar field_name_eng; + varchar field_name_chn; + short field_length; + unsigned char data_type; + + unsigned char allow_null; + //unsigned char is_display; //// + unsigned char display_type; + //short display_length; //// + //unsigned char display_precision; //// + + varchar menu_name; + unsigned char reference_flag; + unsigned char is_keyword; + unsigned char is_index; + int offset; // + int check_tag; // + unsigned char sort_order_no; + + unsigned char reference_mode; ////// + unsigned char reference_display; + //unsigned char is_input; //// + //unsigned char is_fix; //// + + unsigned char is_app_syn; ////// + unsigned char auto_meas_type; ////// + + varchar default_asciival; + varchar min_asciival; + varchar max_asciival; + + int ref_tableno; + short ref_fieldno; +#ifdef _APP_SYS_SUBSTATION + short is_bit_field; +#endif + //unsigned char column_special; + int column_special; + + int search_attribute; //Added 2003-09-01 + int statics_attribute; + int reserved_1; + int reserved_2; + int reserved_3; + int reserved_4; + int reserved_5; + }; + + struct R_FIELD_BASE_INFO + { + int offset; + int field_length; + short field_no; + unsigned char data_type; + unsigned char is_keyword; + }; + + typedef vector SEQ_FIELD_BASE_INFO; +/*------------------------------------------------------------------------------ + 3. RTDBMS NET DATA ACCESS structure for get, write, delete, modify, update +------------------------------------------------------------------------------*/ + + + /* --------------------------------------------------------------------- + one or many records; one or many fields; + the common structure used by others followed + ----------------------------------------------------------------------*/ + struct FIELD_STRU + { + short field_no; + short field_type; //data type for get; byte len for write + short field_length; // 2003-07-31 //reserved for later + + }; + + typedef vector SEQ_FIELD_STRU; + + struct REQ_BASE + { + short context_no; //long + int app_no; //short + int table_no; + char byte_tag; //DB_BYTE_T byte_tag; + SEQ_FIELD_STRU seq_field; + }; + + /* --------------------------------------------------------------------- + get one or many fields of one or many records; + maybe by key_word; if no keyword, default is current record + ----------------------------------------------------------------------*/ + struct REQ_READ + { + REQ_BASE base_info; + + SEQ_CHAR seq_keyword; //usually only one key word + int keybuf_size; //0--no key_word, else key word data size + + varchar str_fname_list; + + //short get_mode; // 0 -- by field no + // 1 -- by field name + // 2 -- by key word + }; + + struct RSP_READ + { + int record_num; //¼ + int record_size; + short field_num; // + SEQ_FIELD_STRU seq_field; //fieldϢ + + SEQ_CHAR seq_data; //return data value + int data_size; //return data size; ܳ + }; + /* --------------------------------------------------------------------- + write one record, include key_word + ----------------------------------------------------------------------*/ + struct REQ_KEY_WRITE + { + REQ_BASE base_info; + + SEQ_CHAR record_value; //record data value + int buf_size; //record data size + }; + + /* --------------------------------------------------------------------- + modify one or many fields of one or many records, + maybe by key_word; if no keyword, default is current record + ----------------------------------------------------------------------*/ + struct REQ_MODIFY + { + REQ_BASE base_info; + short is_field_name; //Ƿ޸ 1 0 + varchar field_name_str; //Ҫ޸ĵ + + SEQ_CHAR seq_keyword; //key word data value + int keybuf_size; //key word data size + + SEQ_CHAR field_value; //field data buffer + int buf_size; //field data size + }; + + /* --------------------------------------------------------------------- + update f one or many records by key_word + ----------------------------------------------------------------------*/ + struct REQ_UPDATE + { + REQ_BASE base_info; + + SEQ_CHAR field_value; //data buffer + int buf_size; //data size + }; + + /* --------------------------------------------------------------------- + delete a record by key_word + ----------------------------------------------------------------------*/ + struct REQ_KEY_ERASE + { + REQ_BASE base_info; + + SEQ_CHAR seq_keyword; //str_keyword;//2003-02-26 + int keybuf_size; //redundant + }; + + /* --------------------------------------------------------------------- + delete many records by key + ----------------------------------------------------------------------*/ + struct DEL_REQ + { + REQ_BASE base_info; + int del_direction; + int del_num; + SEQ_CHAR seq_keyword; + int keybuf_size; + }; + + /* --------------------------------------------------------------------- + clear one table + ----------------------------------------------------------------------*/ + struct REQ_TABLE_CLEAR + { + REQ_BASE base_info; + }; + + struct REQ_FIELD_BASE_INFO + { + REQ_BASE base_info; + SEQ_LONG seq_field_no; + }; + + struct RSP_FIELD_BASE_INFO + { + SEQ_FIELD_BASE_INFO lseq_field_base_info; + }; + + /* --------------------------------------------------------------------- + get table and fields parameter (one) + ----------------------------------------------------------------------*/ + struct REQ_PARAMETER + { + REQ_BASE base_info; + //short para_type; //1--table parameter, 10--fields parameter + + varchar str_field_list; //field's attribute that wanted to be query + }; + + typedef vector SEQ_FIELD_PARAMETER; + + struct RSP_PARAMETER + { + TABLE_PARAMETER table_para; + SEQ_FIELD_PARAMETER seq_field_para; + }; + + /* --------------------------------------------------------------------- + get table and fields parameter (two) + ----------------------------------------------------------------------*/ + struct REQ_APP_PARAMETER + { + int app_no; + varchar app_name; //all_name + }; + + //this is rsp + typedef vector SEQ_TABLE_PARAMETER; + + struct RSP_APP_PARAMETER + { + int app_no; + varchar app_name; //all_name + + SEQ_TABLE_PARAMETER seq_table_para; + }; + +/*------------------------------------------------------------------------------ + 4. RTDBMS key word length of all table + + 2003-03-10 +------------------------------------------------------------------------------*/ + struct TABLE_KEYINFO + { + //int table_no; //RDBMS table no + short keyword_len; //total key word length + }; + + typedef vector SEQ_TABLE_KEYINFO; + + struct RSP_KEYINFO + { + SEQ_TABLE_KEYINFO seq_keyinfo; + }; + +/*------------------------------------------------------------------------------ + 5. SQL INTERFACE + + 2003-03-26 +------------------------------------------------------------------------------*/ + struct REQ_SQL + { + REQ_BASE base_info; + varchar str_select; + //SEQ_CHAR seq_select; + }; +/*------------------------------------------------------------------------------ + 6. some function for gui + + 2003-06-05 +------------------------------------------------------------------------------*/ + /* --------------------------------------------------------------------- + menu read + ----------------------------------------------------------------------*/ + struct REQ_MENU + { + REQ_BASE base_info; + //SEQ_CHAR seq_menu_name; + varchar str_menu_name; + unsigned char menu_status; + }; + + struct MENU_INFO_STRU + { + varchar menu_name; /* ˵*/ + unsigned char menu_no; /* */ + int actual_value; /* ʵֵ*/ + varchar display_value; /* ʾֵ*/ + unsigned char menu_status; /* ˵״̬ */ + varchar menu_macro_name; + }; + + typedef vector SEQ_MENU_INFO; + + struct RSP_MENU + { + int menu_num; + //int record_size; + SEQ_MENU_INFO seq_menu; + }; + + /* --------------------------------------------------------------------- + relevant menu read + ----------------------------------------------------------------------*/ + struct REQ_RELE_MENU + { + REQ_BASE base_info; + }; + + struct MENU_RELEVANT_STRU + { + int table_id; /* ID */ + short column_id; /* ID */ + int column_value; /* ֵ */ + short r_column_id; /* ӦID */ + varchar r_menu_name; /* Ӧ˵ */ + int default_value; /* Ĭֵ */ + }; + + typedef vector SEQ_MENU_RELEVANT; + + struct RSP_RELE_MENU + { + int menu_num; + //int record_size; + SEQ_MENU_RELEVANT seq_menu; + }; + + /* --------------------------------------------------------------------- + get name varchar by key id + ----------------------------------------------------------------------*/ + struct REQ_NAME_STRING + { + short req_type; + + REQ_BASE base_info; + KEYID_STRUCT keyid_stru; //by key id -- 1 + cmnInt64 reference_id; //by id -- 2 + SEQ_CHAR seq_keyword; //usually only one key word + int keybuf_size; //0--no key_word, else key word data size + }; + + struct RSP_NAME_STRING + { + int name_len; + varchar ref_string; + }; + + /* --------------------------------------------------------------------- + get name varchar by many key ids + ----------------------------------------------------------------------*/ + struct REQ_MULTI_NAME_STRING + { + short req_type; + + REQ_BASE base_info; + SEQ_KEY_ID seq_keyid_stru; // -- 1 + + SEQ_APPKEY_ID seq_appkeyid_stru; // -- 2 + + SEQ_APP_ID seq_appid_stru; // -- 3 + + SEQ_LONGLONG seq_id; // -- 4 + }; + + typedef vector SEQ_RSP_NAME_STRING; + + struct RSP_MULTI_NAME_STRING + { + SEQ_RSP_NAME_STRING seq_name_string; + }; + + /* --------------------------------------------------------------------- + reference menu read + ----------------------------------------------------------------------*/ + struct REQ_REF_MENU + { + REQ_BASE base_info; + }; + + struct REF_MENU_STRING + { + cmnInt64 order_no; + varchar menu_name; + }; + + typedef vector SEQ_REF_MENU; + + struct RSP_REF_MENU + { + SEQ_REF_MENU seq_menu; + }; +/*------------------------------------------------------------------------------ + 7. some function for graph + + 2003-06-16 +------------------------------------------------------------------------------*/ + /* --------------------------------------------------------------------- + get real time data from rtdbms server + ----------------------------------------------------------------------*/ + struct GRAPH_SIMPLE_REQ + { + int order_no; + cmnInt64 keyword_id; + short table_no; + short field_no; + }; + + struct GRAPH_XY_REQ + { + int order_no; + cmnInt64 keyword_id; + short table_no; + short field_no; + unsigned char mode; // + short data_num; + }; + + // + struct GRAPH_FIELD_STRU + { + int order_no; + short field_no; + varchar field_alias; //lmj add for graph list query by sql where + + short rele1_table_no; + short rele1_field_no; + + short rele2_table_no; //lmj add for graph list query by 2 index + short rele2_field_no; //lmj add for graph list query by 2 index + }; + + typedef vector SEQ_GRAPH_FIELD; + struct GRAPH_LIST_REQ + { + short table_no; + varchar condition; + SEQ_STRING where_field_seq; //lmj add for graph list query by sql where + SEQ_GRAPH_FIELD seq_field; + }; + + typedef vector SEQ_SIMPLE_REQ; + typedef vector SEQ_XY_REQ; + typedef vector SEQ_LIST_REQ; + + struct GRAPH_REAL_REQ + { + cmnInt64 graph_id; //lmj add for GraphGetDataEx + int cal_type; //lmj add for before calculate + SEQ_SIMPLE_REQ simple_req; + SEQ_XY_REQ xy_req; + SEQ_LIST_REQ list_req; + }; + + struct GRAPH_REAL_ODB_REQ + { + REQ_BASE base_info; + cmnInt64 graph_id; //lmj add for GraphGetDataEx + int cal_type; //lmj add for before calculate + SEQ_SIMPLE_REQ simple_req; + SEQ_XY_REQ xy_req; + SEQ_LIST_REQ list_req; + }; + + /*--------------------------------------------------------------------*/ + struct GRAPH_SIMPLE_RSP + { + int order_no; + union_data_type data_value; + }; + + struct GRAPH_XY_RSP + { + int order_no; + SEQ_FLOAT seq_data_value; + }; + + struct ORDER_VALUE + { + int order_no; + SEQ_COMMON_DATA seq_data_value; + }; + + typedef vector SEQ_ORDER_VALUE; + + struct GRAPH_LIST_RSP + { + SEQ_ORDER_VALUE seq_list; + }; + + // + // + typedef vector SEQ_SIMPLE_RSP; + typedef vector SEQ_XY_RSP; + typedef vector SEQ_LIST_RSP; + + struct GRAPH_REAL_RSP + { + cmnInt64 graph_id; //lmj add for GraphGetDataEx + int cal_type; //lmj add for before calculate + SEQ_SIMPLE_RSP simple_rsp; + SEQ_XY_RSP xy_rsp; + SEQ_LIST_RSP list_rsp; + }; + + /* --------------------------------------------------------------------- + get app info from rtdbms server + ----------------------------------------------------------------------*/ + struct ORDER_KEY_REQ + { + int order_no; + cmnInt64 key_id; + }; + + typedef vector SEQ_ORDER_KEY_REQ; + struct GRAPH_ORDER_KEY_REQ + { + REQ_BASE base_info; + int app_no; + cmnInt64 graph_id; + SEQ_ORDER_KEY_REQ seq_order_key; + }; + + struct ORDER_KEY_RSP + { + int order_no; + unsigned char is_in_app; + }; + + typedef vector SEQ_ORDER_KEY_RSP; + struct GRAPH_ORDER_KEY_RSP + { + cmnInt64 graph_id; + SEQ_ORDER_KEY_RSP seq_app; + }; +/*------------------------------------------------------------------------------ + 8. some function for exchange name & no (app/table/field, include chn/eng) + + 2003-12-16 +------------------------------------------------------------------------------*/ + + struct REQ_ENTITY + { + REQ_BASE base_info; + + varchar object_name; + short object_id; //app/table/field + unsigned char object_mode; // name ---> no // no --->name + unsigned char object_eng; + }; + + struct RSP_ENTITY + { + int object_no; + varchar object_name; + }; +/*------------------------------------------------------------------------------ + 9. some function for factory name & no & id + + 2004-01-06 +------------------------------------------------------------------------------*/ + struct REQ_FAC + { + REQ_BASE base_info; + + int table_no; + SEQ_CHAR seq_keyword; //usually only one key word + int keybuf_size; //0--no key_word, else key word data size + + cmnInt64 fac_no; // hcr: fac_no & fac_id both use this member, so reserve as cmnInt64 but not short + varchar fac_name; + }; + + struct RSP_FAC + { + cmnInt64 fac_no; + varchar fac_name; + }; + + + struct REQ_VAL_STA + { + short req_type; // 1 yc , 2 yx , 3 ym , 4 union type 5 yc , 6 yx , 7 ym , 8 union type + REQ_BASE base_info; + SEQ_KEY_ID keyid_stru_seq; + SEQ_KEY_ID_STA keyid_sta_stru_seq; + }; + + + struct TIntValueStatus + { + int value; + int status; + }; + + + struct TFloatValueStatus + { + float value; + int status; + }; + + struct TCharValueStatus + { + unsigned char value; + int status; + }; + + struct TLongValueStatus + { + cmnInt64 value; + int status; + }; + + struct TUnionValueStatus + { + union_data_type value; + int status; + }; + + + + typedef vector< TIntValueStatus > SEQ_INT_VAL_STA; + + typedef vector< TFloatValueStatus > SEQ_FLOAT_VAL_STA; + + typedef vector< TCharValueStatus > SEQ_CHAR_VAL_STA; + + typedef vector< TLongValueStatus > SEQ_LONG_VAL_STA; + + typedef vector< TUnionValueStatus > SEQ_UNION_VAL_STA; + + struct RSP_INT_VAL_STA + { + SEQ_INT_VAL_STA rsp_val_sta; + }; + + struct RSP_FLOAT_VAL_STA + { + SEQ_FLOAT_VAL_STA rsp_val_sta; + }; + + struct RSP_CHAR_VAL_STA + { + SEQ_CHAR_VAL_STA rsp_val_sta; + }; + + struct RSP_LONG_VAL_STA + { + SEQ_LONG_VAL_STA rsp_val_sta; + }; + + struct RSP_UNION_VAL_STA + { + SEQ_UNION_VAL_STA rsp_val_sta; + }; + +//wj added for ConGet -- 2008.08.11 + struct REQ_CON + { + REQ_BASE base_info;//base_info.seq_field.length() == 1 + //FIELD_STRU get_field_info;//non or only one get_field + SEQ_FIELD_STRU get_field_info;//non or more than one get_field + SEQ_CHAR con_field_value; + }; + + struct RSP_CON + { + int fit_num; + int one_fit_size;//if non get_field, one_fit_size == one_record_size + SEQ_CHAR seq_data; + int data_size; + }; +#ifdef _APP_SYS_SUBSTATION +//wuqx added for xdb layer access -- 2012-07-10 + struct REQ_XDB + { + short op_no; + cmnInt64 table_no; + cmnInt64 id; + }; + + struct RSP_XDB + { + cmnInt64 oid; + cmnInt64 cnt; + }; +//jinjing 20120815 for virtual field + struct VIR_FIELD_STRU + { + short v_field_no; //rtdbms ڲ + short vr_field_no; // + short r_field_no; //bit field no Ӧʵ + short bit_no; // 1 - 32 λ + varchar vir_field_name_eng; + varchar vir_field_name_chn; + }; + + struct REQ_VIR_FIELD + { + REQ_BASE base_info; + }; + + typedef vector SEQ_VIRFIELD_STRU; + struct RSP_VIR_FIELD + { + //TABLE_PARAMETER table_para; + SEQ_VIRFIELD_STRU seq_virfield_para; + }; +#endif +/*------------------------------------------------------------------------------ + 10. rtdb_server function number + + 2008-11-28 + +------------------------------------------------------------------------------*/ + const int FUNC_TABLECREATE_NO = 1; + const int FUNC_TABLEDELETE_NO = 2; + + const int FUNC_TABLEGET_NO = 3; + const int FUNC_TABLEGETBYNAME_NO = 4; + const int FUNC_TABLEGETBYFIELDVALUE_NO = 5; + const int FUNC_TABLEWRITE_NO = 6; + const int FUNC_TABLEMODIFY_NO = 7; + const int FUNC_TABLEUPDATE_NO = 8; + const int FUNC_DELETERECORD_NO = 9; + const int FUNC_TABLECLEAR_NO = 10; + + const int FUNC_GETTABLEPARA_NO = 11; + const int FUNC_GETTABLEPARAMETER_NO = 12; + const int FUNC_GETAPPTABLEPARAMETER_NO = 13; + const int FUNC_GETFIELDPARA_NO = 14; + + const int FUNC_GETKEYINFO_NO = 15; + const int FUNC_TABLEGETBYSQL_NO = 16; + const int FUNC_MENUREAD_NO = 17; + const int FUNC_TABLERELEMENUREAD_NO = 18; + const int FUNC_GETNAMESTRINGBYKEYID_NO = 19; + const int FUNC_GETREFMENUSTRING_NO = 20; + + const int FUNC_GETNAMESTRINGBYMULTIKEYID_NO = 21; + + const int FUNC_GRAPHGETDATA_NO = 22; + const int FUNC_GRAPHGETAPPINFO_NO = 23; + + const int FUNC_EXCHANGENAMENO_NO = 24; + + const int FUNC_GETFACNAMEBYKEYNO_NO = 25; + const int FUNC_GETFACNAMEBYFACID_NO = 26; + const int FUNC_GETFACNAMEBYFACNO_NO = 27; + + const int FUNC_GETFACIDBYFACNAME_NO = 28; + const int FUNC_GETFACNOBYFACNAME_NO = 29; + + const int FUNC_GETFACIDBYFACNO_NO = 30; + const int FUNC_GETFACNOBYFACID_NO = 31; + + const int FUNC_GETVALUEANDSTATUS_NO = 32; + + const int FUNC_PINGRTDBSERVER_NO = 33; + const int FUNC_DELETERECORDS_NO = 34; + const int FUNC_TABLEGET_OPT_NO = 40; + const int FUNC_TABLEGETBYNAME_OPT_NO = 41; + const int FUNC_GETVALUEANDSTATUS_YCOPT_NO = 42; + const int FUNC_GETVALUEANDSTATUS_YXOPT_NO = 43; +const int FUNC_GETTABLEPARA_PARA3_NO = 44; + +#ifdef _APP_SYS_SUBSTATION + const int FUNC_GETTABLEPARAALL_NO = 35; + + const int FUNC_TABLEGETALL_NO = 36; + + const int FUNC_XDBACCESS_NO = 37; + + const int FUNC_GETTABLEPARAVIR_NO = 38; +//for xdb should not been used in other situation + const int GETPARENT_NO = 1; + const int CHDFIRST_NO = 2; + const int CHDNEXT_NO = 3; + const int CHDCNT_NO = 4; +#endif diff --git a/code/sys_nicmonitor/include/db_api/odb_net_m.h b/code/sys_nicmonitor/include/db_api/odb_net_m.h new file mode 100644 index 0000000..f6bb20e --- /dev/null +++ b/code/sys_nicmonitor/include/db_api/odb_net_m.h @@ -0,0 +1,1102 @@ +//************************************** +// Generated by mcpp translator +// Version 1.2 +//************************************** + +#ifndef __ODB_NET_M_H__ +#define __ODB_NET_M_H__ + +#include"mcode/mvector.h" +#include"mcode/mstring.h" +#include"mcode/mstream.h" +#include"mcode/mclient.h" +#include"db_api/odb_net_test.pb.h" + +namespace RTDB_SERVER +{ +const short C_DATATYPE_STRING = 1; +const short C_DATATYPE_UCHAR = 2; +const short C_DATATYPE_SHORT = 3; +const short C_DATATYPE_INT = 4; +const short C_DATATYPE_DATETIME = 5; +const short C_DATATYPE_FLOAT = 6; +const short C_DATATYPE_DOUBLE = 7; +const short C_DATATYPE_KEYID = 8; +const short C_DATATYPE_BINARY = 9; +const short C_DATATYPE_TEXT = 10; +const short C_DATATYPE_IMAGE = 11; +const short C_DATATYPE_APPKEYID = 12; +const short C_DATATYPE_APPID = 13; +const short C_DATATYPE_UINT = 14; +const short C_DATATYPE_LONG = 15; +const short C_DATATYPE_RTDBKEYID = 16; +const short C_DATATYPE_MEASRTDBKEYID = 17; +typedef MLang::VECTOR SEQ_STRING; +typedef MLang::VECTOR SEQ_CHAR; +typedef MLang::VECTOR SEQ_FLOAT; +typedef MLang::VECTOR SEQ_LONG; +typedef MLang::VECTOR SEQ_LONGLONG; +typedef MLang::Long KEYID_STRUCT; +void seq_char_proto2server(const RTDB_PROTO::SEQ_CHAR & _proto, RTDB_SERVER::SEQ_CHAR & _server); +struct RTDBKEY_STRUCT +{ + KEYID_STRUCT key_id1; + KEYID_STRUCT key_id2; + void __write(MLang::OutputStream&__os)const; + void __read(MLang::InputStream&__is); +}; +struct APPKEY_STRUCT +{ + int app_id; + RTDBKEY_STRUCT key_id; + void __write(MLang::OutputStream&__os)const; + void __read(MLang::InputStream&__is); +}; +typedef APPKEY_STRUCT APPID_STRUCT; +struct KEYID_STATUS_STRUCT +{ + KEYID_STRUCT key_id; + short status; + void __write(MLang::OutputStream&__os)const; + void __read(MLang::InputStream&__is); +}; +typedef MLang::VECTOR SEQ_KEY_ID; +typedef MLang::VECTOR SEQ_APPKEY_ID; +typedef MLang::VECTOR SEQ_APP_ID; +typedef MLang::VECTOR SEQ_KEY_ID_STA; +typedef MLang::VECTOR SEQ_RTDBKEY_ID; +struct union_data_type +{ +private: + union + { + char* c_char; + unsigned char c_uchar; + short c_short; + int c_int; + MLang::Long c_time; + float c_float; + double c_double; + KEYID_STRUCT c_keyid; + SEQ_CHAR* c_binary; + SEQ_CHAR* c_text; + SEQ_CHAR* c_image; + APPKEY_STRUCT c_appkeyid; + APPID_STRUCT c_appid; + unsigned int c_uint; + MLang::Long c_long; + RTDBKEY_STRUCT c_rtdbkeyid; + RTDBKEY_STRUCT c_measrtdbkeyid; + }__u_val; + bool __u_init; + unsigned short __u_index; +public: + union_data_type(); + union_data_type(const RTDB_PROTO::union_data_type&); + ~union_data_type(); + union_data_type(const union_data_type&); + union_data_type&operator=(const union_data_type&); + short _d()const; + void __clear(); + void __write(MLang::OutputStream&__os)const; + void __read(MLang::InputStream&__is); + void c_char(const char*); + void c_char(const MLang::STRING&); + const char*c_char()const; + void c_uchar(const unsigned char); + const unsigned char c_uchar()const; + void c_short(const short); + const short c_short()const; + void c_int(const int); + const int c_int()const; + void c_time(const MLang::Long); + const MLang::Long c_time()const; + void c_float(const float); + const float c_float()const; + void c_double(const double); + const double c_double()const; + void c_keyid(const KEYID_STRUCT); + const KEYID_STRUCT c_keyid()const; + void c_binary(const SEQ_CHAR&); + const SEQ_CHAR&c_binary()const; + SEQ_CHAR&c_binary(); + void c_text(const SEQ_CHAR&); + const SEQ_CHAR&c_text()const; + SEQ_CHAR&c_text(); + void c_image(const SEQ_CHAR&); + const SEQ_CHAR&c_image()const; + SEQ_CHAR&c_image(); + void c_appkeyid(const APPKEY_STRUCT&); + const APPKEY_STRUCT&c_appkeyid()const; + APPKEY_STRUCT&c_appkeyid(); + void c_appid(const APPID_STRUCT&); + const APPID_STRUCT&c_appid()const; + APPID_STRUCT&c_appid(); + void c_uint(const unsigned int); + const unsigned int c_uint()const; + void c_long(const MLang::Long); + const MLang::Long c_long()const; + void c_rtdbkeyid(const RTDBKEY_STRUCT&); + const RTDBKEY_STRUCT&c_rtdbkeyid()const; + RTDBKEY_STRUCT&c_rtdbkeyid(); + void c_measrtdbkeyid(const RTDBKEY_STRUCT&); + const RTDBKEY_STRUCT&c_measrtdbkeyid()const; + RTDBKEY_STRUCT&c_measrtdbkeyid(); +}; +typedef MLang::VECTOR SEQ_COMMON_DATA; +struct TABLE_STRU +{ + int table_no; + short app_no; + short column_num; + MLang::STRING table_name_eng; + MLang::STRING table_name_chn; + short record_length; + int record_num; + int max_record_num; + unsigned char is_auto_generate; + unsigned char is_record_app; + TABLE_STRU(); + TABLE_STRU(const TABLE_STRU&); + TABLE_STRU&operator=(const TABLE_STRU&); + void __write(MLang::OutputStream&__os)const; + void __read(MLang::InputStream&__is); +}; +struct COLUMN_STRU +{ + short field_no; + MLang::STRING field_name_eng; + MLang::STRING field_name_chn; + short data_length; + unsigned char data_type; + unsigned char allow_null; + unsigned char is_display; + unsigned char display_type; + short display_length; + unsigned char display_precision; + MLang::STRING menu_name; + unsigned char reference_flag; + unsigned char is_key; + unsigned char is_index; + unsigned char sort_order_no; + unsigned char reference_display; + unsigned char is_input; + unsigned char is_fix; + MLang::STRING init_value; + MLang::STRING min_value; + MLang::STRING max_value; + int reference_table; + short reference_column; + int column_special; + COLUMN_STRU(); + COLUMN_STRU(const COLUMN_STRU&); + COLUMN_STRU&operator=(const COLUMN_STRU&); + void __write(MLang::OutputStream&__os)const; + void __read(MLang::InputStream&__is); +}; +typedef MLang::VECTOR SEQ_COLUMN_INFO; +struct REQ_STDB_CREATE +{ + TABLE_STRU table_info; + SEQ_COLUMN_INFO column_info; + SEQ_COMMON_DATA data_value; + REQ_STDB_CREATE(); + REQ_STDB_CREATE(const REQ_STDB_CREATE&); + REQ_STDB_CREATE&operator=(const REQ_STDB_CREATE&); + void __write(MLang::OutputStream&__os)const; + void __read(MLang::InputStream&__is); +}; +struct REQ_STDB_DELETE +{ + short app_no; + int table_no; + MLang::STRING passwd; + REQ_STDB_DELETE(); + REQ_STDB_DELETE(const REQ_STDB_DELETE&); + REQ_STDB_DELETE&operator=(const REQ_STDB_DELETE&); + void __write(MLang::OutputStream&__os)const; + void __read(MLang::InputStream&__is); +}; +struct TABLE_PARAMETER +{ + MLang::STRING table_name_eng; + MLang::STRING table_name_chn; + int table_no; + int key_len; + int subkey_num; + short field_sum; + int record_number; + int record_size; + unsigned char is_auto_generated; + TABLE_PARAMETER(); + TABLE_PARAMETER(const TABLE_PARAMETER&); + TABLE_PARAMETER&operator=(const TABLE_PARAMETER&); + void __write(MLang::OutputStream&__os)const; + void __read(MLang::InputStream&__is); +}; +struct FIELD_PARAMETER +{ + short field_no; + short r_field_no; + short field_id; + short column_id; + MLang::STRING field_name_eng; + MLang::STRING field_name_chn; + short field_length; + unsigned char data_type; + unsigned char allow_null; + unsigned char display_type; + MLang::STRING menu_name; + unsigned char reference_flag; + unsigned char is_keyword; + unsigned char is_index; + int offset; + int check_tag; + unsigned char sort_order_no; + unsigned char reference_mode; + unsigned char reference_display; + unsigned char is_app_syn; + unsigned char auto_meas_type; + MLang::STRING default_asciival; + MLang::STRING min_asciival; + MLang::STRING max_asciival; + int ref_tableno; + short ref_fieldno; +#ifdef _APP_SYS_SUBSTATION + short is_bit_field; +#endif + int column_special; + int search_attribute; + int statics_attribute; + int reserved_1; + int reserved_2; + int reserved_3; + int reserved_4; + int reserved_5; + FIELD_PARAMETER(); + FIELD_PARAMETER(const FIELD_PARAMETER&); + FIELD_PARAMETER&operator=(const FIELD_PARAMETER&); + void __write(MLang::OutputStream&__os)const; + void __read(MLang::InputStream&__is); +}; +struct R_FIELD_BASE_INFO +{ + int offset; + int field_length; + short field_no; + unsigned char data_type; + unsigned char is_keyword; + void __write(MLang::OutputStream&__os)const; + void __read(MLang::InputStream&__is); +}; +typedef MLang::VECTOR SEQ_FIELD_BASE_INFO; +struct FIELD_STRU +{ + short field_no ; + short field_type ; + short field_length ; + FIELD_STRU(); + FIELD_STRU(const RTDB_PROTO::FIELD_STRU &); + void __write(MLang::OutputStream&__os)const; + void __read(MLang::InputStream&__is); +}; +typedef MLang::VECTOR SEQ_FIELD_STRU; +void seq_field_stru_proto2server(const RTDB_PROTO::SEQ_FIELD_STRU &, RTDB_SERVER::SEQ_FIELD_STRU &); +struct REQ_BASE +{ + short context_no ; + int app_no ; + int table_no ; + int slice_no ; + char byte_tag ; + SEQ_FIELD_STRU seq_field; + REQ_BASE(); + REQ_BASE(const RTDB_PROTO::REQ_BASE &); + REQ_BASE(const REQ_BASE&); + REQ_BASE&operator=(const REQ_BASE&); + void __write(MLang::OutputStream&__os)const; + void __read(MLang::InputStream&__is); +}; +struct REQ_READ +{ + REQ_BASE base_info; + SEQ_CHAR seq_keyword; + int keybuf_size; + MLang::STRING str_fname_list; + REQ_READ(); + REQ_READ(const RTDB_PROTO::REQ_READ &); + REQ_READ(const REQ_READ&); + REQ_READ&operator=(const REQ_READ&); + void __write(MLang::OutputStream&__os)const; + void __read(MLang::InputStream&__is); +}; +struct RSP_READ +{ + int record_num ; + int record_size ; + short field_num ; + SEQ_FIELD_STRU seq_field ; + SEQ_CHAR seq_data ; + int data_size ; + RSP_READ(); + RSP_READ(const RTDB_PROTO::RSP_READ &); + RSP_READ(const RSP_READ&); + RSP_READ&operator=(const RSP_READ&); + void __write(MLang::OutputStream&__os)const; + void __read(MLang::InputStream&__is); +}; +struct REQ_KEY_WRITE +{ + REQ_BASE base_info; + SEQ_CHAR record_value; + int buf_size; + REQ_KEY_WRITE(); + REQ_KEY_WRITE(const REQ_KEY_WRITE&); + REQ_KEY_WRITE&operator=(const REQ_KEY_WRITE&); + void __write(MLang::OutputStream&__os)const; + void __read(MLang::InputStream&__is); +}; +struct REQ_MODIFY +{ + REQ_BASE base_info; + short is_field_name; + MLang::STRING field_name_str; + SEQ_CHAR seq_keyword; + int keybuf_size; + SEQ_CHAR field_value; + int buf_size; + REQ_MODIFY(); + REQ_MODIFY(const REQ_MODIFY&); + REQ_MODIFY&operator=(const REQ_MODIFY&); + void __write(MLang::OutputStream&__os)const; + void __read(MLang::InputStream&__is); +}; +struct REQ_UPDATE +{ + REQ_BASE base_info; + SEQ_CHAR field_value; + int buf_size; + REQ_UPDATE(); + REQ_UPDATE(const REQ_UPDATE&); + REQ_UPDATE&operator=(const REQ_UPDATE&); + void __write(MLang::OutputStream&__os)const; + void __read(MLang::InputStream&__is); +}; +struct REQ_KEY_ERASE +{ + REQ_BASE base_info; + SEQ_CHAR seq_keyword; + int keybuf_size; + REQ_KEY_ERASE(); + REQ_KEY_ERASE(const REQ_KEY_ERASE&); + REQ_KEY_ERASE&operator=(const REQ_KEY_ERASE&); + void __write(MLang::OutputStream&__os)const; + void __read(MLang::InputStream&__is); +}; +struct DEL_REQ +{ + REQ_BASE base_info; + int del_direction; + int del_num; + SEQ_CHAR seq_keyword; + int keybuf_size; + DEL_REQ(); + DEL_REQ(const DEL_REQ&); + DEL_REQ&operator=(const DEL_REQ&); + void __write(MLang::OutputStream&__os)const; + void __read(MLang::InputStream&__is); +}; +struct REQ_TABLE_CLEAR +{ + REQ_BASE base_info; + REQ_TABLE_CLEAR(); + REQ_TABLE_CLEAR(const REQ_TABLE_CLEAR&); + REQ_TABLE_CLEAR&operator=(const REQ_TABLE_CLEAR&); + void __write(MLang::OutputStream&__os)const; + void __read(MLang::InputStream&__is); +}; +struct REQ_FIELD_BASE_INFO +{ + REQ_BASE base_info; + SEQ_LONG seq_field_no; + REQ_FIELD_BASE_INFO(); + REQ_FIELD_BASE_INFO(const REQ_FIELD_BASE_INFO&); + REQ_FIELD_BASE_INFO&operator=(const REQ_FIELD_BASE_INFO&); + void __write(MLang::OutputStream&__os)const; + void __read(MLang::InputStream&__is); +}; +struct RSP_FIELD_BASE_INFO +{ + SEQ_FIELD_BASE_INFO lseq_field_base_info; + RSP_FIELD_BASE_INFO(); + RSP_FIELD_BASE_INFO(const RSP_FIELD_BASE_INFO&); + RSP_FIELD_BASE_INFO&operator=(const RSP_FIELD_BASE_INFO&); + void __write(MLang::OutputStream&__os)const; + void __read(MLang::InputStream&__is); +}; +struct REQ_PARAMETER +{ + REQ_BASE base_info; + MLang::STRING str_field_list; + REQ_PARAMETER(); + REQ_PARAMETER(const REQ_PARAMETER&); + REQ_PARAMETER&operator=(const REQ_PARAMETER&); + void __write(MLang::OutputStream&__os)const; + void __read(MLang::InputStream&__is); +}; +typedef MLang::VECTOR SEQ_FIELD_PARAMETER; +struct RSP_PARAMETER +{ + TABLE_PARAMETER table_para; + SEQ_FIELD_PARAMETER seq_field_para; + RSP_PARAMETER(); + RSP_PARAMETER(const RSP_PARAMETER&); + RSP_PARAMETER&operator=(const RSP_PARAMETER&); + void __write(MLang::OutputStream&__os)const; + void __read(MLang::InputStream&__is); +}; +struct REQ_APP_PARAMETER +{ + int app_no; + MLang::STRING app_name; + REQ_APP_PARAMETER(); + REQ_APP_PARAMETER(const REQ_APP_PARAMETER&); + REQ_APP_PARAMETER&operator=(const REQ_APP_PARAMETER&); + void __write(MLang::OutputStream&__os)const; + void __read(MLang::InputStream&__is); +}; +typedef MLang::VECTOR SEQ_TABLE_PARAMETER; +struct RSP_APP_PARAMETER +{ + int app_no; + MLang::STRING app_name; + SEQ_TABLE_PARAMETER seq_table_para; + RSP_APP_PARAMETER(); + RSP_APP_PARAMETER(const RSP_APP_PARAMETER&); + RSP_APP_PARAMETER&operator=(const RSP_APP_PARAMETER&); + void __write(MLang::OutputStream&__os)const; + void __read(MLang::InputStream&__is); +}; +struct TABLE_KEYINFO +{ + short keyword_len; + int is_sliced; + void __write(MLang::OutputStream&__os)const; + void __read(MLang::InputStream&__is); +}; +typedef MLang::VECTOR SEQ_TABLE_KEYINFO; +struct RSP_KEYINFO +{ + SEQ_TABLE_KEYINFO seq_keyinfo; + RSP_KEYINFO(); + RSP_KEYINFO(const RSP_KEYINFO&); + RSP_KEYINFO&operator=(const RSP_KEYINFO&); + void __write(MLang::OutputStream&__os)const; + void __read(MLang::InputStream&__is); +}; +struct REQ_SQL +{ + REQ_BASE base_info; + MLang::STRING str_select; + REQ_SQL(); + REQ_SQL(const REQ_SQL&); + REQ_SQL&operator=(const REQ_SQL&); + void __write(MLang::OutputStream&__os)const; + void __read(MLang::InputStream&__is); +}; +struct REQ_MENU +{ + REQ_BASE base_info; + MLang::STRING str_menu_name; + unsigned char menu_status; + REQ_MENU(); + REQ_MENU(const REQ_MENU&); + REQ_MENU&operator=(const REQ_MENU&); + void __write(MLang::OutputStream&__os)const; + void __read(MLang::InputStream&__is); +}; +struct MENU_INFO_STRU +{ + MLang::STRING menu_name; + unsigned char menu_no; + int actual_value; + MLang::STRING display_value; + unsigned char menu_status; + MLang::STRING menu_macro_name; + MENU_INFO_STRU(); + MENU_INFO_STRU(const MENU_INFO_STRU&); + MENU_INFO_STRU&operator=(const MENU_INFO_STRU&); + void __write(MLang::OutputStream&__os)const; + void __read(MLang::InputStream&__is); +}; +typedef MLang::VECTOR SEQ_MENU_INFO; +struct RSP_MENU +{ + int menu_num; + SEQ_MENU_INFO seq_menu; + RSP_MENU(); + RSP_MENU(const RSP_MENU&); + RSP_MENU&operator=(const RSP_MENU&); + void __write(MLang::OutputStream&__os)const; + void __read(MLang::InputStream&__is); +}; +struct REQ_RELE_MENU +{ + REQ_BASE base_info; + REQ_RELE_MENU(); + REQ_RELE_MENU(const REQ_RELE_MENU&); + REQ_RELE_MENU&operator=(const REQ_RELE_MENU&); + void __write(MLang::OutputStream&__os)const; + void __read(MLang::InputStream&__is); +}; +struct MENU_RELEVANT_STRU +{ + int table_id; + short column_id; + int column_value; + short r_column_id; + MLang::STRING r_menu_name; + int default_value; + MENU_RELEVANT_STRU(); + MENU_RELEVANT_STRU(const MENU_RELEVANT_STRU&); + MENU_RELEVANT_STRU&operator=(const MENU_RELEVANT_STRU&); + void __write(MLang::OutputStream&__os)const; + void __read(MLang::InputStream&__is); +}; +typedef MLang::VECTOR SEQ_MENU_RELEVANT; +struct RSP_RELE_MENU +{ + int menu_num; + SEQ_MENU_RELEVANT seq_menu; + RSP_RELE_MENU(); + RSP_RELE_MENU(const RSP_RELE_MENU&); + RSP_RELE_MENU&operator=(const RSP_RELE_MENU&); + void __write(MLang::OutputStream&__os)const; + void __read(MLang::InputStream&__is); +}; +struct REQ_NAME_STRING +{ + short req_type; + REQ_BASE base_info; + KEYID_STRUCT keyid_stru; + MLang::Long reference_id; + SEQ_CHAR seq_keyword; + RTDBKEY_STRUCT rtdb_keyid_stru; + int keybuf_size; + REQ_NAME_STRING(); + REQ_NAME_STRING(const REQ_NAME_STRING&); + REQ_NAME_STRING&operator=(const REQ_NAME_STRING&); + void __write(MLang::OutputStream&__os)const; + void __read(MLang::InputStream&__is); +}; +struct RSP_NAME_STRING +{ + int name_len; + MLang::STRING ref_string; + RSP_NAME_STRING(); + RSP_NAME_STRING(const RSP_NAME_STRING&); + RSP_NAME_STRING&operator=(const RSP_NAME_STRING&); + void __write(MLang::OutputStream&__os)const; + void __read(MLang::InputStream&__is); +}; +struct REQ_MULTI_NAME_STRING +{ + short req_type; + REQ_BASE base_info; + SEQ_KEY_ID seq_keyid_stru; + SEQ_APPKEY_ID seq_appkeyid_stru; + SEQ_APP_ID seq_appid_stru; + SEQ_LONGLONG seq_id; + SEQ_RTDBKEY_ID seq_rtdbkeyid_stru; + REQ_MULTI_NAME_STRING(); + REQ_MULTI_NAME_STRING(const REQ_MULTI_NAME_STRING&); + REQ_MULTI_NAME_STRING&operator=(const REQ_MULTI_NAME_STRING&); + void __write(MLang::OutputStream&__os)const; + void __read(MLang::InputStream&__is); +}; +typedef MLang::VECTOR SEQ_RSP_NAME_STRING; +struct RSP_MULTI_NAME_STRING +{ + SEQ_RSP_NAME_STRING seq_name_string; + RSP_MULTI_NAME_STRING(); + RSP_MULTI_NAME_STRING(const RSP_MULTI_NAME_STRING&); + RSP_MULTI_NAME_STRING&operator=(const RSP_MULTI_NAME_STRING&); + void __write(MLang::OutputStream&__os)const; + void __read(MLang::InputStream&__is); +}; +struct REQ_REF_MENU +{ + REQ_BASE base_info; + REQ_REF_MENU(); + REQ_REF_MENU(const REQ_REF_MENU&); + REQ_REF_MENU&operator=(const REQ_REF_MENU&); + void __write(MLang::OutputStream&__os)const; + void __read(MLang::InputStream&__is); +}; +struct REF_MENU_STRING +{ + MLang::Long order_no; + MLang::STRING menu_name; + REF_MENU_STRING(); + REF_MENU_STRING(const REF_MENU_STRING&); + REF_MENU_STRING&operator=(const REF_MENU_STRING&); + void __write(MLang::OutputStream&__os)const; + void __read(MLang::InputStream&__is); +}; +typedef MLang::VECTOR SEQ_REF_MENU; +struct RSP_REF_MENU +{ + SEQ_REF_MENU seq_menu; + RSP_REF_MENU(); + RSP_REF_MENU(const RSP_REF_MENU&); + RSP_REF_MENU&operator=(const RSP_REF_MENU&); + void __write(MLang::OutputStream&__os)const; + void __read(MLang::InputStream&__is); +}; +struct GRAPH_SIMPLE_REQ +{ + int order_no; + RTDBKEY_STRUCT keyword_id; + int table_no; + int field_no; + GRAPH_SIMPLE_REQ(); + GRAPH_SIMPLE_REQ(const RTDB_PROTO::GRAPH_SIMPLE_REQ &); + void __write(MLang::OutputStream&__os)const; + void __read(MLang::InputStream&__is); +}; +struct GRAPH_XY_REQ +{ + int order_no; + RTDBKEY_STRUCT keyword_id; + int table_no; + int field_no; + unsigned char mode; + short data_num; + void __write(MLang::OutputStream&__os)const; + void __read(MLang::InputStream&__is); +}; +struct GRAPH_FIELD_STRU +{ + int order_no; + int field_no; + MLang::STRING field_alias; + int rele1_table_no; + int rele1_field_no; + int rele2_table_no; + int rele2_field_no; + GRAPH_FIELD_STRU(); + GRAPH_FIELD_STRU(const GRAPH_FIELD_STRU&); + GRAPH_FIELD_STRU&operator=(const GRAPH_FIELD_STRU&); + void __write(MLang::OutputStream&__os)const; + void __read(MLang::InputStream&__is); +}; +typedef MLang::VECTOR SEQ_GRAPH_FIELD; +struct GRAPH_LIST_REQ +{ + int table_no; + MLang::STRING condition; + SEQ_STRING where_field_seq; + SEQ_GRAPH_FIELD seq_field; + GRAPH_LIST_REQ(); + GRAPH_LIST_REQ(const GRAPH_LIST_REQ&); + GRAPH_LIST_REQ&operator=(const GRAPH_LIST_REQ&); + void __write(MLang::OutputStream&__os)const; + void __read(MLang::InputStream&__is); +}; +typedef MLang::VECTOR SEQ_SIMPLE_REQ; +typedef MLang::VECTOR SEQ_XY_REQ; +typedef MLang::VECTOR SEQ_LIST_REQ; +struct GRAPH_REAL_REQ +{ + MLang::Long graph_id; + int cal_type; + SEQ_SIMPLE_REQ simple_req; + SEQ_XY_REQ xy_req; + SEQ_LIST_REQ list_req; + GRAPH_REAL_REQ(); + GRAPH_REAL_REQ(const GRAPH_REAL_REQ&); + GRAPH_REAL_REQ&operator=(const GRAPH_REAL_REQ&); + void __write(MLang::OutputStream&__os)const; + void __read(MLang::InputStream&__is); +}; +struct GRAPH_REAL_ODB_REQ +{ + REQ_BASE base_info; + MLang::Long graph_id; + int cal_type; + SEQ_SIMPLE_REQ simple_req; + SEQ_XY_REQ xy_req; + SEQ_LIST_REQ list_req; + GRAPH_REAL_ODB_REQ(); + GRAPH_REAL_ODB_REQ(const GRAPH_REAL_ODB_REQ&); + GRAPH_REAL_ODB_REQ&operator=(const GRAPH_REAL_ODB_REQ&); + void __write(MLang::OutputStream&__os)const; + void __read(MLang::InputStream&__is); +}; +struct GRAPH_SIMPLE_RSP +{ + int order_no; + union_data_type data_value; + GRAPH_SIMPLE_RSP(); + GRAPH_SIMPLE_RSP(const RTDB_PROTO::GRAPH_SIMPLE_RSP &); + void __write(MLang::OutputStream&__os)const; + void __read(MLang::InputStream&__is); +}; +struct GRAPH_XY_RSP +{ + int order_no; + SEQ_FLOAT seq_data_value; + GRAPH_XY_RSP(); + GRAPH_XY_RSP(const GRAPH_XY_RSP&); + GRAPH_XY_RSP&operator=(const GRAPH_XY_RSP&); + void __write(MLang::OutputStream&__os)const; + void __read(MLang::InputStream&__is); +}; +struct ORDER_VALUE +{ + int order_no; + SEQ_COMMON_DATA seq_data_value; + ORDER_VALUE(); + ORDER_VALUE(const ORDER_VALUE&); + ORDER_VALUE&operator=(const ORDER_VALUE&); + void __write(MLang::OutputStream&__os)const; + void __read(MLang::InputStream&__is); +}; +typedef MLang::VECTOR SEQ_ORDER_VALUE; +struct GRAPH_LIST_RSP +{ + SEQ_ORDER_VALUE seq_list; + GRAPH_LIST_RSP(); + GRAPH_LIST_RSP(const GRAPH_LIST_RSP&); + GRAPH_LIST_RSP&operator=(const GRAPH_LIST_RSP&); + void __write(MLang::OutputStream&__os)const; + void __read(MLang::InputStream&__is); +}; +typedef MLang::VECTOR SEQ_SIMPLE_RSP; +typedef MLang::VECTOR SEQ_XY_RSP; +typedef MLang::VECTOR SEQ_LIST_RSP; +struct GRAPH_REAL_RSP +{ + MLang::Long graph_id; + int cal_type; + SEQ_SIMPLE_RSP simple_rsp; + SEQ_XY_RSP xy_rsp; + SEQ_LIST_RSP list_rsp; + GRAPH_REAL_RSP(); + GRAPH_REAL_RSP(const GRAPH_REAL_RSP&); + GRAPH_REAL_RSP&operator=(const GRAPH_REAL_RSP&); + void __write(MLang::OutputStream&__os)const; + void __read(MLang::InputStream&__is); +}; +struct ORDER_KEY_REQ +{ + int order_no; + RTDBKEY_STRUCT key_id; + ORDER_KEY_REQ(); + ORDER_KEY_REQ(const RTDB_PROTO::ORDER_KEY_REQ &); + void __write(MLang::OutputStream&__os)const; + void __read(MLang::InputStream&__is); +}; +typedef MLang::VECTOR SEQ_ORDER_KEY_REQ; +struct GRAPH_ORDER_KEY_REQ +{ + REQ_BASE base_info; + int app_no; + MLang::Long graph_id; + SEQ_ORDER_KEY_REQ seq_order_key; + GRAPH_ORDER_KEY_REQ(); + GRAPH_ORDER_KEY_REQ(const RTDB_PROTO::GRAPH_ORDER_KEY_REQ&); + GRAPH_ORDER_KEY_REQ(const GRAPH_ORDER_KEY_REQ&); + GRAPH_ORDER_KEY_REQ&operator=(const GRAPH_ORDER_KEY_REQ&); + void __write(MLang::OutputStream&__os)const; + void __read(MLang::InputStream&__is); +}; +struct ORDER_KEY_RSP +{ + int order_no; + unsigned char is_in_app; + void __write(MLang::OutputStream&__os)const; + void __read(MLang::InputStream&__is); +}; +typedef MLang::VECTOR SEQ_ORDER_KEY_RSP; +struct GRAPH_ORDER_KEY_RSP +{ + MLang::Long graph_id; + SEQ_ORDER_KEY_RSP seq_app; + GRAPH_ORDER_KEY_RSP(); + GRAPH_ORDER_KEY_RSP(const GRAPH_ORDER_KEY_RSP&); + GRAPH_ORDER_KEY_RSP&operator=(const GRAPH_ORDER_KEY_RSP&); + void __write(MLang::OutputStream&__os)const; + void __read(MLang::InputStream&__is); +}; +struct REQ_ENTITY +{ + REQ_BASE base_info; + MLang::STRING object_name; + short object_id; + unsigned char object_mode; + unsigned char object_eng; + REQ_ENTITY(); + REQ_ENTITY(const REQ_ENTITY&); + REQ_ENTITY&operator=(const REQ_ENTITY&); + void __write(MLang::OutputStream&__os)const; + void __read(MLang::InputStream&__is); +}; +struct RSP_ENTITY +{ + int object_no; + MLang::STRING object_name; + RSP_ENTITY(); + RSP_ENTITY(const RSP_ENTITY&); + RSP_ENTITY&operator=(const RSP_ENTITY&); + void __write(MLang::OutputStream&__os)const; + void __read(MLang::InputStream&__is); +}; +struct REQ_FAC +{ + REQ_BASE base_info; + int table_no; + SEQ_CHAR seq_keyword; + int keybuf_size; + MLang::Long fac_no; + MLang::STRING fac_name; + REQ_FAC(); + REQ_FAC(const REQ_FAC&); + REQ_FAC&operator=(const REQ_FAC&); + void __write(MLang::OutputStream&__os)const; + void __read(MLang::InputStream&__is); +}; +struct RSP_FAC +{ + MLang::Long fac_no; + MLang::STRING fac_name; + RSP_FAC(); + RSP_FAC(const RSP_FAC&); + RSP_FAC&operator=(const RSP_FAC&); + void __write(MLang::OutputStream&__os)const; + void __read(MLang::InputStream&__is); +}; +struct REQ_VAL_STA +{ + short req_type; + REQ_BASE base_info; + SEQ_KEY_ID keyid_stru_seq; + SEQ_KEY_ID_STA keyid_sta_stru_seq; + SEQ_RTDBKEY_ID rtdb_keyid_stru_seq; + REQ_VAL_STA(); + REQ_VAL_STA(const REQ_VAL_STA&); + REQ_VAL_STA&operator=(const REQ_VAL_STA&); + void __write(MLang::OutputStream&__os)const; + void __read(MLang::InputStream&__is); +}; +struct TIntValueStatus +{ + int value; + int status; + void __write(MLang::OutputStream&__os)const; + void __read(MLang::InputStream&__is); +}; +struct TFloatValueStatus +{ + float value; + int status; + void __write(MLang::OutputStream&__os)const; + void __read(MLang::InputStream&__is); +}; +struct TCharValueStatus +{ + unsigned char value; + int status; + void __write(MLang::OutputStream&__os)const; + void __read(MLang::InputStream&__is); +}; +struct TLongValueStatus +{ + MLang::Long value; + int status; + void __write(MLang::OutputStream&__os)const; + void __read(MLang::InputStream&__is); +}; +struct TUnionValueStatus +{ + union_data_type value; + int status; + void __write(MLang::OutputStream&__os)const; + void __read(MLang::InputStream&__is); +}; +typedef MLang::VECTOR SEQ_INT_VAL_STA; +typedef MLang::VECTOR SEQ_FLOAT_VAL_STA; +typedef MLang::VECTOR SEQ_CHAR_VAL_STA; +typedef MLang::VECTOR SEQ_LONG_VAL_STA; +typedef MLang::VECTOR SEQ_UNION_VAL_STA; +struct RSP_INT_VAL_STA +{ + SEQ_INT_VAL_STA rsp_val_sta; + RSP_INT_VAL_STA(); + RSP_INT_VAL_STA(const RSP_INT_VAL_STA&); + RSP_INT_VAL_STA&operator=(const RSP_INT_VAL_STA&); + void __write(MLang::OutputStream&__os)const; + void __read(MLang::InputStream&__is); +}; +struct RSP_FLOAT_VAL_STA +{ + SEQ_FLOAT_VAL_STA rsp_val_sta; + RSP_FLOAT_VAL_STA(); + RSP_FLOAT_VAL_STA(const RSP_FLOAT_VAL_STA&); + RSP_FLOAT_VAL_STA&operator=(const RSP_FLOAT_VAL_STA&); + void __write(MLang::OutputStream&__os)const; + void __read(MLang::InputStream&__is); +}; +struct RSP_CHAR_VAL_STA +{ + SEQ_CHAR_VAL_STA rsp_val_sta; + RSP_CHAR_VAL_STA(); + RSP_CHAR_VAL_STA(const RSP_CHAR_VAL_STA&); + RSP_CHAR_VAL_STA&operator=(const RSP_CHAR_VAL_STA&); + void __write(MLang::OutputStream&__os)const; + void __read(MLang::InputStream&__is); +}; +struct RSP_LONG_VAL_STA +{ + SEQ_LONG_VAL_STA rsp_val_sta; + RSP_LONG_VAL_STA(); + RSP_LONG_VAL_STA(const RSP_LONG_VAL_STA&); + RSP_LONG_VAL_STA&operator=(const RSP_LONG_VAL_STA&); + void __write(MLang::OutputStream&__os)const; + void __read(MLang::InputStream&__is); +}; +struct RSP_UNION_VAL_STA +{ + SEQ_UNION_VAL_STA rsp_val_sta; + RSP_UNION_VAL_STA(); + RSP_UNION_VAL_STA(const RSP_UNION_VAL_STA&); + RSP_UNION_VAL_STA&operator=(const RSP_UNION_VAL_STA&); + void __write(MLang::OutputStream&__os)const; + void __read(MLang::InputStream&__is); +}; +struct REQ_CON +{ + REQ_BASE base_info ; + SEQ_FIELD_STRU get_field_info ; + SEQ_CHAR con_field_value ; + REQ_CON(); + REQ_CON(const RTDB_PROTO::REQ_CON &); + REQ_CON(const REQ_CON&); + REQ_CON&operator=(const REQ_CON&); + void __write(MLang::OutputStream&__os)const; + void __read(MLang::InputStream&__is); +}; +struct RSP_CON +{ + int fit_num; + int one_fit_size; + SEQ_CHAR seq_data; + int data_size; + RSP_CON(); + RSP_CON(const RSP_CON&); + RSP_CON&operator=(const RSP_CON&); + void __write(MLang::OutputStream&__os)const; + void __read(MLang::InputStream&__is); +}; +#ifdef _APP_SYS_SUBSTATION +struct REQ_XDB +{ + short op_no; + MLang::Long table_no; + MLang::Long id; + void __write(MLang::OutputStream&__os)const; + void __read(MLang::InputStream&__is); +}; +struct RSP_XDB +{ + MLang::Long oid; + MLang::Long cnt; + void __write(MLang::OutputStream&__os)const; + void __read(MLang::InputStream&__is); +}; +struct VIR_FIELD_STRU +{ + short v_field_no; + short vr_field_no; + short r_field_no; + short bit_no; + MLang::STRING vir_field_name_eng; + MLang::STRING vir_field_name_chn; + VIR_FIELD_STRU(); + VIR_FIELD_STRU(const VIR_FIELD_STRU&); + VIR_FIELD_STRU&operator=(const VIR_FIELD_STRU&); + void __write(MLang::OutputStream&__os)const; + void __read(MLang::InputStream&__is); +}; +struct REQ_VIR_FIELD +{ + REQ_BASE base_info; + REQ_VIR_FIELD(); + REQ_VIR_FIELD(const REQ_VIR_FIELD&); + REQ_VIR_FIELD&operator=(const REQ_VIR_FIELD&); + void __write(MLang::OutputStream&__os)const; + void __read(MLang::InputStream&__is); +}; +typedef MLang::VECTOR SEQ_VIRFIELD_STRU; +struct RSP_VIR_FIELD +{ + SEQ_VIRFIELD_STRU seq_virfield_para; + RSP_VIR_FIELD(); + RSP_VIR_FIELD(const RSP_VIR_FIELD&); + RSP_VIR_FIELD&operator=(const RSP_VIR_FIELD&); + void __write(MLang::OutputStream&__os)const; + void __read(MLang::InputStream&__is); +}; +#endif +const int FUNC_TABLECREATE_NO = 1; +const int FUNC_TABLEDELETE_NO = 2; +const int FUNC_TABLEGET_NO = 3; +const int FUNC_TABLEGETBYNAME_NO = 4; +const int FUNC_TABLEGETBYFIELDVALUE_NO = 5; +const int FUNC_TABLEWRITE_NO = 6; +const int FUNC_TABLEMODIFY_NO = 7; +const int FUNC_TABLEUPDATE_NO = 8; +const int FUNC_DELETERECORD_NO = 9; +const int FUNC_TABLECLEAR_NO = 10; +const int FUNC_GETTABLEPARA_NO = 11; +const int FUNC_GETTABLEPARAMETER_NO = 12; +const int FUNC_GETAPPTABLEPARAMETER_NO = 13; +const int FUNC_GETFIELDPARA_NO = 14; +const int FUNC_GETKEYINFO_NO = 15; +const int FUNC_TABLEGETBYSQL_NO = 16; +const int FUNC_MENUREAD_NO = 17; +const int FUNC_TABLERELEMENUREAD_NO = 18; +const int FUNC_GETNAMESTRINGBYKEYID_NO = 19; +const int FUNC_GETREFMENUSTRING_NO = 20; +const int FUNC_GETNAMESTRINGBYMULTIKEYID_NO = 21; +const int FUNC_GRAPHGETDATA_NO = 22; +const int FUNC_GRAPHGETAPPINFO_NO = 23; +const int FUNC_EXCHANGENAMENO_NO = 24; +const int FUNC_GETFACNAMEBYKEYNO_NO = 25; +const int FUNC_GETFACNAMEBYFACID_NO = 26; +const int FUNC_GETFACNAMEBYFACNO_NO = 27; +const int FUNC_GETFACIDBYFACNAME_NO = 28; +const int FUNC_GETFACNOBYFACNAME_NO = 29; +const int FUNC_GETFACIDBYFACNO_NO = 30; +const int FUNC_GETFACNOBYFACID_NO = 31; +const int FUNC_GETVALUEANDSTATUS_NO = 32; +const int FUNC_PINGRTDBSERVER_NO = 33; +const int FUNC_DELETERECORDS_NO = 34; +const int FUNC_TABLEGET_OPT_NO = 40; +const int FUNC_TABLEGETBYNAME_OPT_NO = 41; +const int FUNC_GETVALUEANDSTATUS_YCOPT_NO = 42; +const int FUNC_GETVALUEANDSTATUS_YXOPT_NO = 43; +const int FUNC_GETTABLEPARA_PARA3_NO = 44; + +#ifdef _APP_SYS_SUBSTATION +const int FUNC_GETTABLEPARAALL_NO = 35; +const int FUNC_TABLEGETALL_NO = 36; +const int FUNC_XDBACCESS_NO = 37; +const int FUNC_GETTABLEPARAVIR_NO = 38; +const int GETPARENT_NO = 1; +const int CHDFIRST_NO = 2; +const int CHDNEXT_NO = 3; +const int CHDCNT_NO = 4; +#endif +} +#endif diff --git a/code/sys_nicmonitor/include/db_api/odb_netfactory.h b/code/sys_nicmonitor/include/db_api/odb_netfactory.h new file mode 100644 index 0000000..dc13292 --- /dev/null +++ b/code/sys_nicmonitor/include/db_api/odb_netfactory.h @@ -0,0 +1,193 @@ +/******************************************************************************* +ModuleName: ODB Real Time Database management system +FileName: odb_netfactory.h +DESCRIPTION: for class CTableNet of net access +FUNCTION LIST: +COMMENT: for net access +History: +Date Version Modifier Activities +2003-12-12 1.0 modify +================================================================================ +2003-01-09 1.0 created +*******************************************************************************/ + +#ifndef __ODB_NETFACTORY_h__ +#define __ODB_NETFACTORY_h__ + +#ifndef __ODB_DEFINE_H__ +#include "db_api/odb_define.h" +#endif + +//#ifndef __ODB_ORBMGR_H__ +//#include "odb_orbmgr.h" +//#endif + +#include +#include + +#include "system.h" +#include "task_service.h" +#include "sysadm/scn_service.h" + +#include "db_api/odb_net_m.h" +#include "db_api/codb_net.h" + +#ifndef _WINDOWS64 +#include +#include +#include +#include +#endif + +//#include "serviceglobal.h" +#include "servicemanage.h" + +#define NET_FAC_LOCAL_DOMAIN "local_domain" + +#ifdef _WINDOWS64 +#ifdef ODB_API_LIB_EXPORTS +#define ODB_API_LIB_API __declspec(dllexport) +#else +#define ODB_API_LIB_API __declspec(dllimport) +#endif +#else +#define ODB_API_LIB_API +#endif + +using namespace std; +//using namespace RTDB_SERVER; +//using namespace ODB; + +//============================================================================// +struct SERVICE_MESSAGE +{ + char service_name[80]; + char service_object[40]; + char service_port[40]; + int run_port; +}; + +struct NET_INFO +{ + RTDB_SERVER::CODB_NET* net_ptr; + + NET_INFO& operator= (const NET_INFO& other) + { + if( this == &other ) + { + return *this; + } + + net_ptr = other.net_ptr ; + + return *this; + } + +}; +//============================================================================// + + +namespace NET_ODB +{ +class ODB_API_LIB_API CNetFactory +{ +public: + CNetFactory(); + CNetFactory(const int app_no, const short context_no = 0); //obsolete + CNetFactory(const struct SCENARIO_PARA& scn_para); + //CNetFactory(const char* host_name); + ~CNetFactory(); + +public: + RTDB_SERVER::CODB_NET* GetInstance(); + //RTDB_SERVER::CODB_NET* GetInstance(const int app_no, const short context_no = 0, const bool is_managed=true);//obsolete + //RTDB_SERVER::CODB_NET* GetInstance(const char* host_name , const int app_no, const short context_no = 0);//obsolete + //RTDB_SERVER::CODB_NET* GetInstance(const char* domain_name, const tSecLabel& sec_label, const int app_no, const short context_no = 0, const bool is_managed=true);//obsolete + + RTDB_SERVER::CODB_NET* GetInstance(const char* domain_name, const tSecLabel& sec_label, const struct SCENARIO_PARA& scn_para); + RTDB_SERVER::CODB_NET* GetInstance(const char* host_name , const struct SCENARIO_PARA& scn_para); + RTDB_SERVER::CODB_NET* GetInstance(const struct SCENARIO_PARA& scn_para); + + +public: + int DefaultService(); + int SetServiceInfo(); + int SetServiceName(const char* server_name); + int SetServiceObject(const char* server_object); + int SetServiceName(const int server_port); + void SetDomainInfo(); + void SetScnPara(const struct SCENARIO_PARA& scn_para); + int SetManagedMode(const bool is_managed); + + void LocalRemoteChanged(); + +public: + //void GetServiceHandle(Handle& handle); + +private: + int start(); + int InitNet(); + int AddToMap(); + + int ReadHostFromfile(char* host_name); + int GetHostByAppNo(char* host_name, const int app_no, const short context_no );//obsolete + int GetSubScnHost(char* host_name, const struct SCENARIO_PARA& scn_para); + + int CheckHost(const int app_no, const short context_no); ////obsolete + + int CheckHost(const struct SCENARIO_PARA& scn_para); + int CheckHost(const char* host_name); + + int IsCreated(const int app_no, const short context_no); ///obsolete + + int IsCreated(const struct SCENARIO_PARA& scn_para); + int IsCreated(const std::string& host_name); + + void PrnMap(); + +private: + CNetFactory(const CNetFactory& table_net); + CNetFactory& operator=(const CNetFactory& table_net); + +private: + //std::map m_MAppHost; + std::map m_MAppHost; + std::map m_MHostNet; + std::map m_MScnNet; //lmj add + std::map m_MScnHostNet; //lmj add + + //CORBA::ORB_var m_Orb; + //CORBA::Object_var m_Obj; + RTDB_SERVER::CODB_NET* m_OdbNet; + + struct SERVICE_MESSAGE m_ServiceMsg; + + ServiceInfo m_Serviceinfo; + DomainInfo* m_pDomaininfo; + + short m_ContextNo;//obsolete + int m_AppNo;//obsolete + + struct SCENARIO_PARA m_scn_para; + + char m_HostName[MAX_NAME_STRING_LEN]; + char m_AppStr[20]; + char m_AppCtxHostStr[40]; + char m_IpAddress[64]; + + char m_DomainName[40]; + tSecLabel m_SecLabel; + char m_ServiceName[40]; + + bool m_IsSysAdmHost; + + //COrbMgr* m_OrbMgr; + //CServicesManage* m_ServicesManage; ////obsolete + TaskService* m_TaskService; + NS_SYSADMIN::CScnService* m_ServicesManage; + //Handle m_Handle; //for service_bus +}; + +} + +#endif diff --git a/code/sys_nicmonitor/include/db_api/odb_nooverflow_pk.h b/code/sys_nicmonitor/include/db_api/odb_nooverflow_pk.h new file mode 100644 index 0000000..5561aba --- /dev/null +++ b/code/sys_nicmonitor/include/db_api/odb_nooverflow_pk.h @@ -0,0 +1,66 @@ +/******************************************************************************* +ModuleName: Real Time Database management system +FileName: rtdb_api.cpp +DESCRIPTION: rtdb api interfaces implementation +FUNCTION LIST: +COMMENT: +History: +Date Version Modifier Activities +2009-01-10 1.1 add net interfaces +================================================================================ +2008-10-30 1.0 created +*******************************************************************************/ +#include "db_api/odb_baseindex.h" +#ifndef _CNOOVERFLOWPK +#define _CNOOVERFLOWPK + +namespace ODB +{ + +class CNoOverflowPK:public CBaseIndex +{ +public: + virtual int need_rebuilt(char *existed_table_ptr,struct STDB_TAB *stdb_tab_ptr,struct STDB_FIELD_TAB *stdb_field_tab_ptr,INDEX_DEFINE &index_define,int &shm_id); + virtual int CreateIndex(struct STDB_TAB *stdb_tab_ptr,struct STDB_FIELD_TAB *stdb_field_tab_ptr,INDEX_DEFINE &index_define,int &shm_id,int &shm_size); + virtual int Open(char *index_file_name,int table_id,int index_id); //table_idindex_idINDEX_STDB_TAB::table_idINDEX_STDB_TAB::field_idƥУ + virtual int Open(int index_shmid,int table_id,int index_id); //table_idindex_idINDEX_STDB_TAB::table_idINDEX_STDB_TAB::field_idƥУ + virtual int SetIndexPtr(char *index_ptr); //ѻָ븳ֵ࣬ͲʹǰOpen + virtual int GetKeyByIndex(char *index_ptr,std::vector &index_array); + virtual int GetKeyPointerByIndex(char *index_ptr, int& pointer);//ֻЧindexõ¼λ + virtual int IndexInsert(char *index_ptr,char *key_ptr); + virtual int BulkIndexInsert(char *bulk_index_key_ptr);//װʱ + virtual int Indexdelete(char *index_ptr,char *key_ptr); + virtual int IndexClear(); + virtual int GetIdxMthd(); + virtual int FreeResource();//Ʃunmapshmdtָ롣 + virtual int DebugDisp(int type);//ãͬtypeʾͬϸ̶ȲͬϢ + virtual int GetIndexRecNum();//¼ܵĸЧ¼ܺ͡HASHֻǷ0 + virtual DB_STATUS_T GetIndexStatus()//״̬ + { + return m_IndexStdbPtr->index_status; + } + virtual void SetIndexStatus(DB_STATUS_T idx_status)//ͷϵ״̬ + { + m_IndexStdbPtr->index_status = idx_status; + } + + //virtual int ModifyIndex(char *pk_ptr, int pos); + CNoOverflowPK(); + ~CNoOverflowPK();//FreeResource() + +public: + int GetMaxIndexPointer(); + int SetTableEnv(struct STDB_TAB *stdb_tab_ptr,char *table_data_area_ptr); + +private: + struct INDEX_STDB_TAB* m_IndexStdbPtr; + struct STDB_TAB *m_StdbTabPtr; //added for optimization of IndexDelete + char *m_TableDataAreaPtr; //added for optimization of IndexDelete + //struct INDEX_STDB_FIELD_TAB *m_IndexStdbFieldPtr; + int* m_PkIndexStgDirectPtr; + int (*hash_func_ptr)(char *index,int length,int hash_prime);//㷨ֻһ֣һʹ +}; + +} +#endif + diff --git a/code/sys_nicmonitor/include/db_api/odb_orbmgr.h b/code/sys_nicmonitor/include/db_api/odb_orbmgr.h new file mode 100644 index 0000000..52a97bb --- /dev/null +++ b/code/sys_nicmonitor/include/db_api/odb_orbmgr.h @@ -0,0 +1,50 @@ +//*********************************************************************************** +// +// ΪCORBAͻ˵õķװ +// version: no.3 +// time: 2003.03.16 +// +// +// Created by Wangx / Huanghf // 2003-01-01 +//*********************************************************************************** + +#include +#include + +#include + +#ifdef HAVE_STD_IOSTREAM +using namespace std; +#endif + +#ifndef __ODB_ORBMGR_H__ +#define __ODB_ORBMGR_H__ +namespace ODB +{ +class COrbMgr +{ +public: + COrbMgr(); + ~COrbMgr(); + + bool InitOrb(); + bool InitOrb(const char* n_orbname); + bool DelInitOrb(); + bool DelOrb(); + + bool SetOrbPara(const char* n_str_para_name, const char* n_str_para_value); + + CORBA::Object_var GetRemoteObj(CORBA::ORB_var n_orb, const char* n_reffilename); + CORBA::Object_var GetRemoteObj(CORBA::ORB_var n_orb, const char* n_server, const char* n_port, const char* n_objectname); + + CORBA::ORB_var GetOrb(); + bool GetOrb(CORBA::ORB_var & in_orb); + + //bool SetOrb(CORBA::ORB_var n_orb); + +private: + OB::Properties_var m_Props; + CORBA::ORB_var m_Orb; +}; +} +#endif diff --git a/code/sys_nicmonitor/include/db_api/odb_profile.h b/code/sys_nicmonitor/include/db_api/odb_profile.h new file mode 100644 index 0000000..58cc003 --- /dev/null +++ b/code/sys_nicmonitor/include/db_api/odb_profile.h @@ -0,0 +1,66 @@ +#ifndef __ODB_PROFILE_H__ +#define __ODB_PROFILE_H__ + +#include +#include +#include + +using namespace std; + +namespace NProfile +{ + +#define MAX_LINE_LENGTH 1000 + +class CProfile +{ +public: + typedef map KeyMapType; + typedef map SectionMapType; + typedef set StringSetType; + +private: + SectionMapType m_mapSection; + string m_strFileName; + + bool GetSection(string &strSource); + bool GetKeyAndValue(const string &strSource, string &strKey, string &strValue); + + bool Trim(string &strSource); + +public: + CProfile(); + ~CProfile(); + + CProfile(const char *pProfileName); + CProfile(const string &strProfileName); + + void SetFileName(const char *pProfileName); + void SetFileName(const string &strProfileName); + + int ReadFile(void); + + bool IsSectionExists(const string &strSection); + bool IsKeyExists(const string &strSection, const string &strKey); + + string GetString(const string &strSection, const string &strKey, + const string &strDefalut); + + int GetInt(const string &strSection, const string &strKey, int nDefault); + + void GetSections(StringSetType &setSections); + void GetSectionKeys(StringSetType &setKeys, const string &strSection); + void GetSectionValues(StringSetType &setValues, const string &strSection); + + int GetKeyByValue(string& strKey, const char* pValue); // + int GetKeyByValue(string& strKey, const string& strValue); // + + void PrintAllValue(void); + void TestFunctions(void); +}; + + CProfile * CProfileInstance(); + CProfile * CProfileInstance(char* _filename); + +} //End of namespace NProfile +#endif // __PROFILE_FILE_H__ diff --git a/code/sys_nicmonitor/include/db_api/odb_prv_struct.h b/code/sys_nicmonitor/include/db_api/odb_prv_struct.h new file mode 100644 index 0000000..4ae76ac --- /dev/null +++ b/code/sys_nicmonitor/include/db_api/odb_prv_struct.h @@ -0,0 +1,2342 @@ +/******************************************************************************* +ModuleName: ODB Real Time Database management system +FileName: odb_prv_struct.h +DESCRIPTION: data struct define +FUNCTION LIST: +COMMENT: +History: +Date Version Modifier Activities +2002-09-01 1.0 modify +================================================================================ +2002-09-01 1.0 created +*******************************************************************************/ + +#ifndef __ODB_PRV_STRUCT_H__ +#define __ODB_PRV_STRUCT_H__ + +#ifndef _WINDOWS64 +#include +#endif + +#ifndef _HPUX +#include +#else +#include +#endif + +#include +#include +#include +#include + +#ifndef __ODB_DEFINE_H__ +#include "odb_define.h" +#endif + +#include "common_types.h" +#include "odb_struct.h" +namespace ODB +{ +/* Lock struct */ +struct LOCK_STRU +{ + DB_OBJECT_T lock_object; + DB_LOCK_T lock_type; + int lock_num; + int lock_pid; + int sem_key; + int sem_no; + int back_no; + int reserved[2]; + struct LOCK_STRU& operator= (const struct LOCK_STRU& lock2) + { + if( this == &lock2) + { + return *this; + } + + lock_object = lock2.lock_object; + lock_type = lock2.lock_type; + lock_num = lock2.lock_num; + lock_pid = lock2.lock_pid; + sem_key = lock2.sem_key; + sem_no = lock2.sem_no; + back_no = lock2.back_no; + reserved[0] = reserved[0]; + reserved[1] = reserved[1]; + return *this; + }; +}; + + +//scenario allocator +struct SUB_SCENARIO_INFO +{ + unsigned int sub_scenario_id; + char sub_scenario[MAX_NAME_STRING_LEN]; + unsigned int sub_scenario_inst_table[MAX_SUB_SCENARIO_INST_PER_ALLOC]; +}; + +struct SCENARIO_INFO +{ + unsigned int scenario_id; + unsigned int scenario_instance_id; + char scenario[MAX_NAME_STRING_LEN]; + SUB_SCENARIO_INFO sub_scenario_table[MAX_SUB_SCENARIO_PER_ALLOC]; +}; + +struct ALL_SCN_INFO +{ + unsigned int scn_id; + char scn_name[MAX_NAME_STRING_LEN]; + unsigned int scn_inst_id; + unsigned int sub_scn_id; + char sub_scn_name[MAX_NAME_STRING_LEN]; + unsigned int sub_scn_inst_id; +}; +struct SYSTEM_INFO +{ + struct LOCK_STRU system_lock; + struct SCENARIO_INFO scenario_table[MAX_SCENARIO_INST_ALLOC]; +}; + +struct DB_APP_TAB +{ + char file_name[2048]; + long file_size; + char byte_tag; //must use type cast from DB_BYTE_T // 2004-07-07 + unsigned int sub_scenario_id; + char sub_scenario[MAX_NAME_STRING_LEN]; + unsigned int scenario_id; + char scenario[MAX_NAME_STRING_LEN]; + unsigned int scenario_inst_no; + unsigned int sub_scenario_inst_no; + + struct LOCK_STRU lock; + + unsigned short table_sum; //all table allowed to be created, from odb_app.sys; it is also used to solve the problem of down_load if add new table + unsigned short table_num; //table number in fact, may be increase/decrease when add/delete + short table_no[MAX_DB_NUMBER] ; //table relation between rtdbms & [rdbms] + short if_sliced; + time_t download_time; //means the create time of app.dat(such as scada.dat , if the machine has been rebooted, the time will be refreshed) + int reserved[256]; +}; + +struct DB_CTRL_TAB +{ + int table_no; //index no + int r_table_no;//real table_no + unsigned int sub_scenario_id; + char sub_scenario[MAX_NAME_STRING_LEN]; + unsigned int scenario_id; + char scenario[MAX_NAME_STRING_LEN]; + unsigned int scenario_inst_no; + unsigned int sub_scenario_inst_no; + DB_STATUS_T db_status; //access flag TABLE_NORMAL or not + + char table_name_eng[ENG_NAME_LEN]; + char table_name_chn[CHN_NAME_LEN]; + + unsigned char is_record_apped; + char slice_flag; + char passwd[MAX_PASSWD_LEN]; + time_t last_close_time; + int db_size; //table all len + int db_offset; //? + int db_describ_area_size; //des areaС(STDB_TAB+SEQUENT_TAB+STD_FILELD_TAB+) + int db_data_area_size; //data areaС + + char reserved[512]; + +}; + + + +/* Subkey describle */ +struct SUBKEY_STRU +{ + int subkey_type; + int subkey_len; + int offset; + int min_subkey; + int max_subkey; + int fieldvalue_sum; +}; + +/* Keyword describle table */ +struct KEYWORD_STRU +{ + int key_type; + int key_len; + int intkey_len; + int charkey_len; + int subkey_num; + //int hash_sum; //ӦòҪ + //int hash_prime; + //int hash_count; + struct SUBKEY_STRU subkey[MAX_SUBKEY_NUMBER]; +}; + +/* +struct LOCK_ID // +{ + int lock_id; //lock_numһ + int first_record_pointer; //for table's record + int last_record_pointer; +};*/ + +/* Database describe struct table */ +struct STDB_TAB +{ + char file_name[2048]; + char byte_tag; //must use type cast from DB_BYTE_T // 2004-07-07 + int record_size; //record size + int phy_record_size; //physical record size with head + int record_number; //record number in table if the table is compact or the record number in main table if the table is imcompatible . + int record_sum; //record allow to created all + int slice_record_sum; //for slice + short field_sum; //field sum + short field_no[MAX_TABLE_FIELD]; //field relation between rtdbms & [rdbms] +#ifdef _APP_SYS_SUBSTATION + short bit_field_sum; //bit field number + short vir_field_sum; //virtual field number + short v_field_no[MAX_TABLE_FIELD]; //virtual field relation between rtdbms & [rdbms] +#endif + struct KEYWORD_STRU key; + struct LOCK_STRU lock; + + int index_count; + int data_area_offset; + int data_area_size; + long file_size; + // + // int table_type; //for graph, etc + unsigned char is_auto_generated; +/******Added named fields begin *********/ + int named_fields_num; + short named_field_no[20];//It stores STDB_FIELD_TAB::field_no , not STDB_FIELD_TAB::r_field_no, and it is ordered by STDB_FIELD_TAB:: +/******Added named fields end***********/ + +/******Added for index begin ************/ + short index_num; // + char index_storage_type; //Ĵ洢ͣļӳڴ淽ʽ߹ڴ淽ʽ + int fields_used_in_index_num; //μӽһ򱻶ʹõĻfield_used_in_index_numҪϼΡҪFIELD_INDEX_DEFINE_TABĴСͺҪᵽFIELDS_IN_INDEXS_DESC_TABĴС + int indexed_fields_num; //жٸһ򱻶ʹãֻǼһΡ + int pk_storage_type; //洢Ʃ繲ڴļӳڴ + int pk_mem_alloc_type;//ڴ䷽ƩHASHķ䷽HASH䷽ + char primary_key_name[ENG_NAME_LEN]; //ļļӳڴá + int primary_key_id; //ڴIDڴʹá + int pk_index_method; //ɲ˵ƩֱӶλHASH + int pk_shm_size;//ĹڴĴС + int pk_index_length;//ijȣǽеģܻkey.key_length̡ + int pk_index_status;//״̬ + time_t download_time; //ÿװʱ䡣ⲿݻܽŵCOdbTableȥ.ΪȷļǷǻrebootģҪʱΪȽϡ + char version[10];//Ԥʵʱ±ͷ仯ҪversionϢ + char reserved[20]; //Ԥ +/******Added for index end**************/ + +/******Added for overflow table bein ***/ + int ext_record_number;//ڴնıԱʾļ¼ + int area_num; +/******Added for overflow table end ***/ + // unsigned char is_system_table; //Added 2003-09-01 + // unsigned char is_record_app; + // unsigned char is_record_lock; + // unsigned char is_record_resp; + + // int reserved_1; + // int reserved_2; + // int reserved_3; + // int reserved_4; + // int reserved_5; +}; + +/* Database fields describe table */ +struct STDB_FIELD_TAB +{ + short field_no; //rtdbms + short r_field_no; + short field_id; + short column_id; + short field_length; + short check_tag; // + int offset; //data offset from data pointer, after RECORD_HEAD_STRU of this record + + int column_special; + int ref_tableno; + short ref_fieldno; +#ifdef _APP_SYS_SUBSTATION + short is_bit_field; +#endif + unsigned char data_type; + unsigned char is_keyword; + unsigned char is_index; + unsigned char allow_null; + unsigned char sort_order_no; + + unsigned char display_type; + unsigned char reference_flag; + unsigned char reference_mode; + unsigned char reference_display; + + unsigned char is_app_syn; + unsigned char auto_meas_type; + + char field_name_eng[ENG_NAME_LEN]; + char field_name_chn[CHN_NAME_LEN]; + + char menu_name[MENU_NAME_LEN]; + char default_asciival[DEFAULT_VALUE_LEN]; + char min_asciival[DEFAULT_VALUE_LEN]; + char max_asciival[DEFAULT_VALUE_LEN]; +/******Added for index begin ************/ + int in_field_index_pos; //ʾǰFIELD_INDEX_DEFINE_TABУֵĵһλá + int in_index_num; // ʾʹ˸Ҳ˵FIELD_INDEX_DEFINE_TABУ˶ٴΡ +/******Added for index end *************/ + + int search_attribute; // //Added 2003-09-01 + int statics_attribute; // ͳƵ + int reserved_1; // ϵͳ + int reserved_2; // ϵͳ + int reserved_3; // ϵͳ + int reserved_4; // ϵͳ + int reserved_5; // ϵͳ +}; +#ifdef _APP_SYS_SUBSTATION +struct STDB_VIR_FIELD_TAB +{ + short v_field_no; //rtdbms ڲ + short vr_field_no; // + short r_field_no; //bit field no Ӧʵ + short bit_no; // 1 - 32 λ + char vir_field_name_eng[ENG_NAME_LEN]; + char vir_field_name_chn[CHN_NAME_LEN]; +}; +#endif +/* sequent area ctrl tab */ // +struct SEQUENT_TAB +{ + int seq_field_no; //ָÿֶκ + int seq_field_data_type; + int seq_field_offset; + int seq_area_offset; + int seq_area_size; +}; + +/*----------------------------------------------------------------------------*/ + + + +/* record head struct */ +struct RECORD_HEAD_STRU +{ + unsigned char exist_tag; + unsigned char select_tag; + short next_record_pointer; +}; +/* ----------------------------------------------------------------------- */ + + + +/* ---------------------------------------------------------------------------*/ + +struct DATA_FILE_HEAD +{ + int db_size; + int record_number; + int record_total_number; + int record_valid_sum; + int record_sum; + int hash_sum; + int hash_prime; + int data_phy_record_sum; + int data_phy_record_num; + int data_area_size; +}; + + +/* ---------------------------------------------------------------------------*/ +/* ---------------------------------------------------------------------------*/ +struct MEMBER_DEFINITION +{ + int data_index; //maybe only used bu sql +#ifdef _APP_SYS_SUBSTATION + int data_field_no; //r_field_no or vr_field_no, for MoveTo +#endif + int data_type; + int data_size; + //int data_space; + int data_offset; +}; + + + +/* ---------------------------------------------------------------------------*/ +// 2002-10-18, for read sys file +struct NAME_ID +{ + char name[CHN_NAME_LEN]; // 2003-09-15 //may affect others + int no; +}; + +struct APP_ID +{ + char app_name[MAX_NAME_STRING_LEN]; + std::vector vec_name_no; +}; + +/* ---------------------------------------------------------------------------*/ +typedef std::map MAPTABLE_T; +typedef std::map::value_type VALTABLE_T; +typedef std::map MAPAPP_T; +typedef std::map::value_type VALAPP_T; + + +/* ---------------------------------------------------------------------------*/ +// 2002-10-31, for sql query +/*struct SQL_EXPRESS +{ + struct NAME_ID field; + DATA_TYPES_T field_type; + char* field_value; + + CONDITION_OPERATOR_T cond_op; + + union + { + double cond_value; //ֵ + string cond_str; // + }; + + bool value; //ʽֵ +}; + + +struct SQL_NODE +{ + LOGICAL_OPERATOR_T log_op; //߼ + bool value; //߼ʽֵ + int express_id; //ӦҶӵ± + struct NODE* left; + struct NODE* right; +}; +*/ + +/* ---------------------------------------------------------------------------*/ +/*---sqlѯؽ ---*/ +struct SQL_RESPONSE +{ + int ret_code; /* ص״̬ (0: ɹ; :ʧԭ) */ + + int field_num; /* ص */ + struct FIELD_INFO* fldinfo; + + int record_num; /* صļ¼ */ + int record_length; + int* record_no; /* صļ¼± */ + char* val_buf; /* صֵ */ +}; + + +struct FIELD_INFO +{ + char field_name[ENG_NAME_LEN]; + int field_length; + unsigned char data_type; +}; + +struct SQL_SORT +{ + struct NAME_ID field; + bool is_asc; +}; + + +/* ---------------------------------------------------------------------------*/ +//app_no-->r_table_no-->table_name_eng----table_no ʵʱ +//typedef std::map MAP_NO2NAMEID; +//typedef std::map MAP_APP2NO; //app_no to r_table_no + + +/*----------------------------------------------------------------------------*/ + + +struct KEY_TYPE +{ + enum { MAX = 12 }; //ȱʡfield + + union SORT_DATA_TYPE fld_key[MAX]; //fieldֵ + + short fld_type[MAX]; //field + int key_num; //ʵfield + + bool operator>= (const KEY_TYPE& K) const + { + int iSize = key_num; + for(int i = 0; i < iSize; ++i) + { + switch(fld_type[i]) + { + case C_INT_TYPE: + { + if(fld_key[i].to_int == K.fld_key[i].to_int) + { + continue; + } + else + { + return (fld_key[i].to_int > K.fld_key[i].to_int); + } + } + case C_UCHAR_TYPE: + { + if (fld_key[i].to_uchar == K.fld_key[i].to_uchar) + { + continue; + } + else + { + return (fld_key[i].to_uchar > K.fld_key[i].to_uchar); + } + } + case C_STRING_TYPE: + { + int result = strcmp(fld_key[i].to_str, K.fld_key[i].to_str); + if(result == 0) + { + continue; + } + else if(result > 0) + { + return true; + } + else + { + return false; + } + } + case C_FLOAT_TYPE: + { + if(fld_key[i].to_float == K.fld_key[i].to_float) + { + continue; + } + else + { + return (fld_key[i].to_float > K.fld_key[i].to_float); + } + } + case C_DOUBLE_TYPE: + { + if(fld_key[i].to_double == K.fld_key[i].to_double) + { + continue; + } + else + { + return (fld_key[i].to_double > K.fld_key[i].to_double); + } + } +/* + case C_KEYID_TYPE: + { + short table_no,table_no_K; + short field_id,field_id_K; + int key,key_K; + +#if !defined(_BIGENDIAN) + + memcpy ((void *)&table_no, + (char *)&fld_key[i].to_key + sizeof (int) + sizeof (short), sizeof (short)); + memcpy ((void *)&table_no_K, + (char *)&K.fld_key[i].to_key + sizeof (int) + sizeof (short), sizeof (short)); +#else + + memcpy((void *)&table_no,(char *)&fld_key[i].to_key,sizeof(short)); + memcpy((void *)&table_no_K,(char *)&K.fld_key[i].to_key,sizeof(short)); +#endif + + if(table_no > table_no_K) + { + return true; + } + + if(table_no < table_no_K) + { + return false; + } + +#if !defined(_BIGENDIAN) + + memcpy((void *)&key,(char *)&fld_key[i].to_key,sizeof(int)); + memcpy((void *)&key_K,(char *)&K.fld_key[i].to_key,sizeof(int)); +#else + + memcpy ((void *)&key, (char *)&fld_key[i].to_key + sizeof (short) + sizeof ( + short), sizeof (int)); + memcpy ((void *)&key_K, (char *)&K.fld_key[i].to_key + sizeof (short) + sizeof ( + short), sizeof (int)); +#endif + + if(key > key_K) + { + return true; + } + if(key< key_K ) + { + return false; + } + +#if !defined(_BIGENDIAN) + + memcpy ((void *)&field_id, (char *)&fld_key[i].to_key + sizeof (int), + sizeof (short)); + memcpy ((void *)&field_id_K, (char *)&K.fld_key[i].to_key + sizeof (int), + sizeof (short)); +#else + + memcpy ((void *)&field_id, (char *)&fld_key[i].to_key + sizeof (short), + sizeof (short)); + memcpy ((void *)&field_id_K, (char *)&K.fld_key[i].to_key + sizeof (short), + sizeof (short)); +#endif + + if(field_id > field_id_K) + { + return true; + } + if(field_id < field_id_K) + { + return false; + } + + continue; + + } +*/ + case C_APPKEY_TYPE: + { + if(fld_key[i].to_appkey.app_id> K.fld_key[i].to_appkey.app_id) + { + return true; + } + if(fld_key[i].to_appkey.app_id< K.fld_key[i].to_appkey.app_id) + { + return false; + } + + short table_no,table_no_K; + short field_id,field_id_K; + int key,key_K; + +#if !defined(_BIGENDIAN) + + memcpy ((void *)&table_no, + (char *)&fld_key[i].to_appkey.key_id + sizeof (int) + sizeof (short), + sizeof (short)); + memcpy ((void *)&table_no_K, + (char *)&K.fld_key[i].to_appkey.key_id + sizeof (int) + sizeof (short), + sizeof (short)); +#else + + memcpy ((void *)&table_no, (char *)&fld_key[i].to_appkey.key_id, + sizeof (short)); + memcpy ((void *)&table_no_K, (char *)&K.fld_key[i].to_appkey.key_id, + sizeof (short)); +#endif + + if(table_no > table_no_K) + { + return true; + } + + if(table_no < table_no_K) + { + return false; + } + +#if !defined(_BIGENDIAN) + + memcpy((void *)&key,(char *)&fld_key[i].to_appkey.key_id,sizeof(int)); + memcpy((void *)&key_K,(char *)&K.fld_key[i].to_appkey.key_id,sizeof(int)); +#else + + memcpy ((void *)&key, (char *)&fld_key[i].to_appkey.key_id + sizeof ( + short) + sizeof (short), sizeof (int)); + memcpy ((void *)&key_K, (char *)&K.fld_key[i].to_appkey.key_id + sizeof ( + short) + sizeof (short), sizeof (int)); +#endif + + if(key > key_K) + { + return true; + } + if(key< key_K ) + { + return false; + } + +#if !defined(_BIGENDIAN) + + memcpy ((void *)&field_id, (char *)&fld_key[i].to_appkey.key_id + sizeof (int), + sizeof (short)); + memcpy ((void *)&field_id_K, + (char *)&K.fld_key[i].to_appkey.key_id + sizeof (int), sizeof (short)); +#else + + memcpy ((void *)&field_id, + (char *)&fld_key[i].to_appkey.key_id + sizeof (short), sizeof (short)); + memcpy ((void *)&field_id_K, + (char *)&K.fld_key[i].to_appkey.key_id + sizeof (short), sizeof (short)); +#endif + + if(field_id > field_id_K) + { + return true; + } + if(field_id < field_id_K) + { + return false; + } + + continue; + } + case C_APPID_TYPE: + { + if(fld_key[i].to_appkey.app_id> K.fld_key[i].to_appid.app_id) + { + return true; + } + if(fld_key[i].to_appkey.app_id< K.fld_key[i].to_appid.app_id) + { + return false; + } + + short table_no,table_no_K; + int key,key_K; + +#if !defined(_BIGENDIAN) + + memcpy ((void *)&table_no, + (char *)&fld_key[i].to_appid.key_id + sizeof (int) + sizeof (short), + sizeof (short)); + memcpy ((void *)&table_no_K, + (char *)&K.fld_key[i].to_appid.key_id + sizeof (int) + sizeof (short), + sizeof (short)); +#else + + memcpy((void *)&table_no,(char *)&fld_key[i].to_appid.key_id,sizeof(short)); + memcpy ((void *)&table_no_K, (char *)&K.fld_key[i].to_appid.key_id, + sizeof (short)); +#endif + + if(table_no > table_no_K) + { + return true; + } + if(table_no < table_no_K) + { + return false; + } + +#if !defined(_BIGENDIAN) + + memcpy((void *)&key,(char *)&fld_key[i].to_appid.key_id,sizeof(int)); + memcpy((void *)&key_K,(char *)&K.fld_key[i].to_appid.key_id,sizeof(int)); +#else + + memcpy ((void *)&key, (char *)&fld_key[i].to_appid.key_id + sizeof ( + short) + sizeof (short), sizeof (int)); + memcpy ((void *)&key_K, (char *)&K.fld_key[i].to_appid.key_id + sizeof ( + short) + sizeof (short), sizeof (int)); +#endif + + if(key > key_K) + { + return true; + } + if(key< key_K ) + { + return false; + } + + continue; + } + case C_MEASRTDBKEY_TYPE: + case C_RTDBKEY_TYPE: + { + if(fld_key[i].to_rtdbkey == K.fld_key[i].to_rtdbkey) + { + continue; + } + else + { + return fld_key[i].to_rtdbkey > K.fld_key[i].to_rtdbkey; + } + } + case C_LONG_TYPE: + short table_no,table_no_K; + int key,key_K; + +#if !defined(_BIGENDIAN) + + memcpy ((void *)&table_no, + (char *)&fld_key[i].to_long + sizeof (int) + sizeof (short), sizeof (short)); + memcpy ((void *)&table_no_K, + (char *)&K.fld_key[i].to_long + sizeof (int) + sizeof (short), sizeof (short)); +#else + + memcpy((void *)&table_no,(char *)&fld_key[i].to_long,sizeof(short)); + memcpy((void *)&table_no_K,(char *)&K.fld_key[i].to_long,sizeof(short)); +#endif + + if(table_no > table_no_K) + { + return true; + } + if(table_no < table_no_K) + { + return false; + } + +#if !defined(_BIGENDIAN) + + memcpy((void *)&key,(char *)&fld_key[i].to_long,sizeof(int)); + memcpy((void *)&key_K,(char *)&K.fld_key[i].to_long,sizeof(int)); +#else + + memcpy ((void *)&key, (char *)&fld_key[i].to_long + sizeof (short) + sizeof ( + short), sizeof (int)); + memcpy ((void *)&key_K, (char *)&K.fld_key[i].to_long + sizeof ( + short) + sizeof (short), sizeof (int)); +#endif + + if(key > key_K) + { + return true; + } + if(key< key_K ) + { + return false; + } + + continue; + + break; + default: + break; + }//end switch + } // end for i + + return true; + } + + bool operator<= (const KEY_TYPE& K) const + { + int iSize = key_num; + for(int i = 0; i < iSize; ++i) + { + switch(fld_type[i]) + { + case C_INT_TYPE: + { + if(fld_key[i].to_int == K.fld_key[i].to_int) + { + continue; + } + else + { + return (fld_key[i].to_int < K.fld_key[i].to_int); + } + } + case C_UCHAR_TYPE: + { + if (fld_key[i].to_uchar == K.fld_key[i].to_uchar) + { + continue; + } + else + { + return (fld_key[i].to_uchar < K.fld_key[i].to_uchar); + } + } + case C_STRING_TYPE: + { + int result = strcmp(fld_key[i].to_str, K.fld_key[i].to_str); + if(result == 0) + { + continue; + } + else if(result < 0) + { + return true; + } + else + { + return false; + } + } + case C_FLOAT_TYPE: + { + if(fld_key[i].to_float == K.fld_key[i].to_float) + { + continue; + } + else + { + return (fld_key[i].to_float < K.fld_key[i].to_float); + } + } + case C_DOUBLE_TYPE: + { + if(fld_key[i].to_double == K.fld_key[i].to_double) + { + continue; + } + else + { + return (fld_key[i].to_double < K.fld_key[i].to_double); + } + } +/* + case C_KEYID_TYPE: + { + short table_no,table_no_K; + short field_id,field_id_K; + int key,key_K; + +#if !defined(_BIGENDIAN) + + memcpy ((void *)&table_no, + (char *)&fld_key[i].to_key + sizeof (int) + sizeof (short), sizeof (short)); + memcpy ((void *)&table_no_K, + (char *)&K.fld_key[i].to_key + sizeof (int) + sizeof (short), sizeof (short)); +#else + + memcpy((void *)&table_no,(char *)&fld_key[i].to_key,sizeof(short)); + memcpy((void *)&table_no_K,(char *)&K.fld_key[i].to_key,sizeof(short)); +#endif + + if(table_no > table_no_K) + { + return false; + } + + if(table_no < table_no_K) + { + return true; + } + +#if !defined(_BIGENDIAN) + + memcpy((void *)&key,(char *)&fld_key[i].to_key,sizeof(int)); + memcpy((void *)&key_K,(char *)&K.fld_key[i].to_key,sizeof(int)); +#else + + memcpy ((void *)&key, (char *)&fld_key[i].to_key + sizeof (short) + sizeof ( + short), sizeof (int)); + memcpy ((void *)&key_K, (char *)&K.fld_key[i].to_key + sizeof (short) + sizeof ( + short), sizeof (int)); +#endif + + if(key > key_K) + { + return false; + } + if(key< key_K ) + { + return true; + } + +#if !defined(_BIGENDIAN) + + memcpy ((void *)&field_id, (char *)&fld_key[i].to_key + sizeof (int), + sizeof (short)); + memcpy ((void *)&field_id_K, (char *)&K.fld_key[i].to_key + sizeof (int), + sizeof (short)); +#else + + memcpy ((void *)&field_id, (char *)&fld_key[i].to_key + sizeof (short), + sizeof (short)); + memcpy ((void *)&field_id_K, (char *)&K.fld_key[i].to_key + sizeof (short), + sizeof (short)); +#endif + + if(field_id > field_id_K) + { + return false; + } + if(field_id < field_id_K) + { + return true; + } + + continue; + } +*/ + case C_APPKEY_TYPE: + { + if(fld_key[i].to_appkey.app_id> K.fld_key[i].to_appkey.app_id) + { + return false; + } + if(fld_key[i].to_appkey.app_id< K.fld_key[i].to_appkey.app_id) + { + return true; + } + + short table_no,table_no_K; + short field_id,field_id_K; + int key,key_K; + +#if !defined(_BIGENDIAN) + + memcpy ((void *)&table_no, + (char *)&fld_key[i].to_appkey.key_id + sizeof (int) + sizeof (short), + sizeof (short)); + memcpy ((void *)&table_no_K, + (char *)&K.fld_key[i].to_appkey.key_id + sizeof (int) + sizeof (short), + sizeof (short)); +#else + + memcpy ((void *)&table_no, (char *)&fld_key[i].to_appkey.key_id, + sizeof (short)); + memcpy ((void *)&table_no_K, (char *)&K.fld_key[i].to_appkey.key_id, + sizeof (short)); +#endif + + if(table_no > table_no_K) + { + return false; + } + + if(table_no < table_no_K) + { + return true; + } + +#if !defined(_BIGENDIAN) + + memcpy((void *)&key,(char *)&fld_key[i].to_appkey.key_id,sizeof(int)); + memcpy((void *)&key_K,(char *)&K.fld_key[i].to_appkey.key_id,sizeof(int)); +#else + + memcpy ((void *)&key, (char *)&fld_key[i].to_appkey.key_id + sizeof ( + short) + sizeof (short), sizeof (int)); + memcpy ((void *)&key_K, (char *)&K.fld_key[i].to_appkey.key_id + sizeof ( + short) + sizeof (short), sizeof (int)); +#endif + + if(key > key_K) + { + return false; + } + if(key< key_K ) + { + return true; + } + +#if !defined(_BIGENDIAN) + + memcpy ((void *)&field_id, (char *)&fld_key[i].to_appkey.key_id + sizeof (int), + sizeof (short)); + memcpy ((void *)&field_id_K, + (char *)&K.fld_key[i].to_appkey.key_id + sizeof (int), sizeof (short)); +#else + + memcpy ((void *)&field_id, + (char *)&fld_key[i].to_appkey.key_id + sizeof (short), sizeof (short)); + memcpy ((void *)&field_id_K, + (char *)&K.fld_key[i].to_appkey.key_id + sizeof (short), sizeof (short)); +#endif + + if(field_id > field_id_K) + { + return false; + } + if(field_id < field_id_K) + { + return true; + } + + continue; + } + case C_APPID_TYPE: + { + if(fld_key[i].to_appkey.app_id> K.fld_key[i].to_appid.app_id) + { + return false; + } + if(fld_key[i].to_appkey.app_id< K.fld_key[i].to_appid.app_id) + { + return true; + } + + short table_no,table_no_K; + int key,key_K; + +#if !defined(_BIGENDIAN) + + memcpy ((void *)&table_no, + (char *)&fld_key[i].to_appid.key_id + sizeof (int) + sizeof (short), + sizeof (short)); + memcpy ((void *)&table_no_K, + (char *)&K.fld_key[i].to_appid.key_id + sizeof (int) + sizeof (short), + sizeof (short)); +#else + + memcpy((void *)&table_no,(char *)&fld_key[i].to_appid.key_id,sizeof(short)); + memcpy ((void *)&table_no_K, (char *)&K.fld_key[i].to_appid.key_id, + sizeof (short)); +#endif + + if(table_no > table_no_K) + { + return false; + } + if(table_no < table_no_K) + { + return true; + } + +#if !defined(_BIGENDIAN) + + memcpy((void *)&key,(char *)&fld_key[i].to_appid.key_id,sizeof(int)); + memcpy((void *)&key_K,(char *)&K.fld_key[i].to_appid.key_id,sizeof(int)); +#else + + memcpy ((void *)&key, (char *)&fld_key[i].to_appid.key_id + sizeof ( + short) + sizeof (short), sizeof (int)); + memcpy ((void *)&key_K, (char *)&K.fld_key[i].to_appid.key_id + sizeof ( + short) + sizeof (short), sizeof (int)); +#endif + + if(key > key_K) + { + return false; + } + if(key< key_K ) + { + return true; + } + + continue; + } + case C_LONG_TYPE: + { + short table_no,table_no_K; + int key,key_K; + +#if !defined(_BIGENDIAN) + + memcpy ((void *)&table_no, + (char *)&fld_key[i].to_long + sizeof (int) + sizeof (short), sizeof (short)); + memcpy ((void *)&table_no_K, + (char *)&K.fld_key[i].to_long + sizeof (int) + sizeof (short), sizeof (short)); +#else + + memcpy((void *)&table_no,(char *)&fld_key[i].to_long,sizeof(short)); + memcpy((void *)&table_no_K,(char *)&K.fld_key[i].to_long,sizeof(short)); +#endif + + if(table_no > table_no_K) + { + return false; + } + if(table_no < table_no_K) + { + return true; + } + +#if !defined(_BIGENDIAN) + + memcpy((void *)&key,(char *)&fld_key[i].to_long,sizeof(int)); + memcpy((void *)&key_K,(char *)&K.fld_key[i].to_long,sizeof(int)); +#else + + memcpy ((void *)&key, (char *)&fld_key[i].to_long + sizeof (short) + sizeof ( + short), sizeof (int)); + memcpy ((void *)&key_K, (char *)&K.fld_key[i].to_long + sizeof ( + short) + sizeof (short), sizeof (int)); +#endif + + if(key > key_K) + { + return false; + } + if(key< key_K ) + { + return true; + } + + continue; + + break; + } + case C_MEASRTDBKEY_TYPE: + case C_RTDBKEY_TYPE: + { + if(fld_key[i].to_rtdbkey == K.fld_key[i].to_rtdbkey) + { + continue; + } + else + { + return fld_key[i].to_rtdbkey < K.fld_key[i].to_rtdbkey; + } + } + default: + break; + }//end switch + } // end for i + + return true; + } + + bool operator > (const KEY_TYPE& K) const + { + + int iSize = key_num; + + for(int i = 0; i < iSize; ++i) + { + switch(fld_type[i]) + { + case C_INT_TYPE: + { + + if(fld_key[i].to_int == K.fld_key[i].to_int) + { + continue; + } + else + { + return (fld_key[i].to_int > K.fld_key[i].to_int); + } + + } + case C_UCHAR_TYPE: + { + if (fld_key[i].to_uchar == K.fld_key[i].to_uchar) + { + continue; + } + else + { + return (fld_key[i].to_uchar > K.fld_key[i].to_uchar); + } + } + case C_STRING_TYPE: + { + int result = strcmp(fld_key[i].to_str, K.fld_key[i].to_str); + + if(result == 0) + { + continue; + } + else if(result > 0) + { + return true; + } + else + { + return false; + } + } + case C_FLOAT_TYPE: + { + if(fld_key[i].to_float == K.fld_key[i].to_float) + { + continue; + } + else + { + return (fld_key[i].to_float > K.fld_key[i].to_float); + } + + } + case C_DOUBLE_TYPE: + { + if(fld_key[i].to_double == K.fld_key[i].to_double) + { + continue; + } + else + { + return (fld_key[i].to_double > K.fld_key[i].to_double); + } + } +/* + case C_KEYID_TYPE: + { + short table_no,table_no_K; + short field_id,field_id_K; + int key,key_K; + +#if !defined(_BIGENDIAN) + + memcpy ((void *)&table_no, + (char *)&fld_key[i].to_key + sizeof (int) + sizeof (short), sizeof (short)); + memcpy ((void *)&table_no_K, + (char *)&K.fld_key[i].to_key + sizeof (int) + sizeof (short), sizeof (short)); +#else + + memcpy((void *)&table_no,(char *)&fld_key[i].to_key,sizeof(short)); + memcpy((void *)&table_no_K,(char *)&K.fld_key[i].to_key,sizeof(short)); +#endif + + if(table_no > table_no_K) + { + return true; + } + + if(table_no < table_no_K) + { + return false; + } + +#if !defined(_BIGENDIAN) + + memcpy((void *)&key,(char *)&fld_key[i].to_key,sizeof(int)); + memcpy((void *)&key_K,(char *)&K.fld_key[i].to_key,sizeof(int)); +#else + + memcpy ((void *)&key, (char *)&fld_key[i].to_key + sizeof (short) + sizeof ( + short), sizeof (int)); + memcpy ((void *)&key_K, (char *)&K.fld_key[i].to_key + sizeof (short) + sizeof ( + short), sizeof (int)); +#endif + + if(key > key_K) + { + return true; + } + if(key< key_K ) + { + return false; + } + +#if !defined(_BIGENDIAN) + + memcpy ((void *)&field_id, (char *)&fld_key[i].to_key + sizeof (int), + sizeof (short)); + memcpy ((void *)&field_id_K, (char *)&K.fld_key[i].to_key + sizeof (int), + sizeof (short)); +#else + + memcpy ((void *)&field_id, (char *)&fld_key[i].to_key + sizeof (short), + sizeof (short)); + memcpy ((void *)&field_id_K, (char *)&K.fld_key[i].to_key + sizeof (short), + sizeof (short)); +#endif + + if(field_id > field_id_K) + { + return true; + } + if(field_id < field_id_K) + { + return false; + } + + continue; + } +*/ + case C_APPKEY_TYPE: + { + if(fld_key[i].to_appkey.app_id> K.fld_key[i].to_appkey.app_id) + { + return true; + } + if(fld_key[i].to_appkey.app_id< K.fld_key[i].to_appkey.app_id) + { + return false; + } + + short table_no,table_no_K; + short field_id,field_id_K; + int key,key_K; + +#if !defined(_BIGENDIAN) + + memcpy ((void *)&table_no, + (char *)&fld_key[i].to_appkey.key_id + sizeof (int) + sizeof (short), + sizeof (short)); + memcpy ((void *)&table_no_K, + (char *)&K.fld_key[i].to_appkey.key_id + sizeof (int) + sizeof (short), + sizeof (short)); +#else + + memcpy ((void *)&table_no, (char *)&fld_key[i].to_appkey.key_id, + sizeof (short)); + memcpy ((void *)&table_no_K, (char *)&K.fld_key[i].to_appkey.key_id, + sizeof (short)); +#endif + + if(table_no > table_no_K) + { + return true; + } + + if(table_no < table_no_K) + { + return false; + } + +#if !defined(_BIGENDIAN) + + memcpy((void *)&key,(char *)&fld_key[i].to_appkey.key_id,sizeof(int)); + memcpy((void *)&key_K,(char *)&K.fld_key[i].to_appkey.key_id,sizeof(int)); +#else + + memcpy ((void *)&key, (char *)&fld_key[i].to_appkey.key_id + sizeof ( + short) + sizeof (short), sizeof (int)); + memcpy ((void *)&key_K, (char *)&K.fld_key[i].to_appkey.key_id + sizeof ( + short) + sizeof (short), sizeof (int)); +#endif + + if(key > key_K) + { + return true; + } + if(key< key_K ) + { + return false; + } + +#if !defined(_BIGENDIAN) + + memcpy ((void *)&field_id, (char *)&fld_key[i].to_appkey.key_id + sizeof (int), + sizeof (short)); + memcpy ((void *)&field_id_K, + (char *)&K.fld_key[i].to_appkey.key_id + sizeof (int), sizeof (short)); +#else + + memcpy ((void *)&field_id, + (char *)&fld_key[i].to_appkey.key_id + sizeof (short), sizeof (short)); + memcpy ((void *)&field_id_K, + (char *)&K.fld_key[i].to_appkey.key_id + sizeof (short), sizeof (short)); +#endif + + if(field_id > field_id_K) + { + return true; + } + if(field_id < field_id_K) + { + return false; + } + + continue; + } + case C_APPID_TYPE: + { + if(fld_key[i].to_appkey.app_id> K.fld_key[i].to_appid.app_id) + { + return true; + } + if(fld_key[i].to_appkey.app_id< K.fld_key[i].to_appid.app_id) + { + return false; + } + + short table_no,table_no_K; + int key,key_K; + +#if !defined(_BIGENDIAN) + + memcpy ((void *)&table_no, + (char *)&fld_key[i].to_appid.key_id + sizeof (int) + sizeof (short), + sizeof (short)); + memcpy ((void *)&table_no_K, + (char *)&K.fld_key[i].to_appid.key_id + sizeof (int) + sizeof (short), + sizeof (short)); +#else + + memcpy((void *)&table_no,(char *)&fld_key[i].to_appid.key_id,sizeof(short)); + memcpy ((void *)&table_no_K, (char *)&K.fld_key[i].to_appid.key_id, + sizeof (short)); +#endif + + if(table_no > table_no_K) + { + return true; + } + if(table_no < table_no_K) + { + return false; + } + +#if !defined(_BIGENDIAN) + + memcpy((void *)&key,(char *)&fld_key[i].to_appid.key_id,sizeof(int)); + memcpy((void *)&key_K,(char *)&K.fld_key[i].to_appid.key_id,sizeof(int)); +#else + + memcpy ((void *)&key, (char *)&fld_key[i].to_appid.key_id + sizeof ( + short) + sizeof (short), sizeof (int)); + memcpy ((void *)&key_K, (char *)&K.fld_key[i].to_appid.key_id + sizeof ( + short) + sizeof (short), sizeof (int)); +#endif + + if(key > key_K) + { + return true; + } + if(key< key_K ) + { + return false; + } + + continue; + } + case C_MEASRTDBKEY_TYPE: + case C_RTDBKEY_TYPE: + { + if(fld_key[i].to_rtdbkey == K.fld_key[i].to_rtdbkey) + { + continue; + } + else + { + return fld_key[i].to_rtdbkey > K.fld_key[i].to_rtdbkey; + } + } + case C_LONG_TYPE: + short table_no,table_no_K; + int key,key_K; + +#if !defined(_BIGENDIAN) + + memcpy ((void *)&table_no, + (char *)&fld_key[i].to_long + sizeof (int) + sizeof (short), sizeof (short)); + memcpy ((void *)&table_no_K, + (char *)&K.fld_key[i].to_long + sizeof (int) + sizeof (short), sizeof (short)); +#else + + memcpy((void *)&table_no,(char *)&fld_key[i].to_long,sizeof(short)); + memcpy((void *)&table_no_K,(char *)&K.fld_key[i].to_long,sizeof(short)); +#endif + + if(table_no > table_no_K) + { + return true; + } + if(table_no < table_no_K) + { + return false; + } + +#if !defined(_BIGENDIAN) + + memcpy((void *)&key,(char *)&fld_key[i].to_long,sizeof(int)); + memcpy((void *)&key_K,(char *)&K.fld_key[i].to_long,sizeof(int)); +#else + + memcpy ((void *)&key, (char *)&fld_key[i].to_long + sizeof (short) + sizeof ( + short), sizeof (int)); + memcpy ((void *)&key_K, (char *)&K.fld_key[i].to_long + sizeof ( + short) + sizeof (short), sizeof (int)); +#endif + + if(key > key_K) + { + return true; + } + if(key< key_K ) + { + return false; + } + + continue; + + break; + + default: + break; + }//end switch + } // end for i + + return true; + } + + bool operator< (const KEY_TYPE& K) const + { + //static int sta_num = 0; + + int iSize = key_num; + + for(int i = 0; i < iSize; ++i) + { + switch(fld_type[i]) + { + case C_INT_TYPE: + { + + if(fld_key[i].to_int == K.fld_key[i].to_int) + { + continue; + } + else + { + return (fld_key[i].to_int < K.fld_key[i].to_int); + } + + } + case C_UCHAR_TYPE: + { + if (fld_key[i].to_uchar == K.fld_key[i].to_uchar) + { + continue; + } + else + { + return (fld_key[i].to_uchar < K.fld_key[i].to_uchar); + } + } + case C_STRING_TYPE: + { + int result = strcmp(fld_key[i].to_str, K.fld_key[i].to_str); + + if(result == 0) + { + continue; + } + else if(result < 0) + { + return true; + } + else + { + return false; + } + } + case C_FLOAT_TYPE: + { + if(fld_key[i].to_float == K.fld_key[i].to_float) + { + continue; + } + else + { + return (fld_key[i].to_float < K.fld_key[i].to_float); + } + + } + case C_DOUBLE_TYPE: + { + if(fld_key[i].to_double == K.fld_key[i].to_double) + { + continue; + } + else + { + return (fld_key[i].to_double < K.fld_key[i].to_double); + } + } +/* + case C_KEYID_TYPE: + { + short table_no,table_no_K; + short field_id,field_id_K; + int key,key_K; + +#if !defined(_BIGENDIAN) + + memcpy ((void *)&table_no, + (char *)&fld_key[i].to_key + sizeof (int) + sizeof (short), sizeof (short)); + memcpy ((void *)&table_no_K, + (char *)&K.fld_key[i].to_key + sizeof (int) + sizeof (short), sizeof (short)); +#else + + memcpy((void *)&table_no,(char *)&fld_key[i].to_key,sizeof(short)); + memcpy((void *)&table_no_K,(char *)&K.fld_key[i].to_key,sizeof(short)); +#endif + + if(table_no > table_no_K) + { + return false; + } + + if(table_no < table_no_K) + { + return true; + } + +#if !defined(_BIGENDIAN) + + memcpy((void *)&key,(char *)&fld_key[i].to_key,sizeof(int)); + memcpy((void *)&key_K,(char *)&K.fld_key[i].to_key,sizeof(int)); +#else + + memcpy ((void *)&key, (char *)&fld_key[i].to_key + sizeof (short) + sizeof ( + short), sizeof (int)); + memcpy ((void *)&key_K, (char *)&K.fld_key[i].to_key + sizeof (short) + sizeof ( + short), sizeof (int)); +#endif + + if(key > key_K) + { + return false; + } + if(key< key_K ) + { + return true; + } + +#if !defined(_BIGENDIAN) + + memcpy ((void *)&field_id, (char *)&fld_key[i].to_key + sizeof (int), + sizeof (short)); + memcpy ((void *)&field_id_K, (char *)&K.fld_key[i].to_key + sizeof (int), + sizeof (short)); +#else + + memcpy ((void *)&field_id, (char *)&fld_key[i].to_key + sizeof (short), + sizeof (short)); + memcpy ((void *)&field_id_K, (char *)&K.fld_key[i].to_key + sizeof (short), + sizeof (short)); +#endif + + if(field_id > field_id_K) + { + return false; + } + if(field_id < field_id_K) + { + return true; + } + + continue; + } +*/ + case C_APPKEY_TYPE: + { + if(fld_key[i].to_appkey.app_id> K.fld_key[i].to_appkey.app_id) + { + return false; + } + if(fld_key[i].to_appkey.app_id< K.fld_key[i].to_appkey.app_id) + { + return true; + } + + short table_no,table_no_K; + short field_id,field_id_K; + int key,key_K; + +#if !defined(_BIGENDIAN) + + memcpy ((void *)&table_no, + (char *)&fld_key[i].to_appkey.key_id + sizeof (int) + sizeof (short), + sizeof (short)); + memcpy ((void *)&table_no_K, + (char *)&K.fld_key[i].to_appkey.key_id + sizeof (int) + sizeof (short), + sizeof (short)); +#else + + memcpy ((void *)&table_no, (char *)&fld_key[i].to_appkey.key_id, + sizeof (short)); + memcpy ((void *)&table_no_K, (char *)&K.fld_key[i].to_appkey.key_id, + sizeof (short)); +#endif + + if(table_no > table_no_K) + { + return false; + } + + if(table_no < table_no_K) + { + return true; + } + +#if !defined(_BIGENDIAN) + + memcpy((void *)&key,(char *)&fld_key[i].to_appkey.key_id,sizeof(int)); + memcpy((void *)&key_K,(char *)&K.fld_key[i].to_appkey.key_id,sizeof(int)); +#else + + memcpy ((void *)&key, (char *)&fld_key[i].to_appkey.key_id + sizeof ( + short) + sizeof (short), sizeof (int)); + memcpy ((void *)&key_K, (char *)&K.fld_key[i].to_appkey.key_id + sizeof ( + short) + sizeof (short), sizeof (int)); +#endif + + if(key > key_K) + { + return false; + } + if(key< key_K ) + { + return true; + } + +#if !defined(_BIGENDIAN) + + memcpy ((void *)&field_id, (char *)&fld_key[i].to_appkey.key_id + sizeof (int), + sizeof (short)); + memcpy ((void *)&field_id_K, + (char *)&K.fld_key[i].to_appkey.key_id + sizeof (int), sizeof (short)); +#else + + memcpy ((void *)&field_id, + (char *)&fld_key[i].to_appkey.key_id + sizeof (short), sizeof (short)); + memcpy ((void *)&field_id_K, + (char *)&K.fld_key[i].to_appkey.key_id + sizeof (short), sizeof (short)); +#endif + + if(field_id > field_id_K) + { + return false; + } + if(field_id < field_id_K) + { + return true; + } + + continue; + } + case C_APPID_TYPE: + { + if(fld_key[i].to_appkey.app_id> K.fld_key[i].to_appid.app_id) + { + return false; + } + if(fld_key[i].to_appkey.app_id< K.fld_key[i].to_appid.app_id) + { + return true; + } + + short table_no,table_no_K; + int key,key_K; + +#if !defined(_BIGENDIAN) + + memcpy ((void *)&table_no, + (char *)&fld_key[i].to_appid.key_id + sizeof (int) + sizeof (short), + sizeof (short)); + memcpy ((void *)&table_no_K, + (char *)&K.fld_key[i].to_appid.key_id + sizeof (int) + sizeof (short), + sizeof (short)); +#else + + memcpy((void *)&table_no,(char *)&fld_key[i].to_appid.key_id,sizeof(short)); + memcpy ((void *)&table_no_K, (char *)&K.fld_key[i].to_appid.key_id, + sizeof (short)); +#endif + + if(table_no > table_no_K) + { + return false; + } + if(table_no < table_no_K) + { + return true; + } + +#if !defined(_BIGENDIAN) + + memcpy((void *)&key,(char *)&fld_key[i].to_appid.key_id,sizeof(int)); + memcpy((void *)&key_K,(char *)&K.fld_key[i].to_appid.key_id,sizeof(int)); +#else + + memcpy ((void *)&key, (char *)&fld_key[i].to_appid.key_id + sizeof ( + short) + sizeof (short), sizeof (int)); + memcpy ((void *)&key_K, (char *)&K.fld_key[i].to_appid.key_id + sizeof ( + short) + sizeof (short), sizeof (int)); +#endif + + if(key > key_K) + { + return false; + } + if(key< key_K ) + { + return true; + } + + continue; + } + case C_MEASRTDBKEY_TYPE: + case C_RTDBKEY_TYPE: + { + if(fld_key[i].to_rtdbkey == K.fld_key[i].to_rtdbkey) + { + continue; + } + else + { + return fld_key[i].to_rtdbkey < K.fld_key[i].to_rtdbkey; + } + } + case C_LONG_TYPE: + short table_no,table_no_K; + int key,key_K; + +#if !defined(_BIGENDIAN) + + memcpy ((void *)&table_no, + (char *)&fld_key[i].to_long + sizeof (int) + sizeof (short), sizeof (short)); + memcpy ((void *)&table_no_K, + (char *)&K.fld_key[i].to_long + sizeof (int) + sizeof (short), sizeof (short)); +#else + + memcpy((void *)&table_no,(char *)&fld_key[i].to_long,sizeof(short)); + memcpy((void *)&table_no_K,(char *)&K.fld_key[i].to_long,sizeof(short)); +#endif + + if(table_no > table_no_K) + { + return false; + } + if(table_no < table_no_K) + { + return true; + } + +#if !defined(_BIGENDIAN) + + memcpy((void *)&key,(char *)&fld_key[i].to_long,sizeof(int)); + memcpy((void *)&key_K,(char *)&K.fld_key[i].to_long,sizeof(int)); +#else + + memcpy ((void *)&key, (char *)&fld_key[i].to_long + sizeof (short) + sizeof ( + short), sizeof (int)); + memcpy ((void *)&key_K, (char *)&K.fld_key[i].to_long + sizeof ( + short) + sizeof (short), sizeof (int)); +#endif + + if(key > key_K) + { + return false; + } + if(key< key_K ) + { + return true; + } + + continue; + + break; + + default: + break; + }//end switch + } // end for i + + return true; + } +}; + +struct RCD_TYPE +{ + struct KEY_TYPE key; //complex keyword + int pos; //ԭλindex + int value; // + + struct RCD_TYPE& operator = (const struct RCD_TYPE& T) + { + if( this == &T) + { + return *this; + } + + pos = T.pos; + value = T.value; + key = T.key; + + return *this; + } + + bool operator > (const struct RCD_TYPE& T) const + { + return key > T.key; + } + + bool operator < (const struct RCD_TYPE& T) const + { + return key < T.key; + } +}; + + +/*----------------------------------------------------------------------------*/ +#ifdef _APP_SYS_SUBSTATION +union semun +{ + int val; + struct semid_ds* buf; + unsigned short* array; +}; +#endif +/*----------------------------------------------------------------------------*/ +union DATA_VALUE +{ + //char to_str[40]; + char to_char; + char* to_str; + short to_short; + int to_int; + cmnInt64 to_long; + float to_float; + double to_double; + //KEY_ID_STRU to_key; + //binary +}; + +/*----------------------------------------------------------------------------*/ + +/////////////////////////////////////////////////////////////////////////////// +struct MENU_INFO +{ + char menu_name[ORIGIN_MENU_NAME_LEN]; /* ˵*/ + unsigned char menu_no; /* */ + int actual_value; /* ʵֵ*/ + char display_value[ORIGIN_MENU_NAME_LEN]; /* ʾֵ*/ + unsigned char menu_status; /*˵״̬ */ + char menu_macro_name[50]; + char menu_name_lang0[40]; + char menu_name_lang1[40]; + char display_value_lang0[40]; + char display_value_lang1[40]; + char display_value_lang2[40]; + char display_value_lang3[40]; + char menu_name_lang2[40]; + char menu_name_lang3[40]; +}; + + +struct MENU_RELEVANT +{ + int table_id; /* ID */ + short column_id; /* ID */ + int column_value; /* ֵ */ + short r_column_id; /* ӦID */ + char r_menu_name[ORIGIN_MENU_NAME_LEN]; /* Ӧ˵ */ + int default_value; /* Ĭֵ */ +}; + +struct MENU_STRING +{ + RTDB_KEY_STRU order_no; + char menu_name[MENU_NAME_LEN]; +}; + + +struct ORDER_KEY_REQ +{ + int order_no; + RTDB_KEY_STRU key_id; +}; + +struct GRAPH_ORDER_KEY_REQ +{ + int app_no; + int scenario_no; + int scenario_inst; + int sub_scenario_no; + int sub_scenario_inst; + cmnInt64 graph_id; + std::vector vec_keyid; +}; + +struct ORDER_KEY_RSP +{ + int order_no; + bool is_in_app; +}; + +struct GRAPH_ORDER_KEY_RSP +{ + cmnInt64 graph_id; + std::vector vec_app; +}; +/////////////////////////////////////////////////////////////////////////////// + +/******** download appended information begin ******************************/ +struct INDEX_FIELD_DEFINE +{ + short field_no; + int reserved[8]; +}; +typedef std::vector< INDEX_FIELD_DEFINE > IndexFieldsArray; + +struct INDEX_DEFINE +{ + //string index_name;//int index_no + int table_no;//added for verification + int index_no; + int index_method; + int first_hash_size;//˫һĴСϢ + int storage_type; + int mem_alloc_type;//ڴ䷽ƩHASHķ䷽HASH䷽ + int record_app; + int reserved[8]; + IndexFieldsArray index_fields; //Ҫdownload_serverͨselect field_no from index_field_define where index_id = index_id and table_id = table_no and bitop(record_app,APP_NO) = APP_NO order by order_in_index +}; + +typedef std::vector INDEX_DEFINE_ARRAY; +/******** download End ********************************/ + + +/********* index description in the table header begin*************/ +struct INDEX_DEFINE_TAB +{ + //char index_name[FIELD_NAME_LEN]; //,߸ijint index_no + int index_no; + char file_name[4* ENG_NAME_LEN];//ļƣļӳڴʹá + int shm_id;//ʹùڴĻҪϢ + int index_shm_size; //ӦĹڴĴС + char index_method; //򷽷 ƩHASH㷨˳ȡ + int mem_alloc_type;// + int storage_type; + time_t create_time;//ʱͷʱһжҳǷڡ + int index_desc_pos; //ʾĵһᵽFIELDS_IN_INDEXS_DESC_TABλã + int field_num; //ʾܹ˼ͬΪ˶λFIELDS_IN_INDEXS_DESC_TABеijȡ + int index_length;//һ¼棬ռõijȣij֮͡ + int index_rec_length; //һ¼ijȡҪIndexвϢʱͬҪ + int status;//״̬ƩNOT_CREATED , NOT_INITIALIZED , INITIALIZING, OKABNORMAL, REPAIRING״̬,״̬ΪOKôȡ¼Ͳ + int first_hash_size;//Ϊ˫HASHڸݱ + char reserved[20]; //Ԥ +} ;//άΪSTDB_TAB ::index_num + +struct FIELDS_IN_INDEXS_DESC_TAB +{ + short field_no; + short data_offset; //ע⣬˴data_offsetָƫҪעеÿǽеģԵһdata_offset0ڶdata_offsetǵһij..... + char reserved[20]; +};//άΪSTDB_TAB:: fields_used_in _index_num + +struct FIELD_INDEX_DEFINE_TAB +{ + short field_no; // + short index_no; //ڵڼŴ0 ʼ + short in_index_pos; //ڸڵڼ򣬴0ʼλá + char reserved[20]; //Ԥ +};//άΪSTDB_TAB::fields_used_in _index_num + +struct FIELDS_USED_IN_INDEX_TAB +{ + short field_no; + char reserved[20]; //Ԥ +};//άΪSTDB_TAB :: indexed_fields_num +/********* index description in the table header end**************/ + +/********* index head description begin***********************/ +struct INDEX_STDB_TAB +{ + char index_name[ENG_NAME_LEN]; // + int table_id; //ΪУ򿪵ȷģ + int index_id;//ΪУ򿪵ȷģ + int shm_id; //ʹùڴĻҪϢ + int index_method;//򷽷 ƩHASH˳ + //int mem_alloc_type;// + //int storage_type; + time_t create_time;//ʱͷʱһжҳǷڡ + int hash_prime; //ΪHASH㷨ĻHASHӡ + int first_hash_size; //˫HASH͵һHASHӣеfirst_hash_sizeеfirst_hash_sizeΪ0Ļ͸ֵΪhash_prime + int first_hash_prime;//first_hash_sizehashӣƩ͵first_hash_size,߲first_hash_size + int table_record_sum; + int table_record_num;//HASHò + int index_record_sum; + int phy_record_size; //һȫ¼ij + int phy_record_size_pri_overflow; //һȫ¼ij + int phy_record_size_overflow;//һȫ¼ij + int record_size;//һЧ¼ij + int index_length; //һ¼ռõij + int key_length;//һ¼ռõij + int index_offset; //һ¼棬Լ¼ͷƫ + int index_offset_overflow; //һ¼棬Լ¼ͷƫ + int index_offset_pri_overflow; //һ¼棬Լ¼ͷƫ + int key_offset;//һ¼棬Լ¼ͷƫ + int key_offset_overflow;//һ¼棬Լ¼ͷƫ + int key_offset_pri_overflow;//һ¼棬Լ¼ͷƫ + int key_max_assign;//õ + int field_sum; + //int data_area_offset; + int stdb_index_hash_offset; //STDB_INDEX_HASH ṹڴָƫ + int free_array_offset; //йջַ + int index_storage_offset;// ڴָƫ + int index_overflow_offset;//(߶)ڴָƫ + int index_pri_overflow_offset;//һڴָƫ + int data_area_size;//ܻûô + struct KEYWORD_STRU key; + DB_STATUS_T index_status;//״̬ + char reserved[20]; //Ԥ +}; + +struct INDEX_STDB_FIELD_TAB +{ + short offset; //¼ڵһƫ + short data_type; // + short data_length; //ij + char reserved[20]; //Ԥ +};//άΪINDEX_STDB_TAB::field_sum +/********* index head description end************************/ + +/********* structure for hash index body begin *********************/ +struct STDB_INDEX_HASH +{ + //int overflow_record_size;//¼,INDEX_STDB_TABѾ壬Բٶ + //int overflow_area_offset; //ƫͷλ,INDEX_STDB_TABѾ壬Բٶ + //int overflow_area_size; //ĴС,INDEX_STDB_TABѾ壬Բٶ + //int *free_array_ptr;//άINDEX_STDB_TAB::table_record_sum,Dzָʽ档 + int free_pos; + int storage_used_num;// INDEX_STORAGE_HASHѾʹõļ¼ĸҪעǣINDEX_STORAGE_HASHļ¼ѾɾҲused_flag == NOT_USEDĺָ벻ΪյĻô¼Ȼstorage_used_num档 + char reserved[20]; +}; +struct INDEX_STORAGE_HASH_REC_HEAD +{ + //char *index_ptr ;//ΪINDEX_STDB_TAB::index_length; + //char *key_ptr;//ΪINDEX_STDB_TAB::key_length; + int next_pointer;//ͻ£һָλãOVERFLOW_STORAGE 0ż¼ƫ + int tail_pointer;//ӦͬһHASHһλõָ룬ٲ롣žһظΨһҪ. + int same_hash_num;//ͬHASHĹؼĸ,עⲻǸؼ֡ͬʱΪһжоݡ + int used_flag; //ʹñ־ +};//¼INDEX_STDB_TAB::hash_prime + +struct OVERFLOW_STORAGE_HASH_REC_HEAD +{ + //char *index_ptr ;//ΪINDEX_STDB_TAB::key_length; + //char *key_ptr;//ΪINDEX_STDB_TAB::key_length; + int next_pointer;//ͻ£һָλãOVERFLOW_STORAGEַƫ + int prev_pointer;//ǰһλõָ룬2bit00ĻOVERFLOW_STORAGE_HASH 0ż¼ƫ 2bit10ĻȥbitõֵINDEX_STORAGE_HASHλá + //int used_flag; //ʹñ־USEDNOT_USED,ûбҪʹ +};//¼ΪINDEX_STDB_TAB::table_record_sum + +/********* sstructure for HASH index body end* *********************/ + +/********* structure for sequence index body begin *********************/ +/********* structure for sequence index body end ***********************/ + +/********* structure for bi-level index body begin *********************/ +struct STDB_INDEX_BILEVEL +{ + int first_level_index_rec_sum; //ͨñƩ糧վ¼ͨһϢ? + int data_offset; + int overflow_used_num;//ʹõļ¼ + char reserved[20];// +}; + +struct FIRST_LEVEL_INDEX_REC_HEAD +{ + int begin_pos; + int length; + int used_flag; //USED or NOT_USED +};//¼ΪSTDB_INDEX_BILEVEL::first_level_index_rec_sum + +struct FIRST_LEVEL_INDEX_OVERFLOW_REC_HEAD +{ + int begin_pos; + int length; +};//¼ΪSTDB_INDEX_BILEVEL::first_level_index_rec_sum +/********* structure for bi-level index body end ***********************/ + +/********* structure for double-overflow hash index body begin *********************/ +struct STDB_INDEX_HASH_DOVERFLOW +{ + //int overflow_record_size;//¼,INDEX_STDB_TABѾ壬Բٶ + //int overflow_area_offset; //ƫͷλ,INDEX_STDB_TABѾ壬Բٶ + //int overflow_area_size; //ĴС,INDEX_STDB_TABѾ壬Բٶ + //int *prime_free_array_ptr; //άΪINDEX_STDB_TAB::table_record_sum],ʹõĿжй顣 + int prime_free_pos;// + //int *free_array_ptr;//άΪINDEX_STDB_TAB::table_record_sum + int free_pos; + int storage_used_num;// INDEX_STORAGE_HASHѾʹõļ¼ĸҪעǣINDEX_STORAGE_HASHļ¼ѾɾҲused_flag == NOT_USEDĺָ벻ΪյĻô¼Ȼstorage_used_num档 + char reserved[20]; +}; + +struct INDEX_STORAGE_HASH_DOVERFLOW_REC_HEAD +{ + //char *index_ptr ;//ΪINDEX_STDB_TAB::index_length; + //char *key_ptr;//ΪINDEX_STDB_TAB::key_length; + int prime_next_pointer;//HASHλúͣindexֵλindexֵȵ£ô˳PRIMARY_OVERFLOW_STORAGEߣֱPRIMARY_OVERFLOW_STORAGE_HASHҵһindexֵȵҵһλã㷨Prime_next_pointerPRIMARY_OVERFLOW_STORAGE 0ż¼ƫ + int next_pointer;//ͻ£indexָȵ£һָλãOVERFLOW_STORAGE 0ż¼ƫ + int tail_pointer;//һλõָ룬ٲ롣 + int same_hash_num;//ͬHASHĹؼֵĸͬʱΪһжоݡ + int used_flag; //ʹñ־ +};//¼ΪINDEX_STDB_TAB::first_hash_prime + +struct PRIMARY_OVERFLOW_STORAGE_HASH_REC_HEAD +{ + //char *index_ptr ;//ΪINDEX_STDB_TAB::key_length; + //char *key_ptr;//ΪINDEX_STDB_TAB::key_length; + int prime_next_pointer;//PRIMARY_OVERFLOWindexֵȵ£OVERFLOW_STORAGE_HASHһָλãPRIMARY_OVERFLOW_STORAGEַƫ + int prime_prev_pointer;//PRIMARY_OVERFLOWеǰָ롣 + int next_pointer;// PRIMARY_OVERFLOWindexֵȵ³ͻ£һָλãOVERFLOW_STORAGE׼¼ƫ + int tail_pointer;//һλõָ룬ٲ롣 + int same_hash_num;//ͬHASHĹؼֵĸͬʱΪһжоݡ + int used_flag; //ʹñ־USEDNOT_USED +};//¼ΪINDEX_STDB_TAB::first_hash_size + +//ͬҪstruct OVERFLOW_STORAGE_HASH_REC_HEAD,¼ΪINDEX_STDB_TAB::table_record_sumHASHһ + +/********* structure for double-overflow hash index body begin *********************/ + +/********* structure for hash PK bodywithout overflow area begin *********************/ +//ʹڲݽṹٶ +/********* structure for hash PK bodywithout overflow area end *********************/ + +/********* structure for hash PK body begin *********************/ +//ݽṹHASHһģһ +/********* structure for hash PK body begin **********************/ +#ifdef _APP_SYS_SUBSTATION + + + +/* Ϣṹ */ +struct DEF_FIELD_INFO +{ + int table_id; /* ID */ + short column_id; /* ڲID */ + short field_id; /* ID */ + char column_name_eng[32]; /* Ӣ */ + char column_name_chn[64]; /* */ + unsigned char data_type; /* */ + short data_length; /* ݳ */ + unsigned char is_key; /* Ƿ */ + unsigned char allow_null; /* Ƿֵ */ + int app_type; /* Ӧ */ + unsigned char is_app_syn; /* ǷʱȫӦͬ */ + unsigned char index_order_no; /* ˳ */ + unsigned char sort_order_no; /* Ĭ˳ */ + unsigned char is_input; /* Ƿ */ + unsigned char is_display; /* Ƿʾ */ + short display_order_no; /* ʾ˳ */ + unsigned char is_fix; /* ʱǷ̶ */ + short display_length; /* Ĭʾ */ + unsigned char display_precision; /* Сʾ */ + unsigned char align_type; /* 뷽ʽ */ + unsigned char display_type; /* ʾ */ + char menu_name[40]; /* ˵ */ + unsigned char reference_flag; /* ÷ʽ */ + unsigned char reference_mode; /* Ƿ */ + int reference_table; /* ñ */ + short reference_column; /* */ + unsigned char reference_display; /* ʾ */ + char init_value[20]; /* ȱʡֵ */ + char min_value[20]; /* Сֵ */ + char max_value[20]; /* ֵ */ + int column_special; /* */ + int search_attribute; /* */ + int statics_attribute; /* ͳ */ + unsigned char auto_meas_type; /* Զ */ + short gen_array_dimension; /* ά */ + char gen_array_name[32]; /* */ + int reserved_1; /* ϵͳ1 */ + int reserved_2; /* ϵͳ2 */ + int reserved_3; /* ϵͳ3 */ + int reserved_4; /* ϵͳ4 */ + int reserved_5; /* ϵͳ5 */ + char column_description[100]; /* Ϣ */ + cmnInt64 case_mode_type; /* ʽCASEģ */ +}; + +#define FIELD_INFO_DEFFIELDS "table_id,column_id,field_id,column_name_eng,column_name_chn,data_type,data_length,is_key,allow_null,app_type,is_app_syn,index_order_no,sort_order_no,is_input,is_display,display_order_no,is_fix,display_length,display_precision,align_type,display_type,menu_name,reference_flag,reference_mode,reference_table,reference_column,reference_display,init_value,min_value,max_value,column_special,search_attribute,statics_attribute,auto_meas_type,gen_array_dimension,gen_array_name,reserved_1,reserved_2,reserved_3,reserved_4,reserved_5,column_description,case_mode_type" +#endif + + + +} +#endif diff --git a/code/sys_nicmonitor/include/db_api/odb_public.h b/code/sys_nicmonitor/include/db_api/odb_public.h new file mode 100644 index 0000000..3d62ebd --- /dev/null +++ b/code/sys_nicmonitor/include/db_api/odb_public.h @@ -0,0 +1,375 @@ +/******************************************************************************* +ModuleName: ODB Real Time Database management system +FileName: publics.h +DESCRIPTION: public define +FUNCTION LIST: +COMMENT: ؽṹ ͬodb_api_struct.h +History: +Date Version Modifier Activities +2002-09-01 1.0 modify +================================================================================ +2002-09-01 1.0 created +*******************************************************************************/ + +#ifndef __ODB_PUBLIC_H__ +#define __ODB_PUBLIC_H__ + +//ͷļ +#ifndef _WINDOWS64 +#include +#include + +#include +#include +#include +#include + +#include + +#include +#include +#include + +#include + +#ifndef _HPUX +#include +#else +#include +#endif + +#include +#include +#include +#include +#include +#include +#include + +#else +#include +#include +#include +#include +#include +#include +#include +//#include +#endif + +#include +#include +#include +#include +#include +#include +#include +#include "ThreadKit/ThreadKit.h" + +#ifndef __ODB_DEFINE_H__ +#include "db_api/odb_define.h" +#endif + +#include "db_api/odb_struct.h" + +//namespace ODB +//{ + struct TABLE_PARA + { + char table_name_eng[ENG_NAME_LEN]; + char table_name_chn[CHN_NAME_LEN]; + int key_len; + int subkey_num; + int record_number; + int record_size; + short field_sum; + unsigned char is_auto_generated; //key_generate_type + + }; + + struct FIELD_PARA + { + int table_id; //ID INT + short field_id; //ID SHORT + short column_id; //ڲID SHORT + char field_name_eng[ENG_NAME_LEN]; //Ӣ STRING(32) + char field_name_chn[CHN_NAME_LEN]; // STRING(64) + short field_length; //ݳ SHORT + unsigned char data_type; // UCHAR + unsigned char is_keyword; //Ƿ UCHAR + unsigned char allow_null; //Ƿֵ UCHAR + + int app_type; //Ӧ INT + unsigned char is_app_syn; //ǷʱȫӦͬ UCHAR + unsigned char index_order_no; //˳ UCHAR + unsigned char sort_order_no; //Ĭ˳ UCHAR + + // // // // // + unsigned char is_input; //Ƿ UCHAR + unsigned char is_display; //Ƿʾ UCHAR + short display_order_no; //ʾ˳ SHORT + unsigned char is_fix; //ʱǷ̶ UCHAR + short display_length; //Ĭʾ SHORT + unsigned char display_precision; //Сʾ UCHAR + unsigned char align_type; //뷽ʽ UCHAR + unsigned char display_type; //ʾ UCHAR + char menu_name[MENU_NAME_LEN]; //˵ STRING(40) + + unsigned char reference_flag; // UCHAR + unsigned char reference_mode; //÷ʽ UCHAR + int reference_table; //ñ INT + short reference_column; // SHORT + unsigned char reference_display; //ʱǷʾ UCHAR + + char init_value[DEFAULT_VALUE_LEN]; //ȱʡֵ STRING(20) + char min_value[DEFAULT_VALUE_LEN]; //Сֵ STRING(20) + char max_value[DEFAULT_VALUE_LEN]; //ֵ STRING(20) + + int column_special; // INT + unsigned char auto_meas_type; //Զ UCHAR + short gen_array_dimension; //ά SHORT + char gen_array_name[ARRAY_NAME_LEN]; // STRING(32) + char column_description[DESCRIPTION_LEN]; //Ϣ STRING(100) + + unsigned char is_index; // + int offset; //added by RTDBMS + }; + + + + //////////////////////////////////////////////////////////////////////////////// + // for down load // + // // + //////////////////////////////////////////////////////////////////////////////// + + /*============================================================================*/ + + struct STDB_CREAT_REQ + { + int app_no; + int table_no; + int table_version; + int field_sum; //short +#ifdef _APP_SYS_SUBSTATION + int bit_field_sum; + int vir_field_sum; +#endif + char table_name_eng[ENG_NAME_LEN]; + char table_name_chn[CHN_NAME_LEN]; + int record_num; + int record_sum; + int record_length; //short + + unsigned char is_system_table; + unsigned char is_auto_generated; //key_generate_type; + unsigned char is_record_apped; + unsigned char is_record_lock; + unsigned char is_record_resp; + + DB_MEDIA_T stdb_media; //no used + ACCESS_METHODS_T access_meth; // + int seq_field_no; // + char passwd[MAX_NAME_STRING_LEN]; // + + + int table_type; //for graph, etc + + /******Added for index begin ************/ + int pk_index_method; + int pk_storage_type;//洢Ʃ繲ڴļӳڴ档 + int pk_mem_alloc_type;//ڴ䷽ƩHASHķ䷽HASH䷽ + /******Added for index end**************/ + + int reserved_1; + int reserved_2; + int reserved_3; + int reserved_4; + int reserved_5; + int area_num; + int area_no[MAX_AREA_NUM]; + char area_name[MAX_AREA_NUM][ENG_NAME_LEN]; + int slice_flag; + }; + + struct FIELD_CREAT_REQ + { + int app_no; //app_type + short field_no; + short r_field_no; + short field_id; + short column_id; + short field_length; +#ifdef _APP_SYS_SUBSTATION + short is_bit_field; +#endif + char field_name_eng[ENG_NAME_LEN]; + char field_name_chn[CHN_NAME_LEN]; + + int column_special; + int ref_tableno; //long reference_table; + short ref_fieldno; //short reference_column; + + unsigned char reference_flag; + unsigned char reference_mode; + unsigned char reference_display; + + unsigned char data_type; + unsigned char allow_null; + unsigned char is_keyword; + unsigned char display_type; + unsigned char is_index; //octet index_order_no; + unsigned char sort_order_no; + + unsigned char is_app_syn; + unsigned char auto_meas_type; + + char menu_name[MENU_NAME_LEN]; + char default_asciival[DEFAULT_VALUE_LEN]; //init_value + char min_asciival[DEFAULT_VALUE_LEN]; //min_value + char max_asciival[DEFAULT_VALUE_LEN]; //max_value + + + int search_attribute; // //Added 2003-09-01 + int statics_attribute; // ͳƵ + int reserved_1; // ϵͳ + int reserved_2; // ϵͳ + int reserved_3; // ϵͳ + int reserved_4; // ϵͳ + int reserved_5; // ϵͳ + }; + +#ifdef _APP_SYS_SUBSTATION + struct VIR_FIELD_CREAT_REQ + { + short v_field_no; //rtdbms + short vr_field_no; + short r_field_no; //bit field no + short bit_no; + char vir_field_name_eng[ENG_NAME_LEN]; + char vir_field_name_chn[CHN_NAME_LEN]; + }; +#endif + + struct STDB_DELETE_REQ + { + int app_no; + int table_no; + char passwd[MAX_PASSWD_LEN]; + }; + + + //struct FIELD_TYPE + //{ + // short field_no; + // short field_type; //data type for get; byte len for write + //}; + + struct FIELD_BASE_INFO + { + int offset; + int field_length; + short field_no; + unsigned char data_type; + unsigned char is_keyword; + }; + + +#ifndef __i386 + static char strFILE[100]; + static int iLINE; +#endif + +#ifndef __i386 +// #define TRACE strFILE = __FILE__; iLINE = __LINE__; odb_trace + #define TRACE strcpy(strFILE, __FILE__); iLINE = __LINE__; printf("\t%s:%d-->",strFILE,iLINE); odb_trace +#else + #define TRACE(...) odb_trace(__FILE__, __LINE__, __VA_ARGS__) +#endif + +#ifndef _WINDOWS64 +#ifndef __i386 + inline void odb_trace(const char *p,...) + { +#else + inline void odb_trace(const char *strFILE, const int iLINE, const char *p,...) + { + printf("\t%s:%d-->",strFILE,iLINE); +#endif +/* +#ifndef __i386 + static char strFILE[100]; + static int iLINE; + // #define TRACE strFILE = __FILE__; iLINE = __LINE__; odb_trace + #define TRACE strcpy(strFILE, __FILE__); iLINE = __LINE__; printf("\t%s:%d-->",strFILE,iLINE); odb_trace + inline void odb_trace(const char *p,...) + { +#else + #define TRACE(...) odb_trace(__FILE__, __LINE__, __VA_ARGS__) + inline void odb_trace(const char *strFILE, const int iLINE, const char *p,...) + { + printf("\t%s:%d-->",strFILE,iLINE); +#endif +*/ + static pthread_mutex_t lock = PTHREAD_MUTEX_INITIALIZER; + va_list va; + va_start(va,p); + + pthread_mutex_lock(&lock); + vfprintf(stdout,p,va); + fflush(stdout); + pthread_mutex_unlock(&lock); + va_end(va); + } +#else + inline void odb_trace(const char *p,...) + { + /* + //printf("\t%s:%d-->",strFILE,iLINE); + static CRITICAL_SECTION cs; //ٽ + InitializeCriticalSection(&cs);//ʼٽ + + va_list va; + va_start(va,p); + + EnterCriticalSection(&cs);// + vfprintf(stdout,p,va); + fflush(stdout); + LeaveCriticalSection(&cs);// + va_end(va); + */ + //printf("\t%s:%d-->",strFILE,iLINE); + THREADKIT::Mutex g_mutex; + va_list va; + va_start(va,p); + + { + THREADKIT::Guard guard(g_mutex); + vfprintf(stdout,p,va); + fflush(stdout); + } + va_end(va); + + } + +#endif + +class SecClock +{ +public: + SecClock(int time_out):timer(time(NULL)),time_out(time_out){} + bool TimeOut(){return time(NULL)-timer>time_out;} +private: + time_t timer; + int time_out; + +}; + + /*============================================================================*/ + + extern "C" + { + void do_nothing1(int nn); + void do_nothing2(int nn); + } +//} +#endif diff --git a/code/sys_nicmonitor/include/db_api/odb_rtdbbase.h b/code/sys_nicmonitor/include/db_api/odb_rtdbbase.h new file mode 100644 index 0000000..9beedd0 --- /dev/null +++ b/code/sys_nicmonitor/include/db_api/odb_rtdbbase.h @@ -0,0 +1,155 @@ +/******************************************************************************* +ModuleName: ODB Real Time Database management system +FileName: odb_rtdbbase.h +DESCRIPTION: class system interface define +FUNCTION LIST: +COMMENT: +History: +Date Version Modifier Activities +2003-09-10 1.0 modify +2003-12-03 1.1 modify +================================================================================ +2003-09-10 1.0 created +*******************************************************************************/ +#ifndef __ODB_RTDBBASE_H__ +#define __ODB_RTDBBASE_H__ + +#ifndef __ODB_PUBLIC_H__ +#include "db_api/odb_public.h" +#endif + +#include "db_api/odb_prv_struct.h" + +/* +#ifndef __ODB_INCLUDE_H__ +#include "odb_include.h" +#endif +*/ +/* +#ifndef __ODB_BASEBUFFER_H__ +#include "odb_basebuffer.h" +#endif +*/ + +#include "pub.h" + +using namespace std; + +namespace ODB +{ +class CRtdbBase +{ +public: + CRtdbBase(){} + virtual ~CRtdbBase(){} + +public: + // + //query the whole table + // + virtual int TableGet(CBuffer& buf_base) const = 0; + virtual int TableGet(const int field_no, CBuffer& buf_base) const = 0; + virtual int TableGet(const char* field_name, CBuffer& buf_base) const = 0; + virtual int TableGet(const std::vector& vec_field_no, CBuffer& buf_base) const = 0; + + // + //query by key word + // + virtual int TableGetByKey(const char* key_ptr, char* buf_ptr, const int buf_size) const = 0; + virtual int TableGetByKey(const char* key_ptr, const int field_no, char* field_buf_ptr, const int buf_size) const = 0; + virtual int TableGetByKey(const char* key_ptr, const char* field_name, char* field_buf_ptr, const int buf_size) const = 0; + virtual int TableGetByKey(const char* key_ptr, const std::vector& vec_field_no, char* field_buf_ptr, const int buf_size) const = 0; + virtual int TableGetByKey(const char* key_ptr, const int keybuf_size, const std::vector& vec_field_no, char* field_buf_ptr, const int buf_size) const = 0; + + // + //modify + // + virtual int TableModify(const char* buf_ptr, const int record_num, const int record_size) const = 0; + virtual int TableModify(const int field_no, const char* field_buf_ptr, const int buf_size) const = 0; + virtual int TableModify(const char* field_name, const char* field_buf_ptr, const int buf_size) const = 0; + virtual int TableModify(const std::vector& vec_field_no, const char* field_buf_ptr, const int buf_size) const = 0; + + // + //by keyword && fields + // + virtual int TableModifyByKey(const char* key_ptr, const int field_no, const char* field_buf_ptr, const int buf_size) const = 0; + virtual int TableModifyByKey(const char* key_ptr, const char* field_name, const char* field_buf_ptr, const int buf_size) const = 0; + virtual int TableModifyByKey(const char* key_ptr, const std::vector& vec_field_no, const char* field_buf_ptr, const int buf_size) const = 0; + + // + //SQL interface + // + virtual int SqlGet(const char* str_sql, CBuffer& buf_base) const = 0; + +public: + // + //Table PARA + // + virtual int GetTablePara(short& field_num, int& record_num, int& record_size) const = 0; + virtual int GetTablePara(struct TABLE_PARA& table_para, std::vector& vec_field_para) const = 0; + virtual int GetTablePara(const char* str_attribute, CBuffer& buf_base) const = 0; + + virtual int GetFieldInfo(const std::vector vec_field_no, std::vector& vec_field) const = 0; + +public: + // + //Name and No + // + virtual int GetFieldNameByNo(char* field_name, const int field_no, const bool is_eng=true) = 0; + virtual int GetFieldNoByName(int& field_no, const char* field_name, const bool is_eng=true) = 0; + + virtual int GetTableNameByNo(char* table_name, const int table_no, const bool is_eng=true) = 0; + virtual int GetTableNoByName(int& table_no, const char* table_name, const bool is_eng=true) = 0; + + virtual int GetAppNameByNo(char* app_name, const int app_no) = 0; + virtual int GetAppNoByName(int& app_no, const char* app_name) = 0; + +public: + virtual int MenuRead(const char* menu_name, std::vector& vec_menu, const int menu_status=MENU_ON) = 0; + + virtual int TableReleMenuRead(const int table_no, std::vector& vec_menu) = 0; + + virtual int GetRefMenuString(const int table_no, std::vector& vec_menu) = 0; + + //virtual int GetNameStringByKeyID(const KEY_ID_STRU& keyid_stru, string& ref_string) = 0; + + //virtual int GetNameStringByKeyID(const std::vector& vec_keyid, std::vector& vec_ref_string) = 0; + + virtual int GetNameStringByID(const cmnInt64 reference_id, string& ref_string) = 0; + + virtual int GetNameStringBykey(const char* key_ptr, string& ref_string) = 0; + + virtual int GetNameStringByAppKeyID( const std::vector& vec_appkeyid, std::vector& vec_name_string) = 0; + + virtual int GetNameStringByAppID( const std::vector& vec_appid, std::vector& vec_name_string) = 0; + +// virtual int ColMeasType( const std::vector vec_keyid , std::vector& vec_col_prop ) = 0; +// virtual int GraphGetAppInfo(const struct ODB::GRAPH_ORDER_KEY_REQ& graph_req, struct ODB::GRAPH_ORDER_KEY_RSP& graph_rsp) const = 0; + +// virtual int GraphGetData(const struct CODB_NET::GRAPH_REAL_REQ& real_req, CODB_NET::GRAPH_REAL_RSP_var& real_rsp) const = 0; + +public: + virtual int GetFacNameByKeyNo(const int table_no, const char* key_ptr, string& ref_string) = 0; + virtual int GetFacNameByFacID(char* fac_name, const cmnInt64 fac_id) = 0; + virtual int GetFacNameByFacNo(char* fac_name, const int fac_no) = 0; + + virtual int GetFacIDByFacName(cmnInt64& fac_id, const char* fac_name) = 0; + //virtual int GetFacNoByFacName(int& fac_no, const char* fac_name) = 0; //obsolete 2004-04-03 + virtual int GetFacNoByFacName(int& fac_no, const char* fac_name) = 0; + + //virtual int GetFacIDByFacNo(int& fac_id, const int fac_no) = 0; //obsolete 2004-04-03 + virtual int GetFacIDByFacNo(cmnInt64& fac_id, const int fac_no) = 0; + virtual int GetFacNoByFacID(int& fac_no, const cmnInt64 fac_id) = 0; + +public: + virtual int GetValueAndStatus(const vector &struVec , vector< struct INT_VALUE_STATUS > &KeyIdValVec) = 0; //yc + virtual int GetValueAndStatus(const vector &struVec , vector< struct FLOAT_VALUE_STATUS> & KeyIdValVec) = 0; //yx + virtual int GetValueAndStatus(const vector &struVec , vector< struct CHAR_VALUE_STATUS > & KeyIdValVec)= 0; //ym + virtual int GetValueAndStatus(const vector &struVec , vector< struct UNION_VALUE_STATUS> & KeyIdValVec ) = 0; //union type + + +}; + +} + +#endif diff --git a/code/sys_nicmonitor/include/db_api/odb_rtdbfactory.h b/code/sys_nicmonitor/include/db_api/odb_rtdbfactory.h new file mode 100644 index 0000000..4978d10 --- /dev/null +++ b/code/sys_nicmonitor/include/db_api/odb_rtdbfactory.h @@ -0,0 +1,68 @@ +/******************************************************************************* +ModuleName: ODB Real Time Database management system +FileName: odb_rtdbfactory.h +DESCRIPTION: class system interface define +FUNCTION LIST: +COMMENT: +History: +Date Version Modifier Activities +2003-09-10 1.0 modify +2003-12-05 1.1 modify +================================================================================ +2003-09-10 1.0 created +*******************************************************************************/ +#ifndef __ODB_RTDBFACTORY_H__ +#define __ODB_RTDBFACTORY_H__ + +#ifndef __ODB_TABLEBASE_H__ +#include "db_api/odb_tablebase.h" +#endif + +#ifndef __ODB_TABLEOP_H__ +#include "db_api/odb_tableop.h" +#endif + +#ifndef __ODB_APIOP_H__ +#include "db_api/odb_apiop.h" +#endif + +#ifndef __ODB_TABLENET_h__ +#include "db_api/odb_tablenet.h" +#endif + +#ifndef __ODB_APINET_h__ +#include "db_api/odb_apinet.h" +#endif +//#include "sam_service.h" + +namespace ODB +{ +class COdbFactory +{ +public: + COdbFactory(); + //~COdbFactory(); + virtual ~COdbFactory(); + virtual CTableBase* Make(const int app_no, const int table_no, const short context_no, const char* hostname, const int host_mode, const int rtdb_mode=0) ; + +private: + //CServicesManage* m_ServicesManage; + + CTableBase* m_Instance; + CTableOp* m_TableOp; + CApiOp* m_ApiOp; + NET_ODB::CTableNet* m_TableNet; + NET_ODB::CApiNet* m_ApiNet; + + short m_ContextNo; + int m_AppNo; + int m_TableNo; + bool m_HostMode; + bool m_RtdbMode; + char m_HostName[MAX_NAME_STRING_LEN]; +}; + +} + +#endif + diff --git a/code/sys_nicmonitor/include/db_api/odb_rtdbop.h b/code/sys_nicmonitor/include/db_api/odb_rtdbop.h new file mode 100644 index 0000000..584773d --- /dev/null +++ b/code/sys_nicmonitor/include/db_api/odb_rtdbop.h @@ -0,0 +1,184 @@ +/******************************************************************************* +ModuleName: ODB Real Time Database management system +FileName: odb_rtdbbase.h +DESCRIPTION: Unified RTDB system interface definition +FUNCTION LIST: +COMMENT: +History: +Date Version Modifier Activities +2004-06-25 1.1 add context_no parameter +2003-08-18 1.0 modify +2003-12-03 1.0 modify //formal +================================================================================ +2003-08-18 1.0 created +*******************************************************************************/ +#ifndef __ODB_RTDBOP_H__ +#define __ODB_RTDBOP_H__ + +#ifndef __ODB_RTDBBASE_H__ +#include "db_api/odb_rtdbbase.h" +#endif + +#ifndef __ODB_RTDBTABLE_H__ +#include "db_api/odb_rtdbtable.h" +#endif + +#ifdef _WINDOWS64 +#ifdef ODB_API_LIB_EXPORTS +#define ODB_API_LIB_API __declspec(dllexport) +#else +#define ODB_API_LIB_API __declspec(dllimport) +#endif +#else +#define ODB_API_LIB_API +#endif + +using namespace std; + +namespace ODB +{ +typedef NET_ODB::CTableNet CRtdbOp; + +#if 0 +class ODB_API_LIB_API CRtdbOp: public CTableBase +{ +public: + CRtdbOp(); + CRtdbOp(const int app_no, const short context_no = 0); + CRtdbOp(const int app_no, const int table_no, const short context_no = 0); + //CRtdbOp(const char *hostname); + + ~CRtdbOp(); + +public: + int Open(const int table_no); + int Open(const int app_no, const int table_no, const short context_no = 0); + //int Open(const char *hostname); + + int SetAppNo(const int app_no, const short context_no = 0); + + int SetHostMode(const char* host_name); + +//all interface +public: + // + //query the whole table + // + int TableGet(CBuffer& buf_base) const; + int TableGet(const int field_no, CBuffer& buf_base) const; + int TableGet(const char* field_name, CBuffer& buf_base) const; + int TableGet(const std::vector& vec_field_no, CBuffer& buf_base) const; + + // + //query by key word + // + int TableGetByKey(const char* key_ptr, char* buf_ptr, const int buf_size) const; + int TableGetByKey(const char* key_ptr, const int field_no, char* field_buf_ptr, const int buf_size) const; + int TableGetByKey(const char* key_ptr, const char* field_name, char* field_buf_ptr, const int buf_size) const; + int TableGetByKey(const char* key_ptr, const std::vector& vec_field_no, char* field_buf_ptr, const int buf_size) const; + int TableGetByKey(const char* key_ptr, const int keybuf_size, const std::vector& vec_field_no, char* field_buf_ptr, const int buf_size) const; + + // + //modify + // + int TableModify(const char* buf_ptr, const int record_num, const int record_size) const; + int TableModify(const int field_no, const char* field_buf_ptr, const int buf_size) const; + int TableModify(const char* field_name, const char* field_buf_ptr, const int buf_size) const; + int TableModify(const std::vector& vec_field_no, const char* field_buf_ptr, const int buf_size) const; + + // + //by keyword && fields + // + int TableModifyByKey(const char* key_ptr, const int field_no, const char* field_buf_ptr, const int buf_size) const; + int TableModifyByKey(const char* key_ptr, const char* field_name, const char* field_buf_ptr, const int buf_size) const; + int TableModifyByKey(const char* key_ptr, const std::vector& vec_field_no, const char* field_buf_ptr, const int buf_size) const; + + // + //SQL interface + // + virtual int SqlGet(const char* str_sql, CBuffer& buf_base) const; + +public: + int GetTablePara(short& field_num, int& record_num, int& record_size) const; + int GetTablePara(struct TABLE_PARA& table_para, std::vector& vec_field_para) const; + int GetTablePara(const char* str_attribute, CBuffer& buf_base) const; + + int GetFieldInfo(const std::vector vec_field_no, std::vector& vec_field) const; + +public: + int GetFieldNameByNo(char* field_name, const int field_no, const bool is_eng=true); + int GetFieldNoByName(int& field_no, const char* field_name, const bool is_eng=true); + + int GetTableNameByNo(char* table_name, const int table_no, const bool is_eng=true); + int GetTableNoByName(int& table_no, const char* table_name, const bool is_eng=true); + + int GetAppNameByNo(char* app_name, const int app_no); + int GetAppNoByName(int& app_no, const char* app_name); + +public: + int MenuRead(const char* menu_name, std::vector& vec_menu, const int menu_status=MENU_ON); + + int TableReleMenuRead(const int table_no, std::vector& vec_menu); + + int GetRefMenuString(const int table_no, std::vector& vec_menu); + + int GetNameStringByRtdbKeyID(const RTDB_KEY_STRU& keyid_stru, string& ref_string); + + int GetNameStringByRtdbKeyID(const std::vector& vec_keyid, std::vector& vec_ref_string); + + int GetNameStringByID(const cmnInt64 reference_id, string& ref_string); + + int GetNameStringBykey(const char* key_ptr, string& ref_string); + + int GetNameStringByAppKeyID( const std::vector& vec_appkeyid, std::vector& vec_name_string); + + int GetNameStringByAppID( const std::vector& vec_appid, std::vector& vec_name_string); + + int ColMeasType( const std::vector vec_keyid , std::vector& vec_col_prop ); +// virtual int GraphGetAppInfo(const struct ODB::GRAPH_ORDER_KEY_REQ& graph_req, struct ODB::GRAPH_ORDER_KEY_RSP& graph_rsp) const = 0; + +// virtual int GraphGetData(const struct CODB_NET::GRAPH_REAL_REQ& real_req, CODB_NET::GRAPH_REAL_RSP_var& real_rsp) const = 0; + +public: + int GetFacNameByKeyNo(const int table_no, const char* key_ptr, string& ref_string); + int GetFacNameByFacID(char* fac_name, const cmnInt64 fac_id); + int GetFacNameByFacNo(char* fac_name, const int fac_no); + + int GetFacIDByFacName(cmnInt64& fac_id, const char* fac_name); + int GetFacNoByFacName(int& fac_no, const char* fac_name); + + int GetFacIDByFacNo(cmnInt64& fac_id, const int fac_no); + int GetFacNoByFacID(int& fac_no, const cmnInt64 fac_id); + +public: + int GetValueAndStatus(const std::vector &struVec , std::vector< struct INT_VALUE_STATUS > &KeyIdValVec); //ym + + int GetValueAndStatus(const std::vector &struVec , std::vector< struct FLOAT_VALUE_STATUS> & KeyIdValVec); //yc + + int GetValueAndStatus(const std::vector &struVec , std::vector< struct CHAR_VALUE_STATUS > & KeyIdValVec); //yx + + int GetValueAndStatus(const std::vector &struVec , std::vector< struct UNION_VALUE_STATUS> & KeyIdValVec );//union type + + +private: + void Instance(); + int Refresh(const int mode_rtdb=0) const; + +private: + CRtdbOp(const CRtdbOp&); + CRtdbOp& operator=(const CRtdbOp&); + +private: + CRtdbTable* m_TablePtr; + + short m_ContextNo; + int m_AppNo; + int m_TableNo; + bool m_HostMode; + char m_HostName[MAX_NAME_STRING_LEN]; +}; +#endif + +} + +#endif diff --git a/code/sys_nicmonitor/include/db_api/odb_rtdbtable.h b/code/sys_nicmonitor/include/db_api/odb_rtdbtable.h new file mode 100644 index 0000000..4da1e6e --- /dev/null +++ b/code/sys_nicmonitor/include/db_api/odb_rtdbtable.h @@ -0,0 +1,160 @@ +/******************************************************************************* +ModuleName: ODB Real Time Database management system +FileName: odb_rtdbtable.h +DESCRIPTION: Unified RTDB system interface definition +FUNCTION LIST: +COMMENT: +History: +Date Version Modifier Activities +2003-08-18 1.0 modify +2003-12-05 1.0 modify //formal +================================================================================ +2003-08-18 1.0 created +*******************************************************************************/ +#ifndef __ODB_RTDBTABLE_H__ +#define __ODB_RTDBTABLE_H__ + +#ifndef __ODB_RTDBBASE_H__ +#include "db_api/odb_rtdbbase.h" +#endif + +#ifndef __ODB_TABLEBASE_H__ +#include "db_api/odb_tablebase.h" +#endif + +#ifndef __ODB_FACTORY_H__ +#include "db_api/odb_rtdbfactory.h" +#endif + +using namespace std; + +namespace ODB +{ +class CRtdbTable:public CRtdbBase +{ +public: + CRtdbTable(); + ~CRtdbTable(); + +public: + // + //query the whole table + // + int TableGet(CBuffer& buf_base) const; + int TableGet(const int field_no, CBuffer& buf_base) const; + int TableGet(const char* field_name, CBuffer& buf_base) const; + int TableGet(const std::vector& vec_field_no, CBuffer& buf_base) const; + + // + //query by key word + // + int TableGetByKey(const char* key_ptr, char* buf_ptr, const int buf_size) const; + int TableGetByKey(const char* key_ptr, const int field_no, char* field_buf_ptr, const int buf_size) const; + int TableGetByKey(const char* key_ptr, const char* field_name, char* field_buf_ptr, const int buf_size) const; + int TableGetByKey(const char* key_ptr, const std::vector& vec_field_no, char* field_buf_ptr, const int buf_size) const; + int TableGetByKey(const char* key_ptr, const int keybuf_size, const std::vector& vec_field_no, char* field_buf_ptr, const int buf_size) const; + + // + //modify + // + int TableModify(const char* buf_ptr, const int record_num, const int record_size) const; + int TableModify(const int field_no, const char* field_buf_ptr, const int buf_size) const; + int TableModify(const char* field_name, const char* field_buf_ptr, const int buf_size) const; + int TableModify(const std::vector& vec_field_no, const char* field_buf_ptr, const int buf_size) const; + + // + //by keyword && fields + // + int TableModifyByKey(const char* key_ptr, const int field_no, const char* field_buf_ptr, const int buf_size) const; + int TableModifyByKey(const char* key_ptr, const char* field_name, const char* field_buf_ptr, const int buf_size) const; + int TableModifyByKey(const char* key_ptr, const std::vector& vec_field_no, const char* field_buf_ptr, const int buf_size) const; + + // + //SQL interface + // + int SqlGet(const char* str_sql, CBuffer& buf_base) const; + +public: + int GetTablePara(short& field_num, int& record_num, int& record_size) const; + int GetTablePara(struct TABLE_PARA& table_para, std::vector& vec_field_para) const; + int GetTablePara(const char* str_attribute, CBuffer& buf_base) const; + + int GetFieldInfo(const std::vector vec_field_no, std::vector& vec_field) const; + +public: + int GetFieldNameByNo(char* field_name, const int field_no, const bool is_eng=true); + int GetFieldNoByName(int& field_no, const char* field_name, const bool is_eng=true); + + int GetTableNameByNo(char* table_name, const int table_no, const bool is_eng=true); + int GetTableNoByName(int& table_no, const char* table_name, const bool is_eng=true); + + int GetAppNameByNo(char* app_name, const int app_no); + int GetAppNoByName(int& app_no, const char* app_name); + +public: + int MenuRead(const char* menu_name, std::vector& vec_menu, const int menu_status=MENU_ON); + + int TableReleMenuRead(const int table_no, std::vector& vec_menu); + + int GetRefMenuString(const int table_no, std::vector& vec_menu); + + int GetNameStringByRtdbKeyID(const RTDB_KEY_STRU& keyid_stru, string& ref_string); + + int GetNameStringByRtdbKeyID(const std::vector& vec_keyid, std::vector& vec_ref_string); + + int GetNameStringByID(const cmnInt64 reference_id, string& ref_string); + + int GetNameStringBykey(const char* key_ptr, string& ref_string); + + int GetNameStringByAppKeyID( const std::vector& vec_appkeyid, std::vector& vec_name_string); + + int GetNameStringByAppID( const std::vector& vec_appid, std::vector& vec_name_string); + + int ColMeasType( const std::vector vec_keyid , std::vector& vec_col_prop ); +// virtual int GraphGetAppInfo(const struct ODB::GRAPH_ORDER_KEY_REQ& graph_req, struct ODB::GRAPH_ORDER_KEY_RSP& graph_rsp) const = 0; + +// virtual int GraphGetData(const struct CODB_NET::GRAPH_REAL_REQ& real_req, CODB_NET::GRAPH_REAL_RSP_var& real_rsp) const = 0; + +public: + int GetFacNameByKeyNo(const int table_no, const char* key_ptr, string& ref_string); + int GetFacNameByFacID(char* fac_name, const cmnInt64 fac_id); + int GetFacNameByFacNo(char* fac_name, const int fac_no); //mend 2004-04-03 + + int GetFacIDByFacName(cmnInt64& fac_id, const char* fac_name); + int GetFacNoByFacName(int& fac_no, const char* fac_name); + + int GetFacIDByFacNo(cmnInt64& fac_id, const int fac_no); + int GetFacNoByFacID(int& fac_no, const cmnInt64 fac_id); + + +public: + int GetValueAndStatus(const vector &struVec , vector< struct INT_VALUE_STATUS > &KeyIdValVec); //yc + + int GetValueAndStatus(const vector &struVec , vector< struct FLOAT_VALUE_STATUS> & KeyIdValVec); //yx + + int GetValueAndStatus(const vector &struVec , vector< struct CHAR_VALUE_STATUS > & KeyIdValVec); //ym + + int GetValueAndStatus(const vector &struVec , vector< struct UNION_VALUE_STATUS> & KeyIdValVec ); //union type + + +public: + int Refresh(const int app_no, const int table_no, const short context_no, const char* hostname, const int host_mode, const int rtdb_mode=0); + int SetNetMode(const bool is_net = false); + +private: + int StartRtdb(); + int CleanRtdb(); + +private: + CRtdbTable(const CRtdbTable&); + CRtdbTable& operator=(const CRtdbTable&); + +private: + CTableBase* m_TablePtr; + COdbFactory* m_Factory; + +}; + +} + +#endif diff --git a/code/sys_nicmonitor/include/db_api/odb_struct.h b/code/sys_nicmonitor/include/db_api/odb_struct.h new file mode 100644 index 0000000..a2fb25d --- /dev/null +++ b/code/sys_nicmonitor/include/db_api/odb_struct.h @@ -0,0 +1,458 @@ +#ifndef __ODB_STRUCT_H__ +#define __ODB_STRUCT_H__ +#ifndef _WINDOWS64 +#include +#endif + +#include +#include +#include +#include +#include "db_api/odb_define.h" +#include "common_types.h" +#include "db_com/rtdbkey_defs.h" + +//////////////////////////////////////////////////////// + +struct SCENARIO_PARA +{ + std::string scenario; + unsigned int scenario_id;//note: scenario_id is not used in comparasion, to avoid inconsistent with scenario + unsigned int scenario_inst; + std::string sub_scenario; + unsigned int sub_scenario_id;//note: sub_scenario_id is not used in comparasion, to avoid inconsistent with sub_scenario + unsigned int sub_scenario_inst; +public: + SCENARIO_PARA& operator=(const SCENARIO_PARA& _right); + bool operator==(const SCENARIO_PARA& _right) const; + bool operator<(const SCENARIO_PARA& _right) const; + bool operator<=(const SCENARIO_PARA& _right) const; + bool operator>(const SCENARIO_PARA& _right) const; + bool operator>=(const SCENARIO_PARA& _right) const; + std::string to_string() const; +}; +#ifndef _BIGENDIAN +struct KEY_STRU +{ + int key; + short field_id; + short table_no; +}; + +struct KEY_STRU_AREA +{ + int key:24; + int area:8; + short field_id; + short table_no; +}; +#else +struct KEY_STRU +{ + short table_no; + short field_id; + int key; +}; + +struct KEY_STRU_AREA +{ + short table_no; + short field_id; + int area:8; + int key:24; +}; +#endif + +struct SCENARIO_ID_INFO +{ + unsigned int scenario_id; + unsigned int scenario_inst; + unsigned int sub_scenario_id; + unsigned int sub_scenario_inst; + +public: + //struct SCENARIO_ID_INFO():scenario_id(0),scenario_inst(0),sub_scenario_id(0),sub_scenario_inst(0){} + //SCENARIO_PARA& operator=(const SCENARIO_ID_INFO& _right); + bool operator==(const SCENARIO_ID_INFO& _right) const; + bool operator<(const SCENARIO_ID_INFO& _right) const; + bool operator<=(const SCENARIO_ID_INFO& _right) const; + bool operator>(const SCENARIO_ID_INFO& _right) const; + bool operator>=(const SCENARIO_ID_INFO& _right) const; + bool operator!=(const SCENARIO_ID_INFO& _right) const; + std::string to_string() const; + std::string FormCommonSqlStringID() const; +}; + +typedef cmnInt64 KEY_ID_STRU; +typedef cmnUint32 TABLE_NO_T; +typedef cmnUint32 COLUMN_NO_T; +typedef cmnUint64 ARA_SER_NO_T; + +struct RTDB_KEY_STRU +{ + cmnUint64 key_id1; //indicate table_id + cmnUint64 key_id2; //indicate area_id_serial_no && column_no(4) +//Constructor + RTDB_KEY_STRU() : key_id1(0), key_id2(0) { } + RTDB_KEY_STRU(const TABLE_NO_T table_no, const ARA_SER_NO_T area_serial_no, const COLUMN_NO_T column_no = 0); + RTDB_KEY_STRU(const std::string &stringid); + +//creator +//RTDB_KEY_STRU(){key_id1=0;key_id2=0;} + inline void create_key(const TABLE_NO_T table_no, const ARA_SER_NO_T area_serial_no, const COLUMN_NO_T column_no = 0); + + void create_key(const std::string &stringid); //�漰�ַ����IJ��������ܲ���̫�ã����� + +//operator + bool operator==(const RTDB_KEY_STRU &right) const; + bool operator!=(const RTDB_KEY_STRU &right) const; + bool operator>(const RTDB_KEY_STRU &right) const; + bool operator<(const RTDB_KEY_STRU &right) const; + bool operator<=(const RTDB_KEY_STRU &right) const; + bool operator>=(const RTDB_KEY_STRU &right) const; + + RTDB_KEY_STRU& operator=(const RTDB_KEY_STRU &right); + + inline bool is_null() const { return key_id1 == 0 && key_id2 == 0;} + inline void set_null() { key_id1 = 0; key_id2 = 0;} + +//Get Function + inline TABLE_NO_T GetTableID() const; + inline ARA_SER_NO_T GetAreaSerialNo() const; + inline COLUMN_NO_T GetColumnNo() const; + +//Set Function + void SetTableID(TABLE_NO_T table_no); + void SetAreaSerialNo(ARA_SER_NO_T area_serial_no); + void SetColumnNo(COLUMN_NO_T column_no); + + + std::string FormStringID() const; + + + std::string FormSgID() const; + + std::string FormCommonSqlStringID() const; + + int FormSqlStr(char* sql_value, const int length) const; +}; + + +struct APP_KEY_STRU +{ + int app_id; + RTDB_KEY_STRU key_id; + + bool operator>(const APP_KEY_STRU &kr) const; + bool operator<(const APP_KEY_STRU &kr) const; + bool operator==(const APP_KEY_STRU &kr) const; + bool operator!=(const APP_KEY_STRU &kr) const; + + std::string FormCommonSqlStringID() const; + + int FormSqlStr(char* sql_value, const int length) const; +}; + +struct SCN_ID_STRU +{ + struct SCENARIO_ID_INFO scn_info; + RTDB_KEY_STRU key_id; + + bool operator>(const SCN_ID_STRU &kr) const; + bool operator<(const SCN_ID_STRU &kr) const; + bool operator==(const SCN_ID_STRU &kr) const; + bool operator!=(const SCN_ID_STRU &kr) const; + + std::string FormCommonSqlStringID() const; + std::string FormStringID(); + int FormSqlStr(char* sql_value, const int length) const; +}; + +struct APP_ID_STRU +{ + int app_id; + RTDB_KEY_STRU key_id; + + bool operator>(const APP_ID_STRU &kr) const; + bool operator<(const APP_ID_STRU &kr) const; + bool operator==(const APP_ID_STRU &kr) const; + bool operator!=(const APP_ID_STRU &kr) const; + + std::string FormCommonSqlStringID() const; + + int FormSqlStr(char* sql_value, const int length) const; +}; + + +#ifdef _BIGENDIAN +struct COMM_KEY_STRU +{ + short table_no; + short column_id; + int record_id; +}; +#else +struct COMM_KEY_STRU +{ + int record_id; + short column_id; + short table_no; +}; +#endif + +#ifdef _BIGENDIAN +struct COMM_KEY_AREA_STRU +{ + short table_no; + short column_id; + int area_id:8; + int record_id:24; +}; +#else +struct COMM_KEY_AREA_STRU +{ + int record_id:24; + int area_id:8; + short column_id; + short table_no; +}; +#endif + +struct _RTDB_KEY_STRU //as same as RTDB_KEY_STRU, to solve the problem that RTDB_KEY_STRU need constructor +{ + cmnUint64 key_id1; + cmnUint64 key_id2; + + bool operator==(const _RTDB_KEY_STRU &right) const; + bool operator!=(const _RTDB_KEY_STRU &right) const; + bool operator>(const _RTDB_KEY_STRU &right) const; + bool operator<(const _RTDB_KEY_STRU &right) const; + + inline cmnUint32 GetTableID() const; + inline cmnUint64 GetAreaSerialNo() const; + inline cmnUint32 GetColumnNo() const; +}; + + +struct _SCN_ID_STRU +{ + struct SCENARIO_ID_INFO scn_info; + _RTDB_KEY_STRU key_id; + + bool operator>(const _SCN_ID_STRU &kr) const; + bool operator<(const _SCN_ID_STRU &kr) const; + bool operator==(const _SCN_ID_STRU &kr) const; + bool operator!=(const _SCN_ID_STRU &kr) const; + + std::string FormCommonSqlStringID() const; + int FormSqlStr(char* sql_value, const int length) const; +}; + +struct _APP_KEY_STRU //as same as APP_KEY_STRU +{ + int app_id; + _RTDB_KEY_STRU key_id; + + bool operator>(const _APP_KEY_STRU &kr) const; + bool operator<(const _APP_KEY_STRU &kr) const; + bool operator==(const _APP_KEY_STRU &kr) const; + bool operator!=(const _APP_KEY_STRU &kr) const; +}; + +struct _APP_ID_STRU +{ + int app_id; + _RTDB_KEY_STRU key_id; + + bool operator>(const _APP_ID_STRU &kr) const; + bool operator<(const _APP_ID_STRU &kr) const; + bool operator==(const _APP_ID_STRU &kr) const; + bool operator!=(const _APP_ID_STRU &kr) const; +}; + + +// +//data define for record sort of real time db +// +union SORT_DATA_TYPE +{ + char to_str[CHN_NAME_LEN]; + int to_int; + float to_float; + double to_double; + cmnInt64 to_long; + unsigned int to_uint; + //KEY_ID_STRU to_key; + _APP_KEY_STRU to_appkey; + _APP_ID_STRU to_appid; + unsigned char to_uchar; + _RTDB_KEY_STRU to_rtdbkey; + _RTDB_KEY_STRU to_measrtdbkey; + _SCN_ID_STRU to_scn_id; +}; + +//lmj add 2004.0521 + +struct INT_VALUE_STATUS +{ + int value; + int status; + +}; + +struct FLOAT_VALUE_STATUS +{ + float value; + int status; + +}; + + +struct CHAR_VALUE_STATUS +{ + // char value[CHN_NAME_LEN]; + unsigned char value; + int status; + +}; + +struct LONG_VALUE_STATUS +{ + cmnInt64 value; + int status; + +}; + +struct UNION_VALUE_STATUS +{ + SORT_DATA_TYPE value; + int status; +}; + + +struct KEY_ID_STA_STRU +{ + RTDB_KEY_STRU key_id_stru; + int status_field; + +}; + +////////////////// file mapping cache ////////////////////////// + +#define RDB_MAX_MAP_LEN 8000000000 +#define RDB_FILE_NAME_LEN 256 + +typedef cmnInt64 MAP_FILE_KEY; + +struct MapItem +{ + char *map_file_ptr; + char file_name[RDB_FILE_NAME_LEN]; + unsigned int map_size; + int counter; + MAP_FILE_KEY map_id; + + MapItem *p_next; + MapItem *p_prev; + + MapItem() + { + map_file_ptr = NULL; + map_size = 0; + counter = 0; + map_id = 0; + memset(file_name, 0, RDB_FILE_NAME_LEN); + p_next = NULL; + p_prev = NULL; + } +}; + +struct CMmapList +{ + struct MapItem *m_list; + struct MapItem *m_ptail; //tail of list + long m_length; + unsigned int m_item_num; + CMmapList() + { + m_list = NULL; + m_ptail = NULL; + m_length = 0; + m_item_num = 0; + } +}; + + +#define MAP_ID_SYSTEM 1 +#if 0 +struct MAP_FILE_KEY +{ +#ifndef _BIGENDIAN + int area_no:8; + short table_no; + int app_no; + int ctx_no:8; +#else + int ctx_no:8; + int app_no; + short table_no; + int area_no:8; +#endif + bool operator>(const MAP_FILE_KEY& kr) const + { + // return ( (this-> > kr.app_id) || + // ((this->app_id == kr.app_id) && (this->key_id > kr.key_id)) ); + return (*(cmnInt64*)this > (const cmnInt64&)kr); + } + + bool operator<(const MAP_FILE_KEY& kr) const + { +// return ( (this->ctx_no < kr.ctx_no) || +// ((this->ctx_no == kr.ctx_no) && (this->app_no < kr.app_no)) ); + return (*(cmnInt64*)this < (const cmnInt64&)kr); + } + + bool operator==(const MAP_FILE_KEY& kr) const + { +// return ( (this->ctx_no == kr.ctx_no) && (this->app_no == kr.app_no) +// && (this->table_no == kr.table_no) && (this->area_no == kr.area_no)); + return (*(cmnInt64*)this == (const cmnInt64&)kr); + } + + bool operator!=(const MAP_FILE_KEY& kr) const + { +/* + if(this->ctx_no != kr.ctx_no) + return true; + if(this->app_no != kr.app_no) + return true; + if(this->table_no != kr.table_no) + return true; + if(this->area_no != kr.area_no) + return true; + return false; +*/ + return (*(cmnInt64*)this != (const cmnInt64&)kr); + } + +}; +#endif + + +typedef struct map_file_value +{ + char *map_file_ptr; + char file_name[256]; + unsigned int map_size; + int counter; +}RDB_MAP_FILE_VALUE; + +typedef std::map RDB_FILE_MAP; + +typedef struct map_file_struct +{ + RDB_FILE_MAP map_file_list; + cmnInt64 m_total_cache; +}MMapInfoList; + +#endif diff --git a/code/sys_nicmonitor/include/db_api/odb_system.h b/code/sys_nicmonitor/include/db_api/odb_system.h new file mode 100644 index 0000000..f0de5a8 --- /dev/null +++ b/code/sys_nicmonitor/include/db_api/odb_system.h @@ -0,0 +1,185 @@ +/******************************************************************************* +ModuleName: ODB Real Time Database management system (For New Generation) +FileName: odb_system.h +DESCRIPTION: class system define +FUNCTION LIST: +COMMENT: +History: +Date Version Modifier Activities +2018-11-19 1.0 wuqx created +*******************************************************************************/ + +#ifndef __ODB_SYSTEM_H__ +#define __ODB_SYSTEM_H__ + +#include "db_api/odb_prv_struct.h" +#include "db_api/odb_define.h" +#include "priv_para.h" + +#include +#include + +namespace ODB +{ +class COdbSystem +{ +//function to get singleton +public: + static COdbSystem* GetSystemInstance(); + static COdbSystem* pInstance; + static pthread_mutex_t _mutex; + +//creator & destructor +public: + COdbSystem(); + COdbSystem(bool load_flag); + ~COdbSystem(); + +//inneer creator to load config data or initialize all infomation +private: + int InitSystem(); + int LoadSystem(); + + +public: + //scenario allocator + int AddScenario( + const std::string& scenario, + const unsigned int scenario_inst_no, + const std::string& sub_scenario, + const unsigned int sub_scenario_inst_no); + + int AddScenario( + const unsigned int scenario_ID, + const unsigned int scenario_inst_no, + const unsigned int sub_scenario_ID, + const unsigned int sub_scenario_inst_no); + + int ScenarioRemove( + const int scenario_ID, + const int scenario_inst_no, + const int sub_scenario_ID, + const int sub_scenario_inst_no); + + //scenario locator + int IsScenarioCreated( + const std::string& scenario, + const unsigned int scenario_inst_no, + const std::string& sub_scenario, + const unsigned int sub_scenario_inst_no); + + int IsScenarioCreated( + const unsigned int scenario_ID, + const unsigned int scenario_inst_no, + const unsigned int sub_scenario_ID, + const unsigned int sub_scenario_inst_no); + + int IsSubScenarioLoaded( + const unsigned int scenario_ID, + const unsigned int scenario_inst_no, + const unsigned int sub_scenario_ID, + const unsigned int sub_scenario_inst_no); + + int IsSubScenarioLoaded( + const std::string& scenario, + const unsigned int scenario_inst_no, + const std::string& sub_scenario, + const unsigned int sub_scenario_inst_no); + +//sub_scenario manage + int LoadSubScenario( + const std::string& scenario, + const unsigned int scenario_inst_no, + const std::string& sub_scenario, + const unsigned int sub_scenario_inst_no); + + int LoadSubScenario( + const unsigned int scenario_ID, + const unsigned int scenario_inst_no, + const unsigned int sub_scenario_ID, + const unsigned int sub_scenario_inst_no); + + int CreateSubScenarioInst( + const std::string& scenario, + const unsigned int scenario_inst_no, + const std::string& sub_scenario, + const unsigned int sub_scenario_inst_no); + +//infomation aquire + //exchange name & no + int GetScenarioNameByNo(std::string& scenario_name, const unsigned int scenario_id) const; + int GetScenarioNoByName(const std::string& scenario_name, unsigned int& scenario_id) const; + int GetSubScenarioNameByNo(std::string& sub_scenario_name, const unsigned int sub_scenario_id) const; + int GetSubScenarioNoByName(const std::string& sub_scenario_name, unsigned int& sub_scenario_id) const; + int GetAllOdbNoBySubScenarioName (std::vector& vec_table, const std::string& scenario_name, const unsigned int scenario_inst, + const std::string& sub_scenario, const unsigned int sub_scenario_inst) const; + + int GetTableNoByChnName(const char* table_name, bool is_real = false); + int GetTableNoByName(const char* table_name, bool is_real = false); + int GetTableNameByNo(char* table_name, const unsigned int r_table_no, const bool is_eng=true); + const char* GetTableNameByNo(const unsigned int r_table_no); + + int IsTableExisted(const char* table_name) const; + int IsTableExisted(const unsigned int table_no) const; + +//distribute subscn judge + bool IsSubScenarioDistribute(const std::string& sub_scenario_name); + bool IsSubScenarioDistribute(const unsigned int sub_scenario_id); + int DistributeSubScenario(const std::string& DistSubScenarioName, std::string& SubScenarioName); +//system reload + int ReLoadSystem(); + +//for debug + int Show(); + int GetAllScenarioInfo(vector & all_scn_info); + +public: +//ptr access + DB_APP_TAB* GetAppPtr() const; + DB_CTRL_TAB* GetDbCtrlPtr() const; + DB_CTRL_TAB* GetTabDbCtrlPtr(const char* table_name) const; + DB_CTRL_TAB* GetTabDbCtrlPtr(unsigned int table_no) const; + +private: + int GenerateSemKey( + const unsigned int scenario_ID, + const unsigned int scenario_inst_no, + const unsigned int sub_scenario_ID, + const unsigned int sub_scenario_inst_no); + int if_sub_scenario_sliced(const std::string& sub_scenario); +private: + bool IsSpace(char c); + void Trim(string & str); + bool AnalyseLine(const string & line, string & key, string & val); + int InitMap(); + + void scenario_table_clear(struct SCENARIO_INFO* ptr); + void sub_scenario_table_clear(struct SUB_SCENARIO_INFO* ptr); + +private: + //inner member +//id_name map + std::map scenario_name_id_map; + std::map sub_scenario_name_id_map; + std::map scenario_id_name_map; + std::map sub_scenario_id_name_map; + +//system memory ptr + struct SYSTEM_INFO* p_sys_info; + struct SCENARIO_INFO* p_scenario_table; +//sub_scenario + DB_APP_TAB* m_AppTabPtr; + DB_CTRL_TAB* m_DbCtrlTabPtr; + DB_CTRL_TAB* m_CurDbCtrlTabPtr; + + + unsigned int work_mode; //1 means writable 0 means no writable + int sem_id; + unsigned long memsize; + std::string m_sys_path; + std::string m_sub_scn_path; + std::string m_table_path; +}; +} + +#endif diff --git a/code/sys_nicmonitor/include/db_api/odb_table.h b/code/sys_nicmonitor/include/db_api/odb_table.h new file mode 100644 index 0000000..4f629b3 --- /dev/null +++ b/code/sys_nicmonitor/include/db_api/odb_table.h @@ -0,0 +1,354 @@ +/******************************************************************************* +ModuleName: ODB Real Time Database management system +FileName: odb_table.h +DESCRIPTION: class table struct define +FUNCTION LIST: +COMMENT: +History: +Date Version Modifier Activities +2002-09-01 1.0 modify +================================================================================ +2002-09-01 1.0 created +*******************************************************************************/ + +#ifndef __ODB_TABLE_H__ +#define __ODB_TABLE_H__ + +//#include "odb_struct.h" +#include "odb_prv_struct.h" +#include "odb_public.h" +#include "odb_common.h" +#include "odb_baseindex.h" +#include "DeleteRecorder.h" + + +using namespace std; +struct FIX_INDEX_DEF; +class CRWLock; + +//Test Case +class CaseSearch; +class CaseTableWrite; +class CaseDeleteIndex; +#ifdef _APP_SYS_SUBSTATION + class CaseConGet; + class TestItem; +#endif +#define MAX_AREA_IDX_NUM 10 + +namespace ODB +{ + class Tab2Idx; + + enum DIRECTION + { + FORWARD = 0, + BACKWARD = 1 , + }; + + +class COdbTable +{ +public: + COdbTable(); + COdbTable(struct DB_APP_TAB* app_tab_ptr, struct DB_CTRL_TAB* ctrl_tab_ptr); + //COdbTable(struct DB_APP_TAB* app_tab_ptr, struct DB_CTRL_TAB* ctrl_tab_ptr, char* odb_file_name); + //COdbTable(struct DB_APP_TAB* app_tab_ptr, struct DB_CTRL_TAB* ctrl_tab_ptr, int odb_no); + //COdbTable(struct DB_APP_TAB* app_tab_ptr, struct DB_CTRL_TAB* ctrl_tab_ptr, char* odb_name); + COdbTable(struct DB_APP_TAB* app_tab_ptr, int odb_no); + COdbTable(struct DB_APP_TAB* app_tab_ptr, char* odb_name); + + COdbTable(char* app_ptr); + ~COdbTable(); + + //set environment after default constructor + int SetAppCtrl(struct DB_APP_TAB* app_tab_ptr, struct DB_CTRL_TAB* ctrl_tab_ptr = NULL); + + // + //create & delete + // +#ifdef _APP_SYS_SUBSTATION + int CreateTable(const struct STDB_CREAT_REQ* odb_creat_ptr, const struct FIELD_CREAT_REQ* odb_field_descrb_ptr, const struct VIR_FIELD_CREAT_REQ* vir_descrb_ptr, const std::vector& vec_offset,INDEX_DEFINE_ARRAY &index_define_array); +#endif + int CreateTable(const struct STDB_CREAT_REQ* odb_creat_ptr, const struct FIELD_CREAT_REQ* odb_field_descrb_ptr, const std::vector& vec_offset,INDEX_DEFINE_ARRAY &index_define_array); + + int DeleteTable(/*struct STDB_DELETE_REQ* stdb_delete_req_ptr*/); + int AddOneTable(const int r_table_no, const char* table_name_eng); + //int DeleteTable(); + + int CreateAreaTable(const struct STDB_CREAT_REQ* odb_creat_ptr, const struct FIELD_CREAT_REQ* odb_field_descrb_ptr, const std::vector& vec_offset,INDEX_DEFINE_ARRAY &index_define_array); + int DeleteAreaTable(); + + int ClearTable(); + int ClearAreaTable(); + int ClearAreaTableHoleDirect(); + + //write record + int WriteRecords(const char* buf_ptr, const int buf_size); + + // + //operation by key word + // + int ReadRecordByKey(const char* keyword, char** record_data_ptr, int& record_data_size); + int WriteRecordByKey(const char* keyword, const char* write_record_ptr, const int write_record_size); + int DeleteRecordByKey(const char* keyword); + int UpdateRecordByKey(const char* keyword, const char* update_record_ptr, const int update_record_size); + int ModifyRecordByKey(const char* keyword, const char* modify_record_ptr, const int modify_record_size); + + int DeleteAlignedRecords(const char* keyword, int direction = FORWARD); + int DeleteRecords(const char* keyword, const int key_num); + + int DeleteAreaTableRecords(const char* keyword, const int key_num); + + // + //query the whole table //2002-11-07 + // + //int GetAllRecords(char* buf_ptr, int& buf_size); + int GetAllRecords(char* buf_ptr, const int buf_size); + int GetAreaTableAllRecords(char* buf_ptr, const int buf_size); + + // + //move table among application + // + int MoveTo(const int r_table_no); + int MoveTo(const char* table_name); + + // + //move record each other + // + void RecordFirst(); + int RecordPre(); + int RecordNext(); + int RecordTo(const int no); + int RecordTo(const char* key_ptr); + void RecordLast(); + + // + //parameter //2002-10-16 + // + struct DB_CTRL_TAB* GetCtrlTabPtr(); + struct STDB_TAB* GetStdbTabPtr(); + struct STDB_TAB* GetStdbTabPtr(const int area_no); + struct STDB_FIELD_TAB* GetFieldTabPtr(); + char* GetDbPtr(); + char* GetCurRecordPtr(); + int GetKeyWordLength(); + int GetRecordNum(); + int GetPara(short& field_num, int& record_num, int& record_size); + int GetPara(struct TABLE_PARA& table_para); + +#ifdef _APP_SYS_SUBSTATION + struct STDB_VIR_FIELD_TAB* GetVirFieldTabPtr(); + //jinjing 2012-03-27 + int GetParaAll(struct TABLE_PARA& table_para, std::vector vec_offset); +#endif + // + //physical file name + // + int GetFileName(const char* table_name_eng); + int GetWholeMapFileName(char* str_file_name); + int GetFileNameWithAreaName(const char* table_name_eng, const char* area_name); + + char* GetTableName(); + int GetTableName(char* table_name); + int GetTableNo(bool is_real = false); + + //wj added for area tables + int SetAreaEnv(const int area_no, const bool is_manage = false); +#ifndef _APP_SYS_SUBSTATION + int CleanEnv(); +#endif + DB_APP_TAB* GetAppTabPtr(); + STDB_TAB* GetAreaStdbTabPtr(); + time_t GetDbOpenTime(const int table_no); + char* GetTableFileName(); + + void SetAppTabPtr(DB_APP_TAB* app_tab_ptr); + +private: + // + //Access environment //2002-10-15 + // + int SetDefaultEnv(); + int SetAppEnv(char* app_file_ptr); + int SetTableEnv(const struct DB_CTRL_TAB* const init_ctrl_tab_ptr); +#ifdef _APP_SYS_SUBSTATION + int CleanEnv(); +#endif + + // + //lock 2002-10-28 + // + bool Lock(const DB_LOCK_T& lock_type); + bool UnLock(const DB_LOCK_T& lock_type); + + // + //stat 2002-10-28 + // + int MinusDbNumTab(); + int AddDbNumTab(); + int SetStaticsParaPtr(int tag, int op_time); + + // + //Operation to Create // 2002-10-10 + // + int fill_stdb_tab(const struct STDB_CREAT_REQ* stdb_creat_req_ptr); + //int fill_field_tab(const struct STDB_CREAT_REQ* stdb_creat_req_ptr, const struct STDB_FIELD_DESCRIBLE* stdb_field_describle_ptr); + int fill_field_tab(const struct FIELD_CREAT_REQ* stdb_field_describle_ptr, const int field_num, const std::vector& vec_offset); + +#ifdef _APP_SYS_SUBSTATION + int fill_vir_field_tab(const struct VIR_FIELD_CREAT_REQ* vir_field_ptr, const int vir_field_num); +#endif + int get_keyword(); + int fill_sequent_tab(const struct STDB_CREAT_REQ* stdb_creat_req_ptr, int& stdb_describ_area_size, int& stab_total_size); + int fill_db_ctrl_tab(const struct STDB_CREAT_REQ* stdb_creat_req_ptr,int& stdb_describ_area_size); + + // + int search(const char*keyword,int &record_pointer); + int binary_search(const char* keyword, int& record_pointer,bool ext_flag=false);//ext_flag means the search area is in overflow table space in the hole direct table + struct RECORD_HEAD_STRU* get_record_head_ptr(const int record_pointer); + char* get_record_ptr(const int record_pointer); + char* get_record_ptr(const int record_pointer, int& record_size ); + int compare_keyword(const char* keyword1_ptr, const char* keyword2_ptr, const int keyword_len); + + // + //memory data + // + int move_record(int targ_reccord_pointer,int sour_record_pointer, const int move_num); + static int mem_move(char* targ_ptr, char* sour_ptr, const int count); + int assign_position(int* position_ptr, int assign_val); + + // + //Operation to a record + // + int read_record(const int record_pointer, char** record_data_ptr, int& record_data_size); //locked by caller + int write_record(const int record_pointer, const char* write_record_ptr, const int write_record_size); //locked by caller + int delete_record(const int record_pointer); //locked + int modify_record(const int record_pointer, const char* modify_record_ptr, const int modify_record_size,CRWLock &theLock);//locked + + // + //Operation to Record Head //2002-10-15 + // + int set_record_head(char* record_ptr, const int exist_tag); + int get_record_head(char* record_ptr); + int need_rebuilt(char * table_file_ptr, int shm_size,int table_size); + +public: + int sprint_key(char *key_ptr,char *key_string); + int sprint_field(const int data_type, const char* field_data_ptr,char *field_string); + +private: + COdbTable(const COdbTable& odb_table); + COdbTable& operator=(const COdbTable& odb_table); + +/***********Added for index begin ****************/ +public: + INDEX_DEFINE_TAB* GetIdxDfnPtr(); + FIELD_INDEX_DEFINE_TAB* GetFldIdxDfnPtr(); + FIELDS_IN_INDEXS_DESC_TAB* GetFldsInIdxDescPtr(); + FIELDS_USED_IN_INDEX_TAB* GetFldsUsedInIdxPtr(); + CBaseIndex *GetIndexPtr(int seq_no);//idx_op_ptr_arrayĵseq_noԪأseq_noԪNULLĻnewһԪس + CBaseIndex *GetPKIndexPtr();//pk_index_ptrNULLͷһpk_index_ptrnewһµķء + int fill_index_tab(INDEX_DEFINE_ARRAY& seq_idx, std::vector& vec_index_fieldno); + int DebugDisp(int index_seq_no,int type); + int GetAppFile(char *file_name,const struct DB_APP_TAB*app_ptr); +private: + INDEX_DEFINE_TAB *m_IdxDefPtr; + FIELDS_IN_INDEXS_DESC_TAB *m_FieldsInIdxDescPtr; + FIELD_INDEX_DEFINE_TAB *m_FieldIdxDefPtr; + FIELDS_USED_IN_INDEX_TAB *m_FieldsUsedInIndexPtr; + std::vector m_IdxOpPtrArray;//һűʱ򣬾ȸidx_op_ptr_arrayӦĿռ䡣ֻʹõʱٹCBaseIndexлһűʱҪɾÿһCBaseIndex* Ȼ·idx_op_ptr_array + //CNoOverflowPK* direct_pk_ptr;//򿪱ʱҪdirect_pk_ptrhash_pk_ptrлʱҪunmapdetachԭָ룬Ȼmmapattachָ롣 + //CHashPK *hash_pk_ptr; + CBaseIndex *m_PkIdxPtr;//ǵչԣһָһ㡣 + + //CBaseIndex* m_AreaIdxPtr[MAX_AREA_NUM][MAX_AREA_IDX_NUM]; //only for area tables' indexes + +public: + int FormIdxErrReport(int idx_seq_no,struct FIX_INDEX_DEF &fix_idx_def );//idx_seq_no = -1 means primary key index + +/***********Added for index end ****************/ + +/*********Added for imcompact table begin ********/ +private: + int *GetHoleIdxPtr(); + int HoleIdxInsert(int record_pointer); + int HoleIdxDelete(int record_pointer); + int HoleIdxDelete(int del_pointer_start, int del_pointer_end); + int m_CurHolePKPointer;//ΪRecordFirstRecordNextRecordLastRecordPreġ + + char* m_ExtDataAreaPtr; //ָ + int *m_HoleIdxPtr; //ָ롣 + int hole_direct_search (const char* in_keyword, int &record_pointer); + + int hole_idx_search (const int record_pointer, int& real_pos);//record_pointerõm_HoleIdxPtr± + int CheckDownloadTime(); + int ClearTableHoleDirect(); + int WriteRecordByKeyHoleDirect(const char* keyword, const char* write_record_ptr, const int write_record_size); + int UpdateRecordByKeyHoleDirect(const char* keyword, const char* update_record_ptr, const int update_record_size); + int DeleteRecordByKeyHoleDirect(const char* keyword); + int DeletePK(vector& vec_del_start, vector& vec_del_end); + int DeleteHolePK(vector& vec_del_start, vector& vec_del_end); + int DeleteAlignedRecordsHoleDirect(const char* keyword, int direction = FORWARD); + +/*********Added for imcompact table end ********/ +#ifdef _APP_SYS_SUBSTATION + //jinjing 2012-03-29 for GetTableParaAll + int create_field_tab(char* field_para_ptr, struct STDB_FIELD_TAB* stdb_field_ptr, const int field_num, const std::vector& vec_offset); + //jinjing 2012-03-29 for createStdbField + int checkIsBitField(const int field_no); +#endif + +public: + int& GetSemId(const int table_no); //for OPTLOCK jinjing 20120428 + void SetSemId(const int table_no, const int sem_id); //for OPTLOCK jinjing 20120428 + int SetSemKey(const int app_no, const int r_table_no, const short ctx_no); //for OPTLOCK + +private: + struct DB_APP_TAB* m_AppTabPtr; //App info area + struct DB_SYSTEM_TAB* m_SysTabPtr; + struct DB_STATICS_TAB* m_StaticsTabPtr; + struct DB_CTRL_TAB* m_CtrlTabPtr; //Ctrl info area + + struct DB_CTRL_TAB* m_CurCtrlTabPtr; //current table's Ctrl info + struct STDB_TAB* m_StdbTabPtr; // + struct STDB_TAB* m_StdbRootTabPtr; //only for area table's root + struct SEQUENT_TAB* m_SequentTabPtr; // + struct STDB_FIELD_TAB* m_StdbFieldTabPtr; // + + //std::map m_DbFilePtr; + char* m_DbFilePtr[MAX_APP_TABLE]; + char* m_AreaFilePtr[MAX_APP_TABLE][MAX_AREA_NUM]; //only for area table's root + time_t m_DbOpenTime[MAX_APP_TABLE]; //for re-open tables when download + int m_MapSize[MAX_APP_TABLE]; //for re-open tables when download + int m_SemId[MAX_APP_TABLE+1]; //for OPTLOCK + int m_CurTableNo; //for OPTLOCK + char* m_SequentAreaPtr; //current sequent area + char* m_DataAreaPtr; //current data area + + int m_CurRecordPointer; //current record position + int m_CurAreaNo; + int m_LastAreaNo; //only for GetPKIdxPtr + int m_LastIdxAreaNo[MAX_AREA_IDX_NUM]; //only for GetIndexPtr + char m_FileName[120]; //current table's physical file name + char m_RootFileName[120]; //only for area table's root + +#ifdef _APP_SYS_SUBSTATION + struct STDB_VIR_FIELD_TAB* m_StdbVirFieldTabPtr; //virtual field + friend class CTableOp; + //friend class ::CTestItem; + friend class ::CaseConGet; + friend class ::TestItem; +#endif + //for Recreate Index Shm + friend class Tab2Idx; + + //Only for Test Case + friend class ::CaseSearch; + friend class ::CaseTableWrite; + friend class ::CaseDeleteIndex; +}; + +} + +#endif diff --git a/code/sys_nicmonitor/include/db_api/odb_tablebase.h b/code/sys_nicmonitor/include/db_api/odb_tablebase.h new file mode 100644 index 0000000..523d114 --- /dev/null +++ b/code/sys_nicmonitor/include/db_api/odb_tablebase.h @@ -0,0 +1,179 @@ +/******************************************************************************* +ModuleName: ODB Real Time Database management system +FileName: odb_tablebase.h +DESCRIPTION: class system interface define +FUNCTION LIST: +COMMENT: +History: +Date Version Modifier Activities +2003-09-10 1.0 modify +2003-12-03 1.1 modify +================================================================================ +2003-09-10 1.0 created +*******************************************************************************/ +#ifndef __ODB_TABLEBASE_H__ +#define __ODB_TABLEBASE_H__ + +#include +#ifndef __ODB_PUBLIC_H__ +#include "db_api/odb_public.h" +#endif + +#include "db_api/odb_prv_struct.h" + +/* +#ifndef __ODB_INCLUDE_H__ +#include "odb_include.h" +#endif +*/ +/* +#ifndef __ODB_BASEBUFFER_H__ +#include "odb_basebuffer.h" +#endif +*/ +#include "pub.h" + +#ifdef _WINDOWS64 +#ifdef ODB_API_LIB_EXPORTS +#define ODB_API_LIB_API __declspec(dllexport) +#else +#define ODB_API_LIB_API __declspec(dllimport) +#endif +#else +#define ODB_API_LIB_API +#endif + +using namespace std; + +namespace ODB +{ +class ODB_API_LIB_API CTableBase +{ +public: + + CTableBase(){} + virtual ~CTableBase(){} + // + //query the whole table + // + virtual int TableGet(CBuffer& buf_base) { return 0; } + virtual int TableGet(const int field_no, CBuffer& buf_base) { return 0; } + virtual int TableGet(const char* field_name, CBuffer& buf_base) { return 0; } + virtual int TableGet(const std::vector& vec_field_no, CBuffer& buf_base) { return 0; } + + // + //query by key word + // + virtual int TableGetByKey(const char* key_ptr, char* buf_ptr, const int buf_size) { return 0; } + virtual int TableGetByKey(const char* key_ptr, const int field_no, char* field_buf_ptr, const int buf_size) { return 0; } + virtual int TableGetByKey(const char* key_ptr, const char* field_name, char* field_buf_ptr, const int buf_size) { return 0; } + virtual int TableGetByKey(const char* key_ptr, const std::vector& vec_field_no, char* field_buf_ptr, const int buf_size) { return 0; } + virtual int TableGetByKey(const char* key_ptr, const int keybuf_size, const std::vector& vec_field_no, char* field_buf_ptr, const int buf_size) { return 0; } + + // + //modify + // + virtual int TableModify(const char* buf_ptr, const int record_num, const int record_size) { return 0; } + virtual int TableModify(const int field_no, const char* field_buf_ptr, const int buf_size) { return 0; } + virtual int TableModify(const char* field_name, const char* field_buf_ptr, const int buf_size) { return 0; } + virtual int TableModify(const std::vector& vec_field_no, const char* field_buf_ptr, const int buf_size) { return 0; } + + + // + //by keyword && fields + // + virtual int TableModifyByKey(const char* key_ptr, const int field_no, const char* field_buf_ptr, const int buf_size) { return 0; } + virtual int TableModifyByKey(const char* key_ptr, const char* field_name, const char* field_buf_ptr, const int buf_size) { return 0; } + virtual int TableModifyByKey(const char* key_ptr, const std::vector& vec_field_no, const char* field_buf_ptr, const int buf_size) { return 0; } + + + // + //SQL interface + // + virtual int SqlGet(const char* str_sql, CBuffer& buf_base) { return 0; } + + virtual int SqlGet(const char* str_sql, char** buf_ptr, int& buf_size) { return 0; } + +public: + // + //table PARA + // + virtual int GetTablePara(short& field_num, int& record_num, int& record_size) { return 0; } + virtual int GetTablePara(struct TABLE_PARA& table_para, std::vector& vec_field_para) { return 0; } + virtual int GetTablePara(const char* str_attribute, char** field_para_ptr, int& buf_size) { return 0; } + + virtual int GetFieldInfo(const std::vector vec_field_no, std::vector& vec_field) { return 0;} + +public: + //Name and No + virtual int GetAppNameByNo(char* app_name, const int app_no) = 0; + virtual int GetAppNoByName(int& app_no, const char* app_name) = 0; + + virtual int GetTableNameByNo(char* table_name, const int table_no, const bool is_eng=true) = 0; + virtual int GetTableNoByName(int& table_no, const char* table_name, const bool is_eng=true) = 0; + + virtual int GetFieldNameByNo(char* field_name, const int field_no, const bool is_eng=true) = 0; + virtual int GetFieldNoByName(int& field_no, const char* field_name, const bool is_eng=true) = 0; + +public: + virtual int MenuRead(const char* menu_name, std::vector& vec_menu, const int menu_status=MENU_ON){ return 0; } + + virtual int TableReleMenuRead(const int table_no, std::vector& vec_menu){ return 0; } + + virtual int GetRefMenuString(const int table_no, std::vector& vec_menu){ return 0; } + + virtual int GetNameStringByRtdbKeyID(const RTDB_KEY_STRU& keyid_stru, string& ref_string){ return 0; } + virtual int GetNameStringByRtdbKeyID(const std::vector& vec_keyid, std::vector& vec_ref_string){ return 0; } + + virtual int GetNameStringByID(const cmnInt64 reference_id, string& ref_string){ return 0; } + + virtual int GetNameStringBykey(const char* key_ptr, string& ref_string){ return 0; } + + virtual int GetNameStringByAppKeyID( const std::vector& vec_appkeyid, std::vector& vec_name_string){ return 0; } + + virtual int GetNameStringByAppID( const std::vector& vec_appid, std::vector& vec_name_string){ return 0; } + + virtual int ColMeasType( const std::vector vec_keyid , std::vector& vec_col_prop ) { return 0; } +// virtual int GraphGetAppInfo(const struct ODB::GRAPH_ORDER_KEY_REQ& graph_req, struct ODB::GRAPH_ORDER_KEY_RSP& graph_rsp) const; +// virtual int GraphGetData(const struct CODB_NET::GRAPH_REAL_REQ& real_req, CODB_NET::GRAPH_REAL_RSP_var& real_rsp) const; + +public: + virtual int GetFacNameByKeyNo(const int table_no, const char* key_ptr, string& ref_string) { return 0; } + virtual int GetFacNameByFacID(char* fac_name, const cmnInt64 fac_id) { return 0; } + virtual int GetFacNameByFacNo(char* fac_name, const int fac_no) { return 0; } + + virtual int GetFacIDByFacName(cmnInt64& fac_id, const char* fac_name) { return 0; } + virtual int GetFacNoByFacName(int& fac_no, const char* fac_name) { return 0; } + + virtual int GetFacIDByFacNo(cmnInt64& fac_id, const int fac_no) { return 0; } + virtual int GetFacNoByFacID(int& fac_no, const cmnInt64 fac_id) { return 0; } + +//wj added on 20081205 +public: + virtual int TableWrite(const char* buf_ptr, const int record_num, const int record_size) { return 0; } + virtual int TableWrite(const char* buf_ptr, const int buf_size) { return 0; } + virtual int DeleteRecord(const char* key_ptr) { return 0; } + virtual int TableClear() { return 0; } + virtual int GetFieldPara(struct FIELD_BASE_INFO& field_info){ return 0; } + +public: + virtual int StartSession(){ return 0; } + virtual int CloseSession(){ return 0; } + +}; + +namespace SESSION_CONST{ + const int SESSION_LOCK = 1; + const int SESSION_FREE = 0; +} + +struct ODB_SESSION{ + unsigned int session_id; + unsigned int thread_id; + unsigned int session_lock_flag; + pthread_mutex_t session_mutex; +}; + +} + +#endif diff --git a/code/sys_nicmonitor/include/db_api/odb_tablemgr.h b/code/sys_nicmonitor/include/db_api/odb_tablemgr.h new file mode 100644 index 0000000..d755ba0 --- /dev/null +++ b/code/sys_nicmonitor/include/db_api/odb_tablemgr.h @@ -0,0 +1,53 @@ +/******************************************************************************* +ModuleName: ODB Real Time Database management system +FileName: odb_tablemgr.h +DESCRIPTION: for application ctrl +FUNCTION LIST: +COMMENT: for net access +History: +Date Version Modifier Activities +2003-08-19 1.0 modify +================================================================================ +2003-08-18 1.0 created +*******************************************************************************/ + +#ifndef __ODB_TABLEMGR_h__ +#define __ODB_TABLEMGR_h__ + +#ifndef __ODB_TABLEOP_H__ +#include "db_api/odb_tableop.h" +#endif + +#ifdef _WINDOWS64 +#ifdef ODB_API_LIB_EXPORTS +#define ODB_API_LIB_API __declspec(dllexport) +#else +#define ODB_API_LIB_API __declspec(dllimport) +#endif +#else +#define ODB_API_LIB_API +#endif + +namespace ODB +{ +class ODB_API_LIB_API CTableMgr: public CTableOp +{ +public: + CTableMgr(); + ~CTableMgr(); + +public: + int LoadContxt(); + int LoadContxt (const short context_no); + int MoveTo (const short context_no); + + char* GetSysContxtTabPtr(); + struct DB_CONTEXT_TAB* GetCurContextTabPtr(); + + int ShiftTo (const int app_no); + struct DB_APP_TAB* GetCurAppTabPtr(); +}; + +} + +#endif diff --git a/code/sys_nicmonitor/include/db_api/odb_tablenet.h b/code/sys_nicmonitor/include/db_api/odb_tablenet.h new file mode 100644 index 0000000..7cb47ab --- /dev/null +++ b/code/sys_nicmonitor/include/db_api/odb_tablenet.h @@ -0,0 +1,327 @@ +/******************************************************************************* +ModuleName: ODB Real Time Database management system +FileName: odb_tablenet.h +DESCRIPTION: for class CTableNet of net access +FUNCTION LIST: +COMMENT: for net access +History: +Date Version Modifier Activities +2004-06-25 1.1 add context_no parameter +2003-01-09 1.0 modify +2003-12-20 1.0 modify +================================================================================ +2003-01-09 1.0 created +*******************************************************************************/ +#ifndef __ODB_TABLENET_h__ +#define __ODB_TABLENET_h__ + +#ifndef __ODB_COMMON_H__ +#include "odb_common.h" +#endif + +#ifndef __PROFILE_FILE_H__ +#include "db_api/odb_profile.h" +#endif + +#ifndef __ODB_TABLEBASE_H__ +#include "db_api/odb_tablebase.h" +#endif + +#ifndef __ODB_NETFACTORY_h__ +#include "db_api/odb_netfactory.h" +#endif + +#ifndef __ODB_TABLE_H__ +#include "db_api/odb_table.h" +#endif + +#include "task_service.h" +#include "odb_net_m.h" +#include "codb_net.h" +#include + +#ifdef _WINDOWS64 +#ifdef ODB_API_LIB_EXPORTS +#define ODB_API_LIB_API __declspec(dllexport) +#else +#define ODB_API_LIB_API __declspec(dllimport) +#endif +#else +#define ODB_API_LIB_API +#endif + +using namespace std; +//using namespace RTDB_SERVER; +using namespace ODB; + +//============================================================================// + +namespace NET_ODB +{ + typedef struct + { + std::string scn_name; + std::string subscn_name; + int type; + } TTableNetPriv; + + +class ODB_API_LIB_API CTableNet: public CTableBase +{ +public: + CTableNet(); + CTableNet(const int app_no, const short context_no = 0); + CTableNet(const int app_no, const int table_no, const short context_no=0); + CTableNet(const std::string& scenario_name, const int scenario_inst_no, const std::string& sub_scenario_name, const int sub_scenario_inst_no, const int table_no); + CTableNet(const int scenario_no, const int scenario_inst_no, const int sub_scenario_no, const int sub_scenario_inst_no, const int table_no); + + ~CTableNet(); + + int Open(const int app_no, const int table_no, const short context_no=0); + int Open(const int table_no); + cmnInt32 Open (const std::string& scenario_name, + const int scenario_inst_no, + const std::string& sub_scenario_name, + const int sub_scenario_inst_no, + int table_no); + cmnInt32 Open (const int scenario_no, + const int scenario_inst_no, + const int sub_scenario_no, + const int sub_scenario_inst_no, + const int table_no); + + int SetAppNo(const int app_no, const short context_no = 0); + int SetHostMode(const char* host_name); + //int SetManagedMode(const bool is_managed); + + int SetScenario (const std::string& scenario_name, + const int scenario_inst_no, + const std::string& sub_scenario_name, + const int sub_scenario_inst_no); + int SetScenario (const int scenario_no, + const int scenario_inst_no, + const int sub_scenario_no, + const int sub_scenario_inst_no); + +public: + int TableGet(CBuffer& buf_base); + int TableGet(CBuffer& buf_base, short area_no); + int TableGetWithAreaSplit(const int field_no, CBuffer& buf_base, short area_no); + int TableGetWithOrder(CBuffer& buf_base); + int TableGetSplit(const int field_no, CBuffer& buf_base); +#ifdef _APP_SYS_SUBSTATION + int TableGetAll(CBuffer& buf_base); //Get all columns included virtual columns +#endif + int TableGet(const int field_no, CBuffer& buf_base); + int TableGet(CBuffer& buf_base, const int upper, const int lower);//add select * from XXXX limit (lower, upper); + int TableGetSplit(const char* field_name, CBuffer& buf_base); + int TableGetSplit(CBuffer& buf_base, const int upper, const int lower); + int TableGet(const char* field_name, CBuffer& buf_base); + int TableGet(const char* field_name, CBuffer& buf_base, const int upper, const int lower, std::vector& vec_mem); + int TableGetSplit (const std::vector& vec_field_no, CBuffer& buf_base); + int TableGetSplit(const char* field_name, CBuffer& buf_base, const int upper, const int lower, const std::vector& vec_mem); + int TableGet(const std::vector& vec_field_no, CBuffer& buf_base); + int FormKEYCondition(const char* column_name_eng, const RTDB_KEY_STRU& key_value, const char* op, std::string& cond_str); + int SqlGetSplit(const char* str_sql, CBuffer& buf_base); + int SqlGetSplit(const char* keyid_sql, const std::vector& vec_field_no, const int upper, const int lower, CBuffer& buf_base, const std::vector& vec_mem); + int SqlGet(const char* str_sql, CBuffer& buf_base); + int SqlGet(const char* str_sql, CBuffer& buf_base, std::vector& vec_mem); + int SqlGet(const char* str_sql, CBuffer& buf_base, short area_no); + int SqlGetWithAreaSplit(const char* str_sql, CBuffer& buf_base, short area_no); + int SqlGetSplitWithOrder(const char* str_sql, CBuffer& buf_base); +////// + int TableGet(char** buf_ptr, int& buf_size); + int TableGetSplit (const int field_no, char** field_buf_ptr, int& buf_size); //all record + int TableGet(const int field_no, char** field_buf_ptr, int& buf_size); //one field of all record + int TableGetSplit (const std::vector& vec_field_no, char** field_buf_ptr, int& buf_size); + int TableGet(const std::vector& vec_field_no, char** field_buf_ptr, int& buf_size); //get many fields of all record + int TableGetSplit (const char* field_name, char** field_buf_ptr, int& buf_size); + int TableGet(const char* field_name, char** field_buf_ptr, int& buf_size); //Added at 2003-11-22 + + int TableGetByKeySplit (const char* key_ptr, const int field_no, char* field_buf_ptr, const int buf_size); + int TableGetByKey(const char* key_ptr, char* buf_ptr, const int buf_size); //one record by key word + int TableGetByKey(const char* key_ptr, const int field_no, char* field_buf_ptr, const int buf_size); //one field of a record + int TableGetByKeySplit (const char* key_ptr, const std::vector& vec_field_no, char* field_buf_ptr, const int buf_size); + int TableGetByKey(const char* key_ptr, const std::vector& vec_field_no, char* field_buf_ptr, const int buf_size); //get many fields of a record + int TableGetByKeySplit (const char* key_ptr, const char* field_name, char* field_buf_ptr, const int buf_size); + int TableGetByKey(const char* key_ptr, const char* field_name, char* field_buf_ptr, const int buf_size); //Added at 2003-11-22 + int TableGetByKeySplit (const char* key_ptr, const int keybuf_size, const std::vector& vec_field_no, char* field_buf_ptr, const int buf_size); + int TableGetByKey(const char* key_ptr, const int keybuf_size, const std::vector& vec_field_no, char* field_buf_ptr, const int buf_size); + + int TableWriteSplit (const char* buf_ptr, const int buf_size); + int TableWrite(const char* buf_ptr, const int buf_size); //write one or more record + int TableWriteSync(const char* buf_ptr, const int buf_size); //write one or more record + int DeleteRecordSplit (const char* key_ptr); + int DeleteRecord(const char* key_ptr); + int DeleteRecordSync(const char* key_ptr); + int DeleteRecordsSplit (const char* key_ptr, int key_num); //delete a record by key word + int DeleteRecords(const char* key_ptr, int key_num); + //key_ptr�Ƕ���ؼ�����ɵ�һ�����飬key_num��ʾɾ���ĸ������������ɾ����ʱ��һ����?�Ӻ���ǰɾ������һ����Ҫ�жϹؼ����Ƿ������������Ķ���ؼ���һ��ɾ����������?�ֳɼ�������ɾ���� + int DeleteAlignedRecordsSplit (const char* key_ptr, int direction); + int DeleteAlignedRecords(const char* key_ptr, int direction = FORWARD); + //direction��ʾ����FORWARD��ʾɾ������key_ptr�ؼ��ֺ���ǰ������м�¼��Ʃ�����key_ptr��Ӧ��9����¼����ô��ɾ����0��9�ļ�¼����BACKWARD��ʾɾ��key_ptr������������м�¼�? + + //int TableModify(const char* buf_ptr, const int buf_size); //unused 2002-11-14 //modify one or many record + int TableModify(const char* buf_ptr, const int record_num, const int record_size); + int TableModify(const int field_no, const char* field_buf_ptr, const int buf_size); //modify one field of all record by field no + + int TableModifyByKeySplit (const char* key_ptr, const int field_no, const char* field_buf_ptr, const int buf_size); + int TableModifyByKey(const char* key_ptr, const int field_no, const char* field_buf_ptr, const int buf_size); //modify one field by key word and field no, only one record + int TableModifyByKeySplit (const char* key_ptr, const int keybuf_size, const std::vector& vec_field_no, const char* field_buf_ptr, const int buf_size); + int TableModifyByKey(const char* key_ptr, const int keybuf_size, const int field_no, const char* field_buf_ptr, const int buf_size); //modify one field or all fields of many records by key word + int TableModifyByKey(const char* key_ptr, const int keybuf_size, const std::vector& vec_field_no, const char* field_buf_ptr, const int buf_size); //modify many fields or all fields of many records by key word + + // + // + int TableModify(const char* field_name, const char* field_buf_ptr, const int buf_size) ; + int TableModify(const std::vector& vec_field_no, const char* field_buf_ptr, const int buf_size); + + int TableModifyByKeySplit (const char* key_ptr, const char* field_name, const char* field_buf_ptr, const int buf_size); + int TableModifyByKey(const char* key_ptr, const char* field_name, const char* field_buf_ptr, const int buf_size); + int TableModifyByKeySplit (const char* key_ptr, const std::vector& vec_field_no, const char* field_buf_ptr, const int buf_size); + int TableModifyByKey(const char* key_ptr, const std::vector& vec_field_no, const char* field_buf_ptr, const int buf_size); + int TableModifyByKeySplit (const char* key_ptr, const int keybuf_size, const char* field_name, const char* field_buf_ptr, const int buf_size); + int TableModifyByKey(const char* key_ptr, const int keybuf_size, const char* field_name, const char* field_buf_ptr, const int buf_size); + int TableModifyByKeySync(const char* key_ptr, const int keybuf_size, const char* field_name, const char* field_buf_ptr, const int buf_size); + int TableModifyByKeySync(const char* key_ptr, const int keybuf_size, const std::vector& vec_field_no, const char* field_buf_ptr, const int buf_size); //modiify many fields or all fields of many records by key word + + int TableUpdateSplit (const char* buf_ptr, const int buf_size); + int TableUpdate(const char* buf_ptr, const int buf_size); //update one or more record + + int TableClearSplit(); + int TableClear(); + // + //SQL interface + // + //int SqlUpdate(const char* str_sql); + int SqlGetSplit (const char* str_sql, char** buf_ptr, int& buf_size); + int SqlGet(const char* str_sql, char** buf_ptr, int& buf_size); + +public: + int GetFieldInfo(std::vector& vec_filed); + int GetFieldInfo(const std::vector vec_field_no, std::vector& vec_field); + + int GetTableParaSplit(short& field_num, int& record_num, int& record_size); + int GetTablePara(short& field_num, int& record_num, int& record_size); + int GetTablePara(struct TABLE_PARA& table_para); + int GetTablePara(struct STDB_FIELD_TAB* field_descrbptr, const int buf_size); + int GetTablePara(struct TABLE_PARA& table_para, struct STDB_FIELD_TAB* field_descrbptr, const int buf_size); + int GetTablePara(struct TABLE_PARA& table_para, struct STDB_FIELD_TAB** field_descrbptr, int& buf_size); + int GetTablePara(struct TABLE_PARA& table_para, std::vector& vec_field_para); + int GetTablePara(const char* str_attribute, char** field_para_ptr, int& buf_size); +#ifdef _APP_SYS_SUBSTATION + int GetTableParaAll(struct TABLE_PARA& table_para, std::vector& vec_field_para); + //jinjing 20120815 + int GetTableParaVir(std::vector& vec_virfield_para); +#endif + //lmj add 2004.1126 + int GetTablePara(struct TABLE_PARA& table_para, CBuffer& buf_base); + int GetTablePara(struct STDB_FIELD_TAB** field_descrbptr, int& buf_size); + + int GetFieldPara(struct FIELD_BASE_INFO& field_info); + + int GetFieldPara(vector& field_info_vec); + + int GetFieldNameByNo(char* field_name, const int field_no, const bool is_eng=true); + int GetFieldNoByName(int& field_no, const char* field_name, const bool is_eng=true); + + int GetTableNameByNo(char* table_name, const int table_no, const bool is_eng=true); + int GetTableNoByName(int& table_no, const char* table_name, const bool is_eng=true); + + int GetAppNameByNo(char* app_name, const int app_no); + int GetAppNoByName(int& app_no, const char* app_name); + + int GetTableNoByName(const char* table_name, const bool is_eng=true); + int GetTableNoByName(std::vector& vec_table_no , const std::vector& vec_table_name, const bool is_eng=true); + int GetTableNameByNo(std::string& table_name, const int table_no, const bool is_eng=true); + + int GetAllOdbNoByAppName(int& app_no, std::vector& vec_table, const char* app_name, const bool is_eng=true); + int GetAllOdbNoByAppNo(char* app_name, std::vector& vec_table, const int app_no, const bool is_eng=true); + + int GetAllOdbNoBySubScenarioName (int& sub_scenario_id, std::vector& vec_table, + const std::string& sub_scenario, const unsigned int sub_scenario_inst, + const std::string& scenario, const unsigned int scenario_inst, const bool is_eng=true); + int GetAllOdbNoBySubScenarioNo (std::string& sub_scenario, std::vector& vec_table, + const int sub_scenario_id, const unsigned int sub_scenario_inst, + const int scenario_id, const unsigned int scenario_inst, const bool is_eng=true); + + int ConGetSplit(const int con_field_no, const char* con_field_value, const int con_value_size, CBuffer& buf_base); + int ConGet(const int con_field_no, const char* con_field_value, const int con_value_size, CBuffer& buf_base); + int ConGetSplit(const int get_field_no, const int con_field_no, const char* con_field_value, const int con_value_size, CBuffer& buf_base); + int ConGet(const int get_field_no, const int con_field_no, const char* con_field_value, const int con_value_size, CBuffer& buf_base); + int ConGetSplit(const vector& con_field_no_array, const vector& get_field_no_array, char* con_field_value, const int con_value_size, CBuffer& buf_base); + int ConGet(const vector& con_field_no_array, const vector& get_field_no_array, char* con_field_value, const int con_value_size, CBuffer& buf_base); + +public: + int PingRtdbServer(int req_data , int & rep_data); + int GetKeySize(const int table_no); //wj added for d5000 C-API + +public: + int SetDomainName(const char* domain_name); + int SetSecLabel(tSecLabel& sec_label); + void ClearDomainName(); + int SetSliceNo(cmnUint32 slice_no); + +private: + int TableModify(const char* buf_ptr, const int buf_size); + +private: +// public: + int Start(); + int Refresh(); + int Refresh(int app_no); + int GetSliceByKey(const char* key, cmnUint32& slice_no); + int GetAllSlice(vector& slice_no); + + int ParseRsp(char** buf_ptr, int& buf_size, const RTDB_PROTO::RSP_READ& read_rsp); + int ParseRsp(char* buf_ptr, const int buf_size, const RTDB_PROTO::RSP_READ& read_rsp); + int GetKeyInfo(); + int GetKeyInfoSlice(); + inline int slice_app_to_no(int slice_app_no){return slice_app_no % 1000;} + inline int slice_no_to_app(int slice_no){return slice_no+AP_SCADA_AREA;} + + bool IsApplication(const int app_no); + +private: + CTableNet(const CTableNet&); + CTableNet& operator=(const CTableNet&); + +private: + RTDB_SERVER::CODB_NET* m_OdbNet; + CNetFactory* m_Factory; + //Handle m_Handle; //for service_bus + + NProfile::CProfile *m_IniFile; + // + short m_ContextNo; + int m_AppNo; + int m_TableNo; + +// std::string m_scenario_name; + int m_scenario_no; +// std::string m_sub_scenario_name; + int m_sub_scenario_no; + int m_scenario_inst_no; + int m_sub_scenario_inst_no; + + DB_BYTE_T m_ByteTag; + + bool m_IsSysAdmHost; + char m_HostName[MAX_NAME_STRING_LEN]; + + char m_DomainName[40]; + tSecLabel m_SecLabel; + bool m_IsRemote; + int m_SliceNo; + TaskService* task_service; + + std::vector m_VecKey; + std::vector m_IsSliced; + std::vector m_VecField; + + TTableNetPriv *m_pPrvStru; +}; + +} + +#endif diff --git a/code/sys_nicmonitor/include/db_api/odb_tableop.h b/code/sys_nicmonitor/include/db_api/odb_tableop.h new file mode 100644 index 0000000..2f777d0 --- /dev/null +++ b/code/sys_nicmonitor/include/db_api/odb_tableop.h @@ -0,0 +1,658 @@ +/******************************************************************************* +ModuleName: ODB Real Time Database management system +FileName: odb_tableop.h +DESCRIPTION: class system struct define +FUNCTION LIST: +COMMENT: +History: +Date Version Modifier Activities +1004-06-28 1.1 add context_no parameter +2002-11-06 1.0 modify +================================================================================ +2002-10-30 1.0 created +*******************************************************************************/ +#ifndef __ODB_TABLEOP_H__ +#define __ODB_TABLEOP_H__ + +#ifndef __ODB_SYSTEM_H__ +#include "db_api/odb_system.h" +#endif + +#ifndef __ODB_TABLE_H__ +#include "db_api/odb_table.h" +#endif + +#ifndef __ODB_FIELD_H__ +#include "db_api/odb_field.h" +#endif + +#ifndef __ODB_WHERE_H__ +#include "db_api/odb_where.h" +#endif + +#ifndef __ODB_TABLEBASE_H__ +#include "db_api/odb_tablebase.h" +#endif + +#include "db_api/odb_baseindex.h" + +#include "slice_api/logic_table.h" + +using namespace std; +//using namespace ODB_SLICE; +#ifdef _APP_SYS_SUBSTATION +class CaseSearch; +class CaseConGet; +class CaseTableModifyByKey; +class CaseTableWrite; +class CaseDeleteRecord; +class CaseTableUpdate; +class CaseDeleteIndex; +class CaseHashPKDebug; +class idx_mon; +class CaseShowIndexStatus; +class CDyDownload; +class TestItem; +#endif + +namespace ODB +{ +typedef struct +{ + int type; +} TTableOpPriv; + +// enum DIRECTION +// { +// FORWARD = 0, +// BACKWARD = 1 , +// }; + + +class CTableOp: public CTableBase +{ +public: + // + //constructor & destructor // 2002-11-06 + // + CTableOp(); //then Open() + CTableOp (const int app_no, const int table_no, const short context_no = 0); + CTableOp (const int app_no, const char* table_name, const short context_no = 0); + CTableOp (const std::string& scenario_name, const int scenario_inst_no, const std::string& sub_scenario_name, const int sub_scenario_inst_no, const int table_no); + CTableOp (const int scenario_no, const int scenario_inst_no, const int sub_scenario_no, const int sub_scenario_inst_no, const int table_no); + CTableOp (const char* app_name, const int table_no, const short context_no = 0); + CTableOp (const char* app_name, const char* table_name, + const short context_no = 0); + CTableOp (const string& app_name, const string& table_name, + const short context_no = 0); + CTableOp (const int app_no, const short context_no = 0); + //CTableOp(const char* context_name); //abandon context_name // 2004-06-25 + + ~CTableOp(); + + int SetAppNo (const int app_no, const short context_no = 0); + //int Open(const std::pair&, const short context_no = 0); + int Open (std::pair, short context_no = 0); //this is no longer used + cmnInt32 Open (const int app_no, const int table_no, + const short context_no = 0); + cmnInt32 Open (const char* app_name, const int table_no, + const short context_no = 0); // + cmnInt32 Open (const int app_no, const char* table_name, + const short context_no = 0); // 2004-06-25 + cmnInt32 Open (const char* app_name, const char* table_name, + const short context_no = 0); // + cmnInt32 Open (const cmnUint32 app_no, const char* table_name, + const cmnInt32 slice_no, const cmnUint16 context_no); + cmnInt32 Open (const cmnUint32 app_no, const cmnUint32 table_no, + const cmnInt32 slice_no, const cmnUint16 context_no); + cmnInt32 Open (const std::string& scenario_name, + const int scenario_inst_no, + const std::string& sub_scenario_name, + const int sub_scenario_inst_no, + const int table_no); + cmnInt32 Open (const int scenario_no, + const int scenario_inst_no, + const int sub_scenario_no, + const int sub_scenario_inst_no, + const int table_no); + cmnInt32 SetScenario(const std::string& scenario_name, + const int scenario_inst_no, + const std::string& sub_scenario_name, + const int sub_scenario_inst_no); + cmnInt32 SetScenario(const int scenario_no,const int scenario_inst_no,const int sub_scenario_no,const int sub_scenario_inst_no); + + int SetSliceNo (cmnInt32 _slice_no); + + //create & delete +#ifdef _APP_SYS_SUBSTATION + cmnInt32 TableCreate (const struct STDB_CREAT_REQ* stdb_creat_req_ptr, + const struct FIELD_CREAT_REQ* multi_fields_ptr, + const struct VIR_FIELD_CREAT_REQ* vir_fields_ptr, + const std::vector& vec_offset, + INDEX_DEFINE_ARRAY &index_define_array); //������ɾ������,���������������� +#endif + cmnInt32 TableCreate (const struct STDB_CREAT_REQ* stdb_creat_req_ptr, + const struct FIELD_CREAT_REQ* multi_fields_ptr, + const std::vector& vec_offset, + INDEX_DEFINE_ARRAY &index_define_array); + + cmnInt32 TableWrite (const char* buf_ptr, const cmnUint32 record_num, + const cmnUint32 record_size); + cmnInt32 TableWrite (const char* buf_ptr, + const cmnUint32 buf_size); //write one or many records + cmnInt32 TableWriteWithoutIndex (const char* buf_ptr, const cmnUint32 record_num, + const cmnUint32 record_size); + cmnInt32 TableWriteWithoutIndex (const char* buf_ptr, + const cmnUint32 buf_size);//int TableDelete(const int app_no, const int table_no, const char* passwd_ptr); //delete by table no + + cmnInt32 TableWriteNoSlice (const char* buf_ptr, const cmnUint32 record_num, + const cmnUint32 record_size); + cmnInt32 TableWriteNoSlice (const char* buf_ptr, + const cmnUint32 buf_size);//int TableDelete(const int app_no, const int table_no, const char* passwd_ptr); //delete by table no + + //int TableDelete(const int app_no, const char* table_name, const char* passwd_ptr); //delete by table name + + int TableClear(); //clear a table + int TableClear(int slice_no); + // + //query the whole table + // + cmnInt32 TableGet (CBuffer& buf_base); + cmnInt32 TableGetWithArea (CBuffer& buf_base, unsigned char area_no); + cmnInt32 TableGet (const int field_no, CBuffer& buf_base); + int TableGet (const char* field_name, CBuffer& buf_base); + int TableGet (const std::vector& vec_field_no, CBuffer& buf_base); + + // + cmnInt32 TableGet (char* buf_ptr, const int buf_size); //get all record of a table + + cmnInt32 TableGet (char** buf_ptr, cmnUint32& buf_size); + cmnInt32 TableGet (char** buf_ptr, int& buf_size); + cmnInt32 TableGet (const int field_no, char** field_buf_ptr, + cmnUint32& buf_size) ; //get one field of all record by field no + cmnInt32 TableGet (const int field_no, char** field_buf_ptr, + int& buf_size) ; + int TableGet (const char* field_name, char** field_buf_ptr, + cmnUint32& buf_size); + int TableGet (const char* field_name, char** field_buf_ptr, + int& buf_size); + //get one or many fields of all record by field name //2002-11-20 + int TableGet (const std::vector& vec_field_no, char** field_buf_ptr, + cmnUint32& buf_size);//get one or many fields of all record + int TableGet (const std::vector& vec_field_no, char** field_buf_ptr, + int& buf_size); + // + //query by key word + // + cmnInt32 TableGetByKey (const char* key_ptr, char* buf_ptr, + const int buf_size); // get one record by key word + + cmnInt32 TableGetByKey (const char* key_ptr, const int field_no, + char* field_buf_ptr, const int buf_size); //get one field of one record by field no & key word + cmnInt32 TableGetByKey (const char* key_ptr, const int field_no, + char* field_buf_ptr, const int buf_size, int& data_type, int& data_len); + + int TableGetByKey (const char* key_ptr, const std::vector& vec_field_no, + char* field_buf_ptr, const int + buf_size); //get one or many fields by field no & key word + int TableGetByKey (const char* key_ptr, const char* field_name, + char* field_buf_ptr, const int buf_size); //get one or many fields by field name & key word + + int TableGetByKey (const char* key_ptr, const int keybuf_size, + const std::vector& vec_field_no, char* field_buf_ptr, + const int buf_size); //many key words + +public: + int TableGet (const std::vector& vec_field_no, char** field_buf_ptr, + cmnUint32& buf_size, std::vector& vec_offset); + int TableGet (const std::vector& vec_field_no, char** field_buf_ptr, + int& buf_size, std::vector& vec_offset); + int TableGetByKey (const char* key_ptr, const std::vector& vec_field_no, + char* field_buf_ptr, const int buf_size, + std::vector& vec_offset); + int TableGetByKey (const char* key_ptr, const int keybuf_size, + const std::vector& vec_field_no, char* field_buf_ptr, const int buf_size, + std::vector& vec_offset); + + //lmj add 2004.1125 + int TableGetByKeyAligned (const char* key_ptr, + const std::vector& vec_field_no, char* field_buf_ptr, const int buf_size, + std::vector& vec_offset); + int TableGetByKeyAligned (const char* key_ptr, const int keybuf_size, + const std::vector& vec_field_no, char* field_buf_ptr, const int buf_size, + std::vector& vec_offset); + + cmnInt32 TableGetBySlice ( + const cmnUint32 slice_no, + const cmnUint32 phy_pos, + char* buffer, + const cmnUint32 buf_size + ); + cmnInt32 TableGetByRange (cmnUint32 start, cmnUint32 end, char** buffer, + cmnUint32& buf_size); + cmnInt32 GetSliceByKey (const char* key_ptr, cmnUint32 &slice_no, + cmnUint32 &phy_pos); + + + // + //the whole record //modify // 2002-11-12 + // +public: + int TableModify (const char* buf_ptr, const int record_num, + const int record_size); //modify one or many record + int TableModify (const char* buf_ptr, const int buf_size); + + // + //many fields of all record + // + int TableModify (const int field_no, const char* field_buf_ptr, + const int buf_size); //modify one field of all record by field no + int TableModify (const char* field_name, const char* field_buf_ptr, + const int buf_size); //modify one or many fields of all record by field name + int TableModify (const std::vector& vec_field_no, + const char* field_buf_ptr, + const int buf_size); //modify many fields of all record by field no + + // + //by keyword && fields + // + cmnInt32 TableModifyByKey (const char* key_ptr, const int field_no, + const char* field_buf_ptr, + const int buf_size); //modify one field by key word and field no + int TableModifyByKey (const char* key_ptr, const char* field_name, const char* field_buf_ptr, const int buf_size); //modify many fields by key word and field name + int TableModifyByKey (const char* key_ptr, const std::vector& vec_field_no, const char* field_buf_ptr, const int buf_size); //modify many fields by field no + int TableModifyByKeyMulFlds (const char* key_ptr, const int field_num, ...); + + //lmj add 2004.1125 + int TableModifyByKeyAligned (const char* key_ptr, + const std::vector& vec_field_no, const char* field_buf_ptr, + const int buf_size, std::vector& + vec_offset); //modify many fields by field no + + // + //by keywords && fields + // + int TableModifyByKey (const char* key_ptr, const int keybuf_size, const int field_no, const char* field_buf_ptr, const int buf_size); //modify one field or all fields of many records by key word + + int TableModifyByKey (const char* key_ptr, const int keybuf_size, const char* field_name, const char* field_buf_ptr, const int buf_size); //modify many fields or all fields of many records by key word + int TableModifyByKey (const char* key_ptr, const int keybuf_size, const std::vector& vec_field_no, const char* field_buf_ptr, const int buf_size); //the same as above + + //lmj add 2004.1125 + int TableModifyByKeyAligned (const char* key_ptr, const int keybuf_size, + const std::vector& vec_field_no, const char* field_buf_ptr, + const int buf_size, std::vector& + vec_offset); //the same as above + + + // + //update & delete // 2002-11-12 + // + int TableUpdate (const char* buf_ptr, + const int buf_size); //update one or more record + + int TableUpdate (const char* key_ptr, const char* buf_ptr, + const int buf_size, const cmnUint32 slice_no); //update one or more record + + int TableUpdate (const char* buf_ptr, const int record_num, + const int record_size); + + int GetDefaultRecord (char *defaut_rec_ptr); + + int TableUpdate ( const int field_no, const char* buf_ptr, const int buf_size); + int TableUpdate ( vector field_vec, const char* buf_ptr, + const int buf_size); + int TableUpdate ( const char* field_name, const char* buf_ptr, + const int buf_size); + + int DeleteRecord (const char* key_ptr);//delete a record by key word + + int DeleteRecords (const char* key_ptr, int key_num); + int DeleteAlignedRecords (const char* key_ptr, int direction = FORWARD); + + // + //query by condition //aligned + // + cmnInt32 ConGet (const int con_field_no, const int con_field_value, + char* buf_ptr, const int buf_size); //one record by field(int) + cmnInt32 ConGet (const int con_field_no, const cmnInt32 con_field_value, + char** buf_ptr, cmnUint32& + buf_size); //one record by field(int) + cmnInt32 ConGet (const int con_field_no, const char* con_field_value, + char** buf_ptr, cmnUint32& + buf_size); //one record by field(string) + + cmnInt32 ConGet (const int get_field_no, const int con_field_no, + const char* con_field_value, char** buf_ptr, + int& buf_size); //one field by field(string) + + cmnInt32 ConGet (const int get_field_no, const int con_field_no, + const char* con_field_value, char** buf_ptr, + cmnUint32& buf_size); + cmnInt32 ConGet (const int con_field_no, const cmnInt64 con_field_value, + char **buf_ptr, int &buf_size); + cmnInt32 ConGet (const int con_field_no, const cmnInt64 con_field_value, char** buf_ptr, cmnUint32 &buf_size); + cmnInt32 ConGet (const int get_field_no, const int con_field_no, + const long con_field_value, char **buf_ptr, cmnUint32& buf_size); + int ConGet (const std::vector& con_field_no_array, + const std::vector& get_field_no_array, char *con_buf_ptr, char **buf_ptr, + int &buf_size); + + int ConGet (const int con_field_no, const int con_field_value, char** buf_ptr, + int& buf_size); //one record by field(int) + int ConGet (const int con_field_no, const char* con_field_value, char** buf_ptr, + int& buf_size); //one record by field(string) + int ConGet (const int get_field_no, const int con_field_no, + const int con_field_value, char* buf_ptr, + const int buf_size);//one field by field(int) + + int ConGet (const int get_field_no, const int con_field_no, + const cmnInt64 con_field_value, char **buf_ptr, int& buf_size); + + + int ConGetAreaTable (const int con_field_no, const char* con_field_value, + char** buf_ptr, int& buf_size); + int ConGetAreaTable (const int get_field_no, const int con_field_no, + const char* con_field_value, char** buf_ptr, int& buf_size); + int ConGetAreaTable (const std::vector& con_field_no_array, + const std::vector& get_field_no_array, char* con_buf_ptr, char** buf_ptr, + int& buf_size); + + int ConGetByMeasID (const int get_field_no, const char* con_field_value, + char** buf_ptr, int& buf_size); + int ConGetByMeasID (const char* con_field_value, char** buf_ptr, int& buf_size); + int ConGetByMeasID (const std::vector& get_field_no_array, + char* con_field_value, char** buf_ptr, int& buf_size); + //Added for new structure and new function for D-5000 end + + // + //sort record by condition //aligned + // + int SortGet (const int field_no, char* bu_fptr, const int buf_size, + const bool is_asc = true); //one field and sorted by it + int SortGet (const char* field_name, char* bu_fptr, const int buf_size, + const bool is_asc = true); //many fields and sorted by them + int SortGet (const std::vector& vec_field_no, char* buf_ptr, + const int buf_size, const bool is_asc = + true); //many fields and sorted by them + int SortGet (char* buf_ptr, const int buf_size, + const bool is_asc = + true); //get key word & index field and sorted by index + + // + //SQL interface + // + int SqlUpdate (const char* str_sql); + int SqlGet (const char* str_sql, CBuffer& buf_base); + int SqlGet (const char* str_sql, char** buf_ptr, int& buf_size); + int SqlGet (const char* str_sql, char** buf_ptr, int& buf_size, + std::vector& vec_offset); + + int FormKEYCondition(const char* column_name_eng, const RTDB_KEY_STRU& key_value, const char* op, std::string& cond_str); +public: + int GetTablePara (short& field_num, int& record_num, int& record_size); + int GetTablePara (struct TABLE_PARA& table_para); + int GetTablePara (struct STDB_FIELD_TAB* &field_para_ptr, int &buf_size); + int GetTablePara (struct TABLE_PARA& table_para, + struct STDB_FIELD_TAB* &field_para_ptr, int &buf_size); + int GetTablePara (struct TABLE_PARA& table_para, + std::vector& vec_field_para); + //int GetTablePara(std::vector& vec_field_para); // 2003-05-21 + int GetTablePara (const char* str_attribute, char** field_para_ptr, + int& buf_size); + int GetTablePara (const char* str_attribute, char** field_para_ptr, + int& buf_size, std::vector& vec_offset); //by net daemon +#ifdef _APP_SYS_SUBSTATION + int GetTableParaAll (const char* str_attribute, char** field_para_ptr, + int& buf_size, std::vector& vec_offset); //by net daemon + + //jinjing 2012-03-27 with virtual field + int GetTableParaAll (struct TABLE_PARA& table_para, + std::vector& vec_field_para); + int GetTableParaVir (std::vector& vec_virfield_para); +#endif + // int GetRecordNum(); + // int GetKeyWordLength(); + + // + //field's parameter + // + int GetFieldEngNameByNo (char* field_name, const int field_no); + int GetFieldChnNameByNo (char* field_name, const int field_no); + int GetFieldNameByNo (char* field_name, const int field_no, + const bool is_eng = true); + + int GetFieldNoByName (int& field_no, const char* field_name, + const bool is_eng = true); //only one + int GetFieldNoByName (std::vector& vec_field_no, + const char* field_name); //many fields + + int SetFieldNameByNo (const char* field_name, const int field_no); + + int GetFieldNoBySql (std::vector& vec_field_no, const char* str_sql); + //int GetRtNoByFieldNo(int& field_no, const int r_field_no); + + // + //table's parameter + // + int GetTableNameByNo (char* table_name, const int table_no, + const bool is_eng = true); + int GetTableNoByName (int& table_no, const char* table_name, + const bool is_eng = true); + int GetTableNoByName (const char* table_name); + + // + //application's parameter + // + int GetAppNameByNo (char* app_name, const int app_no); + int GetAppNoByName (int& app_no, const char* app_name); + int GetAppNoByName (const char* app_name); + int GetSubScenarioNoByName(const char* sub_scenario_name, unsigned int& sub_scenario_id) const; + int GetSubScenarioNameByNo(std::string& sub_scenario_name, const unsigned int sub_scenario_id) const; + + //int GetAllOdbNoByAppName(short& app_no, std::vector& table, const char* app_name); // 2002-12-02 + int GetAllOdbNoByAppName (int& app_no, std::vector& table, + const char* app_name); // 2002-12-02 + int GetAllOdbNoByAppNo (char* app_name, std::vector& vec_table, + const int app_no, const bool is_eng = true); + int GetAllOdbNoBySubScenarioName (int& sub_scenario_id, std::vector& vec_table, + const std::string& sub_scenario, const unsigned int sub_scenario_inst, + const std::string& scenario, const unsigned int scenario_inst); + int GetAllOdbNoBySubScenarioNo (std::string& sub_scenario, std::vector& vec_table, + const int sub_scenario_id, const unsigned int sub_scenario_inst, + const int scenario_id, const unsigned int scenario_inst, const bool is_eng); + //int GetAllAppNo (std::vector& vec_appno);//鿴װӦ岻ͨϵͳȡߵӦø + int WriteTableStatus (DB_STATUS_T status); + int GetTableStatus (DB_STATUS_T &status); + + int SetSemKey (const int app_no, const int r_table_no, + const short ctx_no); //for OPTLOCK + + //for merge table jinjing 2015-05-28 + int SetMergeTabAreaNo (const int area_no); + + int GetIsDownloadBySlice(int slice_no); + int GetDownloadSliceVec(std::vector& vec_slice_no); + + //jinjing 2017-11-21 for rtdb_mdify + int ConGetOnlyIndex(const std::vector& con_field_no_array, + const std::vector& get_field_no_array, + char *con_buf_ptr, char **buf_ptr, + int &buf_size); + cmnInt32 ConGetOnlyIndex (const int get_field_no, + const int con_field_no, + char* con_field_value, char** buf_ptr, int& buf_size); +public: + struct STDB_TAB* GetCurStdbTab(); // 2003-01-18 + struct STDB_FIELD_TAB* GetCurStdbFieldTab(); // 2003-03-03 + + const struct STDB_TAB* GetStdbTab(); // 2003-12-18 + const struct STDB_FIELD_TAB* GetStdbFieldTab(); // 2003-12-03 + const struct STDB_TAB* GetStdbTab (const int area_no); + + int GetFieldPara (struct FIELD_BASE_INFO& field_info); + int GetFieldParaByNo (std::vector& vec_offset, + const std::vector& vec_field_no); + int GetFieldInfo (const std::vector& vec_field_no, + std::vector& vec_field); +#ifdef _APP_SYS_SUBSTATION + const struct STDB_VIR_FIELD_TAB* GetStdbVirFieldTab(); + //jinjing 2012-03-28 + int GetFieldParaAll (const char* str_attribute, char** field_para_ptr, + int& buf_size, std::vector vec_offset); +#endif + //exchange byte order for buffer data + int ExchangeData (char* buf_ptr, const int buf_size, + const std::vector& vec_field, const DB_BYTE_T& remote_byte); + int ExchangeKeyData (char* buf_ptr, const int buf_size, + const DB_BYTE_T& remote_byte); + + int GetDbID (int& db_id); + int SetDbID (const int db_id); + +public: + int AddApp (const char *all_name, const short context_no ); + int AddOneTable (const int r_table_no, const char* table_name_eng); + int AddContext ( const short context_no ); + +public: +//for index operation + int RebuildIndex(); + +private: + //sql + int GetFieldNames (const char* str_sql, + std::vector& + vec_field); //from select clause, call GetFieldNameBySelect() + + bool GetFieldNameBySelect (const char* str_field, + std::vector& vec_field) const; + bool GetFieldNameByWhere (const char* str_condition, + std::vector& vec_field) const; + bool GetFieldNameByOrder (const char* str_orderby, + std::vector& vec_field_sort) const; + + int GetFieldWhere (std::vector& vec_field_sql, + const std::vector& vec_field_where); + int destory_field_where ( std::vector& vec_field_sql ); + + // + //sort, only used by itself + // + int SortGet (std::vector& vec_select, char** buf_ptr, int& buf_size, + const std::vector& vec_where, std::vector& vec_order); + int SortGet (std::vector& vec_select, char** buf_ptr, int& buf_size, + const std::vector& vec_where, std::vector& vec_order, + std::vector& vec_offset); + + int SortGet(std::vector& vec_select, std::vector& vec_field_where, + char* str_where, char** buf_ptr, int& buf_size, std::vector& vec_order, + std::vector& vec_offset); + + int GetSortedKey ( std::vector& vec_sort, + const char* all_record_ptr, + const std::vector& vec_field_no, + const struct STDB_TAB* stdb_tab_ptr, + const struct STDB_FIELD_TAB* stdb_field_tab_ptr); + + bool ParseLike (const char* str_condition, + std::vector& vec_field) const; + char* CheckLike (const char* str_condition, const char* str_like) const; + + int SortGetForSql (std::vector& SortVecNo , char * orgBufPtr , + char * & bufPtr , int recNum, int is_asc); + +private: + int Start(); + + + int GetScenarioID(const short context_no, unsigned int& scenario_id, unsigned int& scenario_inst_no); + + + //delete + //int TableDelete(struct STDB_DELETE_REQ* stdb_delete_req_ptr); + + /*********Added for index begin *****************/ +public: + INDEX_DEFINE_TAB* GetIdxDfnPtr(); + FIELD_INDEX_DEFINE_TAB* GetFldIdxDfnPtr(); + FIELDS_IN_INDEXS_DESC_TAB* GetFldsInIdxDescPtr(); + FIELDS_USED_IN_INDEX_TAB* GetFldsUsedInIdxPtr(); + CBaseIndex *GetIndexPtr (int + seq_no); //����idx_op_ptr_array�ĵ�seq_no��Ԫ�أ������seq_no��Ԫ����NULL�Ļ���newһ��Ԫ�س����� + CBaseIndex + *GetPKIndexPtr();//���pk_index_ptr������NULL���ͷ���һ��pk_index_ptr������newһ���µķ��ء� +public: + int DebugDisp (int index_no, + int type); // ��ʾ��index_no����������Ϣ��Ʃ��index_noΪ0��1��......��typeΪ��Ϣ����ϸ�̶ȱ�־�� + int TableDelete(); + int DetachSlice(cmnUint32 slice_no); + /*********Added for index end ******************/ +public: //These functions are used only for debug + int SprintKey (char *key_ptr, char *key_string); + //int Search(char *key_ptr,int &record_pointer); + +public: +/* + cmnInt32 CreateOpen (const int app_no, const int table_no, const int slice_no, + const short context_no = 0); +*/ + int CreateOpen (const std::string& scenario_name, + const int scenario_inst_no, + const std::string& sub_scenario_name, + const int sub_scenario_inst_no, + const int table_no); + + cmnInt32 SliceCreate (const int slice_no); + cmnInt32 StartSession(); + cmnInt32 CloseSession(); + +private: + CTableOp (const CTableOp&); + CTableOp& operator= (const CTableOp&); + + TTableOpPriv *m_pPrvStru; + + bool m_IsMap; + int m_slice_no; + +public: + COdbSystem* GetOdbSystemPtr(); + COdbTable* GetOdbTablePtr(); + COdbField* GetOdbFieldPtr(); + +public: + const struct DB_CTRL_TAB* GetDbCtrlTabPtr(); + DB_APP_TAB* GetAppTabPtr(); + char* GetTableFileName(); + +private: + void SetAppTabPtr (DB_APP_TAB* app_tab_ptr); + +protected: + COdbSystem* m_OdbSystemPtr; + COdbField* m_OdbFieldPtr; + ODB_SLICE::CLogicTable m_LogicTable; + + struct ODB_SESSION m_session; + +#ifdef _APP_SYS_SUBSTATION + //friend class ::CTestItem; + friend class ::CaseSearch; + friend class ::CaseConGet; + friend class ::CaseTableModifyByKey; + friend class ::CaseTableWrite; + friend class ::CaseDeleteRecord; + friend class ::CaseTableUpdate; + friend class ::CaseDeleteIndex; + friend class ::CaseHashPKDebug; + friend class ::idx_mon; + friend class Tab2Idx; + friend class ::CaseShowIndexStatus; + friend class ::CDyDownload; + friend class ::TestItem; +#endif +}; + +} + +#endif diff --git a/code/sys_nicmonitor/include/db_api/odb_where.h b/code/sys_nicmonitor/include/db_api/odb_where.h new file mode 100644 index 0000000..511974d --- /dev/null +++ b/code/sys_nicmonitor/include/db_api/odb_where.h @@ -0,0 +1,211 @@ +/******************************************************************************* +ModuleName: ODB Real Time Database management system +FileName: odb_where.h +DESCRIPTION: interface to hubo +FUNCTION LIST: +COMMENT: +History: +Date Version Modifier Activities +2002-11-26 1.0 modify +================================================================================ +2002-11-26 1.0 created +*******************************************************************************/ + +#ifndef __ODB_WHERE_H__ +#define __ODB_WHERE_H__ + +#include + +#include "odb_struct.h" +//#include "where_syntax_anls.h" +//#include "interpreter_define.h" + +using namespace std; + +//class FOR_WHERE::CWhereSyntaxAnalyser; + +/* +#define LEFT_SIDE 0x10 +#define RIGHT_SIDE 0x20 +*/ + +#ifdef _WINDOWS64 +#ifdef ODB_WHERE_EXPORTS +#define ODB_WHERE_API __declspec(dllexport) +#else +#define ODB_WHERE_API __declspec(dllimport) +#endif +#else +#define ODB_WHERE_API +#endif + + +/* +struct CODE_TABLE_STRU; +class CWhereSyntaxAnalyser; +class CInterpreter; +*/ + +namespace FOR_WHERE +{ + class CWhereSyntaxAnalyser; +} + +namespace ODB +{ + +//struct SQL_KEY_ID +//{ +//// int table_no; +//// short field_no; +// int record_id; +// short column_id; +//}; +// +//struct SQL_APP_ID +//{ +// int app_id; +// int record_id; +//}; +// +//struct SQL_APP_KEY +//{ +// int app_id; +// int record_id; +// short column_id; +//}; + +typedef cmnInt64 SQL_KEY_ID; + +typedef _RTDB_KEY_STRU SQL_RTDB_KEY; +/* +struct SQL_APP_KEY +{ + int app_id; + SQL_RTDB_KEY key_id; +}; +*/ +typedef _APP_KEY_STRU SQL_APP_KEY; +typedef _APP_ID_STRU SQL_APP_ID; + +union SQL_DATA_TYPE +{ + //char to_str[40]; + char to_char; + char* to_str; + short to_short; + int to_int; + cmnInt64 to_long; + unsigned int to_uint; + float to_float; + double to_double; + SQL_KEY_ID to_key; + SQL_APP_ID to_appid; + SQL_APP_KEY to_appkey; + SQL_RTDB_KEY to_rtdbkey; + SQL_RTDB_KEY to_measrtdbkey; + //binary +}; + +/* +#ifdef _WINDOWS64 +struct ODB_WHERE_API FIELD_STRU +#else +struct FIELD_STRU +#endif +*/ +struct FIELD_STRU +{ + char field_name[64]; //CHN_NAME_LEN + int data_type; + std::vector vec_value; +// std::vector vec_stru_value; +}; + + +struct SQLIDX_STRU +{ + char field_name[64]; + int data_type; + char field_no; + int is_keyword; +}; + +struct IDX4SEARCH_STRU +{ + enum SIDE{ UNKNOW = 0x1 , LEFT_SIDE = 0x10 , RIGHT_SIDE = 0x20}; + + int field_no; + int data_type; + int operation_type; // == >= <= + SQL_DATA_TYPE value; + int taken_num; + SIDE side; + int is_keyword; + + + IDX4SEARCH_STRU() + { + this->data_type = 0; + this->taken_num = 0; + this->operation_type = -1; + this->side = UNKNOW; + this->is_keyword = 0; + + } + int clear() + { + this->field_no = -1; + this->data_type = 0; + this->operation_type = -1; + this->value.to_int = -1; + this->taken_num = 0; + this->side = UNKNOW; + this->is_keyword = 0; + return 1; + } +}; + + +class ODB_WHERE_API CWhere +{ +public: + CWhere(); +/* { + sql_translate = NULL; + };*/ + ~CWhere(); + /*{ + if(sql_translate) + { + delete sql_translate; + } + };*/ + bool GetWhere(std::vector& vec_where, const char* where_str, const std::vector& vec_sql); + //jinjing 2013-5-3 + bool GetWhere(std::vector& vec_where, const char* where_str, const std::vector& vec_sql); + + void Show(); + + int ExpressSql(char * where_str , std::vector & vec_sqlidx, std::vector & idx_vec); + + private: + FOR_WHERE::CWhereSyntaxAnalyser* sql_translate; +/* +private : + + + float real_const_tab[MAX_REALCONSTTABLE_LEN]; //ʵ + int real_const_tab_len; + char *string_tab[MAX_STRINGTABLE_LEN]; //ַ + int string_tab_len; + CODE_TABLE_STRU* code_tab[MAX_CODETABLE_LEN]; //м + int code_tab_len; + CWhereSyntaxAnalyser* sql_translate; //﷨ + CInterpreter* sql_itprt; // + +*/ +}; + +} +#endif diff --git a/code/sys_nicmonitor/include/db_api/pub_buf.h b/code/sys_nicmonitor/include/db_api/pub_buf.h new file mode 100644 index 0000000..330e355 --- /dev/null +++ b/code/sys_nicmonitor/include/db_api/pub_buf.h @@ -0,0 +1,57 @@ + +#ifndef __PUB_BUF_H__ +#define __PUB_BUF_H__ + +#include +#include + +#ifdef _WINDOWS64 + #ifdef PUB_EXPORTS + #define PUB_LIB_API __declspec(dllexport) + #else + #define PUB_LIB_API __declspec(dllimport) + #pragma comment(lib,"libpub.lib") + #endif +#else + #define PUB_LIB_API +#endif + +class PUB_LIB_API CBuffer +{ +public: + CBuffer(); + ~CBuffer(); + + // + // consumer interface + // + inline char* GetBufPtr() const { return m_BufPtr; } + inline int GetLength() const { return m_DataLen; } + inline int GetBuffer(char** buf_ptr, int& buf_size) const + { + *buf_ptr = m_BufPtr; + buf_size = m_DataLen; + return 0; + } + + char* Detach(); + static void Free(void* pointer); + + + // + // producer interface + // + int SetBuffer(const char* buf_ptr, const int buf_size); + int SetLength(const int buf_size); + int AppendBuf(const char* buf_ptr, const int buf_size); + + int Clear(); +private: + char* m_BufPtr; + int m_BufLen; + int m_DataLen; + int m_Detached; +}; + + +#endif diff --git a/code/sys_nicmonitor/include/db_api/rtdb_graph_name_list.h b/code/sys_nicmonitor/include/db_api/rtdb_graph_name_list.h new file mode 100644 index 0000000..07be176 --- /dev/null +++ b/code/sys_nicmonitor/include/db_api/rtdb_graph_name_list.h @@ -0,0 +1,44 @@ +#ifndef __RTDB_GRAPH_NAME_H__ +#define __RTDB_GRAPH_NAME__ + +#ifdef _WINDOWS64 +#ifdef RTDB_GRAPH_NAME_EXPORTS +#define RTDB_GRAPH_NAME_API __declspec(dllexport) +#else +#define RTDB_GRAPH_NAME_API __declspec(dllimport) +#endif +#else +#define RTDB_GRAPH_NAME_API +#endif + +#ifndef _WINDOWS64 +#include +#include +#include +#include +#include +#else +#include +#include +#endif + +#include +#include "servicemanage.h" +#include "system.h" +#include "sysadm/scn_service.h" +#include "pub_ctx.h" +#include "logclient.h" + +class RTDB_GRAPH_NAME_API CTabGraph +{ +public: + + CTabGraph(); + ~CTabGraph(); + + int GetGraphNameList (const std::string& username, const std::string& keyword, \ + std::map > &listmap); + +}; + +#endif diff --git a/code/sys_nicmonitor/include/db_api/server2proto.h b/code/sys_nicmonitor/include/db_api/server2proto.h new file mode 100644 index 0000000..5c9b31f --- /dev/null +++ b/code/sys_nicmonitor/include/db_api/server2proto.h @@ -0,0 +1,21 @@ +#ifndef __SERVER_2_PROTO_H__ +#define __SERVER_2_PROTO_H__ + +#include "db_api/odb_net_m.h" +#include "db_api/odb_prv_struct.h" + +namespace RTDB_SERVER +{ +void UnionDataTypeConv(const RTDB_SERVER::union_data_type & union_server, RTDB_PROTO::union_data_type * p_union_proto); +void SeqCharConv(const RTDB_SERVER::SEQ_CHAR & _server, RTDB_PROTO::SEQ_CHAR * _p_proto); +void FieldStruConv(const RTDB_SERVER::FIELD_STRU & _server, RTDB_PROTO::FIELD_STRU * _p_proto); +void SeqFieldStruConv(const RTDB_SERVER::SEQ_FIELD_STRU & _server, RTDB_PROTO::SEQ_FIELD_STRU * _p_proto); +void RspReadConv(const RTDB_SERVER::RSP_READ & _server, RTDB_PROTO::RSP_READ * _p_proto); +void RspConConv(const RTDB_SERVER::RSP_CON & _server, RTDB_PROTO::RSP_CON * _p_proto); +void GraphRealRspConv(const RTDB_SERVER::GRAPH_REAL_RSP& real_rsp_server, RTDB_PROTO::GRAPH_REAL_RSP* real_rsp_proto); +void GraphRealReqConv(const RTDB_PROTO::GRAPH_REAL_ODB_REQ& real_req_proto, RTDB_SERVER::GRAPH_REAL_REQ& real_req_server); +void GraphOrderKeyReqConv(const RTDB_PROTO::GRAPH_ORDER_KEY_REQ & _proto, ODB::GRAPH_ORDER_KEY_REQ & _odb); +void GraphOrderKeyRspConv(const ODB::GRAPH_ORDER_KEY_RSP & _odb, RTDB_PROTO::GRAPH_ORDER_KEY_RSP * _p_proto); +} + +#endif diff --git a/code/sys_nicmonitor/include/db_api/tab2idx.h b/code/sys_nicmonitor/include/db_api/tab2idx.h new file mode 100644 index 0000000..a0f8381 --- /dev/null +++ b/code/sys_nicmonitor/include/db_api/tab2idx.h @@ -0,0 +1,48 @@ +//#include "odb_tableop.h" +#include "system.h" +#ifndef _TAB2IDX +#define _TAB2IDX + +#ifdef _WINDOWS64 +#ifdef ODB_API_LIB_EXPORTS +#define ODB_API_LIB_API __declspec(dllexport) +#else +#define ODB_API_LIB_API __declspec(dllimport) +#endif +#else +#define ODB_API_LIB_API +#endif + +namespace ODB +{ +#define ALL_INDEX -2 +#define PK_INDEX -1 +class CTableOp; +class CBaseIndex; +class ODB_API_LIB_API Tab2Idx +{ +private: + Tab2Idx (Tab2Idx &orig_class); + int m_AppNo; + int m_TableNo; + short m_ContextNo; + + int WriteTimeAndIdxStatusNormal(CTableOp& theTableOp,int idx_pos = ALL_INDEX);//idx_pos == -2 means all indexes including pk index, -1 means primary key index, 0 means the first index and so on. + int WriteIdxStatusInit(CTableOp &theTableOp,int idx_pos = ALL_INDEX);//idx_pos == -2 means all indexes including pk index, -1 means primary key index, 0 means the first index and so on. + CBaseIndex *GetPkIndexPtr (struct STDB_TAB* stdb_tab_ptr, int table_no); + CBaseIndex *GetIndexPtr(int seq,struct INDEX_DEFINE_TAB *idx_def_tab_ptr,struct STDB_TAB* stdb_tab_ptr,int table_no); +public: + Tab2Idx() {}; + Tab2Idx (int app_no, int table_no, short ctx_no = AC_REALTIME_NO); + int SetPara (int app_no, int table_no, int ctx_no = AC_REALTIME_NO); + int CreateIdxFromTab(); //This function can create and repair all the indexes including pk index in the table + int RepairIdxFromTab(int idx_pos);//idx_pos == -1 means primary key index, 0 means the first index and so on. It is only used for repairing index , so it is not used for create index for a table not down_load or creating index for case + //int RmIdx(); + int RmIdxInfo(); + + int CreateIdxFromAreaTab(); //This function can create and repair all the indexes including pk indexes in the area table + int RepairIdxFromAreaTab(int idx_pos);//idx_pos == -1 means primary key index, 0 means the first index and so on. It is only used for repairing index , so it is not used for create index for a table not down_load or creating index for case + int RmAreaIdxInfo(); +}; +} +#endif diff --git a/code/sys_nicmonitor/include/db_api/vl_get_data.h b/code/sys_nicmonitor/include/db_api/vl_get_data.h new file mode 100644 index 0000000..085a2bb --- /dev/null +++ b/code/sys_nicmonitor/include/db_api/vl_get_data.h @@ -0,0 +1,57 @@ +#ifndef __VL_GET_DATA_H__ +#define __VL_GET_DATA_H__ + +#ifdef _WINDOWS64 +#ifdef VL_GET_DATA_EXPORTS +#define VL_GET_DATA_API __declspec(dllexport) +#else +#define VL_GET_DATA_API __declspec(dllimport) +#endif +#else +#define VL_GET_DATA_API +#endif + +#ifndef _WINDOWS64 +#include +#include +#include +#include +#include +#else +#include +#include +#endif + +#include +#include "servicemanage.h" +#include "system.h" +#include "sysadm/scn_service.h" +#include "pub_ctx.h" +#include "logclient.h" +#include "db_api/vl_struct_m.h" + +class VL_GET_DATA_API vl_get_data +{ +public: + + vl_get_data(); + ~vl_get_data(); + + int GetRealData (const vector& vec_sgid_in, vector& vec_value_out); + int GetRtNet (const vector& vec_sgid_in, vector& vec_value_out); + +private: + //DomainInfo m_DomainInfo; + ServiceInfo m_Serviceinfo; + char m_IpAddress[64]; + //int m_Port; + Handle m_Handle; + char m_HostName[64]; + //int m_RequestTimeoutSeconds; + + int SetServiceHost(int app_no); + int GetHostByAppNo(char* host_name, const int app_no, const short context_no); + +}; + +#endif diff --git a/code/sys_nicmonitor/include/db_api/vl_struct.h b/code/sys_nicmonitor/include/db_api/vl_struct.h new file mode 100644 index 0000000..b42e063 --- /dev/null +++ b/code/sys_nicmonitor/include/db_api/vl_struct.h @@ -0,0 +1,24 @@ +#include "mcode/mtypes.h" +#include"mcode/mvector.h" + +typedef vector VEC_STRING; + +struct SGID_IN_STRU +{ + VEC_STRING vec_sgid_in; +}; + +struct RealdataValue +{ + float value; + int status; +}; + +typedef vector VEC_RealdataValue; + +struct DATAVALUE_STRU +{ + VEC_RealdataValue vec_value_out; +}; + + diff --git a/code/sys_nicmonitor/include/db_api/vl_struct_m.cpp b/code/sys_nicmonitor/include/db_api/vl_struct_m.cpp new file mode 100644 index 0000000..eed5f47 --- /dev/null +++ b/code/sys_nicmonitor/include/db_api/vl_struct_m.cpp @@ -0,0 +1,93 @@ +//************************************** +// Generated by mcpp translator +// Version 1.3 +//************************************** + +#include"vl_struct_m.h" +#include +void +SGID_IN_STRU::__write(MLang::OutputStream&__os)const +{ + size_t len_0=vec_sgid_in.size(); + __os.write_uint(len_0); + for(size_t i_0=0;i_0 VEC_STRING; +struct SGID_IN_STRU +{ + VEC_STRING vec_sgid_in; + SGID_IN_STRU(); + SGID_IN_STRU(const SGID_IN_STRU&); + SGID_IN_STRU&operator=(const SGID_IN_STRU&); + void __write(MLang::OutputStream&__os)const; + void __read(MLang::InputStream&__is); +}; +struct RealdataValue +{ + float value; + int status; + void __write(MLang::OutputStream&__os)const; + void __read(MLang::InputStream&__is); +}; +typedef MLang::VECTOR VEC_RealdataValue; +struct DATAVALUE_STRU +{ + VEC_RealdataValue vec_value_out; + DATAVALUE_STRU(); + DATAVALUE_STRU(const DATAVALUE_STRU&); + DATAVALUE_STRU&operator=(const DATAVALUE_STRU&); + void __write(MLang::OutputStream&__os)const; + void __read(MLang::InputStream&__is); +}; +#endif diff --git a/code/sys_nicmonitor/include/db_com/CAppNo.h b/code/sys_nicmonitor/include/db_com/CAppNo.h new file mode 100644 index 0000000..9ecb652 --- /dev/null +++ b/code/sys_nicmonitor/include/db_com/CAppNo.h @@ -0,0 +1,63 @@ +#ifndef _CAPPNO_H_ +#define _CAPPNO_H_ +#ifdef _WINDOWS64 +#ifdef CAPP_NO_EXPORTS +#define CAPP_NO_API __declspec(dllexport) +#else +#define CAPP_NO_API __declspec(dllimport) +#endif +#else +#define CAPP_NO_API +#endif + +#include + +#include "system.h" + +using namespace std; + +class CAPP_NO_API CAppNo +{ +public: + unsigned int value_array[4]; + +public: + CAppNo( unsigned int value1, unsigned int value2 = 0, unsigned int value3 = 0, unsigned int value4 = 0); + CAppNo(); + ~CAppNo(); + + // زλ&λ|ȡ~е==(!=)ֵȡࡢ + CAppNo operator&(const CAppNo value); + CAppNo operator&=(const CAppNo value); + CAppNo operator|(const CAppNo value); + CAppNo operator|=(const CAppNo value); + CAppNo operator~(); + bool operator==(const CAppNo value); + bool operator ==(const unsigned int value); + bool operator!=(const CAppNo value); + bool operator!=(const unsigned int value); + int operator=(const unsigned int value); + CAppNo operator+(const CAppNo value); + CAppNo operator+=(const CAppNo value); + CAppNo operator-(const CAppNo value); + CAppNo operator%(const unsigned int value); + CAppNo operator/(const unsigned int value); + CAppNo operator*(const unsigned int value); + + friend CAPP_NO_API ostream& operator<<(ostream&,const CAppNo&); + + bool any();//ijһλΪ1,true + bool none();//ȫΪ0,true + int count();//ó1λĸ + + CAppNo NoToCApp(int index_no);//ӦúתΪCAppNo + int CAppToNo();//CAppNoתΪӦú,С + //int CAppToNo(vector &appno_vec);//CAppNoתΪӦú,,appno_vecΪӦú + int AppColIndex();//Ӧú + + static bool isAppExt();//жϵǰǷӦúչ +private: + //static bool m_is_ext; +}; + +#endif diff --git a/code/sys_nicmonitor/include/db_com/CCharArray.h b/code/sys_nicmonitor/include/db_com/CCharArray.h new file mode 100644 index 0000000..2196063 --- /dev/null +++ b/code/sys_nicmonitor/include/db_com/CCharArray.h @@ -0,0 +1,72 @@ +// CCharArray.h: interface for the CCharArray class. +// +////////////////////////////////////////////////////////////////////// + +#ifndef _CCharArray_H_ +#define _CCharArray_H_ + +#ifdef _WINDOWS64 +#ifdef PUB_TOOLS_EXPORTS +#define PUB_TOOLS_API __declspec(dllexport) +#else +#define PUB_TOOLS_API __declspec(dllimport) +#endif +#else +#define PUB_TOOLS_API +#endif + +class PUB_TOOLS_API CCharArray +{ +public: +// CCharArray(); + CCharArray(char *pChar, int nLen, bool bAutoDel = false); + ~CCharArray(); + +private: + char *m_pChar; // ݻ + int m_nCharLen; // m_pCharij + int m_nCharIndex; // m_pCharеǰЧλ + bool m_bAutoDelete; // Ƿɾ + +private: + void SetLen(int nIndex) + { + m_nCharLen = nIndex; + } + void SetIndex(int nIndex) + { + m_nCharIndex = nIndex; + } + int GetIndex() + { + return m_nCharIndex; + } + int CheckLen(int nLen); + bool GetIsAutoDelete() + { + return m_bAutoDelete; + } + +public: + int GetLen() + { + return m_nCharLen; + } + char *GetChar() + { + return m_pChar; + } + void IsAutoDelete(bool bAutoDelete = true) + { + m_bAutoDelete = bAutoDelete; + } + /* + bool PutChar(char *pChar,int nLen); + + bool GetChar(char *pChar,int nLen); + + bool Skip(int nLen); + */ +}; + +#endif // _CCharArray_H_ diff --git a/code/sys_nicmonitor/include/db_com/CDataStream.h b/code/sys_nicmonitor/include/db_com/CDataStream.h new file mode 100644 index 0000000..df69b4b --- /dev/null +++ b/code/sys_nicmonitor/include/db_com/CDataStream.h @@ -0,0 +1,141 @@ +// CDataStream.h: interface for the CDataStream class. +// +////////////////////////////////////////////////////////////////////// + +#ifndef _CDATASTREAM_H_ +#define _CDATASTREAM_H_ + +#ifdef _WINDOWS64 +#ifdef PUB_TOOLS_EXPORTS +#define PUB_TOOLS_API __declspec(dllexport) +#else +#define PUB_TOOLS_API __declspec(dllimport) +#endif +#else +#define PUB_TOOLS_API +#endif + +#include "common_types.h" +#include "CCharArray.h" +#include + +struct Keyid +{ + int record_id; + short column_id; +}; + +typedef unsigned char byte; + +const int DATASTREAM_NOT_CHECK = -1; //鴫봮ij +const int DEFAULT_DATASTREAM_LENGTH = 255; //ĬݵijӦô +typedef struct Keyid TKEYID; + +#define ERRMSG_LENGTH 255 +class PUB_TOOLS_API CDataStream +{ +public: + CDataStream(); + + ~CDataStream(); + + bool Init(int nMode, bool bAutoDel = true, char *pDataStream = NULL, int nDataStreamLen = 0, int nDefaultDataStreamLen = DEFAULT_DATASTREAM_LENGTH); + + enum + { + load = 0, store = 1 + }; + CDataStream& operator=(const CDataStream & strobj); + + CDataStream(const CDataStream & strobj); + +private: + int m_nMode; + char *m_pDataStream; + int m_nDataStreamLen; + int m_nDataStreamIndex; + int m_nDefaultDataStreanLen; //Ĭϵݻij + + bool m_bAutoDelete; //Ƿɾ + + bool m_bChangeOrder; + + char m_chMsg[ERRMSG_LENGTH + 1]; +private: + bool GetIsAutoDelete() + { + return m_bAutoDelete; + } + + bool IsOutofBound(int nLen); + + int GetDataLen(); + + bool SetData(void *pData, int nLen); + + bool GetData(void *pData, int nLen); + + //exception * GetException(char *pMsg); + + void SetErrMsg(char * pMsg); + + char * GetErrMsg(); + + void ChangeOrder(short &s); + void ChangeOrder(unsigned short &s); + void ChangeOrder(int &i); + void ChangeOrder(cmnInt64 &l); + void ChangeOrder(float &f); + void ChangeOrder(double &d); + void ChangeOrder(cmnUint64 &dw); + +public: + bool IsChangeOrder() + { + return m_bChangeOrder; + } + + int GetDataStreamLen() + { + return m_nDataStreamIndex; + } + + void IsAutoDelete(bool bAutoDelete = true) + { + m_bAutoDelete = bAutoDelete; + } + + void Skip(int nLen); + + void SkipTo(int nLen); + + operator char *(); + + CDataStream & operator <<(char ch); + CDataStream & operator <<(byte by); + CDataStream & operator <<(bool b); + CDataStream & operator <<(short s); + CDataStream & operator <<(unsigned short s); + CDataStream & operator <<(int Integer); + CDataStream & operator <<(cmnInt64 l); + CDataStream & operator <<(float f); + CDataStream & operator <<(double d); + CDataStream & operator <<(cmnUint64 dw); + CDataStream & operator <<(CCharArray & CharArray); + CDataStream & operator <<(TKEYID & keyid); + + CDataStream & operator >>(char &ch); + CDataStream & operator >>(byte &by); + CDataStream & operator >>(bool &b); + CDataStream & operator >>(short &s); + CDataStream & operator >>(unsigned short &s); + CDataStream & operator >>(int &Integer); + CDataStream & operator >>(cmnInt64 &l); + CDataStream & operator >>(float &f); + CDataStream & operator >>(double &d); + CDataStream & operator >>(cmnUint64 &dw); + CDataStream & operator >>(CCharArray & CharArray); + CDataStream & operator >>(TKEYID & keyid); +}; + +#endif // _CDataStream_H_ diff --git a/code/sys_nicmonitor/include/db_com/CDbCommitClient.h b/code/sys_nicmonitor/include/db_com/CDbCommitClient.h new file mode 100644 index 0000000..367c23c --- /dev/null +++ b/code/sys_nicmonitor/include/db_com/CDbCommitClient.h @@ -0,0 +1,93 @@ +#ifndef __CDBCOMMITCLIENT_H__ +#define __CDBCOMMITCLIENT_H__ + +#ifdef _WINDOWS64 +#ifdef DB_COMMIT_DLL_EXPORTS +#define DB_COMMIT_DLL_API __declspec(dllexport) +#else +#define DB_COMMIT_DLL_API __declspec(dllimport) +#endif +#else +#define DB_COMMIT_DLL_API +#endif + +#ifndef _WINDOWS64 +#include +#include +#include +#include +#include +#else +#include +#include +#endif + +#include + +#include "db_commit_m.h" +#include "servicemanage.h" +#include "sysadm/scn_service.h" +#include "pub_ctx.h" +#include "system.h" +#include "port_def.h" +#include "logclient.h" + +using namespace std; +using namespace NS_SYSADMIN; + +const int HIGH = 1; +const int MIDDLE = 2; +const int LOW = 3; +const int NO_SQL_DUP = 0; +const int SQL_DUP = 1; + +#define OP_BIND_INSERT 1 +#define OP_BIND_UPDATE 2 +#define OP_BIND_DELETE 3 + +#define BIND_COMMIT_DATATYPE_CHR 1 /* ַ unsigned char */ +#define BIND_COMMIT_DATATYPE_INT 3 /* short int long */ +#define BIND_COMMIT_DATATYPE_FLT 4 /* float double */ +#define BIND_COMMIT_DATATYPE_STR 5 /* ַstring */ +#define BIND_COMMIT_DATATYPE_ODT 156 /* date*/ + +class DB_COMMIT_DLL_API CDbCommitClient +{ +public: + + CDbCommitClient(); + CDbCommitClient(int sys_port); + CDbCommitClient(int sys_port, int seconds); + ~CDbCommitClient(); + +public: + void SetRequestTimeout(int seconds); + short SqlCommit(TCommitStru CommitSqlStru); //1 + short SqlCommitWithNoDup(TCommitStru CommitSqlStru); //2 + short RsSqlCommit(TCommitStru CommitSqlStru); //3 + short WarnSqlCommit(TCommitStru CommitSqlStru); //4 + short LOBInsertCommit(char* sql_insert, char* sql_select, SEQCommitLOBValueType seq_lob_value); //5 + short LOBUpdateCommit(char* sql_update, char* sql_select, SEQCommitLOBValueType seq_lob_value); //6 + short SqlCommitWithBind(TCommitBindStru CommitBindStru); //7 +#ifdef _DATASRV_DIVERSION + //DATA_SRVģʽָʵӦ + //app_name = data_srv_dms data_srv + //ȡֵdata_srv + void SetServiceApp(const char* app_name); + void ClearServiceApp(); +#endif +private: + ServiceInfo m_Serviceinfo; + char m_IpAddress[64]; + int m_Port; + Handle m_Handle; + char m_HostName[64]; + CScnService* m_ServicesManage; + int m_RequestTimeoutSeconds; + + int GetHostByAppNo(char* host_name, const int app_no, const short context_no); + int SetServiceHost(); +}; + +#endif + diff --git a/code/sys_nicmonitor/include/db_com/CDbMonitorClient.h b/code/sys_nicmonitor/include/db_com/CDbMonitorClient.h new file mode 100644 index 0000000..3dde076 --- /dev/null +++ b/code/sys_nicmonitor/include/db_com/CDbMonitorClient.h @@ -0,0 +1,71 @@ +//****************************************************************** +// +// AUTHOR : ShiHaoQiu +// +// FUNCTION : db_monitor ̵Ŀͻ๫ඨ +// +// TIME : 2011.04.09 +// +// HISTORY : +// Datetime Action Author Reason +// ------------------------------------------------------------------- +// 2011.04.09 Creation ShiHaoQiu +// +//****************************************************************** + +#ifndef __CDBMONITORCLIENT_H__ +#define __CDBMONITORCLIENT_H__ + +#include "db_monitor_m.h" +//#include "servicesclient.h" +#include "sysadm/scn_service.h" +#include "system.h" +#include "pub_ctx.h" +#include +#include +#include +#include +#include +//#include "serviceglobal.h" +#include "servicemanage.h" + + +class CDbMonitorClient +{ + public: + CDbMonitorClient(); + CDbMonitorClient(int seconds); + ~CDbMonitorClient(); + void SetRequestTimeout(int seconds); + short GetMasterDbInfo(TDbLoginInfo & masterDbInfo); + short GetMasterDbInfo(const char* user_name,TDbLoginInfo & masterDbInfo); + //short MasterDbSwitchByDbName(const char* strDbName); + short MasterDbSwitchByDbService(const char* strDbService); + short GetRepDbLoginInfo(const char* strDbName , TDbLoginInfo & repDbLoginInfo); + short GetDbNum(int & nSize); + short GetAllDbServerInfo(TDbServiceInfo & dbServerInfoSec); + void SetLocalServiceFlag(bool flag); + + //add for remote access + int SetDomainInfo(const DomainInfo& domain_info); //ԶϢͨã + int SetDomainInfo(const char* domain_name, const tSecLabel& sec_label, const int app_no = AP_DATA_SRV, const int ctx_no = AC_REALTIME_NO); + int SetDomainName(const char* domain_name); // + int SetSecLabel(tSecLabel& sec_label); //ñǩ + void ClearDomainName(); //m_DomainNameΪlocal_domain + private: + DomainInfo m_DomainInfo; + ServiceInfo m_Serviceinfo; + char m_IpAddress[64]; + int m_Port; + Handle m_Handle; + char m_HostName[64]; + int GetHostByAppNo(char* host_name, const int app_no, const short context_no); + int SetServiceHost(); + bool m_localserviceflag; + int m_RequestTimeoutSeconds; +}; + +#endif + + + diff --git a/code/sys_nicmonitor/include/db_com/CDbMonitorLocal.h b/code/sys_nicmonitor/include/db_com/CDbMonitorLocal.h new file mode 100644 index 0000000..32b4ccf --- /dev/null +++ b/code/sys_nicmonitor/include/db_com/CDbMonitorLocal.h @@ -0,0 +1,44 @@ +#ifndef ___CDBMONITORLOCAL_H__ +#define ___CDBMONITORLOCAL_H__ + +#ifdef _WINDOWS64 +#ifdef DB_MONITOR_DLL_LOCAL_EXPORTS +#define DB_MONITOR_DLL_LOCAL_API __declspec(dllexport) +#else +#define DB_MONITOR_DLL_LOCAL_API __declspec(dllimport) +#endif +#else +#define DB_MONITOR_DLL_LOCAL_API +#endif + +#include "db_com/db_monitor_define.h" +#include "CDbMonitorShm.h" +class DB_MONITOR_DLL_LOCAL_API CDbMonitorLocal +{ +public: + + CDbMonitorLocal(); + ~CDbMonitorLocal(); + + int InitDbMonitorLocal(); + int GetMasterDbInfo(TLoginInfo &masterDbInfo); + int GetMasterDbInfo(const string user_name,TLoginInfo &masterDbInfo); + int GetRepDbLoginInfo(const string &strDbDesc , TLoginInfo &repDbLoginInfo); + int GetRepDbLoginInfo(const string & strUserName,const string &strDbDesc , TLoginInfo &repDbLoginInfo); + int GetDbNum(int &nSize); + int GetAllDbServerInfo(vector &dbServerInfoVec); + int GetAllDbServerInfoExt(vector & dbServerInfoVec); + int GetUserPassword(string strUserName,string & strUserPassword); + int GetAllUserInfo(vector & userLoginVec); + + //Add for db_warn_server by ZhangKeHeng + int GetDbInfoByDbService(TLoginInfo &dbServiceInfo , const string strDbService); + int GetDbInfoByDbService(TLoginInfo &dbServiceInfo , const string strDbService,const string user_name); + //int GetDbInfoByDbName(TLoginInfo &dbServiceInfo , const string strDbName); + int GetDbInfoByDbServiceDesc(TLoginInfo &dbServiceInfo , const string strDbDesc); + int GetDbInfoByDbServiceDesc(TLoginInfo &dbServiceInfo , const string strDbDesc,const string user_name); + //add fro db_warn_server db_config_ext.sys ȡ + int ReadDbConfigInfoFromFile(vector & loginfo_vec); +}; +#endif + diff --git a/code/sys_nicmonitor/include/db_com/CDbMonitorShm.h b/code/sys_nicmonitor/include/db_com/CDbMonitorShm.h new file mode 100644 index 0000000..c2361df --- /dev/null +++ b/code/sys_nicmonitor/include/db_com/CDbMonitorShm.h @@ -0,0 +1,77 @@ +//****************************************************************** +// +// AUTHOR : LMJ +// +// FUNCTION : ݿӽвڴ ෽ +// +// TIME : 2003.12.8 +// +// HISTORY : +// Datetime Action Author Reason +// ----------------------------------------------------------------- +// 2003.12.16 Creation LMJ +// 2004.09.18 Modify ZhangKeHeng add interface for db_warn_server +//****************************************************************** + +#ifndef __CDBMONITORSHM_H_ +#define __CDBMONITORSHM_H_ +#include "db_com/db_monitor_define.h" + + +class CDbMonitorShm +{ + +protected: + CDbMonitorShm(); +public: + static CDbMonitorShm & getInstance() + { + static CDbMonitorShm gCDbMonitorShm; + return gCDbMonitorShm; + } + ~CDbMonitorShm(); +private: + + CDbShm m_DbShm; + + TLoginInfo * m_pAllDbInfo; + + int m_nDbNum; + static int m_nDbAppStatusOffset; + static int m_nMasterDbInfoOffset; + static int m_nDbNumOffset; + static int m_nAllDbInfoOffset; + int m_TotalShmSize; + +public: + int InitDbMonitorShm(); + int SetDbAppStatusInfo(const int nStatus); + int GetDbAppStatusInfo(int &nStatus); + int SetMasterDbLoginInfo(const TLoginInfo &DbLoginInfo); + int GetMasterDbLoginInfo(TLoginInfo &DbLoginInfo); + int SetDbNum(const int nDbNum); + int GetDbNum(int &nDbNum); + int SetDbServiceInfo(const TLoginInfo &dbServiceInfo , int nDbSerialNo); + int GetDbServiceInfo(TLoginInfo &dbServiceInfo , int nDbSerialNo); + int GetDbServiceInfoByDbService(TLoginInfo &dbServiceInfo , string strDbService); + //int GetDbServiceInfoByDbName(TLoginInfo &dbServiceInfo , string strDbName); + int GetDbServiceInfoByDbServiceDesc(TLoginInfo &dbServiceInfo , string strDbDesc); + int GetAllDbServiceInfo(vector &dbServiceInfo); + int SetAllDbServiceInfo(const vector &dbServiceInfo); + //int GetDbSerialNoFromDbName(vector &dbSerialNoVec , string strDbName); + int GetDbSerialNoFromDbServiceDesc(vector &dbSerialNoVec,string strDbDesc); + int GetDbSerialNoFromDbService(int &nDbSerialNo , string strDbService); + + //Add for db_warn_server by ZhangKeHeng + int GetDbInfoByDbService(TLoginInfo &dbServiceInfo , string strDbService); + //int GetDbInfoByDbName(TLoginInfo &dbServiceInfo , string strDbName); + int GetDbInfoByDbServiceDesc(TLoginInfo &dbServiceInfo , string strDbDesc); +}; + + + +#endif + + + + diff --git a/code/sys_nicmonitor/include/db_com/CDbRepSet.h b/code/sys_nicmonitor/include/db_com/CDbRepSet.h new file mode 100644 index 0000000..1ada57a --- /dev/null +++ b/code/sys_nicmonitor/include/db_com/CDbRepSet.h @@ -0,0 +1,192 @@ +//****************************************************************** +// +// AUTHOR : LMJ +// +// FUNCTION : ƶ̬ͷļ +// +// TIME : 2003.08.30 +// +// HISTORY : +// Datetime Action Author Reason +// ------------------------------------------------------------------- +// 2003.08.30 Creation LMJ +// 2004.05.26 Add ZHANGKH Add LOB interface +// 2004.12.20 Modify ZhangKeHeng Modify Function for Time Seq +// 2005.12.28 Add ZhangKeHeng ָ +//****************************************************************** + +#ifndef __CREPSET_H +#define __CREPSET_H + +#ifdef _WINDOWS64 +#ifdef DB_REP_LIB_EXPORTS +#define DB_REP_LIB_API __declspec(dllexport) +#else +#define DB_REP_LIB_API __declspec(dllimport) +#endif +#else +#define DB_REP_LIB_API +#endif + +#include "db_rep_lib_define.h" +#include "database_rep_m.h" + +#ifndef BIND_CHR +#define BIND_CHR 1 /* ַ unsigned char */ +#endif +#ifndef BIND_INT +#define BIND_INT 3 /* short int long */ +#endif +#ifndef BIND_FLT +#define BIND_FLT 4 /* float double */ +#endif +#ifndef BIND_STR +#define BIND_STR 5 /* ַstring */ +#endif +#ifndef BIND_ODT +#define BIND_ODT 156 /* date*/ +#endif + + +const int PARTLY_REP_POLICY_NOREP = 1; +const int PARTLY_REP_POLICY_ALLREP = 2; +const int PARTLY_REP_POLICY_LIST_REP = 3; +const int PARTLY_REP_POLICY_LIST_NOREP = 4; +//̸Ʋ +const int PARTLY_REP_POLICY_NOREP_EXCEPT_PROC = 5; +const int PARTLY_REP_POLICY_ALLREP_EXCEPT_PROC = 6; +const int PARTLY_REP_POLICY_LIST_REP_EXCEPT_PROC = 7; +const int PARTLY_REP_POLICY_LIST_NOREP_EXCEPT_PROC = 8; +//пɱ趨IJ(̲Ա趨Ϊ,ԵSetProcRepList趨̸ƲԺ͸б) +const int PARTLY_REP_POLICY_NOREP_SET = 9;//norep_set +const int PARTLY_REP_POLICY_ALLREP_SET = 10;//allrep_set +const int PARTLY_REP_POLICY_LIST_REP_SET = 11;//list_rep_set +const int PARTLY_REP_POLICY_LIST_NOREP_SET = 12;//list_norep_set + + +const int PARTLY_REP_PROCESS_MODEL = 1; +const int PARTLY_REP_PROCESS_WARN = 2; +const int PARTLY_REP_PROCESS_LOB_EXE = 3; +const int PARTLY_REP_PROCESS_LOB = 4; +const int PARTLY_REP_PROCESS_STATICS = 5; +const int PARTLY_REP_PROCESS_HISDB = 6; + +struct ProcessRepInfo +{ + int process_list_policy; + string process_name; + vector process_table_list_vec; +}; + +struct PartlyRepInfo +{ + string db_service_describe; + int sample_list_policy; + int warn_list_policy; + int model_list_policy; + int statics_list_policy; //add jihy 20130328 + vector warn_list_vec; + vector model_list_vec; + vector statics_list_vec;//add jihy 20130328' + + vector sample_process_repinfo;//Ϣ + vector warn_process_repinfo; + vector model_process_repinfo; + vector statics_process_repinfo; +}; + + +class DB_REP_LIB_API CDbRepSet +{ +public: + CDbRepSet(); + ~CDbRepSet(); + +public: + //ʼƶ̬ (proc_alias_nameΪ̱,Ҫdb_partly_rep.sysһ) + int InitReplicateSet (string proc_alias_name = ""); + + //ý̸б(ý̸ƲԺЩҪ) (ĬΪбƲ) (proc_alias_nameΪ̱,Ҫdb_partly_rep.sysһ) + int SetProcRepList (const string &proc_alias_name, + vector &tablename_vec, const string & strUserName = "d5000", + int rep_policy = PARTLY_REP_POLICY_LIST_REP_SET); + + //ʱҪƣģͣstrDbName Ϊ db_config_ext.sysеdb_service_describe + int ReplicateSql (const vector &strSqlVec , const string &strDbName, + const string & strUserName = "d5000"); + //ʱҪƣ澯strDbName Ϊ db_config_ext.sysеdb_service_describe + int ReplicateSqlWithNoTimeSeq (const vector &strSqlVec , + const string &strDbName , const string & strUserName = "alarm"); + //ʱҪƣstrDbName Ϊ db_config_ext.sysеdb_service_describe + int ReplicateSqlWithNoTimeSeqSample (const vector &strSqlVec , + const string &strDbName , const string & strUserName = "hisdb"); + + //ֶθ + int ReplicateLOB (const string &strSql , const string &strDbName, + const string & strUserName = "d5000"); + int ReplicateLOB (const string &strSql , const string &strSqlSelect , + const vector &lobVec, bool is_insert, const string &strDbName, + const string & strUserName = "d5000"); + + //󶨱 add by shihaoqiu 20130313 + int ReplicateBind (const TRepBindStru &bind_stru, const string &strDbName, + const string & strUserName = "d5000"); + +private: + int m_nPid; + string m_strProcName; //ǰ + string m_strPubPath; + vector m_strDbNameVec; //ݿ + map + m_bPartlyRepMap; //ݿǷ񲿷ָƣ1 + bool m_bRepFlag; + map m_PartlyRepInfoMap; //ָϢMAP + vector m_strPartlyRepPolicyVec; //ָƲַ + +private: + int GetPubPath(); + int GetAllDbName(); + int GetAllPartlyRepInfo(); + int GetReplicatePath (vector &strPathVec, vector &strDbNameVec, + string strDbName, string strUserName); + string IntToStr (int nVal); + //int WriteRepSql(const vector &strSql,const vector &strPathVec, const vector &strDbNameVec); + int WriteRepSql (const vector &strSql, const vector &strPathVec, + const vector &strDbNameVec, string strUserName); + int WriteRepSqlWithNoTimeSeq (const vector &strSql, + const vector &strPathVec, const vector &strDbNameVec); + int WriteRepSqlWithNoTimeSeqSample (const vector &strSql, + const vector &strPathVec, const vector &strDbNameVec); + int MoveInFileToOutFile (const string strInFileName); + int GetOutFileName (const string strInFileName , string &strOutFileName); + + int WriteRepLOB (const string &strSql , const vector &strPathVec, + const vector &strDbNameVec); + int WriteRepLOB (const string &strSql , const string &strSqlSelect , + const vector &lobVec, bool is_insert, + const vector &strPathVec, const vector &strDbNameVec); + int GetLOBReplicatePath ( vector &strPathVec, + vector &strDbNameVec, string strDbName, string strUserName); + int MoveLOBInFileToOutFile (const string strInFileName); + int GetLOBOutFileName (const string strInFileName , string &strOutFileName); + + int GetBindReplicatePath ( vector &strPathVec, + vector &strDbNameVec, string strDbName, string strUserName); + int MoveBindInFileToOutFile (const string strInFileName); + int GetBindOutFileName (const string strInFileName , string &strOutFileName); + int WriteRepBind (const TRepBindStru &bind_stru, + const vector &strPathVec, const vector &strDbNameVec); + + int GetPartlyRepSql (const vector &strSqlVec, + vector &strPartlyRepSqlVec, const string &strDbName, const int &flag); + int GetRepSqlByList (const vector &strSqlVec, + vector &strPartlyRepSqlVec, vector &tablename_list_vec, + const int &rep_policy); + void gUsleep (const int usec); +}; + + + +#endif + + diff --git a/code/sys_nicmonitor/include/db_com/CDbSem.h b/code/sys_nicmonitor/include/db_com/CDbSem.h new file mode 100644 index 0000000..3f133ed --- /dev/null +++ b/code/sys_nicmonitor/include/db_com/CDbSem.h @@ -0,0 +1,67 @@ +#ifndef __CDBSEM_H_ +#define __CDBSEM_H_ + +#ifdef _WINDOWS64 +#ifdef PUB_TOOLS_EXPORTS +#define PUB_TOOLS_API __declspec(dllexport) +#else +#define PUB_TOOLS_API __declspec(dllimport) +#endif +#else +#define PUB_TOOLS_API +#endif + +#include +#include +#include +#include +#include + +#ifndef _WINDOWS64 +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#else +#include +#endif + +using namespace std; + +union db_semun +{ + int val; + struct semid_ds *buf; + unsigned short *array; +}; + +class PUB_TOOLS_API CDbSem +{ +#ifndef _WINDOWS64 + int m_nSemId; +#else + char m_pSemName[64]; +#endif +public: + CDbSem(); + ~CDbSem(); +#ifndef _WINDOWS64 + int InitSem(key_t key, int nsems, int initval); + int GetSemValue(int sem_id, int sem_num); + int ClearSemValue(int sem_id, int sem_num); +#else + int InitSem(const char *sem_name); +#endif + int p(); + int v(); + +}; + +#endif + diff --git a/code/sys_nicmonitor/include/db_com/CDbSemUse.h b/code/sys_nicmonitor/include/db_com/CDbSemUse.h new file mode 100644 index 0000000..af1898e --- /dev/null +++ b/code/sys_nicmonitor/include/db_com/CDbSemUse.h @@ -0,0 +1,35 @@ +#ifndef __CDBSEMUSE_H_ +#define __CDBSEMUSE_H_ + +#include "CDbSem.h" + +#ifdef _WINDOWS64 +#ifdef PUB_TOOLS_EXPORTS +#define PUB_TOOLS_API __declspec(dllexport) +#else +#define PUB_TOOLS_API __declspec(dllimport) +#endif +#else +#define PUB_TOOLS_API +#endif + +class PUB_TOOLS_API CDbSemUse +{ +public: + CDbSemUse(CDbSem &sem); + ~CDbSemUse(); + +private: + CDbSem &m_Sem; + + int m_nPflag; + int m_nVflag; + +public: + int GetPflag(); + int GetVflag(); + +}; + +#endif + diff --git a/code/sys_nicmonitor/include/db_com/CDbShm.h b/code/sys_nicmonitor/include/db_com/CDbShm.h new file mode 100644 index 0000000..9c0e95d --- /dev/null +++ b/code/sys_nicmonitor/include/db_com/CDbShm.h @@ -0,0 +1,96 @@ +#ifndef __CDBSHM_H +#define __CDBSHM_H + +#ifdef _WINDOWS64 +#ifdef PUB_TOOLS_EXPORTS +#define PUB_TOOLS_API __declspec(dllexport) +#else +#define PUB_TOOLS_API __declspec(dllimport) +#endif +#else +#define PUB_TOOLS_API +#endif + +#include + +#ifndef _WINDOWS64 +#include +#include +#include + +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#ifdef _HPUX +#include +#else +#include +#endif +#include +#include +#include +#else +#include +#include +#include +#include +#include +#include +#include +#endif + +class PUB_TOOLS_API CDbShm +{ + +public: + CDbShm(); + ~CDbShm(); +private: + + static int m_TotalShmSize; + + static char * m_pShm; +public: +#ifndef _WINDOWS64 + int InitShm(key_t key, int size); +#else + int InitShm(const char* file_name, const int size); +#endif + + static int SetShmSize(int nSize); + + static int GetShmSize(int &nSize); + + int WriteShm(char * inShm, int inSize, int ptrOffset); + + int ReadShm(char * &outShm, int outSize, int ptrOffset); + + char* MapFile(const char* file_name, const int stab_total_size); + + int ReadShmEx(char * outShm, int outSize, int ptrOffset); + +}; + +#endif + diff --git a/code/sys_nicmonitor/include/db_com/CDyCfgLocal.h b/code/sys_nicmonitor/include/db_com/CDyCfgLocal.h new file mode 100644 index 0000000..1a1b8e9 --- /dev/null +++ b/code/sys_nicmonitor/include/db_com/CDyCfgLocal.h @@ -0,0 +1,130 @@ +#ifndef ___CDY_CFG_LOCAL_H__ +#define ___CDY_CFG_LOCAL_H__ + +#ifdef _WINDOWS64 +#ifdef DY_READ_CONFIG_LOCAL_EXPORTS +#define DY_READ_CONFIG_LOCAL_API __declspec(dllexport) +#else +#define DY_READ_CONFIG_LOCAL_API __declspec(dllimport) +#endif +#else +#define DY_READ_CONFIG_LOCAL_API +#endif + + +#include +#include +#include + +using namespace std; + +class DY_READ_CONFIG_LOCAL_API CDyCfgLocal +{ +public: + + CDyCfgLocal(); + ~CDyCfgLocal(); + + //dy_config.sysȡ + /************************************************************ + Description:dy_nameȡdyӦעӦ + Input: dy_name + Output:app_name + ************************************************************/ + int GetDyAppNameByDyName (const string dy_name , string& app_name); + /************************************************************ + Description:dy_nameȡdyӦעӦú + Input: dy_name + Output:app_no + ************************************************************/ + int GetDyAppNoByDyName (const string dy_name , int& app_no); + /************************************************************ + Description:dy_nameproc_name,䵱ǰ̶˿ں + is_controlֻdy_commit,dy_query_sample_serverЧ + Input: dy_name,proc_name,is_control + Output:app_no + ************************************************************/ + int GetAppPortPosByDyName (const string dy_name , const string proc_name , + int& proc_port, bool is_control = true); + /************************************************************ + Description:dy_nameȡdyӦӦ,dy_iscadaΪiscadaӦ÷ + Input: dy_name + Output:app_name + ************************************************************/ + int GetServedAppNameByDyName (const string dy_name , string& app_name); + /************************************************************ + Description:dy_nameȡdyӦӦú + Input: dy_name + Output:app_no + ************************************************************/ + int GetServedAppNoByDyName (const string dy_name, int& app_no); + /************************************************************ + Description:ȡdy_name + Input: + Output:vec_dy_names + ************************************************************/ + int GetAllDyNameFromCfg (vector& vec_dy_names); + /************************************************************ + Description:ȡdy_nameµdys_name + Input:dy_name + Output:vec_dys_names + ************************************************************/ + int GetAllDysNameByDyNameFromCfg (const string dy_name, + vector& vec_dys_names); + /************************************************************ + Description:ȡʹDYӦõӦú + Input: + Output:vec_app_no + ************************************************************/ + int GetAllDyAppNo (vector& vec_app_no); + /************************************************************ + Description:app_noӦǷʹDY + Input:app_no + Output:-1:ȡdy_config.sysļ;0:δʹDY;1:ʹDY + ************************************************************/ + int CheckDyAppNo (const int app_no); + /************************************************************ + Description:ӦúŻȡdy_name,Ӧdy_config.sysdy_app + Input:app_no + Output:dy_name + ************************************************************/ + int GetDyNameByAppNo (const int app_no, string &dy_name); + /************************************************************ + Description:app_noproc_name,䵱ǰ̶˿ں + is_controlֻdy_commit,dy_query_sample_serverЧ + Input:app_no,proc_name,is_control + Output:proc_port + ************************************************************/ + int GetAppPortPosByAppNo (const int app_no , const string proc_name , + int& proc_port, bool is_control = true); + /************************************************************ + Description:dyӦӦúŻȡdyӦӦú + Input:app_no + Output:register_app + ************************************************************/ + int GetDyAppByServedApp (const int app_no, int ®ister_app); + +private: + int getIndexByServiceName (string service_name) ; + int getIndexByDyName (const string dy_name) ; + string gDyIntToStr (int nVal); + int ReadDyConfigInfoLocal(); + int StringCopy (char *des, const char *src, int max_len); + + vector m_vec_dy_names; + map > m_dy_dys_vec_map; + vector m_vec_app_name; + vector m_vec_port_pos; + map m_dyname_app_map; + map m_app_dyname_map; + //app_name->app_no from mng_app_num_name.ini + map m_mng_app_name_map; + map m_app_dyapp_map; + map m_procname_port_map; + + bool m_read_cfg;//ļȡɹʶ + // void gUsleep(const int usec); +}; + +#endif + diff --git a/code/sys_nicmonitor/include/db_com/CDyCommitClient.h b/code/sys_nicmonitor/include/db_com/CDyCommitClient.h new file mode 100644 index 0000000..95dd010 --- /dev/null +++ b/code/sys_nicmonitor/include/db_com/CDyCommitClient.h @@ -0,0 +1,85 @@ +#ifndef ___CDYCOMMITCLIENT_H__ +#define ___CDYCOMMITCLIENT_H__ + +#ifdef _WINDOWS64 +#ifdef DY_COMMIT_DLL_EXPORTS +#define DY_COMMIT_DLL_API __declspec(dllexport) +#else +#define DY_COMMIT_DLL_API __declspec(dllimport) +#endif +#else +#define DY_COMMIT_DLL_API +#endif + +#ifndef _WINDOWS64 +#include +#include +//#include +#else +#include +#include +#endif + +#include "dy_commit_m.h" +//#include "common_service_interface.h" +//#include +#include "msg_api/message_inv.h" +#include "sysadm/scn_service.h" +#include "servicemanage.h" +#include "pub_ctx.h" +#include "system.h" +#include "port_def.h" +#include "db_com/CDyCfgLocal.h" + +using namespace NS_SYSADMIN; +//#include +//#include + +/*#ifndef SERVEICE_CLASS_H +#define SERVEICE_CLASS_H + +class CServicesManage servicesman; +#endif*/ + +struct TDyReCommitProp //չãݲʹ +{ + int app_no; +}; + +class DY_COMMIT_DLL_API CDyCommitClient +{ +public: + CDyCommitClient (int sys_port); + CDyCommitClient (int sys_port, int seconds); + CDyCommitClient();//ͼ޸SCADA + ~CDyCommitClient(); + + //void SetAppNo(const int app_no); + void SetRequestTimeout (int seconds); + short VSCommit (TDyCommitVS DyCommitVSStru); + short KVSCommit (TDyCommitKVS DyCommitKVSStru); + +private: + ServiceInfo m_Serviceinfo; + CDyCfgLocal m_dy_cfg_read; + char m_IpAddress[64]; + int m_Port; + Handle m_Handle; + char m_HostName[64]; + CScnService* m_ServicesManage; + int m_RequestTimeoutSeconds; + + int GetHostByAppNo (char* host_name, const int app_no, const short context_no); + int SetServiceHost(int app_no); + + bool print_env;//Ƿӡ + //¼ӦǷҪܿط + map map_app_is_ctrl; + //ǷҪԶȡ˿ں,CDyCommitClient()Ч + bool m_is_port_auto_set; + + short GetIsCtrlByApp(const int app_no,bool &is_ctrl); +}; + + +#endif diff --git a/code/sys_nicmonitor/include/db_com/CDyMonitorClient.h b/code/sys_nicmonitor/include/db_com/CDyMonitorClient.h new file mode 100644 index 0000000..9281f69 --- /dev/null +++ b/code/sys_nicmonitor/include/db_com/CDyMonitorClient.h @@ -0,0 +1,80 @@ + +#ifndef __CDYMONITORCLIENT_H__ +#define __CDYMONITORCLIENT_H__ +/* +#ifdef _WINDOWS64 +#ifdef DY_MONITOR_DLL_EXPORTS +#define DY_MONITOR_DLL_API __declspec(dllexport) +#else +#define DY_MONITOR_DLL_API __declspec(dllimport) +#endif +#else +#define DY_MONITOR_DLL_API +#endif +*/ +#include "dy_monitor_m.h" +#include "sysadm/scn_service.h" +#include "system.h" +#include "pub_ctx.h" +#include +#include +#include +#include +#include +#include "servicemanage.h" +//#include "common_service_interface.h" +//#include +using namespace NS_SYSADMIN; + +class CDyMonitorClient// : virtual public common_service_interface +{ + public: + //CDyMonitor_var m_Specify_GenerInvoke; + //CDyMonitor_var m_GenerInvoke; + public: + + /*CDyMonitorClient(int app_id, char * specify_host_name, int specify_port, char * specify_server_object, short context =0 , char * orb_name = NULL) + :common_service_interface(app_id, specify_host_name, specify_port, specify_server_object, context, orb_name){} + + CDyMonitorClient(int app_id, int policy, int sys_port,char * server_object, short context = 0, char * orb_name = NULL) + :common_service_interface(app_id, policy,sys_port, server_object, context , orb_name){} + + CDyMonitorClient(int app_id, int policy, int sys_port, char * server_object,const vector &props_vec, short context =0, char * orb_name = NULL) + :common_service_interface( app_id, policy, sys_port, server_object, props_vec , context , orb_name){} + CDyMonitorClient(int app_id, char * specify_host_name, int specify_port, char * specify_server_object, const vector &props_vec, short context = 0, char * orb_name = NULL) + :common_service_interface( app_id, specify_host_name, specify_port, specify_server_object, props_vec, context , orb_name){} + */ + CDyMonitorClient(); + CDyMonitorClient(int port); + CDyMonitorClient(int port, int seconds); + ~CDyMonitorClient(); + void SetRequestTimeout(int seconds); + //ӦʵķӦ,ĬAP_DATA_SRV_DY + void SetAppNo(const int app_no); + + //õĽӿںӣIDLӳͷļж + short GetMasterDyInfo(const char* strDyName,TDyLoginInfo &masterDyInfo); + + short MasterDySwitchByDyServiceName(const char* strDyName); + + short GetDyNum(int &nSize); + + short GetAllDyServerInfo(TDyServiceInfo &dyServerInfoSec); + + private: + ServiceInfo m_Serviceinfo; + char m_IpAddress[64]; + int m_Port; + Handle m_Handle; + char m_HostName[64]; + CScnService *m_ServicesManage;//modify by wuhan + int m_RequestTimeoutSeconds; + int m_app_no; + int GetHostByAppNo(char* host_name, const int app_no, const short context_no); + int SetServiceHost(); +}; + +#endif + + + diff --git a/code/sys_nicmonitor/include/db_com/CDyMonitorLocal.h b/code/sys_nicmonitor/include/db_com/CDyMonitorLocal.h new file mode 100644 index 0000000..dd8411f --- /dev/null +++ b/code/sys_nicmonitor/include/db_com/CDyMonitorLocal.h @@ -0,0 +1,64 @@ +#ifndef ___CDYMONITORLOCAL_H__ +#define ___CDYMONITORLOCAL_H__ +/* +#ifdef _WINDOWS64 +#ifdef DY_MONITOR_DLL_LOCAL_EXPORTS +#define DY_MONITOR_DLL_LOCAL_API __declspec(dllexport) +#else +#define DY_MONITOR_DLL_LOCAL_API __declspec(dllimport) +#endif +#else +#define DY_MONITOR_DLL_LOCAL_API +#endif +*/ +#include "dy_monitor_define.h" +#include "CDyMonitorShm.h" + +class CDyMonitorLocal +{ +public: + + CDyMonitorLocal(); + ~CDyMonitorLocal(); + + //ʼź,ȡdy_config.sys + int InitDyMonitorLocal(); + //ʼź,Ϊȡdy_config.sys,InitDyMonitorLocal()ֻ2ѡ1 + int InitDyLoginParaInfo(); + //get info from shm + int GetMasterDyInfo (string strDysName, TLoginDyInfo &masterDyInfo); + + int GetMasterDyInfo (string dy_name,string strDysName, TLoginDyInfo &masterDyInfo); + + int GetDyNum (int &nSize); + + int GetAllDyServerInfo (vector &dyServerInfoVec); + + int GetAllDyServerInfo (const string strDyName,vector &dyServerInfoVec); + int getIndexByServiceName (string service_name) ; + + int getIndexByServiceName (const string dy_name,const string service_name) ; + + //get info from dy_config.sys + int GetAllDySNameFromCfg(string strDyName,vector& dySNameVec); + int GetAllDyNameFromCfg (vector& vec_dy_names); + int GetDyNumFromCfg(int &nSize); + int GetDyServerInfoByIndex (const int index,TLoginDyInfo& dyServerInfo); + +private: + + int getIndexByDyName (const string dy_name) ; + string gDyIntToStr (int nVal); + int ReadDyConfigInfoLocal(); + int StringCopy (char *des, const char *src, int max_len); + + vector m_dy_config_info; + + vector m_vec_dy_names;//˳¼dy_name + vector m_vec_dy_pos;//¼dy_namem_dy_config_infoжӦʼλ,Ӧm_vec_dy_names + map > m_app_dys_map; + // void gUsleep(const int usec); +}; + +#endif + diff --git a/code/sys_nicmonitor/include/db_com/CDyMonitorShm.h b/code/sys_nicmonitor/include/db_com/CDyMonitorShm.h new file mode 100644 index 0000000..281b1ce --- /dev/null +++ b/code/sys_nicmonitor/include/db_com/CDyMonitorShm.h @@ -0,0 +1,63 @@ +//****************************************************************** +// +// AUTHOR : JiXueChun +// +// FUNCTION : ݿӽвڴ ෽ +// +// TIME : 2006.11.20 +// +// HISTORY : +// Datetime Action Author Reason +// ----------------------------------------------------------------- +// 2006.11.20 Creation JiXueChun +// 2008.07.29 Modify JiXueChun add support to distributed dys +//****************************************************************** + +#ifndef __CDYMONITORSHM_H_ +#define __CDYMONITORSHM_H_ +#include "dy_monitor_define.h" + + +class CDyMonitorShm +{ + +protected: + CDyMonitorShm(); +public: + static CDyMonitorShm & getInstance() + { + static CDyMonitorShm gCDyMonitorShm; + return gCDyMonitorShm; + } + ~CDyMonitorShm(); +private: + + CDyShm m_DbShm; + + TLoginDyInfo * m_pAllDyInfo; + + int m_nDyNum; + static int m_nDyNumOffset; + static int m_nAllDyAppStatusOffset; + static int m_nAllDyInfoOffset; + int m_TotalShmSize; + +public: + int InitDyMonitorShm(); + int SetDyAppStatusInfoByIndex (int index, int nStatus); + int GetDyAppStatusInfoByIndex (int index, int &nStatus); + int SetDyNum (int nDyNum); + int GetDyNum (int &nDyNum); + int SetDyServiceInfoByIndex (int index, const TLoginDyInfo &dyServiceInfo); + int GetDyServiceInfoByIndex (int index, TLoginDyInfo &dyServiceInfo); +private: + string gDyIntToStr (int nVal); +}; + + + +#endif + + + + diff --git a/code/sys_nicmonitor/include/db_com/CDySem.h b/code/sys_nicmonitor/include/db_com/CDySem.h new file mode 100644 index 0000000..effe3de --- /dev/null +++ b/code/sys_nicmonitor/include/db_com/CDySem.h @@ -0,0 +1,67 @@ +#ifndef __CDYSEM_H_ +#define __CDYSEM_H_ + +#ifdef _WINDOWS64 +#ifdef PUB_TOOLS_EXPORTS +#define PUB_TOOLS_API __declspec(dllexport) +#else +#define PUB_TOOLS_API __declspec(dllimport) +#endif +#else +#define PUB_TOOLS_API +#endif + +#include +#include +#include +#include +#include + +#ifndef _WINDOWS64 +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#else +#include +#endif + +using namespace std; + +union dy_semun +{ + int val; + struct semid_ds *buf; + unsigned short *array; +}; + +class PUB_TOOLS_API CDySem +{ +#ifndef _WINDOWS64 + int m_nSemId; +#else + char m_pSemName[64]; +#endif +public: + CDySem(); + ~CDySem(); +#ifndef _WINDOWS64 + int InitSem(key_t key, int nsems, int initval); + int GetSemValue(int sem_id, int sem_num); + int ClearSemValue(int sem_id, int sem_num); +#else + int InitSem(const char *sem_name); +#endif + int p(); + int v(); + +}; + +#endif + diff --git a/code/sys_nicmonitor/include/db_com/CDySemUse.h b/code/sys_nicmonitor/include/db_com/CDySemUse.h new file mode 100644 index 0000000..df1aa78 --- /dev/null +++ b/code/sys_nicmonitor/include/db_com/CDySemUse.h @@ -0,0 +1,35 @@ +#ifndef __CDYSEMUSE_H_ +#define __CDYSEMUSE_H_ + +#ifdef _WINDOWS64 +#ifdef PUB_TOOLS_EXPORTS +#define PUB_TOOLS_API __declspec(dllexport) +#else +#define PUB_TOOLS_API __declspec(dllimport) +#endif +#else +#define PUB_TOOLS_API +#endif + +#include "CDySem.h" + +class PUB_TOOLS_API CDySemUse +{ +public: + CDySemUse(CDySem &sem); + ~CDySemUse(); + +private: + CDySem &m_Sem; + + int m_nPflag; + int m_nVflag; + +public: + int GetPflag(); + int GetVflag(); + +}; + +#endif + diff --git a/code/sys_nicmonitor/include/db_com/CDyShm.h b/code/sys_nicmonitor/include/db_com/CDyShm.h new file mode 100644 index 0000000..2465c89 --- /dev/null +++ b/code/sys_nicmonitor/include/db_com/CDyShm.h @@ -0,0 +1,86 @@ +#ifndef __CDYSHM_H +#define __CDYSHM_H + +#ifdef _WINDOWS64 +#ifdef PUB_TOOLS_EXPORTS +#define PUB_TOOLS_API __declspec(dllexport) +#else +#define PUB_TOOLS_API __declspec(dllimport) +#endif +#else +#define PUB_TOOLS_API +#endif + +#include + +#ifndef _WINDOWS64 +#include +#include +#include + +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#else +#include +#include +#include +#include +#include +#include +#include +#endif + +class PUB_TOOLS_API CDyShm +{ + +public: + CDyShm(); + ~CDyShm(); + +private: + int m_TotalShmSize; + char* m_pShm; + +public: + +#ifndef _WINDOWS64 + int InitShm(key_t key, int size); +#else + int InitShm(const char* file_name, const int size); +#endif + + int SetShmSize(int nSize); + int GetShmSize(int &nSize); + int WriteShm(char * inShm, int inSize, int ptrOffset); + int ReadShm(char * &outShm, int outSize, int ptrOffset); + char* MapFile(const char* file_name, const int stab_total_size); + +}; + +#endif diff --git a/code/sys_nicmonitor/include/db_com/CDyTagShmInfo.h b/code/sys_nicmonitor/include/db_com/CDyTagShmInfo.h new file mode 100644 index 0000000..074c335 --- /dev/null +++ b/code/sys_nicmonitor/include/db_com/CDyTagShmInfo.h @@ -0,0 +1,30 @@ +//****************************************************************** +// AUTHOR : WangChangpin +// FUNCTION : ṩȡdy_get_tag.sys +// TIME : 2014.11.10 +// HISTORY : +// Datetime Action Author Reason +// ------------------------------------------------------------------- +// 2014.11.10 Creation +//****************************************************************** + +#ifndef _CDY_TAG_SHM_INFO_H_ +#define _CDY_TAG_SHM_INFO_H_ + +#include "paramanage.h" + +class CDyTagShmInfo +{ +public: + CDyTagShmInfo(); + ~CDyTagShmInfo(); + + short GetMaxWaitTime(int& wait_time); + short GetMaxCountByDyName(const string dy_name,int& max_tag_count); + short GetShmKeyByDyName(const string dy_name,int& shm_key); + +private: + CParaManage * pm; +}; + +#endif diff --git a/code/sys_nicmonitor/include/db_com/CErrorLog.h b/code/sys_nicmonitor/include/db_com/CErrorLog.h new file mode 100644 index 0000000..b0efd52 --- /dev/null +++ b/code/sys_nicmonitor/include/db_com/CErrorLog.h @@ -0,0 +1,94 @@ +#ifndef _CERRORLOG_H +#define _CERRORLOG_H + +#ifdef _WINDOWS64 +#ifdef PUB_TOOLS_EXPORTS +#define PUB_TOOLS_API __declspec(dllexport) +#else +#define PUB_TOOLS_API __declspec(dllimport) +#endif +#else +#define PUB_TOOLS_API +#endif + +#include +#include +#include + +#include + +#ifdef _WINDOWS64 +#include +#include +#else +#include +#include +#endif + +//#include "paramanage.h" +#include "system.h" +#include "db_com/wholepubtools.h" + +using namespace std; + +const int ONE_DAY_TIME = 24 * 60 * 60; + +const int MAX_ERROR_LOG_SIZE = 100; +const int ERR_MAX_FILE_NAME = 255; +const int ERR_MAX_PARA_NAME = 128; + +const string ERR_IN_DIR_SEPARATOR = "/in/"; +const string ERR_OUT_DIR_SEPARATOR = "/out/"; + +//Ϣṹ +struct TDbErrorMsg +{ + int err_no; //DBAccess + string dbaccess_err; //DBAccessϢ + string db_err; //ݿϢ +}; + +class PUB_TOOLS_API CErrorLog +{ +private: + + time_t m_LastTime; + time_t m_CurTime; + string m_strFileName; + bool m_bReCreateFile; + + int m_nFileNo; + bool m_LogFlag; + int m_nPid; + string m_strPubPath; + vector m_strDbNameVec; //ݿ + time_t m_LastWriteFileTime; //һдSQLļʱ + +public: + + CErrorLog(); + ~CErrorLog(); + int InitErrorLog(); + + int WriteErrorLog(string sql, vector err_vec, const string strpath, string strDbName = ""); + + int WriteLog(vector strLogVec, const string strpath); + + int WriteLog(string strLog, const string strpath); + + //zhangkeheng add for LOB + int WriteErrorLog(string sql, string select_sql, vector err_vec, const string strpath); + +private: + + int GetTimeStringByTime_t(const time_t seconds, string &value_string) const; + + int CheckIfReCreateFile(); + + int GetPubPath(); + + string IntToStr(int nVal); + +}; + +#endif diff --git a/code/sys_nicmonitor/include/db_com/CFindFile.h b/code/sys_nicmonitor/include/db_com/CFindFile.h new file mode 100644 index 0000000..42b139d --- /dev/null +++ b/code/sys_nicmonitor/include/db_com/CFindFile.h @@ -0,0 +1,143 @@ +#ifndef _CFINDFILE_H_ +#define _CFINDFILE_H_ + +#ifdef _WINDOWS64 +#ifdef PUB_TOOLS_EXPORTS +#define PUB_TOOLS_API __declspec(dllexport) +#else +#define PUB_TOOLS_API __declspec(dllimport) +#endif +#else +#define PUB_TOOLS_API +#endif + +#include +#include +#include +#include +#include +#include +#include + +#ifndef _WINDOWS64 +#include +#include +#include +#include +#include +#include +#include +#include +#else +#include +#include +#include +#include +#endif + +using namespace std; + +#define MAXNAMLENGTH 256 + +#ifndef _WINDOWS64 +class CFindFile +{ +public: + CFindFile(); + ~CFindFile(); + +private: + ///enum {MAXNAMLEN = 256}; + char m_chPath[MAXNAMLENGTH]; + char m_chName[MAXNAMLENGTH]; + + + DIR *m_pDir; + dirent *m_pDirent; + + bool IsSpecialType(int nType) const; + +public: + + char *GetFileName() ; + + bool IsDirectory() const; + bool IsFifo() const; + bool IsChar() const; + bool IsBlock() const; + bool IsLink() const; + bool IsSocket() const; + bool IsNormal() const; + + + void OwnerMode(bool &bRead,bool &bWrite,bool &bExec); + + void GroupMode(bool &bRead,bool &bWrite,bool &bExec); + + void OtherMode(bool &bRead,bool &bWrite,bool &bExec); + + bool GetLastModifyTime(int &sec); + + int chrcnt(const char *string,int letter); + + + +public: + bool FindFile(char *pPath); + + int FindNext(); + + int RmOldFile(char* pPath , int cur_sec , int time_interval); + + bool GetFindFileName(string &filename); + + bool GetFindFileName(const string strPathName , vector &filenameVec , int nFileNum); + + bool GetCurFileName(string & filename) ; + + int CheckPath(string strPathname); + + bool CheckDirSizeOutOfMaxSize(string strPathName , int nMaxSize); + + int RemoveDir(string strPathName); + + //zhangkeheng add for REP + bool GetFindFileNameByAlphaSort(string &filename); + bool GetFindFileNameByAlphaSort(const string strPathName , vector &filenameVec , int nFileNum); + bool GetFindFileNameByAlphaSort1(string &filename , int & count); + + //zhangkeheng add for ʱ + bool GetRep1FileCountByAlphaSort(string &filename , int & rep1_count, const int max_count); + + //chenpeng add for ƷĿ¼ + bool GetFindDirNameByAlphaSort(const string strPathName , vector &dirnameVec , int nDirNum); + bool GetFindDirNameByAlphaSort(const string strPathName , string &dirname ,bool need_check = true); + int GetFindFileNameByAlphaSort(const string strPathName , vector &filenameVec , string &dirname,int nFileNum , bool need_check = true); + bool GetFindDirNameByAlphaSort1(string &dirname , int & count); +}; +#else + +class PUB_TOOLS_API CFindFile +{ +public: + CFindFile(); + ~CFindFile(); +public: + int CheckPath(string strPathname); + + //zhangkeheng add for REP + bool GetFindFileNameByAlphaSort(string &filename); + bool GetFindFileNameByAlphaSort(const string strPathName, vector &filenameVec , int nFileNum); + bool GetFindFileNameByAlphaSort1(string &filename , int & count); + + //zhangkeheng add for ʱ + bool GetRep1FileCountByAlphaSort(string &filename , int & rep1_count, const int max_count); + + //chenpeng add for ƷĿ¼ + bool GetFindDirNameByAlphaSort(const string strPathName , string &dirname ,bool need_check = true); + int GetFindFileNameByAlphaSort(const string strPathName , vector &filenameVec , string &dirname,int nFileNum , bool need_check = true); + bool GetFindDirNameByAlphaSort1(string &dirname , int & count); +}; +#endif +#endif + diff --git a/code/sys_nicmonitor/include/db_com/CPrecTime.h b/code/sys_nicmonitor/include/db_com/CPrecTime.h new file mode 100644 index 0000000..4c0085d --- /dev/null +++ b/code/sys_nicmonitor/include/db_com/CPrecTime.h @@ -0,0 +1,59 @@ +#ifndef __CPRECTIME_H +#define __CPRECTIME_H + +#ifdef _WINDOWS64 +#ifdef PUB_TOOLS_EXPORTS +#define PUB_TOOLS_API __declspec(dllexport) +#else +#define PUB_TOOLS_API __declspec(dllimport) +#endif +#else +#define PUB_TOOLS_API +#endif + +#include +#include + +#ifdef _WINDOWS64 +#include +#else +#include +#endif + +using namespace std; + +class PUB_TOOLS_API CPrecTime +{ + string m_strWork; +public: + CPrecTime (const string & strWork); + + ~CPrecTime(); + +public: + int StartTime(); + + int FinishTime(); + + /************************************************************ + Description:ȡʱʱ + Input: + Output: + Input/Output: + Others: + ************************************************************/ + float GetUsedTime(); + +private: +#ifndef _WINDOWS64 + struct timeval m_TpStart, m_TpFinish; + struct timezone m_TzpStart, m_TzpFinish; +#else + int m_StartMSec; + int m_EndMSec; +#endif + +}; + +#endif + diff --git a/code/sys_nicmonitor/include/db_com/CRecordSet.h b/code/sys_nicmonitor/include/db_com/CRecordSet.h new file mode 100644 index 0000000..2b0c037 --- /dev/null +++ b/code/sys_nicmonitor/include/db_com/CRecordSet.h @@ -0,0 +1,93 @@ +/* + * CRecordSet.h + * + * Created on: 2013-2-19 + * Author: drizzt + */ + +#ifndef CRECORDSET_H_ +#define CRECORDSET_H_ + +#include +#include +#include "db_com/wholesqlsp.h" + +using namespace std; + +class FieldValue +{ +public: + FieldValue(TResultDataValue *data_value); + ~FieldValue(); + +public: + short DataType(); + bool isNull(); + string toString(); + int toInt(); + long toLong(); + float toFloat(); + +private: + TResultDataValue *m_result_data; +}; + + +class CRecordSet +{ +public: + CRecordSet(); + ~CRecordSet(); +public: + int GetQueryResult(char *query_sql); + int GetRecordNum(); //ȡѯ¼ + int GetColumnNum(); //ȡѯ + template + int GetQueryResult(char *query_sql, vector &query_record_vec) + { + int record_num; + SEQOutDataTypeStru data_type_seq; + TSelectResultStru result_ptr; + SEQDBErrorStru err_vec; + VIndicator is_nulls; + if (m_sql_sp_client->SelectSql(query_sql, QUERY_ALL_RESULT, data_type_seq, result_ptr, err_vec) != 0) + { + cout<<"GetRecordData SelectSql : "< 0) + { + T *struct_ptr = &query_record_vec[0]; + if(result_align.GetAlignResultClient(result_ptr.field_info, result_ptr.data_value_seq, is_nulls, struct_ptr, sizeof(T)) < 0) + { + cout<<"GetRecordData GetAlignResultClient ʧ"< +#include +#include +#include +#include +#ifdef _REDIS_ACCESS +#include "hiredis.h" +#endif + +using namespace std; + +#define REDIS_ACCESS_SUCCESS 1 +#define REDIS_ACCESS_FAIL -1 + +class CRedisAccess +{ +public: + CRedisAccess(); + int Connect(const char *ip, int port, string& err_str); + int disConnect(); + int setString(const string &key, const string &value, string& err_str); + int setString(const string & data, string& err_str); + + int getString(const string & key, string & value, string& err_str); + + int freeReply(); + bool isDisconnected(); +private: +#ifdef _REDIS_ACCESS + redisContext * _context; + redisReply * _reply; +#endif +}; + +#endif diff --git a/code/sys_nicmonitor/include/db_com/CRepSet.h b/code/sys_nicmonitor/include/db_com/CRepSet.h new file mode 100644 index 0000000..d8cb9a3 --- /dev/null +++ b/code/sys_nicmonitor/include/db_com/CRepSet.h @@ -0,0 +1,405 @@ +/************************************************* + Copyright (C), 1988-1999, Nari Tech. Co., Ltd. + File name: CRepSet.h + Author: LH + Version: 1.0 + Date: 2011.8.24 + Description: ƶ̬ͷļ + Function List: + 1.int InitReplicateSet(void); ʼƶ̬ + 2.int ReplicateSql(const vector &sqlVec); sqlͬļ + Datetime Action Author Modify + ------------------------------------------------------------------- + 2011.8.24 Creation LH + + 2014.03.25 add wp + Ŀǰ汾׹, ÿ׹ Ľӿڲܻ: + 1.sqlͬļ(ԭй) + ؽӿ: + int InitReplicateSet(void); + int ReplicateSql(const vector &sqlVec); + int WriteRepSql(const vector &sql_vector); + int LogRepWrite(const string remote_db_name, const string &err_msg, int log_flag = 0); + int MoveInFileToOutFile(string inFilePath, string outFilePath, string remote_db_name); + int MoveFileToCommitDir(string &err_msg); + int GetAllDbPubPath(void); + int CheckCommitSysFile(string remote_db_name, string uncommit_file_path, vector &commit_sql_vec); + int isAutoRep(void); + 2.¼sqlعϢعϢͬһͬļ() Զ̵߳á + ˳: ȵInitReplicateSetʼGetRepFileNameȡļȻͿԵúдRepSqlRollbackInfoRollbackTri + ؽӿ: + int InitReplicateSet(int thread_id); + int GetRepFileName(const string keyid, const string user_name,string & str_filename); + int WriteRepSqlByFilename(const string rep_file_name, const vector &sql_vector); + int WriteRollbackInfoByFilename(const string rep_file_name, const vector &sql_vector); + int WriteRollbackTriByFilename(const string rep_file_name, const vector &sql_vector); + int WriteCommonInfoByFilename(const string rep_file_name, const vector &sql_vector); + int WriteOrigStatusByFilename(const string rep_file_name, const string &sql_string); + int WriteModifiedStatusByFilename(const string rep_file_name, const string &sql_string); + int MoveFileToCommitDir (vector file_name_vec, string &err_msg); + int MoveInFileToOutFileByFilename(string file_name);//WriteRepSqlByFilenameô˽ӿڣƶļoutĿ¼ + int ReadRepSqlByFilename( const string file_name, vector &str_sql_vec); + int ReadRollbackInfoByFilename( const string file_name, vector &rollback_info_vec); + int ReadRollbackTriByFilename( const string file_name, vector &rollback_tri_vec); + int ReadCommonInfoByFilename( const string file_name, vector &common_vec); + int ReadOrigStatusByFilename( const string file_name, string &orig_string; + int ReadModifiedStatusByFilename( const string file_name, string &modify_string); + int GetAllDbPubPath(void); + int GetAutoRepFlag(void); + int CheckCommitSysFile(string remote_db_name, string uncommit_file_path, vector &commit_sql_vec); + int LogRepWrite(const string dir_name, const string &err_msg, int log_flag, int thread_id); + int WriteByFilenameAndSeparator(const string file_name,const string dir_name, const string separator_begin, const string separator_end, const vector &sql_vector); + int isAutoRep(void); + *************************************************/ + +#ifndef _CREPSET_H +#define _CREPSET_H + +#ifdef _WINDOWS64 +#ifdef DB_REP_LIB_EXPORTS +#define DB_REP_LIB_API __declspec(dllexport) +#else +#define DB_REP_LIB_API __declspec(dllimport) +#endif +#else +#define DB_REP_LIB_API +#endif + +#include +#include +#include +#include +#include "paramanage.h" +#include "system.h" +#include "db_com/wholepubtools.h" +#include "db_com/server_define.h" + +#define ROLLBACK_MAXLINE 8000 + +const int MAX_PARA_NAME = 64; +const int MAX_FILE_NAME = 128; + +const string FILE_SEPARATOR = "\n_NARI_D5000_NORMAL_SQL_\n"; +#ifndef _WINDOWS64 +const string FILE_END = "\n_FILE_END_\n"; +#else +const string _FILE_END_ = "\n_FILE_END_\n"; +#define FILE_END _FILE_END_; +#endif + +const string REPSQL = ""; +const string REPSQL_END = ""; +const string ROLLBACKINFO = ""; +const string ROLLBACKINFO_END = ""; +const string ROLLBACKTRI = ""; +const string ROLLBACKTRI_END = ""; +const string COMMONINFO = ""; +const string COMMONINFO_END = ""; +const string ORIGINALSTATUS = ""; +const string ORIGINALSTATUS_END = ""; +const string MODIFIEDSTATUS = ""; +const string MODIFIEDSTATUS_END = ""; + +const string ROLLBACKSQL = "[ROLLBACKSQL]"; +const string COMMIT_DIR = "commit"; + +const string INTERFACE_ONE = "INTERFACE_ONE"; //һ׽ӿ +const string INTERFACE_TWO = "INTERFACE_TWO"; //ڶ׽ӿ + +const int SCAN_DIR_NUM_ONE_TIME = 60; +const int SCAN_FILE_NUM_ONE_TIME = 36000; + +class DB_REP_LIB_API CRepSet +{ +public: + CRepSet(); + ~CRepSet(); + +public: + + /* ʼƶ̬*/ + int InitReplicateSet (void); + + /************************************************* + Function: InitReplicateSet(int) + Description: ʼƶ̬ + Calls: GetAllDbPubPath + Input: void + Output: void + Return: 0:ɹ + -1:ʧ + *************************************************/ + int InitReplicateSet (int thread_id); + + /************************************************* + Function: GetRepFileName + Description: ȡһʱļ(<128ַ)Աļд븴ݡ + Input: str_filename: ļַ + keyid: 豸keyid + user_name: û + op_type: MODIFY_OP_INSERT, MODIFY_OP_DELETE, MODIFY_OP_UPDATE, MODIFY_OP_DELALL + Output: ɵļ䵽str_filename + Return: 0:ɹ -1:gettimeofdayʧ -2: localtime_rʧ + *************************************************/ + int GetRepFileName (const string keyid, const string user_name, int op_type, + string & str_filename); + + /* sqlļ + * ֵ1 ɹ + * -1 ʧ + * */ + int ReplicateSql (const vector &sqlVec); + + /************************************************* + Function: WriteRepSqlByFilename + Description: д븴sqlָrep_file_nameͬļ + Input: const vector &sqlVec const string rep_file_nameļ + Output: void + Return: 0:ɹ + -1:ʧ + *************************************************/ + int WriteRepSqlByFilename (const string rep_file_name, + const vector &sql_vector); + + /************************************************* + Function: WriteRollbackInfoByFilename + Description: дعϢָrep_file_nameͬļ + Input: const vector &sqlVec const string rep_file_nameļ + Output: void + Return: 0:ɹ + -1:ʧ + *************************************************/ + int WriteRollbackInfoByFilename (const string rep_file_name, + const vector &sql_vector); + + /************************************************* + Function: WriteRollbackTriByFilename + Description: дعϢָrep_file_nameͬļ + Input: const vector &sqlVec const string rep_file_nameļ + Output: void + Return: 0:ɹ + -1:ʧ + *************************************************/ + int WriteRollbackTriByFilename (const string rep_file_name, + const vector &sql_vector); + + /************************************************* + Function: WriteCommonInfoByFilename + Description: дعϢָrep_file_nameͬļ + ΪֶдmanualĿ¼ + Input: const string rep_file_nameļ + sql_vectorΪд: عϢ + Output: void + Return: 0:ɹ + -1:ʧ + *************************************************/ + int WriteCommonInfoByFilename (const string rep_file_name, + const vector &sql_vector); + + /************************************************* + Function: WriteOrigStatusByFilename + Description: дԭʼϢָrep_file_nameͬļ + ΪֶдmanualĿ¼ + Input: const string rep_file_nameļ + sql_stringΪд: ԭʼϢ + Output: void + Return: 0:ɹ + -1:ʧ + *************************************************/ + int WriteOrigStatusByFilename (const string rep_file_name, + const string &sql_string); + + /************************************************* + Function: WriteModifiedStatusByFilename + Description: д޸ĺϢָrep_file_nameͬļ + ΪֶдmanualĿ¼ + Input: const string rep_file_nameļ + sql_stringΪд: ޸ĺϢ + Output: void + Return: 0:ɹ + -1:ʧ + *************************************************/ + int WriteModifiedStatusByFilename (const string rep_file_name, + const string &sql_string); + + /*SQLcommit.sysļתͬĿ¼ + * ֵ1 ɹ + * -1 ʧ + * */ + int MoveFileToCommitDir (string &err_msg); + int MoveFileToCommitDir (vector file_name_vec, string &err_msg); + + //ͼļתͼרĿ¼ + // int MoveGraphFileToCommitDir(vector file_path_vec, string &err_msg); + + /************************************************* + Function: MoveInFileToOutFileByFilename + Description: ļinĿ¼ͬļoutĿ¼. FileNameƶԶµinļ + ƶ֮ǰļмļʾļ + Input: string FileName + Output: void + Return: 0:ɹ + -1:ʧ + *************************************************/ + int MoveInFileToOutFileByFilename (string file_name); + + /************************************************* + Function: ReadRepSqlFromFile + Description: 1.file_name,ȡļsql + + Calls: + Input: 1.file_name + Output: 1.vector str_sql_vec + + Return: 0:ɹ + -1:ʧ + *************************************************/ + int ReadRepSqlByFilename (const string file_name, vector &str_sql_vec); + + /************************************************* + Function: ReadRollbackInfoByFilename + Description: 1.ȫ·ļfile_name,ȡļ»عϢ + Calls: + Input: 1.file_name + Output: 1.vector rollback_info_vecعϢ + Return: 0:ɹ -1:ʧ + *************************************************/ + int ReadRollbackInfoByFilename (const string file_name, + vector &rollback_info_vec); + + /************************************************* + Function: ReadRollbackTriFromFile + Description: 1.ȫ·ļfile_name,ȡļ»عϢ + Calls: + Input: 1.file_name + Output: 1.vector rollback_tri_vecعϢ + Return: 0:ɹ -1:ʧ + *************************************************/ + int ReadRollbackTriByFilename (const string file_name, + vector &rollback_tri_vec); + + /************************************************* + Function: ReadCommonInfoByFilename + Description: 1.ȫ·ļfile_name,ȡļ»عϢ + Input: 1.file_name + Output: 1.vector rollback_tri_vecعϢ + Return: 0:ɹ + -1:ʧ + *************************************************/ + int ReadCommonInfoByFilename (const string file_name, + vector &common_vec); + + /************************************************* + Function: ReadOrigStatusByFilename + Description: 1.ȫ·ļfile_name,ȡļԭʼϢ + Input: 1.file_name + Output: 1.string orig_stringԭʼϢ + Return: 0:ɹ + -1:ʧ + *************************************************/ + int ReadOrigStatusByFilename (const string file_name, string &orig_string); + + /************************************************* + Function: ReadModifiedStatusByFilename + Description: 1.ȫ·ļfile_name,ȡļ޸ĺϢ + Input: 1.file_name + Output: 1.string modify_string޸ĺϢ + Return: 0:ɹ + -1:ʧ + *************************************************/ + int ReadModifiedStatusByFilename (const string file_name, + string &modify_string); + + /************************************************* + Function: isAutoRep + Description: ȡͬʽ:ֶ/Զ + Input: void + Output: int + Return: >=0:ɹ. =0ֶ.=1Զ + *************************************************/ + int isAutoRep (void); + +private: + bool m_isRepFlag; + bool m_isAutoRep; + int m_nPid; + int m_nThreadid; + string m_PubPath; + string m_InterfaceIdentity; //ʶʹõһ鹦ܽӿ:INTERFACE_ONE INTERFACE_TWO. InitReplicateSetʱȷm_InterfaceIdentityֵ + //ʹòͬĽӿڻᱨ + + vector m_DbNameVec; //Ҫͬݿ + map m_remote_in_path_map; + map m_remote_out_path_map; + map m_remote_backup_path_map; + map m_remote_base_path_map; + +private: + + /*ȡͬļ·*/ + int GetAllDbPubPath (void); + + /************************************************* + Function: GetAutoRepFlag + Description: db_rep.sysļȡǷԶ[auto_replicate]is_auto_replicate=1IJ + Calls: CFindFile::CheckPath() + Input: void + Output: void + Return: 1:ɹ + -1:ʧ + *************************************************/ + int GetAutoRepFlag (void); + + /*ȡָݿϢ*/ + int GetAllPartlyRepInfo (void); + + int CheckCommitSysFile (string remote_db_name, string uncommit_file_path, + vector &commit_sql_vec); + + string IntToStr (int value); + + /*дͬļ*/ + int WriteRepSql (const vector &sql_vector); + + /*¼־,Ĭlog_flagΪ0,¼sqlļmake־*/ + int LogRepWrite (const string remote_db_name, const string &err_msg, + int log_flag = 0); + + /************************************************* + Function: LogRepWrite(const string dir_name, const string &err_msg, int log_flag, int thread_id) + Description: ¼־,Ĭlog_flagΪ0,¼sqlļmake־. + ̰߳汾̵ͬ߳־д벻ͬļ + Calls: CFindFile findfile; + Input: const string &err_msg дϢ + const string dir_name ĿĿ¼ + int log_flag, + int thread_id ̺߳ + Output: void + Return: 1:ɹ + -1:ʧ + *************************************************/ + int LogRepWrite (const string dir_name, const string &err_msg, int log_flag, + int thread_id); + + /*ͬļin outĿ¼*/ + int MoveInFileToOutFile (string inFilePath, string outFilePath, + string remote_db_name); + + /************************************************* + Function: WriteByFilenameAndSeprator + Description: дϢָfile_nameļ + Input: const vector &sqlVec const string file_nameļ + const string dir_nameļԶݿ: huazhong . m_isAutoRep == falseʱҪΪmanual + const string separator_begin, const string separator_end ʼͽķָ + Output: void + Return: 1:ɹ + -1:ʧ + *************************************************/ + int WriteByFilenameAndSeparator (const string file_name, const string dir_name, + const string separator_begin, const string separator_end, + const vector &sql_vector); + +}; + +#endif + diff --git a/code/sys_nicmonitor/include/db_com/CSaveReCommitSql.h b/code/sys_nicmonitor/include/db_com/CSaveReCommitSql.h new file mode 100644 index 0000000..85f177b --- /dev/null +++ b/code/sys_nicmonitor/include/db_com/CSaveReCommitSql.h @@ -0,0 +1,78 @@ +#ifndef __CSAVERECOMMITSQL_H_ +#define __CSAVERECOMMITSQL_H_ + +#ifdef _WINDOWS64 +#ifdef SAVE_SQL_EXPORTS +#define SAVE_SQL_API __declspec(dllexport) +#else +#define SAVE_SQL_API __declspec(dllimport) +#endif +#else +#define SAVE_SQL_API +#endif + +#include +#include +#include +using namespace std; + +const string FILE_SEPARATOR = "\n_NARI_RE_COMMIT_\n"; +const string IN_DIR_SEPARATOR = "/in/"; +const string OUT_DIR_SEPARATOR = "/out/"; + +const int MAX_FILE_NAME_LENGTH = 255; + +const int R_HIGH_PRIOR = 1; +const int R_MIDDLE_PRIOR = 2; +const int R_LOW_PRIOR = 3; + +const int NO_SQL_DUP_RE_COMMIT = 0; +const int SQL_DUP_RE_COMMIT = 1; + +const int RE_COMMIT_SAMPLE = 1; +const int RE_COMMIT_SCADA = 2; +const int RE_COMMIT_MODEL = 3; +const int RE_COMMIT_STATICS = 4; + +#include "db_com/wholepubtools.h" +#include "system.h" +#include "db_commit_m.h" + +class SAVE_SQL_API CSaveReCommitSql +{ + +public: + CSaveReCommitSql(); + ~CSaveReCommitSql(); + +public: + int SaveCommitSqlToFile(const vector & strCommitSqlVec , string strFileType , int nPrior , int nCommitType , int nDupType = SQL_DUP_RE_COMMIT ); + + int SaveSampleSqlToFile(const vector & strCommitSqlVec , string strFileType , int nPrior , int nCommitType , int nDupType = SQL_DUP_RE_COMMIT ); + int SaveWarnSqlToFile(const vector & strCommitSqlVec , string strFileType , int nPrior , int nCommitType , int nDupType = SQL_DUP_RE_COMMIT ); + int SaveModelSqlToFile(const vector & strCommitSqlVec , string strFileType , int nPrior , int nCommitType , int nDupType = SQL_DUP_RE_COMMIT ); + int SaveStaticsSqlToFile(const vector & strCommitSqlVec , string strFileType , int nPrior , int nCommitType , int nDupType = SQL_DUP_RE_COMMIT ); + int SaveBindStructToFile(const TCommitBindStru CommitBindStru, string strFileType , int nPrior , int nCommitType , int nDupType = SQL_DUP_RE_COMMIT ); + +private: + int m_nFileNo; + int m_LastSaveReCommitSqlTime; + string m_strInPathName; + string m_strOutPathName; + string m_strInPathNameBind; + string m_strOutPathNameBind; + + int MoveInFileToOutFile(const string strInFileName); + int GetOutFileName(const string strInFileName , string &strOutFileName); + +private: + int GetPathName(); + + +}; + + + +#endif + + diff --git a/code/sys_nicmonitor/include/db_com/CSqlResultAlign.h b/code/sys_nicmonitor/include/db_com/CSqlResultAlign.h new file mode 100644 index 0000000..779b9c2 --- /dev/null +++ b/code/sys_nicmonitor/include/db_com/CSqlResultAlign.h @@ -0,0 +1,52 @@ +//****************************************************************** +// ÿѯṹ +// +// Author liumengjue +// +// function: Sql Result Align Class +// +// time : 2003.05.27 +// +//****************************************************************** + +#ifndef __CSQLRESULTALIGN_H +#define __CSQLRESULTALIGN_H + +#ifdef _WINDOWS64 +#ifdef ALIGN_EXPORTS +#define ALIGN_API __declspec(dllexport) +#else +#define ALIGN_API __declspec(dllimport) +#endif +#else +#define ALIGN_API +#endif + +#include "db_com/DBAccess.h" +#include +class ALIGN_API CSqlResultAlign +{ + public: + CSqlResultAlign(); + ~CSqlResultAlign(); + + private: + int m_nMaxDataTypeLength; //ͳ + int m_nAlignLength; //ṹԺĽ,align_result_lengthȽϣ + + int GetDataTypeLength(int data_type); // ͨͳһ͵õÿ͵ij + + int GetMaxDataTypeLength(int data_type,int *m_nMaxLength);//ͨͳһ͵õ͵ij + + int DoAlign(int* x, int b); + public: + + int GetAlignResult(const char* result_link_ptr, + const TResultHead *result_head_ptr, + const TFieldInfo *field_info_ptr, + void* align_result_ptr, + int struct_length); //õṹԺĽ align_result_ptr + +}; + +#endif diff --git a/code/sys_nicmonitor/include/db_com/CSqlResultAlignClient.h b/code/sys_nicmonitor/include/db_com/CSqlResultAlignClient.h new file mode 100644 index 0000000..2df45eb --- /dev/null +++ b/code/sys_nicmonitor/include/db_com/CSqlResultAlignClient.h @@ -0,0 +1,71 @@ +//****************************************************************** +// ÿѯṹ --- ڿͻֱSQLʹ洢̣ͨCORBA +// +// Author liumengjue +// +// function: Sql Result Align Class for client, through CORBA +// +// time : 2003.05.27 +// +// -------------------------------------------------------------- +// +// ZhaoTiger Ͼ CSqlResultAlign.h д +// +// TIME 2003.06.24 +//****************************************************************** + +#ifndef __CSQLRESULTALIGNCLIENT_H +#define __CSQLRESULTALIGNCLIENT_H + +#ifdef _WINDOWS64 +#ifdef SQL_SP_CLIENT_EXPORTS +#define SQL_SP_CLIENT_API __declspec(dllexport) +#else +#define SQL_SP_CLIENT_API __declspec(dllimport) +#endif +#else +#define SQL_SP_CLIENT_API +#endif + +#include +#include + +#include "common_types.h" +#include "sql_sp_m.h" +#include "system.h" + +using namespace std; + +#if (defined _LINUX || defined _SUN || defined _WINDOWS64) +#define FALSE 0 +#define TRUE 1 +#endif + +#define ALIGN_TO_RTDBKEY 1 + +typedef vector VIndicator; + +class SQL_SP_CLIENT_API CSqlResultAlignClient +{ +public: + CSqlResultAlignClient(); + ~CSqlResultAlignClient(); + +private: + int m_nMaxDataTypeLength; //ͳ + int m_nAlignLength; //ṹԺĽ,align_result_lengthȽϣ + + int GetDataTypeLength(int data_type); // ͨͳһ͵õÿ͵ij + + int GetMaxDataTypeLength(int data_type, int *m_nMaxLength); //ͨͳһ͵õ͵ij + + int DoAlign(int* x, int b); + +public: + + //int GetAlignResultClient(SEQResultFieldInfo & field_ptr, SEQResultDataValue & data_ptr, VIndicator & null_vec, void * align_result_ptr, int struct_length); //õṹԺĽ align_result_ptr + int GetAlignResultClient(SEQResultFieldInfo & field_ptr, SEQResultDataValue & data_ptr, VIndicator & null_vec, void * align_result_ptr, int struct_length, int align_mode = 0); //char[20]뵽RTDB_KEY_STRU ( align_mode = ALIGN_TO_RTDBKEY) + +}; + +#endif diff --git a/code/sys_nicmonitor/include/db_com/CSqlResultAlignClient2.h b/code/sys_nicmonitor/include/db_com/CSqlResultAlignClient2.h new file mode 100644 index 0000000..6057d63 --- /dev/null +++ b/code/sys_nicmonitor/include/db_com/CSqlResultAlignClient2.h @@ -0,0 +1,55 @@ +//****************************************************************** +// ÿѯṹ --- ڿͻֱSQLʹ洢̣ͨCORBA +// +// Author liumengjue +// +// function: Sql Result Align Class for client, through CORBA +// +// time : 2003.05.27 +// +// -------------------------------------------------------------- +// +// ZhaoTiger Ͼ CSqlResultAlign.h д +// +// TIME 2003.06.24 +//****************************************************************** + + +#ifndef __CSQLRESULTALIGNCLIENT_H +#define __CSQLRESULTALIGNCLIENT_H + +#include +#include "model_query_m.h" +#include + +using namespace std; + +typedef vector VIndicator; + +class CSqlResultAlignClient +{ + public: + CSqlResultAlignClient(); + ~CSqlResultAlignClient(); + + private: + int m_nMaxDataTypeLength; //ͳ + int m_nAlignLength; //ṹԺĽ,align_result_lengthȽϣ + + int GetDataTypeLength(int data_type); // ͨͳһ͵õÿ͵ij + + int GetMaxDataTypeLength(int data_type,int *m_nMaxLength);//ͨͳһ͵õ͵ij + + int DoAlign(int* x, int b); + + public: + + int GetAlignResultClient(SEQResultFieldInfo & field_ptr, + SEQResultDataValue & data_ptr, + VIndicator & null_vec, + void * align_result_ptr, + int struct_length); //õṹԺĽ align_result_ptr + +}; + +#endif diff --git a/code/sys_nicmonitor/include/db_com/DBAccess.h b/code/sys_nicmonitor/include/db_com/DBAccess.h new file mode 100644 index 0000000..0ad4bd3 --- /dev/null +++ b/code/sys_nicmonitor/include/db_com/DBAccess.h @@ -0,0 +1,1094 @@ +//******************************************************************************** +// +// AUTHOR : ZhangKeHeng +// +// FUNCTION : ÿඨ +// +// TIME : 2003.05.17 +// +// HISTORY : +// Datetime Action Author Reason +// ------------------------------------------------------------------------------ +// 2003.05.17 Creation ZhangKeHeng +// 2003.09.01 Modify ZhangKeHeng AppKeyId AppId֧ +// 2003.11.26 Modify ZhangKeHeng ORACLE LOB(Large OBject)֧ +// 2003.12.06 Modify ZhangKeHeng SYBASE LOB(TEXT/IMAGE) ֧ +// 2003.12.07 Modify ZhangKeHeng UNSIGNED CHAR -1֧ +// time : 2011.01.13 ChenPeng Ӱ󶨱ӿؽṹ +//******************************************************************************** + +#ifndef _DB_ACCESS_H +#define _DB_ACCESS_H + +#ifdef __WINDOWS64 +#ifdef DBACCESS_EXPORTS +#define DBACCESS_API __declspec(dllexport) +#else +#define DBACCESS_API __declspec(dllimport) +#endif +#else +#define DBACCESS_API +#endif + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#ifdef _APP_SYS_SUBSTATION +#include "db_com/sqlite_server_client.h" +#endif + +#ifdef _WIN64 // Windows compatible version +#define strcasecmp _stricmp +#endif + +#define DB_SUCCESS 0 +#define DB_FAIL -1 +#define DB_NO_DATA 100 + +#define DB_AUTO_LOGOFF 0 +#define DB_MANUAL_LOGOFF 1 + +#define DB_STATUS_CONNECT 0 +#define DB_STATUS_DISCONNECT 1 + +#define GET_ALL_RESULT -1 + +#define LOGIN_DEFAULT_MODE 0 +#define LOGIN_THREADED_MODE 1 + +//ͳһC +#define DB_DATATYPE_STRING 1 +#define DB_DATATYPE_UCHAR 2 +#define DB_DATATYPE_SHORT 3 +#define DB_DATATYPE_INT 4 +#define DB_DATATYPE_DATETIME 5 +#define DB_DATATYPE_FLOAT 6 +#define DB_DATATYPE_DOUBLE 7 +#define DB_DATATYPE_KEYID 8 +#define DB_DATATYPE_BINARY 9 +#define DB_DATATYPE_TEXT 10 +#define DB_DATATYPE_IMAGE 11 +#define DB_DATATYPE_APPKEYID 12 +#define DB_DATATYPE_APPID 13 + +#define DB_DATATYPE_LONG 15 + +#define MAX_COL_NUMBER 1024 +#define MAX_LOB_NUMBER 1024 +#define MAX_COLNAME_LENGTH 255 +#define MAX_PROCNAME_LENGTH 255 +#define MAX_SQL_LENGTH 10240 +#define QUERY_RECORD_BUF 102400 // ¼Ԥڴ100K + +#ifdef _ALPHA +#define READ_BUFSIZE 204800 // +#endif +#ifdef _IBM +#define READ_BUFSIZE 204800 // +#endif +#ifdef _SUN +#define READ_BUFSIZE 102400 // +#endif +#ifdef _HPUX +#define READ_BUFSIZE 204800 // +#endif +#ifdef _LINUX +#define READ_BUFSIZE 204800 // +#endif + +struct DBACCESS_API TResultHead +{ + int field_num; + int field_size; + int data_num; + int data_size; + int record_length; + int reach_max; +}; + +#ifndef _APP_SYS_SUBSTATION +struct DBACCESS_API TFieldInfo +{ + short field_type; + short field_length; + char col_name[256]; +}; +#else +struct DBACCESS_API TFieldInfo +{ + short field_type; + short field_length; +}; +#endif + +// Define the KeyID_Type's Description +struct DBACCESS_API TKeyidType +{ + int record_id; + short column_id; +}; + +// Define the AppKeyID_Type's Description +//struct DBACCESS_API TAppKeyidType +//{ +// int app_id; +// int record_id; +// short column_id; +//}; +struct DBACCESS_API TAppKeyidType +{ + long key_id; + int app_id; +}; + +// Define the AppID_Type's Description +struct DBACCESS_API TAppidType +{ + int app_id; + int record_id; +}; + +#ifndef _APP_SYS_SUBSTATION +union DBACCESS_API UColumnVal +{ + unsigned char unsigned_value; + short short_value; + int int_value; + float float_value; + double double_value; + OCIDate date_value; + unsigned char bin_value[10240]; + char string_value[10240]; + UColumnVal() + { + memset(this,0,sizeof(UColumnVal)); + } +}; +#endif + +struct DBACCESS_API TFieldAttr { + //char *colName; + char colName[256]; + unsigned int colNameLen; + unsigned short field_type; + unsigned int field_len; + unsigned char field_precision; + signed char field_scale; + TFieldAttr() + { + memset(this,0,sizeof(TFieldAttr)); + } +}; + +using namespace std; + +//Ϣṹ +struct DBACCESS_API TErrorMsg +{ + int err_no; //DBAccess + int ora_errno; //ݿ + string dbaccess_err; //DBAccessϢ + string db_err; //ݿϢ +}; + +struct TDCIBindParaStru +{ + unsigned short dci_type; // 󶨱 ֵμdci.hSQLTͷһϵк궨 + unsigned int data_size; // 󶨱ݳ +}; +typedef vector SEQDCIBindParaStru; + +//LOBʹõResultHead +struct DBACCESS_API TLOBResultHead +{ + int field_num; + int field_size; + int data_num; + int data_size; + vector record_length_vec; //data_num==0record_length_vec + int reach_max; +}; + +//LOBʹõFieldInfo +struct DBACCESS_API TLOBFieldInfo +{ + short field_type; + vector field_length_vec; //field_length_vec.sizeTLOBResultHeadеdata_num + //data_num == 0, field_length_vec.size = 1 +}; + +//LOBݽṹ +struct DBACCESS_API TLOBContent +{ + unsigned char *lob_content; + int lob_content_size; +}; + +//UserSpecTypeMap firstԪΪָ +// secondԪΪûָ,ȡֵΪͳһC +typedef map UserSpecTypeMap; + +#ifndef _APP_SYS_SUBSTATION +class DBACCESS_API CDbAccess +{ +public: + //캯auto_logoff == true ޲ʱҪʾLogoffе + //֮ҪʾLogoffעݿ¼ûͷ + CDbAccess(bool auto_logoff = true); + + // + ~CDbAccess(); +private: + OCIEnv *m_pEnvhp; + OCIError *m_pErrhp; + OCISvcCtx *m_pSvchp; + OCILobLocator *m_pLob; + + //OCIStmt *m_pStmhp1; + //OCIStmt *m_pStmhp2; + +private: + int PrintError(OCIError *errhp, sword status, string &err_string, int &ora_errno); + int InitHandles(ub4 mode,vector &err_vec); + int InitOneStatement(OCIStmt **stmhp,vector &err_vec); + int FreeOneStatement(OCIStmt *stmhp,vector &err_vec); + int PrepareOneSentence(OCIStmt *stmhp,text *sql_sen,vector &err_vec); + int ExecuteOneSelectSentence(OCIStmt *stmhp,vector &err_vec); + int ExecuteOneModifySentence(OCIStmt *stmhp,ub4 commit_flag,int step,vector &err_vec); + int ExecuteOneModifySentence(OCIStmt *stmhp,ub4 commit_flag,int step,vector &err_vec,int &affect_record_num); + int ExecuteSentenceOnlyDiscribe(OCIStmt *stmhp,vector &err_vec); + int FetchNextRow(OCIStmt *stmhp,int step,vector &err_vec); + int CancelFetch(OCIStmt *stmhp,vector &err_vec); + int GetFetchRowNum(OCIStmt *stmhp,int *stmrow,vector &err_vec); + int DefineArrayOfStruct(OCIDefine *defhp,int recorderlen,int num_cols,vector &err_vec); + int BindArrayOfStruct(OCIBind *defhp ,int recorderlen,int num_cols,vector &err_vec); + int GetSelectColNum(OCIStmt *stmhp,int *col_num,vector &err_vec); + int GetSingleColInfo(OCIStmt *stmhp,ub4 pos,TFieldAttr &field_attr,vector &err_vec); + int BindByPosition(OCIStmt *stmhp,OCIBind **bind_pp,ub4 position,dvoid *value_p,sb4 value_size,ub2 data_type,dvoid *indicator_p,vector &err_vec); + int BindByName(OCIStmt *stmhp,OCIBind **bind_pp,OraText *placeholder,dvoid *value_p,sb4 value_size,ub2 data_type,dvoid *indicator_p,vector &err_vec); + int DefineByPosition(OCIStmt *stmhp,OCIDefine **define_pp,ub4 position,dvoid *value_p,sb4 value_size,ub2 data_type,dvoid *indicator_p,vector &err_vec); + int CheckAndRestorePackageStatus(char *pck_name,vector &err_vec); +// int ConvertSQLDateToTimet(char* date_ptr,time_t *osdate); +// int ConvertOCIDateToTimet(OCIDate odate,time_t *osdate); +// int ConvertTimetToOCIDate(time_t OsDate,OCIDate *OciDate); + string ConvertSQLDateToString(char* date_ptr); + +private: + int m_Status; + int m_LoginMode; + int m_LogoffFlag; +private: + TKeyidType* ConvertKeyidToStruct(char *keyid); + TAppKeyidType* ConvertAppKeyidToStruct(char *keyid); + TAppidType* ConvertAppidToStruct(char *keyid); +// char* ConvertStructToKeyid(TKeyidType* keyid_type); + +public: + /*--------------------------------------------------------------------------------- + - : ݿע + - : user_name: û + passwd: + server: + mode: ģʽ LOGIN_DEFAULT_MODE ͨģʽ + LOGIN_THREADED_MODE ߳ģʽ + - : err_vec: 󷵻ؽṹVector + - : DB_SUCCESS: ɹ + DB_FAIL: ʧ + ----------------------------------------------------------------------------------*/ + int Login( char *user_name, + char *passwd, + char *server, + unsigned int mode, + vector &err_vec + ); + + /*--------------------------------------------------------------------------------- + - : ݿע + - : + - : err_vec: 󷵻ؽṹVector + - : DB_SUCCESS: ɹ + DB_FAIL: ʧ + ----------------------------------------------------------------------------------*/ + int Logoff(vector &err_vec); + + /*--------------------------------------------------------------------------------- + - : ȡ״̬ + - : + - : + - : DB_STATUS_CONNECT + DB_STATUS_DISCONNECT ʧȥ + ----------------------------------------------------------------------------------*/ + int GetConnectStatus(); + + + /*--------------------------------------------------------------------------------- + - : ״̬ + - : status ״̬ + - : + - : DB_SUCCESS ɹ + ----------------------------------------------------------------------------------*/ + int SetConnectStatus(int status); + + /*--------------------------------------------------------------------------------- + - : ʼ + - : + - : err_vec: 󷵻ؽṹVector + - : DB_SUCCESS: ɹ + DB_FAIL: ʧ + ----------------------------------------------------------------------------------*/ + int BeginTransaction(vector &err_vec); + + /*--------------------------------------------------------------------------------- + - : ύ + - : + - : err_vec: 󷵻ؽṹVector + - : DB_SUCCESS: ɹ + DB_FAIL: ʧ + ----------------------------------------------------------------------------------*/ + int CommitTransaction(vector &err_vec); + + /*--------------------------------------------------------------------------------- + - : ع + - : + - : err_vec: 󷵻ؽṹVector + - : DB_SUCCESS: ɹ + DB_FAIL: ʧ + ----------------------------------------------------------------------------------*/ + int RollbackTransaction(vector &err_vec); + + + /*--------------------------------------------------------------------------------- + - : ִSQLύ + - : cmd_string: SQL + - : err_vec: 󷵻ؽṹVector + - : DB_SUCCESS: ɹ + DB_FAIL: ʧ + ----------------------------------------------------------------------------------*/ + int ExecuteCommandWithCommit(char *cmd_string, + vector &err_vec + ); + int ExecuteCommandWithCommit(char *cmd_string, + int &affected_record_num, + vector &err_vec); + /*--------------------------------------------------------------------------------- + - : ð󶨱ʽִSQLύ + - sql_str ҪύSQL + - out_db_error Ϣ + - rep_flag Ƿ + - ֵ TRUE ִгɹ + - FALSE ִʧ + ----------------------------------------------------------------------------------*/ + + int BindExecuteCommandWithCommit(char *cmd_string, SEQDCIBindParaStru &seq_bind_para, void * data_buffer, + unsigned short * null_flag_buffer, unsigned int row_num, + vector &err_vec); + + +// int ExecuteCommandWithCommitEx(char *cmd_string, +// vector &err_vec +// ); + + /*--------------------------------------------------------------------------------- + - : ִSQLύ + - : cmd_string: SQL + - : err_vec: 󷵻ؽṹVector + - : DB_SUCCESS: ɹ + DB_FAIL: ʧ + ----------------------------------------------------------------------------------*/ + int ExecuteCommandWithoutCommit(char *cmd_string, + vector &err_vec + ); + + + /*--------------------------------------------------------------------------------- + - : ȡSQLѯؽ(LOB) + - : query_string: SQLѯ + max_result: GET_ALL_RESULTʾȡ + user_type_map: ûָͣMAP + - : result_link: ָ + result_indicator ǷΪָ + err_vec: 󷵻ؽṹVector + - : DB_SUCCESS: ɹ + DB_FAIL: ʧ + ----------------------------------------------------------------------------------*/ + int GetQueryResult( char *query_string, + int max_result, + UserSpecTypeMap user_type_map, + char *&result_link, + signed short *&result_indicator, + vector &err_vec + ); + + /*--------------------------------------------------------------------------------- + - : ȡHEADFIELDDATAָ + - : result_link: ָ + - : result_head_ptr: HEADָ + field_info_ptr: FIELDָ + data_ptr: DATAָ + err_vec: 󷵻ؽṹVector + - : DB_SUCCESS: ɹ + DB_FAIL: ʧ + ----------------------------------------------------------------------------------*/ + int GetQueryHead( char *result_link, + TResultHead *&result_head_ptr, + TFieldInfo *&field_info_ptr, + char *&data_ptr, + vector &err_vec); + + /*--------------------------------------------------------------------------------- + - : ȡ洢̲ѯؽ + - : pck_name: (SYBASEòΪNULL) + proc_name 洢 + parm_vec: 洢̲Vector(1~n)ORACLEαָ + vectorʽ룬ȫΪstring + ͲYYYY-MM-DD HH:MM:SSʽ + max_result: GET_ALL_RESULTʾȡ + user_type_map: ûָͣMAP + - : result_link: ָ + result_indicator ǷΪָ + err_vec: 󷵻ؽṹVector + - : DB_SUCCESS: ɹ + DB_FAIL: ʧ + ----------------------------------------------------------------------------------*/ + int GetProcedureResult( char *pck_name, + char *proc_name, + vector parm_vec, + int max_result, + UserSpecTypeMap user_type_map, + char *&result_link, + signed short *&result_indicator, + vector &err_vec + ); + + /*--------------------------------------------------------------------------------- + - : ִд洢̣޷ؽ + - : pck_name: (SYBASEòΪNULL) + proc_name 洢 + parm_vec: 洢̲Vector(1~n)ORACLEαָ + vectorʽ룬ȫΪstring + ͲYYYY-MM-DD HH:MM:SSʽ + - : err_vec: 󷵻ؽṹVector + - : DB_SUCCESS: ɹ + DB_FAIL: ʧ + ----------------------------------------------------------------------------------*/ + int ExecuteProcedure ( char *pck_name, + char *proc_name, + vector parm_vec, + vector &err_vec + ); + + /*--------------------------------------------------------------------------------- + - : ִд洢̣޷ؽʵPLSQL + ExecuteProcedureִУֻExecuteProcedureִгɹøú + - : pck_name: (SYBASEòΪNULL) + proc_name 洢 + parm_vec: 洢̲Vector(1~n)ORACLEαָ + vectorʽ룬ȫΪstring + ͲYYYY-MM-DD HH:MM:SSʽ + - : err_vec: 󷵻ؽṹVector + - : SQL: pck_nameproc_nameparm_vecSQL + "" : Ϊ""ʾ + ----------------------------------------------------------------------------------*/ + string GetProcedureSQL ( char *pck_name, + char *proc_name, + vector parm_vec, + vector &err_vec + ); + + /*--------------------------------------------------------------------------------- + - : жָı(table)Ƿ + - : table_name: + - : ture: + false: + ----------------------------------------------------------------------------------*/ + bool TableExist ( char *table_name ); + + /*--------------------------------------------------------------------------------- + - : ַתΪд + - : str: ַ + - : str: ַ(д) + - : + ----------------------------------------------------------------------------------*/ + void UpperString (char * & str); + + + + /*================================================================================*/ + /* */ + /* LOB(Large OBject)֧ */ + /* */ + /* ʹñΪMY_TEST_LOB */ + /* ORACLEDDLΪ */ + /* CREATE TABLE MY_TEST_LOB( */ + /* ID NUMBER(10) NOT NULL, */ + /* CLOB_CONTENT CLOB, */ + /* BLOB_CONTENT BLOB, */ + /* NAME VARCHAR2(32), */ + /* KEYID_V CHAR(14), */ + /* APPKEYID_V CHAR(24), */ + /* APPID_V CHAR(20), */ + /* DATE_V DATE, */ + /* FLOAT_V NUMBER(22, 6), */ + /* CONSTRAINT PK_TEST_LOB PRIMARY KEY(ID)) */ + /* */ + /* SYBASEDDLΪ */ + /* CREATE TABLE MY_LOB_TEST( */ + /* ID INT, */ + /* CLOB_CONTENT TEXT NULL, */ + /* BLOB_CONTENT IMAGE NULL, */ + /* NAME VARCHAR(32) NULL, */ + /* KEYID_V CHAR(14) NULL, */ + /* APPKEYID_V CHAR(24) NULL, */ + /* APPID_V CHAR(20) NULL, */ + /* DATE_V DATETIME NULL, */ + /* FLOAT_V REAL NULL, */ + /* CONSTRAINT PK_TEST_LOB PRIMARY KEY(ID)) */ + /* */ + /* */ + /*================================================================================*/ + + + + /*--------------------------------------------------------------------------------- + - : ִаLOBݵINSERTύ + - : insert_string: INSERT(LOB) + select_string: ӵSELECT FOR UPDATE(ֻҪдLOB) + lob_vec: LOBVector + - : err_vec: 󷵻ؽṹVector + - : DB_SUCCESS: ɹ + DB_FAIL: ʧ + + - ˵ + 1insert_string + ORACLE"insert into my_test_lob(id,clob_content,blob_content) + values(1,empty_clob(),empty_blob())" + SYBASE"insert into my_test_lob(id,clob_content,blob_content) + values(1,'','')" + ҪselectиLOBעⲻҪInsertнLOBΪգNULL + ORACLEʹempty_clob()empty_blob()EMPTY + SYBASEʹ''EMPTY + 2select_string + ORACLE"select clob_content,blob_content from my_test_lob where id = 1 for update" + SYBASE"select clob_content,blob_content from my_test_lob where id = 1" + ע⣺whereӾ䲻Ӧinsertе½Ԥ + ORACLE for updateؼDZ + 3lob_vecLOBʵݣlob_vec.size()select_stringLOBĸһ + + ----------------------------------------------------------------------------------*/ + int ExecuteInsertCommandWithLOB( const char *insert_string, + const char *select_string, + const vector &lob_vec, + vector &err_vec + ); + + /*--------------------------------------------------------------------------------- + - : ִаLOBݵUPDATEύ + - : update_string: UPDATE(LOB) + select_string: ӵSELECT FOR UPDATE(ֻҪдLOB) + lob_vec: LOBVector + - : err_vec: 󷵻ؽṹVector + - : DB_SUCCESS: ɹ + DB_FAIL: ʧ + - ˵ + 1update_string + ORACLE"update my_test_lob set blob_content = empty_blob() where id = 1" + SYBASE"update my_test_lob set blob_content = '' where id = 1" + ҪselectиLOBעⲻҪUpdateнLOBΪգNULL + ORACLEʹempty_clob()empty_blob()EMPTY + SYBASEʹ''EMPTY + 2select_string + ORACLE"select clob_content,blob_content from my_test_lob where id = 1 for update" + SYBASE"select clob_content,blob_content from my_test_lob where id = 1" + ע⣺whereӾ䲻Ӧupdateе½Ԥ + 2lob_vecLOBʵݣlob_vec.size()select_stringLOBĸһ + ----------------------------------------------------------------------------------*/ + int ExecuteUpdateCommandWithLOB( const char *update_string, + const char *select_string, + const vector &lob_vec, + vector &err_vec + ); + + + /*--------------------------------------------------------------------------------- + - : ȡSQLѯؽ(LOB) + - : query_string: SQLѯ + max_result: GET_ALL_RESULTʾȡ + user_type_map: ûָͣMAP + עLOB޷ָ + - : result_link: ָ + result_indicator ǷΪָ + err_vec: 󷵻ؽṹVector + - : DB_SUCCESS: ɹ + DB_FAIL: ʧ + - ˵ + 1SYBASEݿҪLOB򶼱BINDͨ򣩵ĺ + ͳһҪquery_stringеLOB֮ͨ + ----------------------------------------------------------------------------------*/ + int GetQueryResultWithLOB( const char *query_string, + int max_result, + UserSpecTypeMap user_type_map, + char *&result_link, + signed short *&result_indicator, + TLOBResultHead *&result_head_ptr, + TLOBFieldInfo *&field_info_ptr, + vector &err_vec + ); + + /*--------------------------------------------------------------------------------- + - : ȡHEADFIELDDATAָ(LOB) + - : result_link: ָ + - : result_head_ptr: HEADָ룬ӦTLOBResultHeadṹ + field_info_ptr: FIELDָ룬ӦTLOBFieldInfoṹ + data_ptr: DATAָ + err_vec: 󷵻ؽṹVector + - : DB_SUCCESS: ɹ + DB_FAIL: ʧ + ----------------------------------------------------------------------------------*/ + int GetQueryHeadWithLOB( char *result_link, + TLOBResultHead *&result_head_ptr, + TLOBFieldInfo *&field_info_ptr, + char *&data_ptr, + vector &err_vec); + + /*--------------------------------------------------------------------------------- + - : ȡSQLѯؽ(LOB)γָASCIIļ + - : query_string: SQLѯ + file_name: ļƣ· + - : err_vec: 󷵻ؽṹVector + - : DB_SUCCESS: ɹ + DB_FAIL: ʧ + ----------------------------------------------------------------------------------*/ + int GetQueryResultToFile(const char *query_string, + const char *file_name, + vector &err_vec + ); +}; +#else +class DBACCESS_API CDbAccess +{ +public: + //캯auto_logoff == true ޲ʱҪʾLogoffе + //֮ҪʾLogoffעݿ¼ûͷ + //ָļ· 磺/home/d5000/kf/sqlite-autoconf-3070900/test.db + CDbAccess(bool auto_logoff = true); + + // + ~CDbAccess(); + + //ΪƹṩĽӿ + int SetHostName(char* host_name); +private: + int m_Status; + int m_LoginMode; + int m_LogoffFlag; + +private: + SqliteServerClient *m_sqlite_server_client; + +private: + + TKeyidType* ConvertKeyidToStruct(char *keyid); + + TAppKeyidType* ConvertAppKeyidToStruct(char *keyid); + + TAppidType* ConvertAppidToStruct(char *keyid); + +// int ConvertSQLDateToTimet(char* date_ptr,time_t *osdate); +public: + /*--------------------------------------------------------------------------------- + - : ݿע + - : user_name: û + passwd: + server: + mode: ģʽ LOGIN_DEFAULT_MODE ͨģʽ + LOGIN_THREADED_MODE ߳ģʽ + - : err_vec: 󷵻ؽṹVector + - : DB_SUCCESS: ɹ + DB_FAIL: ʧ + ----------------------------------------------------------------------------------*/ + int Login( char *user_name, + char *passwd, + char *server, + unsigned int mode, + vector &err_vec + ); + + /*--------------------------------------------------------------------------------- + - : ݿע + - : user_name: û + passwd: + server: + mode: ģʽ LOGIN_DEFAULT_MODE ͨģʽ + LOGIN_THREADED_MODE ߳ģʽ + host_name: + - : err_vec: 󷵻ؽṹVector + - : DB_SUCCESS: ɹ + DB_FAIL: ʧ + ----------------------------------------------------------------------------------*/ + int Login( char *user_name, + char *passwd, + char *server, + unsigned int mode, + char * host_name, + vector &err_vec + ); + + /*--------------------------------------------------------------------------------- + - : ݿע + - : + - : err_vec: 󷵻ؽṹVector + - : DB_SUCCESS: ɹ + DB_FAIL: ʧ + ----------------------------------------------------------------------------------*/ + int Logoff(vector &err_vec); + + /*--------------------------------------------------------------------------------- + - : ȡ״̬ + - : + - : + - : DB_STATUS_CONNECT + DB_STATUS_DISCONNECT ʧȥ + ----------------------------------------------------------------------------------*/ + int GetConnectStatus(); + + + /*--------------------------------------------------------------------------------- + - : ״̬ + - : status ״̬ + - : + - : DB_SUCCESS ɹ + ----------------------------------------------------------------------------------*/ + int SetConnectStatus(int status); + + /*--------------------------------------------------------------------------------- + - : ʼ + - : + - : err_vec: 󷵻ؽṹVector + - : DB_SUCCESS: ɹ + DB_FAIL: ʧ + ----------------------------------------------------------------------------------*/ + int BeginTransaction(vector &err_vec); + + /*--------------------------------------------------------------------------------- + - : ύ + - : + - : err_vec: 󷵻ؽṹVector + - : DB_SUCCESS: ɹ + DB_FAIL: ʧ + ----------------------------------------------------------------------------------*/ + int CommitTransaction(vector &err_vec); + + /*--------------------------------------------------------------------------------- + - : ع + - : + - : err_vec: 󷵻ؽṹVector + - : DB_SUCCESS: ɹ + DB_FAIL: ʧ + ----------------------------------------------------------------------------------*/ + int RollbackTransaction(vector &err_vec); + + /*--------------------------------------------------------------------------------- + - : ȡSQLѯؽ(LOB) + - : query_string: SQLѯ + max_result: GET_ALL_RESULTʾȡ + user_type_map: ûָͣMAP + - : result_link: ָ + result_indicator ǷΪָ + err_vec: 󷵻ؽṹVector + - : DB_SUCCESS: ɹ + DB_FAIL: ʧ + ----------------------------------------------------------------------------------*/ + + int GetQueryResult(char *query_string, + int max_result, + UserSpecTypeMap user_type_map, + char *&result_link, + signed short *&result_indicator, + vector &err_vec + ); + + /*--------------------------------------------------------------------------------- + - : ȡHEADFIELDDATAָ + - : result_link: ָ + - : result_head_ptr: HEADָ + field_info_ptr: FIELDָ + data_ptr: DATAָ + err_vec: 󷵻ؽṹVector + - : DB_SUCCESS: ɹ + DB_FAIL: ʧ + ----------------------------------------------------------------------------------*/ + int GetQueryHead(char *result_link, + TResultHead *&result_head_ptr, + TFieldInfo *&field_info_ptr, + char *&data_ptr, + vector &err_vec); + + /*--------------------------------------------------------------------------------- + - : ִSQLύ + - : cmd_string: SQL + - : err_vec: 󷵻ؽṹVector + - : DB_SUCCESS: ɹ + DB_FAIL: ʧ + ----------------------------------------------------------------------------------*/ + int ExecuteCommandWithCommit(char *cmd_string, vector &err_vec); + + /*--------------------------------------------------------------------------------- + - : ð󶨱ʽִSQLύ + - sql_str ҪύSQL + - out_db_error Ϣ + - rep_flag Ƿ + - ֵ TRUE ִгɹ + - FALSE ִʧ + ----------------------------------------------------------------------------------*/ + + int BindExecuteCommandWithCommit(char *cmd_string, SEQDCIBindParaStru &seq_bind_para, void *data_buffer, + unsigned short * null_flag_buffer, unsigned int row_num, + vector &err_vec); + + /*--------------------------------------------------------------------------------- + - : ִSQLύ + - : cmd_string: SQL + - : err_vec: 󷵻ؽṹVector + - : DB_SUCCESS: ɹ + DB_FAIL: ʧ + ----------------------------------------------------------------------------------*/ + int ExecuteCommandWithoutCommit(char *cmd_string, + vector &err_vec + ); + + /*--------------------------------------------------------------------------------- + - : ȡ洢̲ѯؽ + - : pck_name: (SYBASEòΪNULL) + proc_name 洢 + parm_vec: 洢̲Vector(1~n)ORACLEαָ + vectorʽ룬ȫΪstring + ͲYYYY-MM-DD HH:MM:SSʽ + max_result: GET_ALL_RESULTʾȡ + user_type_map: ûָͣMAP + - : result_link: ָ + result_indicator ǷΪָ + err_vec: 󷵻ؽṹVector + - : DB_SUCCESS: ɹ + DB_FAIL: ʧ + ----------------------------------------------------------------------------------*/ + int GetProcedureResult( char *pck_name, + char *proc_name, + vector parm_vec, + int max_result, + UserSpecTypeMap user_type_map, + char *&result_link, + signed short *&result_indicator, + vector &err_vec + ); + + /*--------------------------------------------------------------------------------- + - : ִд洢̣޷ؽ + - : pck_name: (SYBASEòΪNULL) + proc_name 洢 + parm_vec: 洢̲Vector(1~n)ORACLEαָ + vectorʽ룬ȫΪstring + ͲYYYY-MM-DD HH:MM:SSʽ + - : err_vec: 󷵻ؽṹVector + - : DB_SUCCESS: ɹ + DB_FAIL: ʧ + ----------------------------------------------------------------------------------*/ + int ExecuteProcedure ( char *pck_name, + char *proc_name, + vector parm_vec, + vector &err_vec + ); + + /*--------------------------------------------------------------------------------- + - : ִд洢̣޷ؽʵPLSQL + ExecuteProcedureִУֻExecuteProcedureִгɹøú + - : pck_name: (SYBASEòΪNULL) + proc_name 洢 + parm_vec: 洢̲Vector(1~n)ORACLEαָ + vectorʽ룬ȫΪstring + ͲYYYY-MM-DD HH:MM:SSʽ + - : err_vec: 󷵻ؽṹVector + - : SQL: pck_nameproc_nameparm_vecSQL + "" : Ϊ""ʾ + ----------------------------------------------------------------------------------*/ + string GetProcedureSQL ( char *pck_name, + char *proc_name, + vector parm_vec, + vector &err_vec + ); + + /*--------------------------------------------------------------------------------- + - : жָı(table)Ƿ + - : table_name: + - : ture: + false: + ----------------------------------------------------------------------------------*/ + bool TableExist( char *table_name ); + + /*--------------------------------------------------------------------------------- + - : ַתΪд + - : str: ַ + - : str: ַ(д) + - : + ----------------------------------------------------------------------------------*/ + void UpperString(char * & str); + + /*================================================================================*/ + /* */ + /* LOB(Large OBject)֧ */ + /* */ + /* ʹñΪMY_TEST_LOB */ + /* ORACLEDDLΪ */ + /* CREATE TABLE MY_TEST_LOB( */ + /* ID NUMBER(10) NOT NULL, */ + /* CLOB_CONTENT CLOB, */ + /* BLOB_CONTENT BLOB, */ + /* NAME VARCHAR2(32), */ + /* KEYID_V CHAR(14), */ + /* APPKEYID_V CHAR(24), */ + /* APPID_V CHAR(20), */ + /* DATE_V DATE, */ + /* FLOAT_V NUMBER(22, 6), */ + /* CONSTRAINT PK_TEST_LOB PRIMARY KEY(ID)) */ + /* */ + /* SYBASEDDLΪ */ + /* CREATE TABLE MY_LOB_TEST( */ + /* ID INT, */ + /* CLOB_CONTENT TEXT NULL, */ + /* BLOB_CONTENT IMAGE NULL, */ + /* NAME VARCHAR(32) NULL, */ + /* KEYID_V CHAR(14) NULL, */ + /* APPKEYID_V CHAR(24) NULL, */ + /* APPID_V CHAR(20) NULL, */ + /* DATE_V DATETIME NULL, */ + /* FLOAT_V REAL NULL, */ + /* CONSTRAINT PK_TEST_LOB PRIMARY KEY(ID)) */ + /* */ + /* */ + /*================================================================================*/ + + + + /*--------------------------------------------------------------------------------- + - : ִаLOBݵINSERTύ + - : insert_string: INSERT(LOB) + select_string: ӵSELECT FOR UPDATE(ֻҪдLOB) + lob_vec: LOBVector + - : err_vec: 󷵻ؽṹVector + - : DB_SUCCESS: ɹ + DB_FAIL: ʧ + + - ˵ + 1insert_string + ORACLE"insert into my_test_lob(id,clob_content,blob_content) + values(1,empty_clob(),empty_blob())" + SYBASE"insert into my_test_lob(id,clob_content,blob_content) + values(1,'','')" + ҪselectиLOBעⲻҪInsertнLOBΪգNULL + ORACLEʹempty_clob()empty_blob()EMPTY + SYBASEʹ''EMPTY + 2select_string + ORACLE"select clob_content,blob_content from my_test_lob where id = 1 for update" + SYBASE"select clob_content,blob_content from my_test_lob where id = 1" + ע⣺whereӾ䲻Ӧinsertе½Ԥ + ORACLE for updateؼDZ + 3lob_vecLOBʵݣlob_vec.size()select_stringLOBĸһ + + ----------------------------------------------------------------------------------*/ + int ExecuteInsertCommandWithLOB( const char *insert_string, + const char *select_string, + const vector &lob_vec, + vector &err_vec + ); + + /*--------------------------------------------------------------------------------- + - : ִаLOBݵUPDATEύ + - : update_string: UPDATE(LOB) + select_string: ӵSELECT FOR UPDATE(ֻҪдLOB) + lob_vec: LOBVector + - : err_vec: 󷵻ؽṹVector + - : DB_SUCCESS: ɹ + DB_FAIL: ʧ + - ˵ + 1update_string + ORACLE"update my_test_lob set blob_content = empty_blob() where id = 1" + SYBASE"update my_test_lob set blob_content = '' where id = 1" + ҪselectиLOBעⲻҪUpdateнLOBΪգNULL + ORACLEʹempty_clob()empty_blob()EMPTY + SYBASEʹ''EMPTY + 2select_string + ORACLE"select clob_content,blob_content from my_test_lob where id = 1 for update" + SYBASE"select clob_content,blob_content from my_test_lob where id = 1" + ע⣺whereӾ䲻Ӧupdateе½Ԥ + 2lob_vecLOBʵݣlob_vec.size()select_stringLOBĸһ + ----------------------------------------------------------------------------------*/ + int ExecuteUpdateCommandWithLOB( const char *update_string, + const char *select_string, + const vector &lob_vec, + vector &err_vec + ); + + + /*--------------------------------------------------------------------------------- + - : ȡSQLѯؽ(LOB) + - : query_string: SQLѯ + max_result: GET_ALL_RESULTʾȡ + user_type_map: ûָͣMAP + עLOB޷ָ + - : result_link: ָ + result_indicator ǷΪָ + err_vec: 󷵻ؽṹVector + - : DB_SUCCESS: ɹ + DB_FAIL: ʧ + - ˵ + 1SYBASEݿҪLOB򶼱BINDͨ򣩵ĺ + ͳһҪquery_stringеLOB֮ͨ + ----------------------------------------------------------------------------------*/ + int GetQueryResultWithLOB( const char *query_string, + int max_result, + UserSpecTypeMap user_type_map, + char *&result_link, + signed short *&result_indicator, + TLOBResultHead *&result_head_ptr, + TLOBFieldInfo *&field_info_ptr, + vector &err_vec + ); + + /*--------------------------------------------------------------------------------- + - : ȡHEADFIELDDATAָ(LOB) + - : result_link: ָ + - : result_head_ptr: HEADָ룬ӦTLOBResultHeadṹ + field_info_ptr: FIELDָ룬ӦTLOBFieldInfoṹ + data_ptr: DATAָ + err_vec: 󷵻ؽṹVector + - : DB_SUCCESS: ɹ + DB_FAIL: ʧ + ----------------------------------------------------------------------------------*/ + int GetQueryHeadWithLOB( char *result_link, + TLOBResultHead *&result_head_ptr, + TLOBFieldInfo *&field_info_ptr, + char *&data_ptr, + vector &err_vec); + + /*--------------------------------------------------------------------------------- + - : ȡSQLѯؽ(LOB)γָASCIIļ + - : query_string: SQLѯ + file_name: ļƣ· + - : err_vec: 󷵻ؽṹVector + - : DB_SUCCESS: ɹ + DB_FAIL: ʧ + ----------------------------------------------------------------------------------*/ + int GetQueryResultToFile(const char *query_string, + const char *file_name, + vector &err_vec + ); +}; +#endif + +#endif + diff --git a/code/sys_nicmonitor/include/db_com/DBCipher.h b/code/sys_nicmonitor/include/db_com/DBCipher.h new file mode 100644 index 0000000..4716089 --- /dev/null +++ b/code/sys_nicmonitor/include/db_com/DBCipher.h @@ -0,0 +1,103 @@ +//****************************************************************** +// +// AUTHOR : ShiHaoQiu +// +// FUNCTION : 뺯װγɵĶ̬⣬ɽAESӽܡȡݵMD5ֵ +// +// TIME : 2014.05.14 +// +// HISTORY : +// Datetime Action Author Reason +// ------------------------------------------------------------------- +// 2014.05.14 Creation ShiHaoQiu +//****************************************************************** + +#ifndef DBCIPHER_H +#define DBCIPHER_H + +#ifdef _WINDOWS64 +#ifdef DB_CIPHER_EXPORTS +#define DB_CIPHER_DLL __declspec(dllexport) +#else +#define DB_CIPHER_DLL __declspec(dllimport) +#endif +#else +#define DB_CIPHER_DLL +#endif + +#include +#include +using namespace std; + +class DB_CIPHER_DLL DBCipher +{ +public: + DBCipher(unsigned char* key); + //keyΪ128λԿʱָ + + virtual ~DBCipher(); + + //AES ӽ(ܽͨBASE64) + //ֶ֧char[15]ļ + unsigned char* AESCipher(unsigned char* input); // + unsigned char* AESInvCipher(unsigned char* input); // + void* AESCipher(void* input, int length=0); + void* AESInvCipher(void* input, int length); + + //MD5 + string GetMD5Value(const unsigned char* input,size_t length); //ȡMD5ֵ + + + //BASE64 뺯 + /* + DataByte + [in]ݳ,ֽΪλ + */ + string Base64Encode(const unsigned char* Data,int DataByte); + + /* + DataByte + [in]ݳ,ֽΪλ + OutByte + [out]ݳ,ֽΪλ,벻Ҫֵͨ + ݵij + */ + string Base64Decode(const char* Data,int DataByte,int& OutByte); + +private: + //AESӽسԱ begin + unsigned char Sbox[256]; + unsigned char InvSbox[256]; + unsigned char w[11][4][4]; + + void KeyExpansion(unsigned char* key, unsigned char w[][4][4]); + unsigned char FFmul(unsigned char a, unsigned char b); + + void SubBytes(unsigned char state[][4]); + void ShiftRows(unsigned char state[][4]); + void MixColumns(unsigned char state[][4]); + void AddRoundKey(unsigned char state[][4], unsigned char k[][4]); + + void InvSubBytes(unsigned char state[][4]); + void InvShiftRows(unsigned char state[][4]); + void InvMixColumns(unsigned char state[][4]); + //AESӽسԱ end + + //MD5سԱ begin + unsigned long _state[4]; /* state (ABCD) */ + unsigned long _count[2]; /* number of bits, modulo 2^64 (low-order word first) */ + unsigned char _buffer[64]; /* input buffer */ + unsigned char _digest[16]; /* message digest */ + bool _finished; /* calculate finished ? */ + + void transform(const unsigned char block[64]); + void final(); + const unsigned char* digest(); + void encode(const unsigned long *input, unsigned char *output, size_t length); + void decode(const unsigned char *input, unsigned long *output, size_t length); + string bytesToHexString(const unsigned char *input, size_t length); + void update(const unsigned char *input, size_t length); + //MD5سԱ end +}; + +#endif // DBCIPHER_H diff --git a/code/sys_nicmonitor/include/db_com/DBConnectPool.h b/code/sys_nicmonitor/include/db_com/DBConnectPool.h new file mode 100644 index 0000000..6eae439 --- /dev/null +++ b/code/sys_nicmonitor/include/db_com/DBConnectPool.h @@ -0,0 +1,115 @@ +/* + * DBConnectPool.h + * + * Created on: 2013-6-17 + * Author: lihao + */ + +#ifndef DBCONNECTPOOL_H_ +#define DBCONNECTPOOL_H_ + +#include "ThreadKit/ThreadKit.h" +#include "db_com/DBAccess.h" +#include +#include +#include + +using namespace std; + +struct TDBConnInfo +{ + char user_name[16]; + char passwd[16]; + char db_server_name[16]; +}; +/* + * + */ +class ThreadTask : public THREADKIT::RefCount +{ +public: + ThreadTask() + { + m_pdbaccess = NULL; + m_requestBuffer = NULL; + m_requestlen = 0; + m_responseBuffer = NULL; + m_responselen = NULL; + m_p_db_info= NULL; + } + virtual ~ThreadTask(){} + + virtual void SetCurDBConnection(CDbAccess* pDbAccess, TDBConnInfo* last_db_info, unsigned int pid){} +// { +// m_pdbaccess = pDbAccess; +// m_pid = pid; +// } + virtual void ProcessOneTask(){} + + virtual void Wait(){} +protected: + virtual void Signal(){} +protected: + CDbAccess *m_pdbaccess; + char *m_requestBuffer; + int m_requestlen; + char **m_responseBuffer; + int *m_responselen; + unsigned int m_pid; + bool m_can_start, m_is_stopped; + TDBConnInfo* m_p_db_info; + string err_msg; +}; + +typedef THREADKIT::Handle ThreadTaskHandle; + +class DBConnectThread; // ߳ +class DBConnectPoolImpl; // ̳߳ʵ + +// +class DBConnectPool +{ +public: + /* + * һthreadPoolNum̵̳߳߳ + */ + DBConnectPool(unsigned int threadPoolNum); + virtual ~DBConnectPool(); + + //int initAllConnect(const char* user_name, const char* passwd, const char* db_service_name, string &err_msg); + + // ̹߳ + int start(string &err_msg); + + //ȡ̳߳еǰ̸߳ + unsigned int getThreadCount(); + + //ֹͣ߳ + void stop(); + + //ȴй + bool wait(); + + //msecʱ,ȴй + //,򷵻true + bool waitTimeout(unsigned long msec); + + //̳߳мһ + void postWork(ThreadTaskHandle task); + + //߳е쳣 + virtual void uncaughtException(THREADKIT::Thread* t); + + virtual void uncaughtException(THREADKIT::Thread* t, const THREADKIT::Exception &e); +private: + friend class DBConnectThread; + int m_can_start; // + ThreadTaskHandle waitForTask(); //ȡͷ + void finishThisWork(); + DBConnectPoolImpl* m_pool_impl; + DECLARE_NO_ASSIGN_CLASS(DBConnectPool) +}; + + + +#endif /* DBCONNECTPOOL_H_ */ diff --git a/code/sys_nicmonitor/include/db_com/DbFileNetIf.h b/code/sys_nicmonitor/include/db_com/DbFileNetIf.h new file mode 100644 index 0000000..42d646a --- /dev/null +++ b/code/sys_nicmonitor/include/db_com/DbFileNetIf.h @@ -0,0 +1,154 @@ +/* + * CDbFileNetIf.h + * + * Created on: 2012-8-1 + * Author: ThinkPad + */ + +#ifndef CDBFILENETIF_H_ +#define CDBFILENETIF_H_ + +#ifdef _WIN64 +# ifdef NET_IF_EXPORTS +# define NET_IF_API __declspec(dllexport) +# else +# define NET_IF_API __declspec(dllimport) +# endif +# pragma warning(disable : 4251) +#else +# define NET_IF_API +#endif + +#include "db_com/DBAccess.h" + +/** +@brief ļϢ +*/ +struct FileNameData{ + union{ + long idx; + long keyWord; + }; + ///ļ + char name[128]; + ///ļ + long idxFileSubType; + ///汾 + int iVersion; + ///ļС + int iSize; + ///ļ޸ʱ + long tmModify; + ///״̬ + bool isLocked; + ///ǰû + long idxUserName; + ///Ӧ + long idxAppType; + /// + long idxLockNode; + ///ʱ + long tmLock; + ///վ =NS::NOEXISTʾȫվ + long idxFactoryName; + + FileNameData(){ SetDefaultData(); } + + void SetDefaultData(){ + memset(this, 0, sizeof(*this)); + } + +}; + +// ѯʱҪõĽָṹ +struct TQueryResultPtr +{ + char *result_link_ptr; + char *result_data_ptr; + short *result_indicator_ptr; + TResultHead *result_head_ptr; + TFieldInfo *field_info_ptr; +}; + +// ѯLOBֶεSQLʱҪõĽָṹ +struct TLOBQueryResultPtr +{ + char *result_link_ptr; + char *result_data_ptr; + short *result_indicator_ptr; + TLOBResultHead *result_head_ptr; + TLOBFieldInfo *field_info_ptr; +}; + + + +class NET_IF_API CDbFileNetIf //: public CDbFileIf +{ +public: + /** + @brief 캯 + */ + CDbFileNetIf(); + + /// + ~CDbFileNetIf(); + +public: + /** + @brief ļȡ, ļ(ļͷϢ), ļʵʴС + @param fileIdx ļ¼ + @param pFileNameData1 ļͷָ + @param pReadBuf1 ȡ,˲ΪʱӿԶڴ棬ɵ÷ʹfreeͷ + @param len1 С + @retval ɹNS::RETURN_OK,򷵻<0 + */ + int Read( const long fileIdx, FileNameData *pFileNameData1, + char* &pReadBuf, int &file_len, int mode = 0); + + + /** + @brief ļϢ,ļ汾Զ1ļԶ + @param FileNameData stFileNameData ļͷ + @param pWriteBuf1 ļָ + @retval ɹNS::RETURN_OK,򷵻<0 + */ + int Update( FileNameData &stFileNameData, const char* pWriteBuf, int mode = 0); + + + /** + @brief ɾļϢ + @param idFile1 ļϢ¼ + @retval ɹNS::RETURN_OK,򷵻<0 + */ + int DeleteSingleFile( const long fileIdx, int mode = 0); + + /** + @brief ļϢ + @param strUserName1 ʹ + @param idHostNode1 ڵ + @retval ɹNS::RETURN_OK,򷵻<0 + */ +// INT32 Lock(const INT32 idFile1, const INT32 idUser1, const INT32 idHostNode1,INT32 mode = 0); + + /** + @brief ļϢ + @param strUserName11 ʹ + @param idHostNode1 ڵ + @param operMachineType1 ͣȱʡΪ + @retval ɹNS::RETURN_OK,򷵻<0 + */ +// INT32 Unlock(const INT32 idFile1, const INT32 idUser1, const INT32 idHostNode1,INT32 mode = 0); + +private: + CDbAccess m_db_access; + +private: + void NewQueryResultPtr(TQueryResultPtr &query_result_ptr_stru); + void DeleteQueryResultPtr(TQueryResultPtr & query_result_ptr_stru); + + void NewLOBQueryResultPtr(TLOBQueryResultPtr & query_result_ptr_stru); + void DeleteLOBQueryResultPtr(TLOBQueryResultPtr & query_result_ptr_stru); +}; + + +#endif /* CDBFILENETIF_H_ */ diff --git a/code/sys_nicmonitor/include/db_com/Hbase.h b/code/sys_nicmonitor/include/db_com/Hbase.h new file mode 100644 index 0000000..2e6ac1a --- /dev/null +++ b/code/sys_nicmonitor/include/db_com/Hbase.h @@ -0,0 +1,6701 @@ +/** + * Autogenerated by Thrift Compiler (0.9.0) + * + * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING + * @generated + */ +#ifndef Hbase_H +#define Hbase_H + +#include +#include "Hbase_types.h" + +namespace apache { namespace hadoop { namespace hbase { namespace thrift { + +class HbaseIf { + public: + virtual ~HbaseIf() {} + virtual void enableTable(const Bytes& tableName) = 0; + virtual void disableTable(const Bytes& tableName) = 0; + virtual bool isTableEnabled(const Bytes& tableName) = 0; + virtual void compact(const Bytes& tableNameOrRegionName) = 0; + virtual void majorCompact(const Bytes& tableNameOrRegionName) = 0; + virtual void getTableNames(std::vector & _return) = 0; + virtual void getColumnDescriptors(std::map & _return, const Text& tableName) = 0; + virtual void getTableRegions(std::vector & _return, const Text& tableName) = 0; + virtual void createTable(const Text& tableName, const std::vector & columnFamilies) = 0; + virtual void deleteTable(const Text& tableName) = 0; + virtual void get(std::vector & _return, const Text& tableName, const Text& row, const Text& column, const std::map & attributes) = 0; + virtual void getVer(std::vector & _return, const Text& tableName, const Text& row, const Text& column, const int32_t numVersions, const std::map & attributes) = 0; + virtual void getVerTs(std::vector & _return, const Text& tableName, const Text& row, const Text& column, const int64_t timestamp, const int32_t numVersions, const std::map & attributes) = 0; + virtual void getRow(std::vector & _return, const Text& tableName, const Text& row, const std::map & attributes) = 0; + virtual void getRowWithColumns(std::vector & _return, const Text& tableName, const Text& row, const std::vector & columns, const std::map & attributes) = 0; + virtual void getRowTs(std::vector & _return, const Text& tableName, const Text& row, const int64_t timestamp, const std::map & attributes) = 0; + virtual void getRowWithColumnsTs(std::vector & _return, const Text& tableName, const Text& row, const std::vector & columns, const int64_t timestamp, const std::map & attributes) = 0; + virtual void getRows(std::vector & _return, const Text& tableName, const std::vector & rows, const std::map & attributes) = 0; + virtual void getRowsWithColumns(std::vector & _return, const Text& tableName, const std::vector & rows, const std::vector & columns, const std::map & attributes) = 0; + virtual void getRowsTs(std::vector & _return, const Text& tableName, const std::vector & rows, const int64_t timestamp, const std::map & attributes) = 0; + virtual void getRowsWithColumnsTs(std::vector & _return, const Text& tableName, const std::vector & rows, const std::vector & columns, const int64_t timestamp, const std::map & attributes) = 0; + virtual void mutateRow(const Text& tableName, const Text& row, const std::vector & mutations, const std::map & attributes) = 0; + virtual void mutateRowTs(const Text& tableName, const Text& row, const std::vector & mutations, const int64_t timestamp, const std::map & attributes) = 0; + virtual void mutateRows(const Text& tableName, const std::vector & rowBatches, const std::map & attributes) = 0; + virtual void mutateRowsTs(const Text& tableName, const std::vector & rowBatches, const int64_t timestamp, const std::map & attributes) = 0; + virtual int64_t atomicIncrement(const Text& tableName, const Text& row, const Text& column, const int64_t value) = 0; + virtual void deleteAll(const Text& tableName, const Text& row, const Text& column, const std::map & attributes) = 0; + virtual void deleteAllTs(const Text& tableName, const Text& row, const Text& column, const int64_t timestamp, const std::map & attributes) = 0; + virtual void deleteAllRow(const Text& tableName, const Text& row, const std::map & attributes) = 0; + virtual void increment(const TIncrement& increment) = 0; + virtual void incrementRows(const std::vector & increments) = 0; + virtual void deleteAllRowTs(const Text& tableName, const Text& row, const int64_t timestamp, const std::map & attributes) = 0; + virtual ScannerID scannerOpenWithScan(const Text& tableName, const TScan& scan, const std::map & attributes) = 0; + virtual ScannerID scannerOpen(const Text& tableName, const Text& startRow, const std::vector & columns, const std::map & attributes) = 0; + virtual ScannerID scannerOpenWithStop(const Text& tableName, const Text& startRow, const Text& stopRow, const std::vector & columns, const std::map & attributes) = 0; + virtual ScannerID scannerOpenWithPrefix(const Text& tableName, const Text& startAndPrefix, const std::vector & columns, const std::map & attributes) = 0; + virtual ScannerID scannerOpenTs(const Text& tableName, const Text& startRow, const std::vector & columns, const int64_t timestamp, const std::map & attributes) = 0; + virtual ScannerID scannerOpenWithStopTs(const Text& tableName, const Text& startRow, const Text& stopRow, const std::vector & columns, const int64_t timestamp, const std::map & attributes) = 0; + virtual void scannerGet(std::vector & _return, const ScannerID id) = 0; + virtual void scannerGetList(std::vector & _return, const ScannerID id, const int32_t nbRows) = 0; + virtual void scannerClose(const ScannerID id) = 0; + virtual void getRowOrBefore(std::vector & _return, const Text& tableName, const Text& row, const Text& family) = 0; + virtual void getRegionInfo(TRegionInfo& _return, const Text& row) = 0; +}; + +class HbaseIfFactory { + public: + typedef HbaseIf Handler; + + virtual ~HbaseIfFactory() {} + + virtual HbaseIf* getHandler(const ::apache::thrift::TConnectionInfo& connInfo) = 0; + virtual void releaseHandler(HbaseIf* /* handler */) = 0; +}; + +class HbaseIfSingletonFactory : virtual public HbaseIfFactory { + public: + HbaseIfSingletonFactory(const boost::shared_ptr& iface) : iface_(iface) {} + virtual ~HbaseIfSingletonFactory() {} + + virtual HbaseIf* getHandler(const ::apache::thrift::TConnectionInfo&) { + return iface_.get(); + } + virtual void releaseHandler(HbaseIf* /* handler */) {} + + protected: + boost::shared_ptr iface_; +}; + +class HbaseNull : virtual public HbaseIf { + public: + virtual ~HbaseNull() {} + void enableTable(const Bytes& /* tableName */) { + return; + } + void disableTable(const Bytes& /* tableName */) { + return; + } + bool isTableEnabled(const Bytes& /* tableName */) { + bool _return = false; + return _return; + } + void compact(const Bytes& /* tableNameOrRegionName */) { + return; + } + void majorCompact(const Bytes& /* tableNameOrRegionName */) { + return; + } + void getTableNames(std::vector & /* _return */) { + return; + } + void getColumnDescriptors(std::map & /* _return */, const Text& /* tableName */) { + return; + } + void getTableRegions(std::vector & /* _return */, const Text& /* tableName */) { + return; + } + void createTable(const Text& /* tableName */, const std::vector & /* columnFamilies */) { + return; + } + void deleteTable(const Text& /* tableName */) { + return; + } + void get(std::vector & /* _return */, const Text& /* tableName */, const Text& /* row */, const Text& /* column */, const std::map & /* attributes */) { + return; + } + void getVer(std::vector & /* _return */, const Text& /* tableName */, const Text& /* row */, const Text& /* column */, const int32_t /* numVersions */, const std::map & /* attributes */) { + return; + } + void getVerTs(std::vector & /* _return */, const Text& /* tableName */, const Text& /* row */, const Text& /* column */, const int64_t /* timestamp */, const int32_t /* numVersions */, const std::map & /* attributes */) { + return; + } + void getRow(std::vector & /* _return */, const Text& /* tableName */, const Text& /* row */, const std::map & /* attributes */) { + return; + } + void getRowWithColumns(std::vector & /* _return */, const Text& /* tableName */, const Text& /* row */, const std::vector & /* columns */, const std::map & /* attributes */) { + return; + } + void getRowTs(std::vector & /* _return */, const Text& /* tableName */, const Text& /* row */, const int64_t /* timestamp */, const std::map & /* attributes */) { + return; + } + void getRowWithColumnsTs(std::vector & /* _return */, const Text& /* tableName */, const Text& /* row */, const std::vector & /* columns */, const int64_t /* timestamp */, const std::map & /* attributes */) { + return; + } + void getRows(std::vector & /* _return */, const Text& /* tableName */, const std::vector & /* rows */, const std::map & /* attributes */) { + return; + } + void getRowsWithColumns(std::vector & /* _return */, const Text& /* tableName */, const std::vector & /* rows */, const std::vector & /* columns */, const std::map & /* attributes */) { + return; + } + void getRowsTs(std::vector & /* _return */, const Text& /* tableName */, const std::vector & /* rows */, const int64_t /* timestamp */, const std::map & /* attributes */) { + return; + } + void getRowsWithColumnsTs(std::vector & /* _return */, const Text& /* tableName */, const std::vector & /* rows */, const std::vector & /* columns */, const int64_t /* timestamp */, const std::map & /* attributes */) { + return; + } + void mutateRow(const Text& /* tableName */, const Text& /* row */, const std::vector & /* mutations */, const std::map & /* attributes */) { + return; + } + void mutateRowTs(const Text& /* tableName */, const Text& /* row */, const std::vector & /* mutations */, const int64_t /* timestamp */, const std::map & /* attributes */) { + return; + } + void mutateRows(const Text& /* tableName */, const std::vector & /* rowBatches */, const std::map & /* attributes */) { + return; + } + void mutateRowsTs(const Text& /* tableName */, const std::vector & /* rowBatches */, const int64_t /* timestamp */, const std::map & /* attributes */) { + return; + } + int64_t atomicIncrement(const Text& /* tableName */, const Text& /* row */, const Text& /* column */, const int64_t /* value */) { + int64_t _return = 0; + return _return; + } + void deleteAll(const Text& /* tableName */, const Text& /* row */, const Text& /* column */, const std::map & /* attributes */) { + return; + } + void deleteAllTs(const Text& /* tableName */, const Text& /* row */, const Text& /* column */, const int64_t /* timestamp */, const std::map & /* attributes */) { + return; + } + void deleteAllRow(const Text& /* tableName */, const Text& /* row */, const std::map & /* attributes */) { + return; + } + void increment(const TIncrement& /* increment */) { + return; + } + void incrementRows(const std::vector & /* increments */) { + return; + } + void deleteAllRowTs(const Text& /* tableName */, const Text& /* row */, const int64_t /* timestamp */, const std::map & /* attributes */) { + return; + } + ScannerID scannerOpenWithScan(const Text& /* tableName */, const TScan& /* scan */, const std::map & /* attributes */) { + ScannerID _return = 0; + return _return; + } + ScannerID scannerOpen(const Text& /* tableName */, const Text& /* startRow */, const std::vector & /* columns */, const std::map & /* attributes */) { + ScannerID _return = 0; + return _return; + } + ScannerID scannerOpenWithStop(const Text& /* tableName */, const Text& /* startRow */, const Text& /* stopRow */, const std::vector & /* columns */, const std::map & /* attributes */) { + ScannerID _return = 0; + return _return; + } + ScannerID scannerOpenWithPrefix(const Text& /* tableName */, const Text& /* startAndPrefix */, const std::vector & /* columns */, const std::map & /* attributes */) { + ScannerID _return = 0; + return _return; + } + ScannerID scannerOpenTs(const Text& /* tableName */, const Text& /* startRow */, const std::vector & /* columns */, const int64_t /* timestamp */, const std::map & /* attributes */) { + ScannerID _return = 0; + return _return; + } + ScannerID scannerOpenWithStopTs(const Text& /* tableName */, const Text& /* startRow */, const Text& /* stopRow */, const std::vector & /* columns */, const int64_t /* timestamp */, const std::map & /* attributes */) { + ScannerID _return = 0; + return _return; + } + void scannerGet(std::vector & /* _return */, const ScannerID /* id */) { + return; + } + void scannerGetList(std::vector & /* _return */, const ScannerID /* id */, const int32_t /* nbRows */) { + return; + } + void scannerClose(const ScannerID /* id */) { + return; + } + void getRowOrBefore(std::vector & /* _return */, const Text& /* tableName */, const Text& /* row */, const Text& /* family */) { + return; + } + void getRegionInfo(TRegionInfo& /* _return */, const Text& /* row */) { + return; + } +}; + +typedef struct _Hbase_enableTable_args__isset { + _Hbase_enableTable_args__isset() : tableName(false) {} + bool tableName; +} _Hbase_enableTable_args__isset; + +class Hbase_enableTable_args { + public: + + Hbase_enableTable_args() : tableName() { + } + + virtual ~Hbase_enableTable_args() throw() {} + + Bytes tableName; + + _Hbase_enableTable_args__isset __isset; + + void __set_tableName(const Bytes& val) { + tableName = val; + } + + bool operator == (const Hbase_enableTable_args & rhs) const + { + if (!(tableName == rhs.tableName)) + return false; + return true; + } + bool operator != (const Hbase_enableTable_args &rhs) const { + return !(*this == rhs); + } + + bool operator < (const Hbase_enableTable_args & ) const; + + uint32_t read(::apache::thrift::protocol::TProtocol* iprot); + uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const; + +}; + + +class Hbase_enableTable_pargs { + public: + + + virtual ~Hbase_enableTable_pargs() throw() {} + + const Bytes* tableName; + + uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const; + +}; + +typedef struct _Hbase_enableTable_result__isset { + _Hbase_enableTable_result__isset() : io(false) {} + bool io; +} _Hbase_enableTable_result__isset; + +class Hbase_enableTable_result { + public: + + Hbase_enableTable_result() { + } + + virtual ~Hbase_enableTable_result() throw() {} + + IOError io; + + _Hbase_enableTable_result__isset __isset; + + void __set_io(const IOError& val) { + io = val; + } + + bool operator == (const Hbase_enableTable_result & rhs) const + { + if (!(io == rhs.io)) + return false; + return true; + } + bool operator != (const Hbase_enableTable_result &rhs) const { + return !(*this == rhs); + } + + bool operator < (const Hbase_enableTable_result & ) const; + + uint32_t read(::apache::thrift::protocol::TProtocol* iprot); + uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const; + +}; + +typedef struct _Hbase_enableTable_presult__isset { + _Hbase_enableTable_presult__isset() : io(false) {} + bool io; +} _Hbase_enableTable_presult__isset; + +class Hbase_enableTable_presult { + public: + + + virtual ~Hbase_enableTable_presult() throw() {} + + IOError io; + + _Hbase_enableTable_presult__isset __isset; + + uint32_t read(::apache::thrift::protocol::TProtocol* iprot); + +}; + +typedef struct _Hbase_disableTable_args__isset { + _Hbase_disableTable_args__isset() : tableName(false) {} + bool tableName; +} _Hbase_disableTable_args__isset; + +class Hbase_disableTable_args { + public: + + Hbase_disableTable_args() : tableName() { + } + + virtual ~Hbase_disableTable_args() throw() {} + + Bytes tableName; + + _Hbase_disableTable_args__isset __isset; + + void __set_tableName(const Bytes& val) { + tableName = val; + } + + bool operator == (const Hbase_disableTable_args & rhs) const + { + if (!(tableName == rhs.tableName)) + return false; + return true; + } + bool operator != (const Hbase_disableTable_args &rhs) const { + return !(*this == rhs); + } + + bool operator < (const Hbase_disableTable_args & ) const; + + uint32_t read(::apache::thrift::protocol::TProtocol* iprot); + uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const; + +}; + + +class Hbase_disableTable_pargs { + public: + + + virtual ~Hbase_disableTable_pargs() throw() {} + + const Bytes* tableName; + + uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const; + +}; + +typedef struct _Hbase_disableTable_result__isset { + _Hbase_disableTable_result__isset() : io(false) {} + bool io; +} _Hbase_disableTable_result__isset; + +class Hbase_disableTable_result { + public: + + Hbase_disableTable_result() { + } + + virtual ~Hbase_disableTable_result() throw() {} + + IOError io; + + _Hbase_disableTable_result__isset __isset; + + void __set_io(const IOError& val) { + io = val; + } + + bool operator == (const Hbase_disableTable_result & rhs) const + { + if (!(io == rhs.io)) + return false; + return true; + } + bool operator != (const Hbase_disableTable_result &rhs) const { + return !(*this == rhs); + } + + bool operator < (const Hbase_disableTable_result & ) const; + + uint32_t read(::apache::thrift::protocol::TProtocol* iprot); + uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const; + +}; + +typedef struct _Hbase_disableTable_presult__isset { + _Hbase_disableTable_presult__isset() : io(false) {} + bool io; +} _Hbase_disableTable_presult__isset; + +class Hbase_disableTable_presult { + public: + + + virtual ~Hbase_disableTable_presult() throw() {} + + IOError io; + + _Hbase_disableTable_presult__isset __isset; + + uint32_t read(::apache::thrift::protocol::TProtocol* iprot); + +}; + +typedef struct _Hbase_isTableEnabled_args__isset { + _Hbase_isTableEnabled_args__isset() : tableName(false) {} + bool tableName; +} _Hbase_isTableEnabled_args__isset; + +class Hbase_isTableEnabled_args { + public: + + Hbase_isTableEnabled_args() : tableName() { + } + + virtual ~Hbase_isTableEnabled_args() throw() {} + + Bytes tableName; + + _Hbase_isTableEnabled_args__isset __isset; + + void __set_tableName(const Bytes& val) { + tableName = val; + } + + bool operator == (const Hbase_isTableEnabled_args & rhs) const + { + if (!(tableName == rhs.tableName)) + return false; + return true; + } + bool operator != (const Hbase_isTableEnabled_args &rhs) const { + return !(*this == rhs); + } + + bool operator < (const Hbase_isTableEnabled_args & ) const; + + uint32_t read(::apache::thrift::protocol::TProtocol* iprot); + uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const; + +}; + + +class Hbase_isTableEnabled_pargs { + public: + + + virtual ~Hbase_isTableEnabled_pargs() throw() {} + + const Bytes* tableName; + + uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const; + +}; + +typedef struct _Hbase_isTableEnabled_result__isset { + _Hbase_isTableEnabled_result__isset() : success(false), io(false) {} + bool success; + bool io; +} _Hbase_isTableEnabled_result__isset; + +class Hbase_isTableEnabled_result { + public: + + Hbase_isTableEnabled_result() : success(0) { + } + + virtual ~Hbase_isTableEnabled_result() throw() {} + + bool success; + IOError io; + + _Hbase_isTableEnabled_result__isset __isset; + + void __set_success(const bool val) { + success = val; + } + + void __set_io(const IOError& val) { + io = val; + } + + bool operator == (const Hbase_isTableEnabled_result & rhs) const + { + if (!(success == rhs.success)) + return false; + if (!(io == rhs.io)) + return false; + return true; + } + bool operator != (const Hbase_isTableEnabled_result &rhs) const { + return !(*this == rhs); + } + + bool operator < (const Hbase_isTableEnabled_result & ) const; + + uint32_t read(::apache::thrift::protocol::TProtocol* iprot); + uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const; + +}; + +typedef struct _Hbase_isTableEnabled_presult__isset { + _Hbase_isTableEnabled_presult__isset() : success(false), io(false) {} + bool success; + bool io; +} _Hbase_isTableEnabled_presult__isset; + +class Hbase_isTableEnabled_presult { + public: + + + virtual ~Hbase_isTableEnabled_presult() throw() {} + + bool* success; + IOError io; + + _Hbase_isTableEnabled_presult__isset __isset; + + uint32_t read(::apache::thrift::protocol::TProtocol* iprot); + +}; + +typedef struct _Hbase_compact_args__isset { + _Hbase_compact_args__isset() : tableNameOrRegionName(false) {} + bool tableNameOrRegionName; +} _Hbase_compact_args__isset; + +class Hbase_compact_args { + public: + + Hbase_compact_args() : tableNameOrRegionName() { + } + + virtual ~Hbase_compact_args() throw() {} + + Bytes tableNameOrRegionName; + + _Hbase_compact_args__isset __isset; + + void __set_tableNameOrRegionName(const Bytes& val) { + tableNameOrRegionName = val; + } + + bool operator == (const Hbase_compact_args & rhs) const + { + if (!(tableNameOrRegionName == rhs.tableNameOrRegionName)) + return false; + return true; + } + bool operator != (const Hbase_compact_args &rhs) const { + return !(*this == rhs); + } + + bool operator < (const Hbase_compact_args & ) const; + + uint32_t read(::apache::thrift::protocol::TProtocol* iprot); + uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const; + +}; + + +class Hbase_compact_pargs { + public: + + + virtual ~Hbase_compact_pargs() throw() {} + + const Bytes* tableNameOrRegionName; + + uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const; + +}; + +typedef struct _Hbase_compact_result__isset { + _Hbase_compact_result__isset() : io(false) {} + bool io; +} _Hbase_compact_result__isset; + +class Hbase_compact_result { + public: + + Hbase_compact_result() { + } + + virtual ~Hbase_compact_result() throw() {} + + IOError io; + + _Hbase_compact_result__isset __isset; + + void __set_io(const IOError& val) { + io = val; + } + + bool operator == (const Hbase_compact_result & rhs) const + { + if (!(io == rhs.io)) + return false; + return true; + } + bool operator != (const Hbase_compact_result &rhs) const { + return !(*this == rhs); + } + + bool operator < (const Hbase_compact_result & ) const; + + uint32_t read(::apache::thrift::protocol::TProtocol* iprot); + uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const; + +}; + +typedef struct _Hbase_compact_presult__isset { + _Hbase_compact_presult__isset() : io(false) {} + bool io; +} _Hbase_compact_presult__isset; + +class Hbase_compact_presult { + public: + + + virtual ~Hbase_compact_presult() throw() {} + + IOError io; + + _Hbase_compact_presult__isset __isset; + + uint32_t read(::apache::thrift::protocol::TProtocol* iprot); + +}; + +typedef struct _Hbase_majorCompact_args__isset { + _Hbase_majorCompact_args__isset() : tableNameOrRegionName(false) {} + bool tableNameOrRegionName; +} _Hbase_majorCompact_args__isset; + +class Hbase_majorCompact_args { + public: + + Hbase_majorCompact_args() : tableNameOrRegionName() { + } + + virtual ~Hbase_majorCompact_args() throw() {} + + Bytes tableNameOrRegionName; + + _Hbase_majorCompact_args__isset __isset; + + void __set_tableNameOrRegionName(const Bytes& val) { + tableNameOrRegionName = val; + } + + bool operator == (const Hbase_majorCompact_args & rhs) const + { + if (!(tableNameOrRegionName == rhs.tableNameOrRegionName)) + return false; + return true; + } + bool operator != (const Hbase_majorCompact_args &rhs) const { + return !(*this == rhs); + } + + bool operator < (const Hbase_majorCompact_args & ) const; + + uint32_t read(::apache::thrift::protocol::TProtocol* iprot); + uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const; + +}; + + +class Hbase_majorCompact_pargs { + public: + + + virtual ~Hbase_majorCompact_pargs() throw() {} + + const Bytes* tableNameOrRegionName; + + uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const; + +}; + +typedef struct _Hbase_majorCompact_result__isset { + _Hbase_majorCompact_result__isset() : io(false) {} + bool io; +} _Hbase_majorCompact_result__isset; + +class Hbase_majorCompact_result { + public: + + Hbase_majorCompact_result() { + } + + virtual ~Hbase_majorCompact_result() throw() {} + + IOError io; + + _Hbase_majorCompact_result__isset __isset; + + void __set_io(const IOError& val) { + io = val; + } + + bool operator == (const Hbase_majorCompact_result & rhs) const + { + if (!(io == rhs.io)) + return false; + return true; + } + bool operator != (const Hbase_majorCompact_result &rhs) const { + return !(*this == rhs); + } + + bool operator < (const Hbase_majorCompact_result & ) const; + + uint32_t read(::apache::thrift::protocol::TProtocol* iprot); + uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const; + +}; + +typedef struct _Hbase_majorCompact_presult__isset { + _Hbase_majorCompact_presult__isset() : io(false) {} + bool io; +} _Hbase_majorCompact_presult__isset; + +class Hbase_majorCompact_presult { + public: + + + virtual ~Hbase_majorCompact_presult() throw() {} + + IOError io; + + _Hbase_majorCompact_presult__isset __isset; + + uint32_t read(::apache::thrift::protocol::TProtocol* iprot); + +}; + + +class Hbase_getTableNames_args { + public: + + Hbase_getTableNames_args() { + } + + virtual ~Hbase_getTableNames_args() throw() {} + + + bool operator == (const Hbase_getTableNames_args & /* rhs */) const + { + return true; + } + bool operator != (const Hbase_getTableNames_args &rhs) const { + return !(*this == rhs); + } + + bool operator < (const Hbase_getTableNames_args & ) const; + + uint32_t read(::apache::thrift::protocol::TProtocol* iprot); + uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const; + +}; + + +class Hbase_getTableNames_pargs { + public: + + + virtual ~Hbase_getTableNames_pargs() throw() {} + + + uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const; + +}; + +typedef struct _Hbase_getTableNames_result__isset { + _Hbase_getTableNames_result__isset() : success(false), io(false) {} + bool success; + bool io; +} _Hbase_getTableNames_result__isset; + +class Hbase_getTableNames_result { + public: + + Hbase_getTableNames_result() { + } + + virtual ~Hbase_getTableNames_result() throw() {} + + std::vector success; + IOError io; + + _Hbase_getTableNames_result__isset __isset; + + void __set_success(const std::vector & val) { + success = val; + } + + void __set_io(const IOError& val) { + io = val; + } + + bool operator == (const Hbase_getTableNames_result & rhs) const + { + if (!(success == rhs.success)) + return false; + if (!(io == rhs.io)) + return false; + return true; + } + bool operator != (const Hbase_getTableNames_result &rhs) const { + return !(*this == rhs); + } + + bool operator < (const Hbase_getTableNames_result & ) const; + + uint32_t read(::apache::thrift::protocol::TProtocol* iprot); + uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const; + +}; + +typedef struct _Hbase_getTableNames_presult__isset { + _Hbase_getTableNames_presult__isset() : success(false), io(false) {} + bool success; + bool io; +} _Hbase_getTableNames_presult__isset; + +class Hbase_getTableNames_presult { + public: + + + virtual ~Hbase_getTableNames_presult() throw() {} + + std::vector * success; + IOError io; + + _Hbase_getTableNames_presult__isset __isset; + + uint32_t read(::apache::thrift::protocol::TProtocol* iprot); + +}; + +typedef struct _Hbase_getColumnDescriptors_args__isset { + _Hbase_getColumnDescriptors_args__isset() : tableName(false) {} + bool tableName; +} _Hbase_getColumnDescriptors_args__isset; + +class Hbase_getColumnDescriptors_args { + public: + + Hbase_getColumnDescriptors_args() : tableName() { + } + + virtual ~Hbase_getColumnDescriptors_args() throw() {} + + Text tableName; + + _Hbase_getColumnDescriptors_args__isset __isset; + + void __set_tableName(const Text& val) { + tableName = val; + } + + bool operator == (const Hbase_getColumnDescriptors_args & rhs) const + { + if (!(tableName == rhs.tableName)) + return false; + return true; + } + bool operator != (const Hbase_getColumnDescriptors_args &rhs) const { + return !(*this == rhs); + } + + bool operator < (const Hbase_getColumnDescriptors_args & ) const; + + uint32_t read(::apache::thrift::protocol::TProtocol* iprot); + uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const; + +}; + + +class Hbase_getColumnDescriptors_pargs { + public: + + + virtual ~Hbase_getColumnDescriptors_pargs() throw() {} + + const Text* tableName; + + uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const; + +}; + +typedef struct _Hbase_getColumnDescriptors_result__isset { + _Hbase_getColumnDescriptors_result__isset() : success(false), io(false) {} + bool success; + bool io; +} _Hbase_getColumnDescriptors_result__isset; + +class Hbase_getColumnDescriptors_result { + public: + + Hbase_getColumnDescriptors_result() { + } + + virtual ~Hbase_getColumnDescriptors_result() throw() {} + + std::map success; + IOError io; + + _Hbase_getColumnDescriptors_result__isset __isset; + + void __set_success(const std::map & val) { + success = val; + } + + void __set_io(const IOError& val) { + io = val; + } + + bool operator == (const Hbase_getColumnDescriptors_result & rhs) const + { + if (!(success == rhs.success)) + return false; + if (!(io == rhs.io)) + return false; + return true; + } + bool operator != (const Hbase_getColumnDescriptors_result &rhs) const { + return !(*this == rhs); + } + + bool operator < (const Hbase_getColumnDescriptors_result & ) const; + + uint32_t read(::apache::thrift::protocol::TProtocol* iprot); + uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const; + +}; + +typedef struct _Hbase_getColumnDescriptors_presult__isset { + _Hbase_getColumnDescriptors_presult__isset() : success(false), io(false) {} + bool success; + bool io; +} _Hbase_getColumnDescriptors_presult__isset; + +class Hbase_getColumnDescriptors_presult { + public: + + + virtual ~Hbase_getColumnDescriptors_presult() throw() {} + + std::map * success; + IOError io; + + _Hbase_getColumnDescriptors_presult__isset __isset; + + uint32_t read(::apache::thrift::protocol::TProtocol* iprot); + +}; + +typedef struct _Hbase_getTableRegions_args__isset { + _Hbase_getTableRegions_args__isset() : tableName(false) {} + bool tableName; +} _Hbase_getTableRegions_args__isset; + +class Hbase_getTableRegions_args { + public: + + Hbase_getTableRegions_args() : tableName() { + } + + virtual ~Hbase_getTableRegions_args() throw() {} + + Text tableName; + + _Hbase_getTableRegions_args__isset __isset; + + void __set_tableName(const Text& val) { + tableName = val; + } + + bool operator == (const Hbase_getTableRegions_args & rhs) const + { + if (!(tableName == rhs.tableName)) + return false; + return true; + } + bool operator != (const Hbase_getTableRegions_args &rhs) const { + return !(*this == rhs); + } + + bool operator < (const Hbase_getTableRegions_args & ) const; + + uint32_t read(::apache::thrift::protocol::TProtocol* iprot); + uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const; + +}; + + +class Hbase_getTableRegions_pargs { + public: + + + virtual ~Hbase_getTableRegions_pargs() throw() {} + + const Text* tableName; + + uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const; + +}; + +typedef struct _Hbase_getTableRegions_result__isset { + _Hbase_getTableRegions_result__isset() : success(false), io(false) {} + bool success; + bool io; +} _Hbase_getTableRegions_result__isset; + +class Hbase_getTableRegions_result { + public: + + Hbase_getTableRegions_result() { + } + + virtual ~Hbase_getTableRegions_result() throw() {} + + std::vector success; + IOError io; + + _Hbase_getTableRegions_result__isset __isset; + + void __set_success(const std::vector & val) { + success = val; + } + + void __set_io(const IOError& val) { + io = val; + } + + bool operator == (const Hbase_getTableRegions_result & rhs) const + { + if (!(success == rhs.success)) + return false; + if (!(io == rhs.io)) + return false; + return true; + } + bool operator != (const Hbase_getTableRegions_result &rhs) const { + return !(*this == rhs); + } + + bool operator < (const Hbase_getTableRegions_result & ) const; + + uint32_t read(::apache::thrift::protocol::TProtocol* iprot); + uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const; + +}; + +typedef struct _Hbase_getTableRegions_presult__isset { + _Hbase_getTableRegions_presult__isset() : success(false), io(false) {} + bool success; + bool io; +} _Hbase_getTableRegions_presult__isset; + +class Hbase_getTableRegions_presult { + public: + + + virtual ~Hbase_getTableRegions_presult() throw() {} + + std::vector * success; + IOError io; + + _Hbase_getTableRegions_presult__isset __isset; + + uint32_t read(::apache::thrift::protocol::TProtocol* iprot); + +}; + +typedef struct _Hbase_createTable_args__isset { + _Hbase_createTable_args__isset() : tableName(false), columnFamilies(false) {} + bool tableName; + bool columnFamilies; +} _Hbase_createTable_args__isset; + +class Hbase_createTable_args { + public: + + Hbase_createTable_args() : tableName() { + } + + virtual ~Hbase_createTable_args() throw() {} + + Text tableName; + std::vector columnFamilies; + + _Hbase_createTable_args__isset __isset; + + void __set_tableName(const Text& val) { + tableName = val; + } + + void __set_columnFamilies(const std::vector & val) { + columnFamilies = val; + } + + bool operator == (const Hbase_createTable_args & rhs) const + { + if (!(tableName == rhs.tableName)) + return false; + if (!(columnFamilies == rhs.columnFamilies)) + return false; + return true; + } + bool operator != (const Hbase_createTable_args &rhs) const { + return !(*this == rhs); + } + + bool operator < (const Hbase_createTable_args & ) const; + + uint32_t read(::apache::thrift::protocol::TProtocol* iprot); + uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const; + +}; + + +class Hbase_createTable_pargs { + public: + + + virtual ~Hbase_createTable_pargs() throw() {} + + const Text* tableName; + const std::vector * columnFamilies; + + uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const; + +}; + +typedef struct _Hbase_createTable_result__isset { + _Hbase_createTable_result__isset() : io(false), ia(false), exist(false) {} + bool io; + bool ia; + bool exist; +} _Hbase_createTable_result__isset; + +class Hbase_createTable_result { + public: + + Hbase_createTable_result() { + } + + virtual ~Hbase_createTable_result() throw() {} + + IOError io; + IllegalArgument ia; + AlreadyExists exist; + + _Hbase_createTable_result__isset __isset; + + void __set_io(const IOError& val) { + io = val; + } + + void __set_ia(const IllegalArgument& val) { + ia = val; + } + + void __set_exist(const AlreadyExists& val) { + exist = val; + } + + bool operator == (const Hbase_createTable_result & rhs) const + { + if (!(io == rhs.io)) + return false; + if (!(ia == rhs.ia)) + return false; + if (!(exist == rhs.exist)) + return false; + return true; + } + bool operator != (const Hbase_createTable_result &rhs) const { + return !(*this == rhs); + } + + bool operator < (const Hbase_createTable_result & ) const; + + uint32_t read(::apache::thrift::protocol::TProtocol* iprot); + uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const; + +}; + +typedef struct _Hbase_createTable_presult__isset { + _Hbase_createTable_presult__isset() : io(false), ia(false), exist(false) {} + bool io; + bool ia; + bool exist; +} _Hbase_createTable_presult__isset; + +class Hbase_createTable_presult { + public: + + + virtual ~Hbase_createTable_presult() throw() {} + + IOError io; + IllegalArgument ia; + AlreadyExists exist; + + _Hbase_createTable_presult__isset __isset; + + uint32_t read(::apache::thrift::protocol::TProtocol* iprot); + +}; + +typedef struct _Hbase_deleteTable_args__isset { + _Hbase_deleteTable_args__isset() : tableName(false) {} + bool tableName; +} _Hbase_deleteTable_args__isset; + +class Hbase_deleteTable_args { + public: + + Hbase_deleteTable_args() : tableName() { + } + + virtual ~Hbase_deleteTable_args() throw() {} + + Text tableName; + + _Hbase_deleteTable_args__isset __isset; + + void __set_tableName(const Text& val) { + tableName = val; + } + + bool operator == (const Hbase_deleteTable_args & rhs) const + { + if (!(tableName == rhs.tableName)) + return false; + return true; + } + bool operator != (const Hbase_deleteTable_args &rhs) const { + return !(*this == rhs); + } + + bool operator < (const Hbase_deleteTable_args & ) const; + + uint32_t read(::apache::thrift::protocol::TProtocol* iprot); + uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const; + +}; + + +class Hbase_deleteTable_pargs { + public: + + + virtual ~Hbase_deleteTable_pargs() throw() {} + + const Text* tableName; + + uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const; + +}; + +typedef struct _Hbase_deleteTable_result__isset { + _Hbase_deleteTable_result__isset() : io(false) {} + bool io; +} _Hbase_deleteTable_result__isset; + +class Hbase_deleteTable_result { + public: + + Hbase_deleteTable_result() { + } + + virtual ~Hbase_deleteTable_result() throw() {} + + IOError io; + + _Hbase_deleteTable_result__isset __isset; + + void __set_io(const IOError& val) { + io = val; + } + + bool operator == (const Hbase_deleteTable_result & rhs) const + { + if (!(io == rhs.io)) + return false; + return true; + } + bool operator != (const Hbase_deleteTable_result &rhs) const { + return !(*this == rhs); + } + + bool operator < (const Hbase_deleteTable_result & ) const; + + uint32_t read(::apache::thrift::protocol::TProtocol* iprot); + uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const; + +}; + +typedef struct _Hbase_deleteTable_presult__isset { + _Hbase_deleteTable_presult__isset() : io(false) {} + bool io; +} _Hbase_deleteTable_presult__isset; + +class Hbase_deleteTable_presult { + public: + + + virtual ~Hbase_deleteTable_presult() throw() {} + + IOError io; + + _Hbase_deleteTable_presult__isset __isset; + + uint32_t read(::apache::thrift::protocol::TProtocol* iprot); + +}; + +typedef struct _Hbase_get_args__isset { + _Hbase_get_args__isset() : tableName(false), row(false), column(false), attributes(false) {} + bool tableName; + bool row; + bool column; + bool attributes; +} _Hbase_get_args__isset; + +class Hbase_get_args { + public: + + Hbase_get_args() : tableName(), row(), column() { + } + + virtual ~Hbase_get_args() throw() {} + + Text tableName; + Text row; + Text column; + std::map attributes; + + _Hbase_get_args__isset __isset; + + void __set_tableName(const Text& val) { + tableName = val; + } + + void __set_row(const Text& val) { + row = val; + } + + void __set_column(const Text& val) { + column = val; + } + + void __set_attributes(const std::map & val) { + attributes = val; + } + + bool operator == (const Hbase_get_args & rhs) const + { + if (!(tableName == rhs.tableName)) + return false; + if (!(row == rhs.row)) + return false; + if (!(column == rhs.column)) + return false; + if (!(attributes == rhs.attributes)) + return false; + return true; + } + bool operator != (const Hbase_get_args &rhs) const { + return !(*this == rhs); + } + + bool operator < (const Hbase_get_args & ) const; + + uint32_t read(::apache::thrift::protocol::TProtocol* iprot); + uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const; + +}; + + +class Hbase_get_pargs { + public: + + + virtual ~Hbase_get_pargs() throw() {} + + const Text* tableName; + const Text* row; + const Text* column; + const std::map * attributes; + + uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const; + +}; + +typedef struct _Hbase_get_result__isset { + _Hbase_get_result__isset() : success(false), io(false) {} + bool success; + bool io; +} _Hbase_get_result__isset; + +class Hbase_get_result { + public: + + Hbase_get_result() { + } + + virtual ~Hbase_get_result() throw() {} + + std::vector success; + IOError io; + + _Hbase_get_result__isset __isset; + + void __set_success(const std::vector & val) { + success = val; + } + + void __set_io(const IOError& val) { + io = val; + } + + bool operator == (const Hbase_get_result & rhs) const + { + if (!(success == rhs.success)) + return false; + if (!(io == rhs.io)) + return false; + return true; + } + bool operator != (const Hbase_get_result &rhs) const { + return !(*this == rhs); + } + + bool operator < (const Hbase_get_result & ) const; + + uint32_t read(::apache::thrift::protocol::TProtocol* iprot); + uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const; + +}; + +typedef struct _Hbase_get_presult__isset { + _Hbase_get_presult__isset() : success(false), io(false) {} + bool success; + bool io; +} _Hbase_get_presult__isset; + +class Hbase_get_presult { + public: + + + virtual ~Hbase_get_presult() throw() {} + + std::vector * success; + IOError io; + + _Hbase_get_presult__isset __isset; + + uint32_t read(::apache::thrift::protocol::TProtocol* iprot); + +}; + +typedef struct _Hbase_getVer_args__isset { + _Hbase_getVer_args__isset() : tableName(false), row(false), column(false), numVersions(false), attributes(false) {} + bool tableName; + bool row; + bool column; + bool numVersions; + bool attributes; +} _Hbase_getVer_args__isset; + +class Hbase_getVer_args { + public: + + Hbase_getVer_args() : tableName(), row(), column(), numVersions(0) { + } + + virtual ~Hbase_getVer_args() throw() {} + + Text tableName; + Text row; + Text column; + int32_t numVersions; + std::map attributes; + + _Hbase_getVer_args__isset __isset; + + void __set_tableName(const Text& val) { + tableName = val; + } + + void __set_row(const Text& val) { + row = val; + } + + void __set_column(const Text& val) { + column = val; + } + + void __set_numVersions(const int32_t val) { + numVersions = val; + } + + void __set_attributes(const std::map & val) { + attributes = val; + } + + bool operator == (const Hbase_getVer_args & rhs) const + { + if (!(tableName == rhs.tableName)) + return false; + if (!(row == rhs.row)) + return false; + if (!(column == rhs.column)) + return false; + if (!(numVersions == rhs.numVersions)) + return false; + if (!(attributes == rhs.attributes)) + return false; + return true; + } + bool operator != (const Hbase_getVer_args &rhs) const { + return !(*this == rhs); + } + + bool operator < (const Hbase_getVer_args & ) const; + + uint32_t read(::apache::thrift::protocol::TProtocol* iprot); + uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const; + +}; + + +class Hbase_getVer_pargs { + public: + + + virtual ~Hbase_getVer_pargs() throw() {} + + const Text* tableName; + const Text* row; + const Text* column; + const int32_t* numVersions; + const std::map * attributes; + + uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const; + +}; + +typedef struct _Hbase_getVer_result__isset { + _Hbase_getVer_result__isset() : success(false), io(false) {} + bool success; + bool io; +} _Hbase_getVer_result__isset; + +class Hbase_getVer_result { + public: + + Hbase_getVer_result() { + } + + virtual ~Hbase_getVer_result() throw() {} + + std::vector success; + IOError io; + + _Hbase_getVer_result__isset __isset; + + void __set_success(const std::vector & val) { + success = val; + } + + void __set_io(const IOError& val) { + io = val; + } + + bool operator == (const Hbase_getVer_result & rhs) const + { + if (!(success == rhs.success)) + return false; + if (!(io == rhs.io)) + return false; + return true; + } + bool operator != (const Hbase_getVer_result &rhs) const { + return !(*this == rhs); + } + + bool operator < (const Hbase_getVer_result & ) const; + + uint32_t read(::apache::thrift::protocol::TProtocol* iprot); + uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const; + +}; + +typedef struct _Hbase_getVer_presult__isset { + _Hbase_getVer_presult__isset() : success(false), io(false) {} + bool success; + bool io; +} _Hbase_getVer_presult__isset; + +class Hbase_getVer_presult { + public: + + + virtual ~Hbase_getVer_presult() throw() {} + + std::vector * success; + IOError io; + + _Hbase_getVer_presult__isset __isset; + + uint32_t read(::apache::thrift::protocol::TProtocol* iprot); + +}; + +typedef struct _Hbase_getVerTs_args__isset { + _Hbase_getVerTs_args__isset() : tableName(false), row(false), column(false), timestamp(false), numVersions(false), attributes(false) {} + bool tableName; + bool row; + bool column; + bool timestamp; + bool numVersions; + bool attributes; +} _Hbase_getVerTs_args__isset; + +class Hbase_getVerTs_args { + public: + + Hbase_getVerTs_args() : tableName(), row(), column(), timestamp(0), numVersions(0) { + } + + virtual ~Hbase_getVerTs_args() throw() {} + + Text tableName; + Text row; + Text column; + int64_t timestamp; + int32_t numVersions; + std::map attributes; + + _Hbase_getVerTs_args__isset __isset; + + void __set_tableName(const Text& val) { + tableName = val; + } + + void __set_row(const Text& val) { + row = val; + } + + void __set_column(const Text& val) { + column = val; + } + + void __set_timestamp(const int64_t val) { + timestamp = val; + } + + void __set_numVersions(const int32_t val) { + numVersions = val; + } + + void __set_attributes(const std::map & val) { + attributes = val; + } + + bool operator == (const Hbase_getVerTs_args & rhs) const + { + if (!(tableName == rhs.tableName)) + return false; + if (!(row == rhs.row)) + return false; + if (!(column == rhs.column)) + return false; + if (!(timestamp == rhs.timestamp)) + return false; + if (!(numVersions == rhs.numVersions)) + return false; + if (!(attributes == rhs.attributes)) + return false; + return true; + } + bool operator != (const Hbase_getVerTs_args &rhs) const { + return !(*this == rhs); + } + + bool operator < (const Hbase_getVerTs_args & ) const; + + uint32_t read(::apache::thrift::protocol::TProtocol* iprot); + uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const; + +}; + + +class Hbase_getVerTs_pargs { + public: + + + virtual ~Hbase_getVerTs_pargs() throw() {} + + const Text* tableName; + const Text* row; + const Text* column; + const int64_t* timestamp; + const int32_t* numVersions; + const std::map * attributes; + + uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const; + +}; + +typedef struct _Hbase_getVerTs_result__isset { + _Hbase_getVerTs_result__isset() : success(false), io(false) {} + bool success; + bool io; +} _Hbase_getVerTs_result__isset; + +class Hbase_getVerTs_result { + public: + + Hbase_getVerTs_result() { + } + + virtual ~Hbase_getVerTs_result() throw() {} + + std::vector success; + IOError io; + + _Hbase_getVerTs_result__isset __isset; + + void __set_success(const std::vector & val) { + success = val; + } + + void __set_io(const IOError& val) { + io = val; + } + + bool operator == (const Hbase_getVerTs_result & rhs) const + { + if (!(success == rhs.success)) + return false; + if (!(io == rhs.io)) + return false; + return true; + } + bool operator != (const Hbase_getVerTs_result &rhs) const { + return !(*this == rhs); + } + + bool operator < (const Hbase_getVerTs_result & ) const; + + uint32_t read(::apache::thrift::protocol::TProtocol* iprot); + uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const; + +}; + +typedef struct _Hbase_getVerTs_presult__isset { + _Hbase_getVerTs_presult__isset() : success(false), io(false) {} + bool success; + bool io; +} _Hbase_getVerTs_presult__isset; + +class Hbase_getVerTs_presult { + public: + + + virtual ~Hbase_getVerTs_presult() throw() {} + + std::vector * success; + IOError io; + + _Hbase_getVerTs_presult__isset __isset; + + uint32_t read(::apache::thrift::protocol::TProtocol* iprot); + +}; + +typedef struct _Hbase_getRow_args__isset { + _Hbase_getRow_args__isset() : tableName(false), row(false), attributes(false) {} + bool tableName; + bool row; + bool attributes; +} _Hbase_getRow_args__isset; + +class Hbase_getRow_args { + public: + + Hbase_getRow_args() : tableName(), row() { + } + + virtual ~Hbase_getRow_args() throw() {} + + Text tableName; + Text row; + std::map attributes; + + _Hbase_getRow_args__isset __isset; + + void __set_tableName(const Text& val) { + tableName = val; + } + + void __set_row(const Text& val) { + row = val; + } + + void __set_attributes(const std::map & val) { + attributes = val; + } + + bool operator == (const Hbase_getRow_args & rhs) const + { + if (!(tableName == rhs.tableName)) + return false; + if (!(row == rhs.row)) + return false; + if (!(attributes == rhs.attributes)) + return false; + return true; + } + bool operator != (const Hbase_getRow_args &rhs) const { + return !(*this == rhs); + } + + bool operator < (const Hbase_getRow_args & ) const; + + uint32_t read(::apache::thrift::protocol::TProtocol* iprot); + uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const; + +}; + + +class Hbase_getRow_pargs { + public: + + + virtual ~Hbase_getRow_pargs() throw() {} + + const Text* tableName; + const Text* row; + const std::map * attributes; + + uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const; + +}; + +typedef struct _Hbase_getRow_result__isset { + _Hbase_getRow_result__isset() : success(false), io(false) {} + bool success; + bool io; +} _Hbase_getRow_result__isset; + +class Hbase_getRow_result { + public: + + Hbase_getRow_result() { + } + + virtual ~Hbase_getRow_result() throw() {} + + std::vector success; + IOError io; + + _Hbase_getRow_result__isset __isset; + + void __set_success(const std::vector & val) { + success = val; + } + + void __set_io(const IOError& val) { + io = val; + } + + bool operator == (const Hbase_getRow_result & rhs) const + { + if (!(success == rhs.success)) + return false; + if (!(io == rhs.io)) + return false; + return true; + } + bool operator != (const Hbase_getRow_result &rhs) const { + return !(*this == rhs); + } + + bool operator < (const Hbase_getRow_result & ) const; + + uint32_t read(::apache::thrift::protocol::TProtocol* iprot); + uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const; + +}; + +typedef struct _Hbase_getRow_presult__isset { + _Hbase_getRow_presult__isset() : success(false), io(false) {} + bool success; + bool io; +} _Hbase_getRow_presult__isset; + +class Hbase_getRow_presult { + public: + + + virtual ~Hbase_getRow_presult() throw() {} + + std::vector * success; + IOError io; + + _Hbase_getRow_presult__isset __isset; + + uint32_t read(::apache::thrift::protocol::TProtocol* iprot); + +}; + +typedef struct _Hbase_getRowWithColumns_args__isset { + _Hbase_getRowWithColumns_args__isset() : tableName(false), row(false), columns(false), attributes(false) {} + bool tableName; + bool row; + bool columns; + bool attributes; +} _Hbase_getRowWithColumns_args__isset; + +class Hbase_getRowWithColumns_args { + public: + + Hbase_getRowWithColumns_args() : tableName(), row() { + } + + virtual ~Hbase_getRowWithColumns_args() throw() {} + + Text tableName; + Text row; + std::vector columns; + std::map attributes; + + _Hbase_getRowWithColumns_args__isset __isset; + + void __set_tableName(const Text& val) { + tableName = val; + } + + void __set_row(const Text& val) { + row = val; + } + + void __set_columns(const std::vector & val) { + columns = val; + } + + void __set_attributes(const std::map & val) { + attributes = val; + } + + bool operator == (const Hbase_getRowWithColumns_args & rhs) const + { + if (!(tableName == rhs.tableName)) + return false; + if (!(row == rhs.row)) + return false; + if (!(columns == rhs.columns)) + return false; + if (!(attributes == rhs.attributes)) + return false; + return true; + } + bool operator != (const Hbase_getRowWithColumns_args &rhs) const { + return !(*this == rhs); + } + + bool operator < (const Hbase_getRowWithColumns_args & ) const; + + uint32_t read(::apache::thrift::protocol::TProtocol* iprot); + uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const; + +}; + + +class Hbase_getRowWithColumns_pargs { + public: + + + virtual ~Hbase_getRowWithColumns_pargs() throw() {} + + const Text* tableName; + const Text* row; + const std::vector * columns; + const std::map * attributes; + + uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const; + +}; + +typedef struct _Hbase_getRowWithColumns_result__isset { + _Hbase_getRowWithColumns_result__isset() : success(false), io(false) {} + bool success; + bool io; +} _Hbase_getRowWithColumns_result__isset; + +class Hbase_getRowWithColumns_result { + public: + + Hbase_getRowWithColumns_result() { + } + + virtual ~Hbase_getRowWithColumns_result() throw() {} + + std::vector success; + IOError io; + + _Hbase_getRowWithColumns_result__isset __isset; + + void __set_success(const std::vector & val) { + success = val; + } + + void __set_io(const IOError& val) { + io = val; + } + + bool operator == (const Hbase_getRowWithColumns_result & rhs) const + { + if (!(success == rhs.success)) + return false; + if (!(io == rhs.io)) + return false; + return true; + } + bool operator != (const Hbase_getRowWithColumns_result &rhs) const { + return !(*this == rhs); + } + + bool operator < (const Hbase_getRowWithColumns_result & ) const; + + uint32_t read(::apache::thrift::protocol::TProtocol* iprot); + uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const; + +}; + +typedef struct _Hbase_getRowWithColumns_presult__isset { + _Hbase_getRowWithColumns_presult__isset() : success(false), io(false) {} + bool success; + bool io; +} _Hbase_getRowWithColumns_presult__isset; + +class Hbase_getRowWithColumns_presult { + public: + + + virtual ~Hbase_getRowWithColumns_presult() throw() {} + + std::vector * success; + IOError io; + + _Hbase_getRowWithColumns_presult__isset __isset; + + uint32_t read(::apache::thrift::protocol::TProtocol* iprot); + +}; + +typedef struct _Hbase_getRowTs_args__isset { + _Hbase_getRowTs_args__isset() : tableName(false), row(false), timestamp(false), attributes(false) {} + bool tableName; + bool row; + bool timestamp; + bool attributes; +} _Hbase_getRowTs_args__isset; + +class Hbase_getRowTs_args { + public: + + Hbase_getRowTs_args() : tableName(), row(), timestamp(0) { + } + + virtual ~Hbase_getRowTs_args() throw() {} + + Text tableName; + Text row; + int64_t timestamp; + std::map attributes; + + _Hbase_getRowTs_args__isset __isset; + + void __set_tableName(const Text& val) { + tableName = val; + } + + void __set_row(const Text& val) { + row = val; + } + + void __set_timestamp(const int64_t val) { + timestamp = val; + } + + void __set_attributes(const std::map & val) { + attributes = val; + } + + bool operator == (const Hbase_getRowTs_args & rhs) const + { + if (!(tableName == rhs.tableName)) + return false; + if (!(row == rhs.row)) + return false; + if (!(timestamp == rhs.timestamp)) + return false; + if (!(attributes == rhs.attributes)) + return false; + return true; + } + bool operator != (const Hbase_getRowTs_args &rhs) const { + return !(*this == rhs); + } + + bool operator < (const Hbase_getRowTs_args & ) const; + + uint32_t read(::apache::thrift::protocol::TProtocol* iprot); + uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const; + +}; + + +class Hbase_getRowTs_pargs { + public: + + + virtual ~Hbase_getRowTs_pargs() throw() {} + + const Text* tableName; + const Text* row; + const int64_t* timestamp; + const std::map * attributes; + + uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const; + +}; + +typedef struct _Hbase_getRowTs_result__isset { + _Hbase_getRowTs_result__isset() : success(false), io(false) {} + bool success; + bool io; +} _Hbase_getRowTs_result__isset; + +class Hbase_getRowTs_result { + public: + + Hbase_getRowTs_result() { + } + + virtual ~Hbase_getRowTs_result() throw() {} + + std::vector success; + IOError io; + + _Hbase_getRowTs_result__isset __isset; + + void __set_success(const std::vector & val) { + success = val; + } + + void __set_io(const IOError& val) { + io = val; + } + + bool operator == (const Hbase_getRowTs_result & rhs) const + { + if (!(success == rhs.success)) + return false; + if (!(io == rhs.io)) + return false; + return true; + } + bool operator != (const Hbase_getRowTs_result &rhs) const { + return !(*this == rhs); + } + + bool operator < (const Hbase_getRowTs_result & ) const; + + uint32_t read(::apache::thrift::protocol::TProtocol* iprot); + uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const; + +}; + +typedef struct _Hbase_getRowTs_presult__isset { + _Hbase_getRowTs_presult__isset() : success(false), io(false) {} + bool success; + bool io; +} _Hbase_getRowTs_presult__isset; + +class Hbase_getRowTs_presult { + public: + + + virtual ~Hbase_getRowTs_presult() throw() {} + + std::vector * success; + IOError io; + + _Hbase_getRowTs_presult__isset __isset; + + uint32_t read(::apache::thrift::protocol::TProtocol* iprot); + +}; + +typedef struct _Hbase_getRowWithColumnsTs_args__isset { + _Hbase_getRowWithColumnsTs_args__isset() : tableName(false), row(false), columns(false), timestamp(false), attributes(false) {} + bool tableName; + bool row; + bool columns; + bool timestamp; + bool attributes; +} _Hbase_getRowWithColumnsTs_args__isset; + +class Hbase_getRowWithColumnsTs_args { + public: + + Hbase_getRowWithColumnsTs_args() : tableName(), row(), timestamp(0) { + } + + virtual ~Hbase_getRowWithColumnsTs_args() throw() {} + + Text tableName; + Text row; + std::vector columns; + int64_t timestamp; + std::map attributes; + + _Hbase_getRowWithColumnsTs_args__isset __isset; + + void __set_tableName(const Text& val) { + tableName = val; + } + + void __set_row(const Text& val) { + row = val; + } + + void __set_columns(const std::vector & val) { + columns = val; + } + + void __set_timestamp(const int64_t val) { + timestamp = val; + } + + void __set_attributes(const std::map & val) { + attributes = val; + } + + bool operator == (const Hbase_getRowWithColumnsTs_args & rhs) const + { + if (!(tableName == rhs.tableName)) + return false; + if (!(row == rhs.row)) + return false; + if (!(columns == rhs.columns)) + return false; + if (!(timestamp == rhs.timestamp)) + return false; + if (!(attributes == rhs.attributes)) + return false; + return true; + } + bool operator != (const Hbase_getRowWithColumnsTs_args &rhs) const { + return !(*this == rhs); + } + + bool operator < (const Hbase_getRowWithColumnsTs_args & ) const; + + uint32_t read(::apache::thrift::protocol::TProtocol* iprot); + uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const; + +}; + + +class Hbase_getRowWithColumnsTs_pargs { + public: + + + virtual ~Hbase_getRowWithColumnsTs_pargs() throw() {} + + const Text* tableName; + const Text* row; + const std::vector * columns; + const int64_t* timestamp; + const std::map * attributes; + + uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const; + +}; + +typedef struct _Hbase_getRowWithColumnsTs_result__isset { + _Hbase_getRowWithColumnsTs_result__isset() : success(false), io(false) {} + bool success; + bool io; +} _Hbase_getRowWithColumnsTs_result__isset; + +class Hbase_getRowWithColumnsTs_result { + public: + + Hbase_getRowWithColumnsTs_result() { + } + + virtual ~Hbase_getRowWithColumnsTs_result() throw() {} + + std::vector success; + IOError io; + + _Hbase_getRowWithColumnsTs_result__isset __isset; + + void __set_success(const std::vector & val) { + success = val; + } + + void __set_io(const IOError& val) { + io = val; + } + + bool operator == (const Hbase_getRowWithColumnsTs_result & rhs) const + { + if (!(success == rhs.success)) + return false; + if (!(io == rhs.io)) + return false; + return true; + } + bool operator != (const Hbase_getRowWithColumnsTs_result &rhs) const { + return !(*this == rhs); + } + + bool operator < (const Hbase_getRowWithColumnsTs_result & ) const; + + uint32_t read(::apache::thrift::protocol::TProtocol* iprot); + uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const; + +}; + +typedef struct _Hbase_getRowWithColumnsTs_presult__isset { + _Hbase_getRowWithColumnsTs_presult__isset() : success(false), io(false) {} + bool success; + bool io; +} _Hbase_getRowWithColumnsTs_presult__isset; + +class Hbase_getRowWithColumnsTs_presult { + public: + + + virtual ~Hbase_getRowWithColumnsTs_presult() throw() {} + + std::vector * success; + IOError io; + + _Hbase_getRowWithColumnsTs_presult__isset __isset; + + uint32_t read(::apache::thrift::protocol::TProtocol* iprot); + +}; + +typedef struct _Hbase_getRows_args__isset { + _Hbase_getRows_args__isset() : tableName(false), rows(false), attributes(false) {} + bool tableName; + bool rows; + bool attributes; +} _Hbase_getRows_args__isset; + +class Hbase_getRows_args { + public: + + Hbase_getRows_args() : tableName() { + } + + virtual ~Hbase_getRows_args() throw() {} + + Text tableName; + std::vector rows; + std::map attributes; + + _Hbase_getRows_args__isset __isset; + + void __set_tableName(const Text& val) { + tableName = val; + } + + void __set_rows(const std::vector & val) { + rows = val; + } + + void __set_attributes(const std::map & val) { + attributes = val; + } + + bool operator == (const Hbase_getRows_args & rhs) const + { + if (!(tableName == rhs.tableName)) + return false; + if (!(rows == rhs.rows)) + return false; + if (!(attributes == rhs.attributes)) + return false; + return true; + } + bool operator != (const Hbase_getRows_args &rhs) const { + return !(*this == rhs); + } + + bool operator < (const Hbase_getRows_args & ) const; + + uint32_t read(::apache::thrift::protocol::TProtocol* iprot); + uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const; + +}; + + +class Hbase_getRows_pargs { + public: + + + virtual ~Hbase_getRows_pargs() throw() {} + + const Text* tableName; + const std::vector * rows; + const std::map * attributes; + + uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const; + +}; + +typedef struct _Hbase_getRows_result__isset { + _Hbase_getRows_result__isset() : success(false), io(false) {} + bool success; + bool io; +} _Hbase_getRows_result__isset; + +class Hbase_getRows_result { + public: + + Hbase_getRows_result() { + } + + virtual ~Hbase_getRows_result() throw() {} + + std::vector success; + IOError io; + + _Hbase_getRows_result__isset __isset; + + void __set_success(const std::vector & val) { + success = val; + } + + void __set_io(const IOError& val) { + io = val; + } + + bool operator == (const Hbase_getRows_result & rhs) const + { + if (!(success == rhs.success)) + return false; + if (!(io == rhs.io)) + return false; + return true; + } + bool operator != (const Hbase_getRows_result &rhs) const { + return !(*this == rhs); + } + + bool operator < (const Hbase_getRows_result & ) const; + + uint32_t read(::apache::thrift::protocol::TProtocol* iprot); + uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const; + +}; + +typedef struct _Hbase_getRows_presult__isset { + _Hbase_getRows_presult__isset() : success(false), io(false) {} + bool success; + bool io; +} _Hbase_getRows_presult__isset; + +class Hbase_getRows_presult { + public: + + + virtual ~Hbase_getRows_presult() throw() {} + + std::vector * success; + IOError io; + + _Hbase_getRows_presult__isset __isset; + + uint32_t read(::apache::thrift::protocol::TProtocol* iprot); + +}; + +typedef struct _Hbase_getRowsWithColumns_args__isset { + _Hbase_getRowsWithColumns_args__isset() : tableName(false), rows(false), columns(false), attributes(false) {} + bool tableName; + bool rows; + bool columns; + bool attributes; +} _Hbase_getRowsWithColumns_args__isset; + +class Hbase_getRowsWithColumns_args { + public: + + Hbase_getRowsWithColumns_args() : tableName() { + } + + virtual ~Hbase_getRowsWithColumns_args() throw() {} + + Text tableName; + std::vector rows; + std::vector columns; + std::map attributes; + + _Hbase_getRowsWithColumns_args__isset __isset; + + void __set_tableName(const Text& val) { + tableName = val; + } + + void __set_rows(const std::vector & val) { + rows = val; + } + + void __set_columns(const std::vector & val) { + columns = val; + } + + void __set_attributes(const std::map & val) { + attributes = val; + } + + bool operator == (const Hbase_getRowsWithColumns_args & rhs) const + { + if (!(tableName == rhs.tableName)) + return false; + if (!(rows == rhs.rows)) + return false; + if (!(columns == rhs.columns)) + return false; + if (!(attributes == rhs.attributes)) + return false; + return true; + } + bool operator != (const Hbase_getRowsWithColumns_args &rhs) const { + return !(*this == rhs); + } + + bool operator < (const Hbase_getRowsWithColumns_args & ) const; + + uint32_t read(::apache::thrift::protocol::TProtocol* iprot); + uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const; + +}; + + +class Hbase_getRowsWithColumns_pargs { + public: + + + virtual ~Hbase_getRowsWithColumns_pargs() throw() {} + + const Text* tableName; + const std::vector * rows; + const std::vector * columns; + const std::map * attributes; + + uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const; + +}; + +typedef struct _Hbase_getRowsWithColumns_result__isset { + _Hbase_getRowsWithColumns_result__isset() : success(false), io(false) {} + bool success; + bool io; +} _Hbase_getRowsWithColumns_result__isset; + +class Hbase_getRowsWithColumns_result { + public: + + Hbase_getRowsWithColumns_result() { + } + + virtual ~Hbase_getRowsWithColumns_result() throw() {} + + std::vector success; + IOError io; + + _Hbase_getRowsWithColumns_result__isset __isset; + + void __set_success(const std::vector & val) { + success = val; + } + + void __set_io(const IOError& val) { + io = val; + } + + bool operator == (const Hbase_getRowsWithColumns_result & rhs) const + { + if (!(success == rhs.success)) + return false; + if (!(io == rhs.io)) + return false; + return true; + } + bool operator != (const Hbase_getRowsWithColumns_result &rhs) const { + return !(*this == rhs); + } + + bool operator < (const Hbase_getRowsWithColumns_result & ) const; + + uint32_t read(::apache::thrift::protocol::TProtocol* iprot); + uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const; + +}; + +typedef struct _Hbase_getRowsWithColumns_presult__isset { + _Hbase_getRowsWithColumns_presult__isset() : success(false), io(false) {} + bool success; + bool io; +} _Hbase_getRowsWithColumns_presult__isset; + +class Hbase_getRowsWithColumns_presult { + public: + + + virtual ~Hbase_getRowsWithColumns_presult() throw() {} + + std::vector * success; + IOError io; + + _Hbase_getRowsWithColumns_presult__isset __isset; + + uint32_t read(::apache::thrift::protocol::TProtocol* iprot); + +}; + +typedef struct _Hbase_getRowsTs_args__isset { + _Hbase_getRowsTs_args__isset() : tableName(false), rows(false), timestamp(false), attributes(false) {} + bool tableName; + bool rows; + bool timestamp; + bool attributes; +} _Hbase_getRowsTs_args__isset; + +class Hbase_getRowsTs_args { + public: + + Hbase_getRowsTs_args() : tableName(), timestamp(0) { + } + + virtual ~Hbase_getRowsTs_args() throw() {} + + Text tableName; + std::vector rows; + int64_t timestamp; + std::map attributes; + + _Hbase_getRowsTs_args__isset __isset; + + void __set_tableName(const Text& val) { + tableName = val; + } + + void __set_rows(const std::vector & val) { + rows = val; + } + + void __set_timestamp(const int64_t val) { + timestamp = val; + } + + void __set_attributes(const std::map & val) { + attributes = val; + } + + bool operator == (const Hbase_getRowsTs_args & rhs) const + { + if (!(tableName == rhs.tableName)) + return false; + if (!(rows == rhs.rows)) + return false; + if (!(timestamp == rhs.timestamp)) + return false; + if (!(attributes == rhs.attributes)) + return false; + return true; + } + bool operator != (const Hbase_getRowsTs_args &rhs) const { + return !(*this == rhs); + } + + bool operator < (const Hbase_getRowsTs_args & ) const; + + uint32_t read(::apache::thrift::protocol::TProtocol* iprot); + uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const; + +}; + + +class Hbase_getRowsTs_pargs { + public: + + + virtual ~Hbase_getRowsTs_pargs() throw() {} + + const Text* tableName; + const std::vector * rows; + const int64_t* timestamp; + const std::map * attributes; + + uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const; + +}; + +typedef struct _Hbase_getRowsTs_result__isset { + _Hbase_getRowsTs_result__isset() : success(false), io(false) {} + bool success; + bool io; +} _Hbase_getRowsTs_result__isset; + +class Hbase_getRowsTs_result { + public: + + Hbase_getRowsTs_result() { + } + + virtual ~Hbase_getRowsTs_result() throw() {} + + std::vector success; + IOError io; + + _Hbase_getRowsTs_result__isset __isset; + + void __set_success(const std::vector & val) { + success = val; + } + + void __set_io(const IOError& val) { + io = val; + } + + bool operator == (const Hbase_getRowsTs_result & rhs) const + { + if (!(success == rhs.success)) + return false; + if (!(io == rhs.io)) + return false; + return true; + } + bool operator != (const Hbase_getRowsTs_result &rhs) const { + return !(*this == rhs); + } + + bool operator < (const Hbase_getRowsTs_result & ) const; + + uint32_t read(::apache::thrift::protocol::TProtocol* iprot); + uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const; + +}; + +typedef struct _Hbase_getRowsTs_presult__isset { + _Hbase_getRowsTs_presult__isset() : success(false), io(false) {} + bool success; + bool io; +} _Hbase_getRowsTs_presult__isset; + +class Hbase_getRowsTs_presult { + public: + + + virtual ~Hbase_getRowsTs_presult() throw() {} + + std::vector * success; + IOError io; + + _Hbase_getRowsTs_presult__isset __isset; + + uint32_t read(::apache::thrift::protocol::TProtocol* iprot); + +}; + +typedef struct _Hbase_getRowsWithColumnsTs_args__isset { + _Hbase_getRowsWithColumnsTs_args__isset() : tableName(false), rows(false), columns(false), timestamp(false), attributes(false) {} + bool tableName; + bool rows; + bool columns; + bool timestamp; + bool attributes; +} _Hbase_getRowsWithColumnsTs_args__isset; + +class Hbase_getRowsWithColumnsTs_args { + public: + + Hbase_getRowsWithColumnsTs_args() : tableName(), timestamp(0) { + } + + virtual ~Hbase_getRowsWithColumnsTs_args() throw() {} + + Text tableName; + std::vector rows; + std::vector columns; + int64_t timestamp; + std::map attributes; + + _Hbase_getRowsWithColumnsTs_args__isset __isset; + + void __set_tableName(const Text& val) { + tableName = val; + } + + void __set_rows(const std::vector & val) { + rows = val; + } + + void __set_columns(const std::vector & val) { + columns = val; + } + + void __set_timestamp(const int64_t val) { + timestamp = val; + } + + void __set_attributes(const std::map & val) { + attributes = val; + } + + bool operator == (const Hbase_getRowsWithColumnsTs_args & rhs) const + { + if (!(tableName == rhs.tableName)) + return false; + if (!(rows == rhs.rows)) + return false; + if (!(columns == rhs.columns)) + return false; + if (!(timestamp == rhs.timestamp)) + return false; + if (!(attributes == rhs.attributes)) + return false; + return true; + } + bool operator != (const Hbase_getRowsWithColumnsTs_args &rhs) const { + return !(*this == rhs); + } + + bool operator < (const Hbase_getRowsWithColumnsTs_args & ) const; + + uint32_t read(::apache::thrift::protocol::TProtocol* iprot); + uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const; + +}; + + +class Hbase_getRowsWithColumnsTs_pargs { + public: + + + virtual ~Hbase_getRowsWithColumnsTs_pargs() throw() {} + + const Text* tableName; + const std::vector * rows; + const std::vector * columns; + const int64_t* timestamp; + const std::map * attributes; + + uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const; + +}; + +typedef struct _Hbase_getRowsWithColumnsTs_result__isset { + _Hbase_getRowsWithColumnsTs_result__isset() : success(false), io(false) {} + bool success; + bool io; +} _Hbase_getRowsWithColumnsTs_result__isset; + +class Hbase_getRowsWithColumnsTs_result { + public: + + Hbase_getRowsWithColumnsTs_result() { + } + + virtual ~Hbase_getRowsWithColumnsTs_result() throw() {} + + std::vector success; + IOError io; + + _Hbase_getRowsWithColumnsTs_result__isset __isset; + + void __set_success(const std::vector & val) { + success = val; + } + + void __set_io(const IOError& val) { + io = val; + } + + bool operator == (const Hbase_getRowsWithColumnsTs_result & rhs) const + { + if (!(success == rhs.success)) + return false; + if (!(io == rhs.io)) + return false; + return true; + } + bool operator != (const Hbase_getRowsWithColumnsTs_result &rhs) const { + return !(*this == rhs); + } + + bool operator < (const Hbase_getRowsWithColumnsTs_result & ) const; + + uint32_t read(::apache::thrift::protocol::TProtocol* iprot); + uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const; + +}; + +typedef struct _Hbase_getRowsWithColumnsTs_presult__isset { + _Hbase_getRowsWithColumnsTs_presult__isset() : success(false), io(false) {} + bool success; + bool io; +} _Hbase_getRowsWithColumnsTs_presult__isset; + +class Hbase_getRowsWithColumnsTs_presult { + public: + + + virtual ~Hbase_getRowsWithColumnsTs_presult() throw() {} + + std::vector * success; + IOError io; + + _Hbase_getRowsWithColumnsTs_presult__isset __isset; + + uint32_t read(::apache::thrift::protocol::TProtocol* iprot); + +}; + +typedef struct _Hbase_mutateRow_args__isset { + _Hbase_mutateRow_args__isset() : tableName(false), row(false), mutations(false), attributes(false) {} + bool tableName; + bool row; + bool mutations; + bool attributes; +} _Hbase_mutateRow_args__isset; + +class Hbase_mutateRow_args { + public: + + Hbase_mutateRow_args() : tableName(), row() { + } + + virtual ~Hbase_mutateRow_args() throw() {} + + Text tableName; + Text row; + std::vector mutations; + std::map attributes; + + _Hbase_mutateRow_args__isset __isset; + + void __set_tableName(const Text& val) { + tableName = val; + } + + void __set_row(const Text& val) { + row = val; + } + + void __set_mutations(const std::vector & val) { + mutations = val; + } + + void __set_attributes(const std::map & val) { + attributes = val; + } + + bool operator == (const Hbase_mutateRow_args & rhs) const + { + if (!(tableName == rhs.tableName)) + return false; + if (!(row == rhs.row)) + return false; + if (!(mutations == rhs.mutations)) + return false; + if (!(attributes == rhs.attributes)) + return false; + return true; + } + bool operator != (const Hbase_mutateRow_args &rhs) const { + return !(*this == rhs); + } + + bool operator < (const Hbase_mutateRow_args & ) const; + + uint32_t read(::apache::thrift::protocol::TProtocol* iprot); + uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const; + +}; + + +class Hbase_mutateRow_pargs { + public: + + + virtual ~Hbase_mutateRow_pargs() throw() {} + + const Text* tableName; + const Text* row; + const std::vector * mutations; + const std::map * attributes; + + uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const; + +}; + +typedef struct _Hbase_mutateRow_result__isset { + _Hbase_mutateRow_result__isset() : io(false), ia(false) {} + bool io; + bool ia; +} _Hbase_mutateRow_result__isset; + +class Hbase_mutateRow_result { + public: + + Hbase_mutateRow_result() { + } + + virtual ~Hbase_mutateRow_result() throw() {} + + IOError io; + IllegalArgument ia; + + _Hbase_mutateRow_result__isset __isset; + + void __set_io(const IOError& val) { + io = val; + } + + void __set_ia(const IllegalArgument& val) { + ia = val; + } + + bool operator == (const Hbase_mutateRow_result & rhs) const + { + if (!(io == rhs.io)) + return false; + if (!(ia == rhs.ia)) + return false; + return true; + } + bool operator != (const Hbase_mutateRow_result &rhs) const { + return !(*this == rhs); + } + + bool operator < (const Hbase_mutateRow_result & ) const; + + uint32_t read(::apache::thrift::protocol::TProtocol* iprot); + uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const; + +}; + +typedef struct _Hbase_mutateRow_presult__isset { + _Hbase_mutateRow_presult__isset() : io(false), ia(false) {} + bool io; + bool ia; +} _Hbase_mutateRow_presult__isset; + +class Hbase_mutateRow_presult { + public: + + + virtual ~Hbase_mutateRow_presult() throw() {} + + IOError io; + IllegalArgument ia; + + _Hbase_mutateRow_presult__isset __isset; + + uint32_t read(::apache::thrift::protocol::TProtocol* iprot); + +}; + +typedef struct _Hbase_mutateRowTs_args__isset { + _Hbase_mutateRowTs_args__isset() : tableName(false), row(false), mutations(false), timestamp(false), attributes(false) {} + bool tableName; + bool row; + bool mutations; + bool timestamp; + bool attributes; +} _Hbase_mutateRowTs_args__isset; + +class Hbase_mutateRowTs_args { + public: + + Hbase_mutateRowTs_args() : tableName(), row(), timestamp(0) { + } + + virtual ~Hbase_mutateRowTs_args() throw() {} + + Text tableName; + Text row; + std::vector mutations; + int64_t timestamp; + std::map attributes; + + _Hbase_mutateRowTs_args__isset __isset; + + void __set_tableName(const Text& val) { + tableName = val; + } + + void __set_row(const Text& val) { + row = val; + } + + void __set_mutations(const std::vector & val) { + mutations = val; + } + + void __set_timestamp(const int64_t val) { + timestamp = val; + } + + void __set_attributes(const std::map & val) { + attributes = val; + } + + bool operator == (const Hbase_mutateRowTs_args & rhs) const + { + if (!(tableName == rhs.tableName)) + return false; + if (!(row == rhs.row)) + return false; + if (!(mutations == rhs.mutations)) + return false; + if (!(timestamp == rhs.timestamp)) + return false; + if (!(attributes == rhs.attributes)) + return false; + return true; + } + bool operator != (const Hbase_mutateRowTs_args &rhs) const { + return !(*this == rhs); + } + + bool operator < (const Hbase_mutateRowTs_args & ) const; + + uint32_t read(::apache::thrift::protocol::TProtocol* iprot); + uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const; + +}; + + +class Hbase_mutateRowTs_pargs { + public: + + + virtual ~Hbase_mutateRowTs_pargs() throw() {} + + const Text* tableName; + const Text* row; + const std::vector * mutations; + const int64_t* timestamp; + const std::map * attributes; + + uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const; + +}; + +typedef struct _Hbase_mutateRowTs_result__isset { + _Hbase_mutateRowTs_result__isset() : io(false), ia(false) {} + bool io; + bool ia; +} _Hbase_mutateRowTs_result__isset; + +class Hbase_mutateRowTs_result { + public: + + Hbase_mutateRowTs_result() { + } + + virtual ~Hbase_mutateRowTs_result() throw() {} + + IOError io; + IllegalArgument ia; + + _Hbase_mutateRowTs_result__isset __isset; + + void __set_io(const IOError& val) { + io = val; + } + + void __set_ia(const IllegalArgument& val) { + ia = val; + } + + bool operator == (const Hbase_mutateRowTs_result & rhs) const + { + if (!(io == rhs.io)) + return false; + if (!(ia == rhs.ia)) + return false; + return true; + } + bool operator != (const Hbase_mutateRowTs_result &rhs) const { + return !(*this == rhs); + } + + bool operator < (const Hbase_mutateRowTs_result & ) const; + + uint32_t read(::apache::thrift::protocol::TProtocol* iprot); + uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const; + +}; + +typedef struct _Hbase_mutateRowTs_presult__isset { + _Hbase_mutateRowTs_presult__isset() : io(false), ia(false) {} + bool io; + bool ia; +} _Hbase_mutateRowTs_presult__isset; + +class Hbase_mutateRowTs_presult { + public: + + + virtual ~Hbase_mutateRowTs_presult() throw() {} + + IOError io; + IllegalArgument ia; + + _Hbase_mutateRowTs_presult__isset __isset; + + uint32_t read(::apache::thrift::protocol::TProtocol* iprot); + +}; + +typedef struct _Hbase_mutateRows_args__isset { + _Hbase_mutateRows_args__isset() : tableName(false), rowBatches(false), attributes(false) {} + bool tableName; + bool rowBatches; + bool attributes; +} _Hbase_mutateRows_args__isset; + +class Hbase_mutateRows_args { + public: + + Hbase_mutateRows_args() : tableName() { + } + + virtual ~Hbase_mutateRows_args() throw() {} + + Text tableName; + std::vector rowBatches; + std::map attributes; + + _Hbase_mutateRows_args__isset __isset; + + void __set_tableName(const Text& val) { + tableName = val; + } + + void __set_rowBatches(const std::vector & val) { + rowBatches = val; + } + + void __set_attributes(const std::map & val) { + attributes = val; + } + + bool operator == (const Hbase_mutateRows_args & rhs) const + { + if (!(tableName == rhs.tableName)) + return false; + if (!(rowBatches == rhs.rowBatches)) + return false; + if (!(attributes == rhs.attributes)) + return false; + return true; + } + bool operator != (const Hbase_mutateRows_args &rhs) const { + return !(*this == rhs); + } + + bool operator < (const Hbase_mutateRows_args & ) const; + + uint32_t read(::apache::thrift::protocol::TProtocol* iprot); + uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const; + +}; + + +class Hbase_mutateRows_pargs { + public: + + + virtual ~Hbase_mutateRows_pargs() throw() {} + + const Text* tableName; + const std::vector * rowBatches; + const std::map * attributes; + + uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const; + +}; + +typedef struct _Hbase_mutateRows_result__isset { + _Hbase_mutateRows_result__isset() : io(false), ia(false) {} + bool io; + bool ia; +} _Hbase_mutateRows_result__isset; + +class Hbase_mutateRows_result { + public: + + Hbase_mutateRows_result() { + } + + virtual ~Hbase_mutateRows_result() throw() {} + + IOError io; + IllegalArgument ia; + + _Hbase_mutateRows_result__isset __isset; + + void __set_io(const IOError& val) { + io = val; + } + + void __set_ia(const IllegalArgument& val) { + ia = val; + } + + bool operator == (const Hbase_mutateRows_result & rhs) const + { + if (!(io == rhs.io)) + return false; + if (!(ia == rhs.ia)) + return false; + return true; + } + bool operator != (const Hbase_mutateRows_result &rhs) const { + return !(*this == rhs); + } + + bool operator < (const Hbase_mutateRows_result & ) const; + + uint32_t read(::apache::thrift::protocol::TProtocol* iprot); + uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const; + +}; + +typedef struct _Hbase_mutateRows_presult__isset { + _Hbase_mutateRows_presult__isset() : io(false), ia(false) {} + bool io; + bool ia; +} _Hbase_mutateRows_presult__isset; + +class Hbase_mutateRows_presult { + public: + + + virtual ~Hbase_mutateRows_presult() throw() {} + + IOError io; + IllegalArgument ia; + + _Hbase_mutateRows_presult__isset __isset; + + uint32_t read(::apache::thrift::protocol::TProtocol* iprot); + +}; + +typedef struct _Hbase_mutateRowsTs_args__isset { + _Hbase_mutateRowsTs_args__isset() : tableName(false), rowBatches(false), timestamp(false), attributes(false) {} + bool tableName; + bool rowBatches; + bool timestamp; + bool attributes; +} _Hbase_mutateRowsTs_args__isset; + +class Hbase_mutateRowsTs_args { + public: + + Hbase_mutateRowsTs_args() : tableName(), timestamp(0) { + } + + virtual ~Hbase_mutateRowsTs_args() throw() {} + + Text tableName; + std::vector rowBatches; + int64_t timestamp; + std::map attributes; + + _Hbase_mutateRowsTs_args__isset __isset; + + void __set_tableName(const Text& val) { + tableName = val; + } + + void __set_rowBatches(const std::vector & val) { + rowBatches = val; + } + + void __set_timestamp(const int64_t val) { + timestamp = val; + } + + void __set_attributes(const std::map & val) { + attributes = val; + } + + bool operator == (const Hbase_mutateRowsTs_args & rhs) const + { + if (!(tableName == rhs.tableName)) + return false; + if (!(rowBatches == rhs.rowBatches)) + return false; + if (!(timestamp == rhs.timestamp)) + return false; + if (!(attributes == rhs.attributes)) + return false; + return true; + } + bool operator != (const Hbase_mutateRowsTs_args &rhs) const { + return !(*this == rhs); + } + + bool operator < (const Hbase_mutateRowsTs_args & ) const; + + uint32_t read(::apache::thrift::protocol::TProtocol* iprot); + uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const; + +}; + + +class Hbase_mutateRowsTs_pargs { + public: + + + virtual ~Hbase_mutateRowsTs_pargs() throw() {} + + const Text* tableName; + const std::vector * rowBatches; + const int64_t* timestamp; + const std::map * attributes; + + uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const; + +}; + +typedef struct _Hbase_mutateRowsTs_result__isset { + _Hbase_mutateRowsTs_result__isset() : io(false), ia(false) {} + bool io; + bool ia; +} _Hbase_mutateRowsTs_result__isset; + +class Hbase_mutateRowsTs_result { + public: + + Hbase_mutateRowsTs_result() { + } + + virtual ~Hbase_mutateRowsTs_result() throw() {} + + IOError io; + IllegalArgument ia; + + _Hbase_mutateRowsTs_result__isset __isset; + + void __set_io(const IOError& val) { + io = val; + } + + void __set_ia(const IllegalArgument& val) { + ia = val; + } + + bool operator == (const Hbase_mutateRowsTs_result & rhs) const + { + if (!(io == rhs.io)) + return false; + if (!(ia == rhs.ia)) + return false; + return true; + } + bool operator != (const Hbase_mutateRowsTs_result &rhs) const { + return !(*this == rhs); + } + + bool operator < (const Hbase_mutateRowsTs_result & ) const; + + uint32_t read(::apache::thrift::protocol::TProtocol* iprot); + uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const; + +}; + +typedef struct _Hbase_mutateRowsTs_presult__isset { + _Hbase_mutateRowsTs_presult__isset() : io(false), ia(false) {} + bool io; + bool ia; +} _Hbase_mutateRowsTs_presult__isset; + +class Hbase_mutateRowsTs_presult { + public: + + + virtual ~Hbase_mutateRowsTs_presult() throw() {} + + IOError io; + IllegalArgument ia; + + _Hbase_mutateRowsTs_presult__isset __isset; + + uint32_t read(::apache::thrift::protocol::TProtocol* iprot); + +}; + +typedef struct _Hbase_atomicIncrement_args__isset { + _Hbase_atomicIncrement_args__isset() : tableName(false), row(false), column(false), value(false) {} + bool tableName; + bool row; + bool column; + bool value; +} _Hbase_atomicIncrement_args__isset; + +class Hbase_atomicIncrement_args { + public: + + Hbase_atomicIncrement_args() : tableName(), row(), column(), value(0) { + } + + virtual ~Hbase_atomicIncrement_args() throw() {} + + Text tableName; + Text row; + Text column; + int64_t value; + + _Hbase_atomicIncrement_args__isset __isset; + + void __set_tableName(const Text& val) { + tableName = val; + } + + void __set_row(const Text& val) { + row = val; + } + + void __set_column(const Text& val) { + column = val; + } + + void __set_value(const int64_t val) { + value = val; + } + + bool operator == (const Hbase_atomicIncrement_args & rhs) const + { + if (!(tableName == rhs.tableName)) + return false; + if (!(row == rhs.row)) + return false; + if (!(column == rhs.column)) + return false; + if (!(value == rhs.value)) + return false; + return true; + } + bool operator != (const Hbase_atomicIncrement_args &rhs) const { + return !(*this == rhs); + } + + bool operator < (const Hbase_atomicIncrement_args & ) const; + + uint32_t read(::apache::thrift::protocol::TProtocol* iprot); + uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const; + +}; + + +class Hbase_atomicIncrement_pargs { + public: + + + virtual ~Hbase_atomicIncrement_pargs() throw() {} + + const Text* tableName; + const Text* row; + const Text* column; + const int64_t* value; + + uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const; + +}; + +typedef struct _Hbase_atomicIncrement_result__isset { + _Hbase_atomicIncrement_result__isset() : success(false), io(false), ia(false) {} + bool success; + bool io; + bool ia; +} _Hbase_atomicIncrement_result__isset; + +class Hbase_atomicIncrement_result { + public: + + Hbase_atomicIncrement_result() : success(0) { + } + + virtual ~Hbase_atomicIncrement_result() throw() {} + + int64_t success; + IOError io; + IllegalArgument ia; + + _Hbase_atomicIncrement_result__isset __isset; + + void __set_success(const int64_t val) { + success = val; + } + + void __set_io(const IOError& val) { + io = val; + } + + void __set_ia(const IllegalArgument& val) { + ia = val; + } + + bool operator == (const Hbase_atomicIncrement_result & rhs) const + { + if (!(success == rhs.success)) + return false; + if (!(io == rhs.io)) + return false; + if (!(ia == rhs.ia)) + return false; + return true; + } + bool operator != (const Hbase_atomicIncrement_result &rhs) const { + return !(*this == rhs); + } + + bool operator < (const Hbase_atomicIncrement_result & ) const; + + uint32_t read(::apache::thrift::protocol::TProtocol* iprot); + uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const; + +}; + +typedef struct _Hbase_atomicIncrement_presult__isset { + _Hbase_atomicIncrement_presult__isset() : success(false), io(false), ia(false) {} + bool success; + bool io; + bool ia; +} _Hbase_atomicIncrement_presult__isset; + +class Hbase_atomicIncrement_presult { + public: + + + virtual ~Hbase_atomicIncrement_presult() throw() {} + + int64_t* success; + IOError io; + IllegalArgument ia; + + _Hbase_atomicIncrement_presult__isset __isset; + + uint32_t read(::apache::thrift::protocol::TProtocol* iprot); + +}; + +typedef struct _Hbase_deleteAll_args__isset { + _Hbase_deleteAll_args__isset() : tableName(false), row(false), column(false), attributes(false) {} + bool tableName; + bool row; + bool column; + bool attributes; +} _Hbase_deleteAll_args__isset; + +class Hbase_deleteAll_args { + public: + + Hbase_deleteAll_args() : tableName(), row(), column() { + } + + virtual ~Hbase_deleteAll_args() throw() {} + + Text tableName; + Text row; + Text column; + std::map attributes; + + _Hbase_deleteAll_args__isset __isset; + + void __set_tableName(const Text& val) { + tableName = val; + } + + void __set_row(const Text& val) { + row = val; + } + + void __set_column(const Text& val) { + column = val; + } + + void __set_attributes(const std::map & val) { + attributes = val; + } + + bool operator == (const Hbase_deleteAll_args & rhs) const + { + if (!(tableName == rhs.tableName)) + return false; + if (!(row == rhs.row)) + return false; + if (!(column == rhs.column)) + return false; + if (!(attributes == rhs.attributes)) + return false; + return true; + } + bool operator != (const Hbase_deleteAll_args &rhs) const { + return !(*this == rhs); + } + + bool operator < (const Hbase_deleteAll_args & ) const; + + uint32_t read(::apache::thrift::protocol::TProtocol* iprot); + uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const; + +}; + + +class Hbase_deleteAll_pargs { + public: + + + virtual ~Hbase_deleteAll_pargs() throw() {} + + const Text* tableName; + const Text* row; + const Text* column; + const std::map * attributes; + + uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const; + +}; + +typedef struct _Hbase_deleteAll_result__isset { + _Hbase_deleteAll_result__isset() : io(false) {} + bool io; +} _Hbase_deleteAll_result__isset; + +class Hbase_deleteAll_result { + public: + + Hbase_deleteAll_result() { + } + + virtual ~Hbase_deleteAll_result() throw() {} + + IOError io; + + _Hbase_deleteAll_result__isset __isset; + + void __set_io(const IOError& val) { + io = val; + } + + bool operator == (const Hbase_deleteAll_result & rhs) const + { + if (!(io == rhs.io)) + return false; + return true; + } + bool operator != (const Hbase_deleteAll_result &rhs) const { + return !(*this == rhs); + } + + bool operator < (const Hbase_deleteAll_result & ) const; + + uint32_t read(::apache::thrift::protocol::TProtocol* iprot); + uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const; + +}; + +typedef struct _Hbase_deleteAll_presult__isset { + _Hbase_deleteAll_presult__isset() : io(false) {} + bool io; +} _Hbase_deleteAll_presult__isset; + +class Hbase_deleteAll_presult { + public: + + + virtual ~Hbase_deleteAll_presult() throw() {} + + IOError io; + + _Hbase_deleteAll_presult__isset __isset; + + uint32_t read(::apache::thrift::protocol::TProtocol* iprot); + +}; + +typedef struct _Hbase_deleteAllTs_args__isset { + _Hbase_deleteAllTs_args__isset() : tableName(false), row(false), column(false), timestamp(false), attributes(false) {} + bool tableName; + bool row; + bool column; + bool timestamp; + bool attributes; +} _Hbase_deleteAllTs_args__isset; + +class Hbase_deleteAllTs_args { + public: + + Hbase_deleteAllTs_args() : tableName(), row(), column(), timestamp(0) { + } + + virtual ~Hbase_deleteAllTs_args() throw() {} + + Text tableName; + Text row; + Text column; + int64_t timestamp; + std::map attributes; + + _Hbase_deleteAllTs_args__isset __isset; + + void __set_tableName(const Text& val) { + tableName = val; + } + + void __set_row(const Text& val) { + row = val; + } + + void __set_column(const Text& val) { + column = val; + } + + void __set_timestamp(const int64_t val) { + timestamp = val; + } + + void __set_attributes(const std::map & val) { + attributes = val; + } + + bool operator == (const Hbase_deleteAllTs_args & rhs) const + { + if (!(tableName == rhs.tableName)) + return false; + if (!(row == rhs.row)) + return false; + if (!(column == rhs.column)) + return false; + if (!(timestamp == rhs.timestamp)) + return false; + if (!(attributes == rhs.attributes)) + return false; + return true; + } + bool operator != (const Hbase_deleteAllTs_args &rhs) const { + return !(*this == rhs); + } + + bool operator < (const Hbase_deleteAllTs_args & ) const; + + uint32_t read(::apache::thrift::protocol::TProtocol* iprot); + uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const; + +}; + + +class Hbase_deleteAllTs_pargs { + public: + + + virtual ~Hbase_deleteAllTs_pargs() throw() {} + + const Text* tableName; + const Text* row; + const Text* column; + const int64_t* timestamp; + const std::map * attributes; + + uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const; + +}; + +typedef struct _Hbase_deleteAllTs_result__isset { + _Hbase_deleteAllTs_result__isset() : io(false) {} + bool io; +} _Hbase_deleteAllTs_result__isset; + +class Hbase_deleteAllTs_result { + public: + + Hbase_deleteAllTs_result() { + } + + virtual ~Hbase_deleteAllTs_result() throw() {} + + IOError io; + + _Hbase_deleteAllTs_result__isset __isset; + + void __set_io(const IOError& val) { + io = val; + } + + bool operator == (const Hbase_deleteAllTs_result & rhs) const + { + if (!(io == rhs.io)) + return false; + return true; + } + bool operator != (const Hbase_deleteAllTs_result &rhs) const { + return !(*this == rhs); + } + + bool operator < (const Hbase_deleteAllTs_result & ) const; + + uint32_t read(::apache::thrift::protocol::TProtocol* iprot); + uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const; + +}; + +typedef struct _Hbase_deleteAllTs_presult__isset { + _Hbase_deleteAllTs_presult__isset() : io(false) {} + bool io; +} _Hbase_deleteAllTs_presult__isset; + +class Hbase_deleteAllTs_presult { + public: + + + virtual ~Hbase_deleteAllTs_presult() throw() {} + + IOError io; + + _Hbase_deleteAllTs_presult__isset __isset; + + uint32_t read(::apache::thrift::protocol::TProtocol* iprot); + +}; + +typedef struct _Hbase_deleteAllRow_args__isset { + _Hbase_deleteAllRow_args__isset() : tableName(false), row(false), attributes(false) {} + bool tableName; + bool row; + bool attributes; +} _Hbase_deleteAllRow_args__isset; + +class Hbase_deleteAllRow_args { + public: + + Hbase_deleteAllRow_args() : tableName(), row() { + } + + virtual ~Hbase_deleteAllRow_args() throw() {} + + Text tableName; + Text row; + std::map attributes; + + _Hbase_deleteAllRow_args__isset __isset; + + void __set_tableName(const Text& val) { + tableName = val; + } + + void __set_row(const Text& val) { + row = val; + } + + void __set_attributes(const std::map & val) { + attributes = val; + } + + bool operator == (const Hbase_deleteAllRow_args & rhs) const + { + if (!(tableName == rhs.tableName)) + return false; + if (!(row == rhs.row)) + return false; + if (!(attributes == rhs.attributes)) + return false; + return true; + } + bool operator != (const Hbase_deleteAllRow_args &rhs) const { + return !(*this == rhs); + } + + bool operator < (const Hbase_deleteAllRow_args & ) const; + + uint32_t read(::apache::thrift::protocol::TProtocol* iprot); + uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const; + +}; + + +class Hbase_deleteAllRow_pargs { + public: + + + virtual ~Hbase_deleteAllRow_pargs() throw() {} + + const Text* tableName; + const Text* row; + const std::map * attributes; + + uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const; + +}; + +typedef struct _Hbase_deleteAllRow_result__isset { + _Hbase_deleteAllRow_result__isset() : io(false) {} + bool io; +} _Hbase_deleteAllRow_result__isset; + +class Hbase_deleteAllRow_result { + public: + + Hbase_deleteAllRow_result() { + } + + virtual ~Hbase_deleteAllRow_result() throw() {} + + IOError io; + + _Hbase_deleteAllRow_result__isset __isset; + + void __set_io(const IOError& val) { + io = val; + } + + bool operator == (const Hbase_deleteAllRow_result & rhs) const + { + if (!(io == rhs.io)) + return false; + return true; + } + bool operator != (const Hbase_deleteAllRow_result &rhs) const { + return !(*this == rhs); + } + + bool operator < (const Hbase_deleteAllRow_result & ) const; + + uint32_t read(::apache::thrift::protocol::TProtocol* iprot); + uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const; + +}; + +typedef struct _Hbase_deleteAllRow_presult__isset { + _Hbase_deleteAllRow_presult__isset() : io(false) {} + bool io; +} _Hbase_deleteAllRow_presult__isset; + +class Hbase_deleteAllRow_presult { + public: + + + virtual ~Hbase_deleteAllRow_presult() throw() {} + + IOError io; + + _Hbase_deleteAllRow_presult__isset __isset; + + uint32_t read(::apache::thrift::protocol::TProtocol* iprot); + +}; + +typedef struct _Hbase_increment_args__isset { + _Hbase_increment_args__isset() : increment(false) {} + bool increment; +} _Hbase_increment_args__isset; + +class Hbase_increment_args { + public: + + Hbase_increment_args() { + } + + virtual ~Hbase_increment_args() throw() {} + + TIncrement increment; + + _Hbase_increment_args__isset __isset; + + void __set_increment(const TIncrement& val) { + increment = val; + } + + bool operator == (const Hbase_increment_args & rhs) const + { + if (!(increment == rhs.increment)) + return false; + return true; + } + bool operator != (const Hbase_increment_args &rhs) const { + return !(*this == rhs); + } + + bool operator < (const Hbase_increment_args & ) const; + + uint32_t read(::apache::thrift::protocol::TProtocol* iprot); + uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const; + +}; + + +class Hbase_increment_pargs { + public: + + + virtual ~Hbase_increment_pargs() throw() {} + + const TIncrement* increment; + + uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const; + +}; + +typedef struct _Hbase_increment_result__isset { + _Hbase_increment_result__isset() : io(false) {} + bool io; +} _Hbase_increment_result__isset; + +class Hbase_increment_result { + public: + + Hbase_increment_result() { + } + + virtual ~Hbase_increment_result() throw() {} + + IOError io; + + _Hbase_increment_result__isset __isset; + + void __set_io(const IOError& val) { + io = val; + } + + bool operator == (const Hbase_increment_result & rhs) const + { + if (!(io == rhs.io)) + return false; + return true; + } + bool operator != (const Hbase_increment_result &rhs) const { + return !(*this == rhs); + } + + bool operator < (const Hbase_increment_result & ) const; + + uint32_t read(::apache::thrift::protocol::TProtocol* iprot); + uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const; + +}; + +typedef struct _Hbase_increment_presult__isset { + _Hbase_increment_presult__isset() : io(false) {} + bool io; +} _Hbase_increment_presult__isset; + +class Hbase_increment_presult { + public: + + + virtual ~Hbase_increment_presult() throw() {} + + IOError io; + + _Hbase_increment_presult__isset __isset; + + uint32_t read(::apache::thrift::protocol::TProtocol* iprot); + +}; + +typedef struct _Hbase_incrementRows_args__isset { + _Hbase_incrementRows_args__isset() : increments(false) {} + bool increments; +} _Hbase_incrementRows_args__isset; + +class Hbase_incrementRows_args { + public: + + Hbase_incrementRows_args() { + } + + virtual ~Hbase_incrementRows_args() throw() {} + + std::vector increments; + + _Hbase_incrementRows_args__isset __isset; + + void __set_increments(const std::vector & val) { + increments = val; + } + + bool operator == (const Hbase_incrementRows_args & rhs) const + { + if (!(increments == rhs.increments)) + return false; + return true; + } + bool operator != (const Hbase_incrementRows_args &rhs) const { + return !(*this == rhs); + } + + bool operator < (const Hbase_incrementRows_args & ) const; + + uint32_t read(::apache::thrift::protocol::TProtocol* iprot); + uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const; + +}; + + +class Hbase_incrementRows_pargs { + public: + + + virtual ~Hbase_incrementRows_pargs() throw() {} + + const std::vector * increments; + + uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const; + +}; + +typedef struct _Hbase_incrementRows_result__isset { + _Hbase_incrementRows_result__isset() : io(false) {} + bool io; +} _Hbase_incrementRows_result__isset; + +class Hbase_incrementRows_result { + public: + + Hbase_incrementRows_result() { + } + + virtual ~Hbase_incrementRows_result() throw() {} + + IOError io; + + _Hbase_incrementRows_result__isset __isset; + + void __set_io(const IOError& val) { + io = val; + } + + bool operator == (const Hbase_incrementRows_result & rhs) const + { + if (!(io == rhs.io)) + return false; + return true; + } + bool operator != (const Hbase_incrementRows_result &rhs) const { + return !(*this == rhs); + } + + bool operator < (const Hbase_incrementRows_result & ) const; + + uint32_t read(::apache::thrift::protocol::TProtocol* iprot); + uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const; + +}; + +typedef struct _Hbase_incrementRows_presult__isset { + _Hbase_incrementRows_presult__isset() : io(false) {} + bool io; +} _Hbase_incrementRows_presult__isset; + +class Hbase_incrementRows_presult { + public: + + + virtual ~Hbase_incrementRows_presult() throw() {} + + IOError io; + + _Hbase_incrementRows_presult__isset __isset; + + uint32_t read(::apache::thrift::protocol::TProtocol* iprot); + +}; + +typedef struct _Hbase_deleteAllRowTs_args__isset { + _Hbase_deleteAllRowTs_args__isset() : tableName(false), row(false), timestamp(false), attributes(false) {} + bool tableName; + bool row; + bool timestamp; + bool attributes; +} _Hbase_deleteAllRowTs_args__isset; + +class Hbase_deleteAllRowTs_args { + public: + + Hbase_deleteAllRowTs_args() : tableName(), row(), timestamp(0) { + } + + virtual ~Hbase_deleteAllRowTs_args() throw() {} + + Text tableName; + Text row; + int64_t timestamp; + std::map attributes; + + _Hbase_deleteAllRowTs_args__isset __isset; + + void __set_tableName(const Text& val) { + tableName = val; + } + + void __set_row(const Text& val) { + row = val; + } + + void __set_timestamp(const int64_t val) { + timestamp = val; + } + + void __set_attributes(const std::map & val) { + attributes = val; + } + + bool operator == (const Hbase_deleteAllRowTs_args & rhs) const + { + if (!(tableName == rhs.tableName)) + return false; + if (!(row == rhs.row)) + return false; + if (!(timestamp == rhs.timestamp)) + return false; + if (!(attributes == rhs.attributes)) + return false; + return true; + } + bool operator != (const Hbase_deleteAllRowTs_args &rhs) const { + return !(*this == rhs); + } + + bool operator < (const Hbase_deleteAllRowTs_args & ) const; + + uint32_t read(::apache::thrift::protocol::TProtocol* iprot); + uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const; + +}; + + +class Hbase_deleteAllRowTs_pargs { + public: + + + virtual ~Hbase_deleteAllRowTs_pargs() throw() {} + + const Text* tableName; + const Text* row; + const int64_t* timestamp; + const std::map * attributes; + + uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const; + +}; + +typedef struct _Hbase_deleteAllRowTs_result__isset { + _Hbase_deleteAllRowTs_result__isset() : io(false) {} + bool io; +} _Hbase_deleteAllRowTs_result__isset; + +class Hbase_deleteAllRowTs_result { + public: + + Hbase_deleteAllRowTs_result() { + } + + virtual ~Hbase_deleteAllRowTs_result() throw() {} + + IOError io; + + _Hbase_deleteAllRowTs_result__isset __isset; + + void __set_io(const IOError& val) { + io = val; + } + + bool operator == (const Hbase_deleteAllRowTs_result & rhs) const + { + if (!(io == rhs.io)) + return false; + return true; + } + bool operator != (const Hbase_deleteAllRowTs_result &rhs) const { + return !(*this == rhs); + } + + bool operator < (const Hbase_deleteAllRowTs_result & ) const; + + uint32_t read(::apache::thrift::protocol::TProtocol* iprot); + uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const; + +}; + +typedef struct _Hbase_deleteAllRowTs_presult__isset { + _Hbase_deleteAllRowTs_presult__isset() : io(false) {} + bool io; +} _Hbase_deleteAllRowTs_presult__isset; + +class Hbase_deleteAllRowTs_presult { + public: + + + virtual ~Hbase_deleteAllRowTs_presult() throw() {} + + IOError io; + + _Hbase_deleteAllRowTs_presult__isset __isset; + + uint32_t read(::apache::thrift::protocol::TProtocol* iprot); + +}; + +typedef struct _Hbase_scannerOpenWithScan_args__isset { + _Hbase_scannerOpenWithScan_args__isset() : tableName(false), scan(false), attributes(false) {} + bool tableName; + bool scan; + bool attributes; +} _Hbase_scannerOpenWithScan_args__isset; + +class Hbase_scannerOpenWithScan_args { + public: + + Hbase_scannerOpenWithScan_args() : tableName() { + } + + virtual ~Hbase_scannerOpenWithScan_args() throw() {} + + Text tableName; + TScan scan; + std::map attributes; + + _Hbase_scannerOpenWithScan_args__isset __isset; + + void __set_tableName(const Text& val) { + tableName = val; + } + + void __set_scan(const TScan& val) { + scan = val; + } + + void __set_attributes(const std::map & val) { + attributes = val; + } + + bool operator == (const Hbase_scannerOpenWithScan_args & rhs) const + { + if (!(tableName == rhs.tableName)) + return false; + if (!(scan == rhs.scan)) + return false; + if (!(attributes == rhs.attributes)) + return false; + return true; + } + bool operator != (const Hbase_scannerOpenWithScan_args &rhs) const { + return !(*this == rhs); + } + + bool operator < (const Hbase_scannerOpenWithScan_args & ) const; + + uint32_t read(::apache::thrift::protocol::TProtocol* iprot); + uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const; + +}; + + +class Hbase_scannerOpenWithScan_pargs { + public: + + + virtual ~Hbase_scannerOpenWithScan_pargs() throw() {} + + const Text* tableName; + const TScan* scan; + const std::map * attributes; + + uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const; + +}; + +typedef struct _Hbase_scannerOpenWithScan_result__isset { + _Hbase_scannerOpenWithScan_result__isset() : success(false), io(false) {} + bool success; + bool io; +} _Hbase_scannerOpenWithScan_result__isset; + +class Hbase_scannerOpenWithScan_result { + public: + + Hbase_scannerOpenWithScan_result() : success(0) { + } + + virtual ~Hbase_scannerOpenWithScan_result() throw() {} + + ScannerID success; + IOError io; + + _Hbase_scannerOpenWithScan_result__isset __isset; + + void __set_success(const ScannerID val) { + success = val; + } + + void __set_io(const IOError& val) { + io = val; + } + + bool operator == (const Hbase_scannerOpenWithScan_result & rhs) const + { + if (!(success == rhs.success)) + return false; + if (!(io == rhs.io)) + return false; + return true; + } + bool operator != (const Hbase_scannerOpenWithScan_result &rhs) const { + return !(*this == rhs); + } + + bool operator < (const Hbase_scannerOpenWithScan_result & ) const; + + uint32_t read(::apache::thrift::protocol::TProtocol* iprot); + uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const; + +}; + +typedef struct _Hbase_scannerOpenWithScan_presult__isset { + _Hbase_scannerOpenWithScan_presult__isset() : success(false), io(false) {} + bool success; + bool io; +} _Hbase_scannerOpenWithScan_presult__isset; + +class Hbase_scannerOpenWithScan_presult { + public: + + + virtual ~Hbase_scannerOpenWithScan_presult() throw() {} + + ScannerID* success; + IOError io; + + _Hbase_scannerOpenWithScan_presult__isset __isset; + + uint32_t read(::apache::thrift::protocol::TProtocol* iprot); + +}; + +typedef struct _Hbase_scannerOpen_args__isset { + _Hbase_scannerOpen_args__isset() : tableName(false), startRow(false), columns(false), attributes(false) {} + bool tableName; + bool startRow; + bool columns; + bool attributes; +} _Hbase_scannerOpen_args__isset; + +class Hbase_scannerOpen_args { + public: + + Hbase_scannerOpen_args() : tableName(), startRow() { + } + + virtual ~Hbase_scannerOpen_args() throw() {} + + Text tableName; + Text startRow; + std::vector columns; + std::map attributes; + + _Hbase_scannerOpen_args__isset __isset; + + void __set_tableName(const Text& val) { + tableName = val; + } + + void __set_startRow(const Text& val) { + startRow = val; + } + + void __set_columns(const std::vector & val) { + columns = val; + } + + void __set_attributes(const std::map & val) { + attributes = val; + } + + bool operator == (const Hbase_scannerOpen_args & rhs) const + { + if (!(tableName == rhs.tableName)) + return false; + if (!(startRow == rhs.startRow)) + return false; + if (!(columns == rhs.columns)) + return false; + if (!(attributes == rhs.attributes)) + return false; + return true; + } + bool operator != (const Hbase_scannerOpen_args &rhs) const { + return !(*this == rhs); + } + + bool operator < (const Hbase_scannerOpen_args & ) const; + + uint32_t read(::apache::thrift::protocol::TProtocol* iprot); + uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const; + +}; + + +class Hbase_scannerOpen_pargs { + public: + + + virtual ~Hbase_scannerOpen_pargs() throw() {} + + const Text* tableName; + const Text* startRow; + const std::vector * columns; + const std::map * attributes; + + uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const; + +}; + +typedef struct _Hbase_scannerOpen_result__isset { + _Hbase_scannerOpen_result__isset() : success(false), io(false) {} + bool success; + bool io; +} _Hbase_scannerOpen_result__isset; + +class Hbase_scannerOpen_result { + public: + + Hbase_scannerOpen_result() : success(0) { + } + + virtual ~Hbase_scannerOpen_result() throw() {} + + ScannerID success; + IOError io; + + _Hbase_scannerOpen_result__isset __isset; + + void __set_success(const ScannerID val) { + success = val; + } + + void __set_io(const IOError& val) { + io = val; + } + + bool operator == (const Hbase_scannerOpen_result & rhs) const + { + if (!(success == rhs.success)) + return false; + if (!(io == rhs.io)) + return false; + return true; + } + bool operator != (const Hbase_scannerOpen_result &rhs) const { + return !(*this == rhs); + } + + bool operator < (const Hbase_scannerOpen_result & ) const; + + uint32_t read(::apache::thrift::protocol::TProtocol* iprot); + uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const; + +}; + +typedef struct _Hbase_scannerOpen_presult__isset { + _Hbase_scannerOpen_presult__isset() : success(false), io(false) {} + bool success; + bool io; +} _Hbase_scannerOpen_presult__isset; + +class Hbase_scannerOpen_presult { + public: + + + virtual ~Hbase_scannerOpen_presult() throw() {} + + ScannerID* success; + IOError io; + + _Hbase_scannerOpen_presult__isset __isset; + + uint32_t read(::apache::thrift::protocol::TProtocol* iprot); + +}; + +typedef struct _Hbase_scannerOpenWithStop_args__isset { + _Hbase_scannerOpenWithStop_args__isset() : tableName(false), startRow(false), stopRow(false), columns(false), attributes(false) {} + bool tableName; + bool startRow; + bool stopRow; + bool columns; + bool attributes; +} _Hbase_scannerOpenWithStop_args__isset; + +class Hbase_scannerOpenWithStop_args { + public: + + Hbase_scannerOpenWithStop_args() : tableName(), startRow(), stopRow() { + } + + virtual ~Hbase_scannerOpenWithStop_args() throw() {} + + Text tableName; + Text startRow; + Text stopRow; + std::vector columns; + std::map attributes; + + _Hbase_scannerOpenWithStop_args__isset __isset; + + void __set_tableName(const Text& val) { + tableName = val; + } + + void __set_startRow(const Text& val) { + startRow = val; + } + + void __set_stopRow(const Text& val) { + stopRow = val; + } + + void __set_columns(const std::vector & val) { + columns = val; + } + + void __set_attributes(const std::map & val) { + attributes = val; + } + + bool operator == (const Hbase_scannerOpenWithStop_args & rhs) const + { + if (!(tableName == rhs.tableName)) + return false; + if (!(startRow == rhs.startRow)) + return false; + if (!(stopRow == rhs.stopRow)) + return false; + if (!(columns == rhs.columns)) + return false; + if (!(attributes == rhs.attributes)) + return false; + return true; + } + bool operator != (const Hbase_scannerOpenWithStop_args &rhs) const { + return !(*this == rhs); + } + + bool operator < (const Hbase_scannerOpenWithStop_args & ) const; + + uint32_t read(::apache::thrift::protocol::TProtocol* iprot); + uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const; + +}; + + +class Hbase_scannerOpenWithStop_pargs { + public: + + + virtual ~Hbase_scannerOpenWithStop_pargs() throw() {} + + const Text* tableName; + const Text* startRow; + const Text* stopRow; + const std::vector * columns; + const std::map * attributes; + + uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const; + +}; + +typedef struct _Hbase_scannerOpenWithStop_result__isset { + _Hbase_scannerOpenWithStop_result__isset() : success(false), io(false) {} + bool success; + bool io; +} _Hbase_scannerOpenWithStop_result__isset; + +class Hbase_scannerOpenWithStop_result { + public: + + Hbase_scannerOpenWithStop_result() : success(0) { + } + + virtual ~Hbase_scannerOpenWithStop_result() throw() {} + + ScannerID success; + IOError io; + + _Hbase_scannerOpenWithStop_result__isset __isset; + + void __set_success(const ScannerID val) { + success = val; + } + + void __set_io(const IOError& val) { + io = val; + } + + bool operator == (const Hbase_scannerOpenWithStop_result & rhs) const + { + if (!(success == rhs.success)) + return false; + if (!(io == rhs.io)) + return false; + return true; + } + bool operator != (const Hbase_scannerOpenWithStop_result &rhs) const { + return !(*this == rhs); + } + + bool operator < (const Hbase_scannerOpenWithStop_result & ) const; + + uint32_t read(::apache::thrift::protocol::TProtocol* iprot); + uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const; + +}; + +typedef struct _Hbase_scannerOpenWithStop_presult__isset { + _Hbase_scannerOpenWithStop_presult__isset() : success(false), io(false) {} + bool success; + bool io; +} _Hbase_scannerOpenWithStop_presult__isset; + +class Hbase_scannerOpenWithStop_presult { + public: + + + virtual ~Hbase_scannerOpenWithStop_presult() throw() {} + + ScannerID* success; + IOError io; + + _Hbase_scannerOpenWithStop_presult__isset __isset; + + uint32_t read(::apache::thrift::protocol::TProtocol* iprot); + +}; + +typedef struct _Hbase_scannerOpenWithPrefix_args__isset { + _Hbase_scannerOpenWithPrefix_args__isset() : tableName(false), startAndPrefix(false), columns(false), attributes(false) {} + bool tableName; + bool startAndPrefix; + bool columns; + bool attributes; +} _Hbase_scannerOpenWithPrefix_args__isset; + +class Hbase_scannerOpenWithPrefix_args { + public: + + Hbase_scannerOpenWithPrefix_args() : tableName(), startAndPrefix() { + } + + virtual ~Hbase_scannerOpenWithPrefix_args() throw() {} + + Text tableName; + Text startAndPrefix; + std::vector columns; + std::map attributes; + + _Hbase_scannerOpenWithPrefix_args__isset __isset; + + void __set_tableName(const Text& val) { + tableName = val; + } + + void __set_startAndPrefix(const Text& val) { + startAndPrefix = val; + } + + void __set_columns(const std::vector & val) { + columns = val; + } + + void __set_attributes(const std::map & val) { + attributes = val; + } + + bool operator == (const Hbase_scannerOpenWithPrefix_args & rhs) const + { + if (!(tableName == rhs.tableName)) + return false; + if (!(startAndPrefix == rhs.startAndPrefix)) + return false; + if (!(columns == rhs.columns)) + return false; + if (!(attributes == rhs.attributes)) + return false; + return true; + } + bool operator != (const Hbase_scannerOpenWithPrefix_args &rhs) const { + return !(*this == rhs); + } + + bool operator < (const Hbase_scannerOpenWithPrefix_args & ) const; + + uint32_t read(::apache::thrift::protocol::TProtocol* iprot); + uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const; + +}; + + +class Hbase_scannerOpenWithPrefix_pargs { + public: + + + virtual ~Hbase_scannerOpenWithPrefix_pargs() throw() {} + + const Text* tableName; + const Text* startAndPrefix; + const std::vector * columns; + const std::map * attributes; + + uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const; + +}; + +typedef struct _Hbase_scannerOpenWithPrefix_result__isset { + _Hbase_scannerOpenWithPrefix_result__isset() : success(false), io(false) {} + bool success; + bool io; +} _Hbase_scannerOpenWithPrefix_result__isset; + +class Hbase_scannerOpenWithPrefix_result { + public: + + Hbase_scannerOpenWithPrefix_result() : success(0) { + } + + virtual ~Hbase_scannerOpenWithPrefix_result() throw() {} + + ScannerID success; + IOError io; + + _Hbase_scannerOpenWithPrefix_result__isset __isset; + + void __set_success(const ScannerID val) { + success = val; + } + + void __set_io(const IOError& val) { + io = val; + } + + bool operator == (const Hbase_scannerOpenWithPrefix_result & rhs) const + { + if (!(success == rhs.success)) + return false; + if (!(io == rhs.io)) + return false; + return true; + } + bool operator != (const Hbase_scannerOpenWithPrefix_result &rhs) const { + return !(*this == rhs); + } + + bool operator < (const Hbase_scannerOpenWithPrefix_result & ) const; + + uint32_t read(::apache::thrift::protocol::TProtocol* iprot); + uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const; + +}; + +typedef struct _Hbase_scannerOpenWithPrefix_presult__isset { + _Hbase_scannerOpenWithPrefix_presult__isset() : success(false), io(false) {} + bool success; + bool io; +} _Hbase_scannerOpenWithPrefix_presult__isset; + +class Hbase_scannerOpenWithPrefix_presult { + public: + + + virtual ~Hbase_scannerOpenWithPrefix_presult() throw() {} + + ScannerID* success; + IOError io; + + _Hbase_scannerOpenWithPrefix_presult__isset __isset; + + uint32_t read(::apache::thrift::protocol::TProtocol* iprot); + +}; + +typedef struct _Hbase_scannerOpenTs_args__isset { + _Hbase_scannerOpenTs_args__isset() : tableName(false), startRow(false), columns(false), timestamp(false), attributes(false) {} + bool tableName; + bool startRow; + bool columns; + bool timestamp; + bool attributes; +} _Hbase_scannerOpenTs_args__isset; + +class Hbase_scannerOpenTs_args { + public: + + Hbase_scannerOpenTs_args() : tableName(), startRow(), timestamp(0) { + } + + virtual ~Hbase_scannerOpenTs_args() throw() {} + + Text tableName; + Text startRow; + std::vector columns; + int64_t timestamp; + std::map attributes; + + _Hbase_scannerOpenTs_args__isset __isset; + + void __set_tableName(const Text& val) { + tableName = val; + } + + void __set_startRow(const Text& val) { + startRow = val; + } + + void __set_columns(const std::vector & val) { + columns = val; + } + + void __set_timestamp(const int64_t val) { + timestamp = val; + } + + void __set_attributes(const std::map & val) { + attributes = val; + } + + bool operator == (const Hbase_scannerOpenTs_args & rhs) const + { + if (!(tableName == rhs.tableName)) + return false; + if (!(startRow == rhs.startRow)) + return false; + if (!(columns == rhs.columns)) + return false; + if (!(timestamp == rhs.timestamp)) + return false; + if (!(attributes == rhs.attributes)) + return false; + return true; + } + bool operator != (const Hbase_scannerOpenTs_args &rhs) const { + return !(*this == rhs); + } + + bool operator < (const Hbase_scannerOpenTs_args & ) const; + + uint32_t read(::apache::thrift::protocol::TProtocol* iprot); + uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const; + +}; + + +class Hbase_scannerOpenTs_pargs { + public: + + + virtual ~Hbase_scannerOpenTs_pargs() throw() {} + + const Text* tableName; + const Text* startRow; + const std::vector * columns; + const int64_t* timestamp; + const std::map * attributes; + + uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const; + +}; + +typedef struct _Hbase_scannerOpenTs_result__isset { + _Hbase_scannerOpenTs_result__isset() : success(false), io(false) {} + bool success; + bool io; +} _Hbase_scannerOpenTs_result__isset; + +class Hbase_scannerOpenTs_result { + public: + + Hbase_scannerOpenTs_result() : success(0) { + } + + virtual ~Hbase_scannerOpenTs_result() throw() {} + + ScannerID success; + IOError io; + + _Hbase_scannerOpenTs_result__isset __isset; + + void __set_success(const ScannerID val) { + success = val; + } + + void __set_io(const IOError& val) { + io = val; + } + + bool operator == (const Hbase_scannerOpenTs_result & rhs) const + { + if (!(success == rhs.success)) + return false; + if (!(io == rhs.io)) + return false; + return true; + } + bool operator != (const Hbase_scannerOpenTs_result &rhs) const { + return !(*this == rhs); + } + + bool operator < (const Hbase_scannerOpenTs_result & ) const; + + uint32_t read(::apache::thrift::protocol::TProtocol* iprot); + uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const; + +}; + +typedef struct _Hbase_scannerOpenTs_presult__isset { + _Hbase_scannerOpenTs_presult__isset() : success(false), io(false) {} + bool success; + bool io; +} _Hbase_scannerOpenTs_presult__isset; + +class Hbase_scannerOpenTs_presult { + public: + + + virtual ~Hbase_scannerOpenTs_presult() throw() {} + + ScannerID* success; + IOError io; + + _Hbase_scannerOpenTs_presult__isset __isset; + + uint32_t read(::apache::thrift::protocol::TProtocol* iprot); + +}; + +typedef struct _Hbase_scannerOpenWithStopTs_args__isset { + _Hbase_scannerOpenWithStopTs_args__isset() : tableName(false), startRow(false), stopRow(false), columns(false), timestamp(false), attributes(false) {} + bool tableName; + bool startRow; + bool stopRow; + bool columns; + bool timestamp; + bool attributes; +} _Hbase_scannerOpenWithStopTs_args__isset; + +class Hbase_scannerOpenWithStopTs_args { + public: + + Hbase_scannerOpenWithStopTs_args() : tableName(), startRow(), stopRow(), timestamp(0) { + } + + virtual ~Hbase_scannerOpenWithStopTs_args() throw() {} + + Text tableName; + Text startRow; + Text stopRow; + std::vector columns; + int64_t timestamp; + std::map attributes; + + _Hbase_scannerOpenWithStopTs_args__isset __isset; + + void __set_tableName(const Text& val) { + tableName = val; + } + + void __set_startRow(const Text& val) { + startRow = val; + } + + void __set_stopRow(const Text& val) { + stopRow = val; + } + + void __set_columns(const std::vector & val) { + columns = val; + } + + void __set_timestamp(const int64_t val) { + timestamp = val; + } + + void __set_attributes(const std::map & val) { + attributes = val; + } + + bool operator == (const Hbase_scannerOpenWithStopTs_args & rhs) const + { + if (!(tableName == rhs.tableName)) + return false; + if (!(startRow == rhs.startRow)) + return false; + if (!(stopRow == rhs.stopRow)) + return false; + if (!(columns == rhs.columns)) + return false; + if (!(timestamp == rhs.timestamp)) + return false; + if (!(attributes == rhs.attributes)) + return false; + return true; + } + bool operator != (const Hbase_scannerOpenWithStopTs_args &rhs) const { + return !(*this == rhs); + } + + bool operator < (const Hbase_scannerOpenWithStopTs_args & ) const; + + uint32_t read(::apache::thrift::protocol::TProtocol* iprot); + uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const; + +}; + + +class Hbase_scannerOpenWithStopTs_pargs { + public: + + + virtual ~Hbase_scannerOpenWithStopTs_pargs() throw() {} + + const Text* tableName; + const Text* startRow; + const Text* stopRow; + const std::vector * columns; + const int64_t* timestamp; + const std::map * attributes; + + uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const; + +}; + +typedef struct _Hbase_scannerOpenWithStopTs_result__isset { + _Hbase_scannerOpenWithStopTs_result__isset() : success(false), io(false) {} + bool success; + bool io; +} _Hbase_scannerOpenWithStopTs_result__isset; + +class Hbase_scannerOpenWithStopTs_result { + public: + + Hbase_scannerOpenWithStopTs_result() : success(0) { + } + + virtual ~Hbase_scannerOpenWithStopTs_result() throw() {} + + ScannerID success; + IOError io; + + _Hbase_scannerOpenWithStopTs_result__isset __isset; + + void __set_success(const ScannerID val) { + success = val; + } + + void __set_io(const IOError& val) { + io = val; + } + + bool operator == (const Hbase_scannerOpenWithStopTs_result & rhs) const + { + if (!(success == rhs.success)) + return false; + if (!(io == rhs.io)) + return false; + return true; + } + bool operator != (const Hbase_scannerOpenWithStopTs_result &rhs) const { + return !(*this == rhs); + } + + bool operator < (const Hbase_scannerOpenWithStopTs_result & ) const; + + uint32_t read(::apache::thrift::protocol::TProtocol* iprot); + uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const; + +}; + +typedef struct _Hbase_scannerOpenWithStopTs_presult__isset { + _Hbase_scannerOpenWithStopTs_presult__isset() : success(false), io(false) {} + bool success; + bool io; +} _Hbase_scannerOpenWithStopTs_presult__isset; + +class Hbase_scannerOpenWithStopTs_presult { + public: + + + virtual ~Hbase_scannerOpenWithStopTs_presult() throw() {} + + ScannerID* success; + IOError io; + + _Hbase_scannerOpenWithStopTs_presult__isset __isset; + + uint32_t read(::apache::thrift::protocol::TProtocol* iprot); + +}; + +typedef struct _Hbase_scannerGet_args__isset { + _Hbase_scannerGet_args__isset() : id(false) {} + bool id; +} _Hbase_scannerGet_args__isset; + +class Hbase_scannerGet_args { + public: + + Hbase_scannerGet_args() : id(0) { + } + + virtual ~Hbase_scannerGet_args() throw() {} + + ScannerID id; + + _Hbase_scannerGet_args__isset __isset; + + void __set_id(const ScannerID val) { + id = val; + } + + bool operator == (const Hbase_scannerGet_args & rhs) const + { + if (!(id == rhs.id)) + return false; + return true; + } + bool operator != (const Hbase_scannerGet_args &rhs) const { + return !(*this == rhs); + } + + bool operator < (const Hbase_scannerGet_args & ) const; + + uint32_t read(::apache::thrift::protocol::TProtocol* iprot); + uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const; + +}; + + +class Hbase_scannerGet_pargs { + public: + + + virtual ~Hbase_scannerGet_pargs() throw() {} + + const ScannerID* id; + + uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const; + +}; + +typedef struct _Hbase_scannerGet_result__isset { + _Hbase_scannerGet_result__isset() : success(false), io(false), ia(false) {} + bool success; + bool io; + bool ia; +} _Hbase_scannerGet_result__isset; + +class Hbase_scannerGet_result { + public: + + Hbase_scannerGet_result() { + } + + virtual ~Hbase_scannerGet_result() throw() {} + + std::vector success; + IOError io; + IllegalArgument ia; + + _Hbase_scannerGet_result__isset __isset; + + void __set_success(const std::vector & val) { + success = val; + } + + void __set_io(const IOError& val) { + io = val; + } + + void __set_ia(const IllegalArgument& val) { + ia = val; + } + + bool operator == (const Hbase_scannerGet_result & rhs) const + { + if (!(success == rhs.success)) + return false; + if (!(io == rhs.io)) + return false; + if (!(ia == rhs.ia)) + return false; + return true; + } + bool operator != (const Hbase_scannerGet_result &rhs) const { + return !(*this == rhs); + } + + bool operator < (const Hbase_scannerGet_result & ) const; + + uint32_t read(::apache::thrift::protocol::TProtocol* iprot); + uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const; + +}; + +typedef struct _Hbase_scannerGet_presult__isset { + _Hbase_scannerGet_presult__isset() : success(false), io(false), ia(false) {} + bool success; + bool io; + bool ia; +} _Hbase_scannerGet_presult__isset; + +class Hbase_scannerGet_presult { + public: + + + virtual ~Hbase_scannerGet_presult() throw() {} + + std::vector * success; + IOError io; + IllegalArgument ia; + + _Hbase_scannerGet_presult__isset __isset; + + uint32_t read(::apache::thrift::protocol::TProtocol* iprot); + +}; + +typedef struct _Hbase_scannerGetList_args__isset { + _Hbase_scannerGetList_args__isset() : id(false), nbRows(false) {} + bool id; + bool nbRows; +} _Hbase_scannerGetList_args__isset; + +class Hbase_scannerGetList_args { + public: + + Hbase_scannerGetList_args() : id(0), nbRows(0) { + } + + virtual ~Hbase_scannerGetList_args() throw() {} + + ScannerID id; + int32_t nbRows; + + _Hbase_scannerGetList_args__isset __isset; + + void __set_id(const ScannerID val) { + id = val; + } + + void __set_nbRows(const int32_t val) { + nbRows = val; + } + + bool operator == (const Hbase_scannerGetList_args & rhs) const + { + if (!(id == rhs.id)) + return false; + if (!(nbRows == rhs.nbRows)) + return false; + return true; + } + bool operator != (const Hbase_scannerGetList_args &rhs) const { + return !(*this == rhs); + } + + bool operator < (const Hbase_scannerGetList_args & ) const; + + uint32_t read(::apache::thrift::protocol::TProtocol* iprot); + uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const; + +}; + + +class Hbase_scannerGetList_pargs { + public: + + + virtual ~Hbase_scannerGetList_pargs() throw() {} + + const ScannerID* id; + const int32_t* nbRows; + + uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const; + +}; + +typedef struct _Hbase_scannerGetList_result__isset { + _Hbase_scannerGetList_result__isset() : success(false), io(false), ia(false) {} + bool success; + bool io; + bool ia; +} _Hbase_scannerGetList_result__isset; + +class Hbase_scannerGetList_result { + public: + + Hbase_scannerGetList_result() { + } + + virtual ~Hbase_scannerGetList_result() throw() {} + + std::vector success; + IOError io; + IllegalArgument ia; + + _Hbase_scannerGetList_result__isset __isset; + + void __set_success(const std::vector & val) { + success = val; + } + + void __set_io(const IOError& val) { + io = val; + } + + void __set_ia(const IllegalArgument& val) { + ia = val; + } + + bool operator == (const Hbase_scannerGetList_result & rhs) const + { + if (!(success == rhs.success)) + return false; + if (!(io == rhs.io)) + return false; + if (!(ia == rhs.ia)) + return false; + return true; + } + bool operator != (const Hbase_scannerGetList_result &rhs) const { + return !(*this == rhs); + } + + bool operator < (const Hbase_scannerGetList_result & ) const; + + uint32_t read(::apache::thrift::protocol::TProtocol* iprot); + uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const; + +}; + +typedef struct _Hbase_scannerGetList_presult__isset { + _Hbase_scannerGetList_presult__isset() : success(false), io(false), ia(false) {} + bool success; + bool io; + bool ia; +} _Hbase_scannerGetList_presult__isset; + +class Hbase_scannerGetList_presult { + public: + + + virtual ~Hbase_scannerGetList_presult() throw() {} + + std::vector * success; + IOError io; + IllegalArgument ia; + + _Hbase_scannerGetList_presult__isset __isset; + + uint32_t read(::apache::thrift::protocol::TProtocol* iprot); + +}; + +typedef struct _Hbase_scannerClose_args__isset { + _Hbase_scannerClose_args__isset() : id(false) {} + bool id; +} _Hbase_scannerClose_args__isset; + +class Hbase_scannerClose_args { + public: + + Hbase_scannerClose_args() : id(0) { + } + + virtual ~Hbase_scannerClose_args() throw() {} + + ScannerID id; + + _Hbase_scannerClose_args__isset __isset; + + void __set_id(const ScannerID val) { + id = val; + } + + bool operator == (const Hbase_scannerClose_args & rhs) const + { + if (!(id == rhs.id)) + return false; + return true; + } + bool operator != (const Hbase_scannerClose_args &rhs) const { + return !(*this == rhs); + } + + bool operator < (const Hbase_scannerClose_args & ) const; + + uint32_t read(::apache::thrift::protocol::TProtocol* iprot); + uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const; + +}; + + +class Hbase_scannerClose_pargs { + public: + + + virtual ~Hbase_scannerClose_pargs() throw() {} + + const ScannerID* id; + + uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const; + +}; + +typedef struct _Hbase_scannerClose_result__isset { + _Hbase_scannerClose_result__isset() : io(false), ia(false) {} + bool io; + bool ia; +} _Hbase_scannerClose_result__isset; + +class Hbase_scannerClose_result { + public: + + Hbase_scannerClose_result() { + } + + virtual ~Hbase_scannerClose_result() throw() {} + + IOError io; + IllegalArgument ia; + + _Hbase_scannerClose_result__isset __isset; + + void __set_io(const IOError& val) { + io = val; + } + + void __set_ia(const IllegalArgument& val) { + ia = val; + } + + bool operator == (const Hbase_scannerClose_result & rhs) const + { + if (!(io == rhs.io)) + return false; + if (!(ia == rhs.ia)) + return false; + return true; + } + bool operator != (const Hbase_scannerClose_result &rhs) const { + return !(*this == rhs); + } + + bool operator < (const Hbase_scannerClose_result & ) const; + + uint32_t read(::apache::thrift::protocol::TProtocol* iprot); + uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const; + +}; + +typedef struct _Hbase_scannerClose_presult__isset { + _Hbase_scannerClose_presult__isset() : io(false), ia(false) {} + bool io; + bool ia; +} _Hbase_scannerClose_presult__isset; + +class Hbase_scannerClose_presult { + public: + + + virtual ~Hbase_scannerClose_presult() throw() {} + + IOError io; + IllegalArgument ia; + + _Hbase_scannerClose_presult__isset __isset; + + uint32_t read(::apache::thrift::protocol::TProtocol* iprot); + +}; + +typedef struct _Hbase_getRowOrBefore_args__isset { + _Hbase_getRowOrBefore_args__isset() : tableName(false), row(false), family(false) {} + bool tableName; + bool row; + bool family; +} _Hbase_getRowOrBefore_args__isset; + +class Hbase_getRowOrBefore_args { + public: + + Hbase_getRowOrBefore_args() : tableName(), row(), family() { + } + + virtual ~Hbase_getRowOrBefore_args() throw() {} + + Text tableName; + Text row; + Text family; + + _Hbase_getRowOrBefore_args__isset __isset; + + void __set_tableName(const Text& val) { + tableName = val; + } + + void __set_row(const Text& val) { + row = val; + } + + void __set_family(const Text& val) { + family = val; + } + + bool operator == (const Hbase_getRowOrBefore_args & rhs) const + { + if (!(tableName == rhs.tableName)) + return false; + if (!(row == rhs.row)) + return false; + if (!(family == rhs.family)) + return false; + return true; + } + bool operator != (const Hbase_getRowOrBefore_args &rhs) const { + return !(*this == rhs); + } + + bool operator < (const Hbase_getRowOrBefore_args & ) const; + + uint32_t read(::apache::thrift::protocol::TProtocol* iprot); + uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const; + +}; + + +class Hbase_getRowOrBefore_pargs { + public: + + + virtual ~Hbase_getRowOrBefore_pargs() throw() {} + + const Text* tableName; + const Text* row; + const Text* family; + + uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const; + +}; + +typedef struct _Hbase_getRowOrBefore_result__isset { + _Hbase_getRowOrBefore_result__isset() : success(false), io(false) {} + bool success; + bool io; +} _Hbase_getRowOrBefore_result__isset; + +class Hbase_getRowOrBefore_result { + public: + + Hbase_getRowOrBefore_result() { + } + + virtual ~Hbase_getRowOrBefore_result() throw() {} + + std::vector success; + IOError io; + + _Hbase_getRowOrBefore_result__isset __isset; + + void __set_success(const std::vector & val) { + success = val; + } + + void __set_io(const IOError& val) { + io = val; + } + + bool operator == (const Hbase_getRowOrBefore_result & rhs) const + { + if (!(success == rhs.success)) + return false; + if (!(io == rhs.io)) + return false; + return true; + } + bool operator != (const Hbase_getRowOrBefore_result &rhs) const { + return !(*this == rhs); + } + + bool operator < (const Hbase_getRowOrBefore_result & ) const; + + uint32_t read(::apache::thrift::protocol::TProtocol* iprot); + uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const; + +}; + +typedef struct _Hbase_getRowOrBefore_presult__isset { + _Hbase_getRowOrBefore_presult__isset() : success(false), io(false) {} + bool success; + bool io; +} _Hbase_getRowOrBefore_presult__isset; + +class Hbase_getRowOrBefore_presult { + public: + + + virtual ~Hbase_getRowOrBefore_presult() throw() {} + + std::vector * success; + IOError io; + + _Hbase_getRowOrBefore_presult__isset __isset; + + uint32_t read(::apache::thrift::protocol::TProtocol* iprot); + +}; + +typedef struct _Hbase_getRegionInfo_args__isset { + _Hbase_getRegionInfo_args__isset() : row(false) {} + bool row; +} _Hbase_getRegionInfo_args__isset; + +class Hbase_getRegionInfo_args { + public: + + Hbase_getRegionInfo_args() : row() { + } + + virtual ~Hbase_getRegionInfo_args() throw() {} + + Text row; + + _Hbase_getRegionInfo_args__isset __isset; + + void __set_row(const Text& val) { + row = val; + } + + bool operator == (const Hbase_getRegionInfo_args & rhs) const + { + if (!(row == rhs.row)) + return false; + return true; + } + bool operator != (const Hbase_getRegionInfo_args &rhs) const { + return !(*this == rhs); + } + + bool operator < (const Hbase_getRegionInfo_args & ) const; + + uint32_t read(::apache::thrift::protocol::TProtocol* iprot); + uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const; + +}; + + +class Hbase_getRegionInfo_pargs { + public: + + + virtual ~Hbase_getRegionInfo_pargs() throw() {} + + const Text* row; + + uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const; + +}; + +typedef struct _Hbase_getRegionInfo_result__isset { + _Hbase_getRegionInfo_result__isset() : success(false), io(false) {} + bool success; + bool io; +} _Hbase_getRegionInfo_result__isset; + +class Hbase_getRegionInfo_result { + public: + + Hbase_getRegionInfo_result() { + } + + virtual ~Hbase_getRegionInfo_result() throw() {} + + TRegionInfo success; + IOError io; + + _Hbase_getRegionInfo_result__isset __isset; + + void __set_success(const TRegionInfo& val) { + success = val; + } + + void __set_io(const IOError& val) { + io = val; + } + + bool operator == (const Hbase_getRegionInfo_result & rhs) const + { + if (!(success == rhs.success)) + return false; + if (!(io == rhs.io)) + return false; + return true; + } + bool operator != (const Hbase_getRegionInfo_result &rhs) const { + return !(*this == rhs); + } + + bool operator < (const Hbase_getRegionInfo_result & ) const; + + uint32_t read(::apache::thrift::protocol::TProtocol* iprot); + uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const; + +}; + +typedef struct _Hbase_getRegionInfo_presult__isset { + _Hbase_getRegionInfo_presult__isset() : success(false), io(false) {} + bool success; + bool io; +} _Hbase_getRegionInfo_presult__isset; + +class Hbase_getRegionInfo_presult { + public: + + + virtual ~Hbase_getRegionInfo_presult() throw() {} + + TRegionInfo* success; + IOError io; + + _Hbase_getRegionInfo_presult__isset __isset; + + uint32_t read(::apache::thrift::protocol::TProtocol* iprot); + +}; + +class HbaseClient : virtual public HbaseIf { + public: + HbaseClient(boost::shared_ptr< ::apache::thrift::protocol::TProtocol> prot) : + piprot_(prot), + poprot_(prot) { + iprot_ = prot.get(); + oprot_ = prot.get(); + } + HbaseClient(boost::shared_ptr< ::apache::thrift::protocol::TProtocol> iprot, boost::shared_ptr< ::apache::thrift::protocol::TProtocol> oprot) : + piprot_(iprot), + poprot_(oprot) { + iprot_ = iprot.get(); + oprot_ = oprot.get(); + } + boost::shared_ptr< ::apache::thrift::protocol::TProtocol> getInputProtocol() { + return piprot_; + } + boost::shared_ptr< ::apache::thrift::protocol::TProtocol> getOutputProtocol() { + return poprot_; + } + void enableTable(const Bytes& tableName); + void send_enableTable(const Bytes& tableName); + void recv_enableTable(); + void disableTable(const Bytes& tableName); + void send_disableTable(const Bytes& tableName); + void recv_disableTable(); + bool isTableEnabled(const Bytes& tableName); + void send_isTableEnabled(const Bytes& tableName); + bool recv_isTableEnabled(); + void compact(const Bytes& tableNameOrRegionName); + void send_compact(const Bytes& tableNameOrRegionName); + void recv_compact(); + void majorCompact(const Bytes& tableNameOrRegionName); + void send_majorCompact(const Bytes& tableNameOrRegionName); + void recv_majorCompact(); + void getTableNames(std::vector & _return); + void send_getTableNames(); + void recv_getTableNames(std::vector & _return); + void getColumnDescriptors(std::map & _return, const Text& tableName); + void send_getColumnDescriptors(const Text& tableName); + void recv_getColumnDescriptors(std::map & _return); + void getTableRegions(std::vector & _return, const Text& tableName); + void send_getTableRegions(const Text& tableName); + void recv_getTableRegions(std::vector & _return); + void createTable(const Text& tableName, const std::vector & columnFamilies); + void send_createTable(const Text& tableName, const std::vector & columnFamilies); + void recv_createTable(); + void deleteTable(const Text& tableName); + void send_deleteTable(const Text& tableName); + void recv_deleteTable(); + void get(std::vector & _return, const Text& tableName, const Text& row, const Text& column, const std::map & attributes); + void send_get(const Text& tableName, const Text& row, const Text& column, const std::map & attributes); + void recv_get(std::vector & _return); + void getVer(std::vector & _return, const Text& tableName, const Text& row, const Text& column, const int32_t numVersions, const std::map & attributes); + void send_getVer(const Text& tableName, const Text& row, const Text& column, const int32_t numVersions, const std::map & attributes); + void recv_getVer(std::vector & _return); + void getVerTs(std::vector & _return, const Text& tableName, const Text& row, const Text& column, const int64_t timestamp, const int32_t numVersions, const std::map & attributes); + void send_getVerTs(const Text& tableName, const Text& row, const Text& column, const int64_t timestamp, const int32_t numVersions, const std::map & attributes); + void recv_getVerTs(std::vector & _return); + void getRow(std::vector & _return, const Text& tableName, const Text& row, const std::map & attributes); + void send_getRow(const Text& tableName, const Text& row, const std::map & attributes); + void recv_getRow(std::vector & _return); + void getRowWithColumns(std::vector & _return, const Text& tableName, const Text& row, const std::vector & columns, const std::map & attributes); + void send_getRowWithColumns(const Text& tableName, const Text& row, const std::vector & columns, const std::map & attributes); + void recv_getRowWithColumns(std::vector & _return); + void getRowTs(std::vector & _return, const Text& tableName, const Text& row, const int64_t timestamp, const std::map & attributes); + void send_getRowTs(const Text& tableName, const Text& row, const int64_t timestamp, const std::map & attributes); + void recv_getRowTs(std::vector & _return); + void getRowWithColumnsTs(std::vector & _return, const Text& tableName, const Text& row, const std::vector & columns, const int64_t timestamp, const std::map & attributes); + void send_getRowWithColumnsTs(const Text& tableName, const Text& row, const std::vector & columns, const int64_t timestamp, const std::map & attributes); + void recv_getRowWithColumnsTs(std::vector & _return); + void getRows(std::vector & _return, const Text& tableName, const std::vector & rows, const std::map & attributes); + void send_getRows(const Text& tableName, const std::vector & rows, const std::map & attributes); + void recv_getRows(std::vector & _return); + void getRowsWithColumns(std::vector & _return, const Text& tableName, const std::vector & rows, const std::vector & columns, const std::map & attributes); + void send_getRowsWithColumns(const Text& tableName, const std::vector & rows, const std::vector & columns, const std::map & attributes); + void recv_getRowsWithColumns(std::vector & _return); + void getRowsTs(std::vector & _return, const Text& tableName, const std::vector & rows, const int64_t timestamp, const std::map & attributes); + void send_getRowsTs(const Text& tableName, const std::vector & rows, const int64_t timestamp, const std::map & attributes); + void recv_getRowsTs(std::vector & _return); + void getRowsWithColumnsTs(std::vector & _return, const Text& tableName, const std::vector & rows, const std::vector & columns, const int64_t timestamp, const std::map & attributes); + void send_getRowsWithColumnsTs(const Text& tableName, const std::vector & rows, const std::vector & columns, const int64_t timestamp, const std::map & attributes); + void recv_getRowsWithColumnsTs(std::vector & _return); + void mutateRow(const Text& tableName, const Text& row, const std::vector & mutations, const std::map & attributes); + void send_mutateRow(const Text& tableName, const Text& row, const std::vector & mutations, const std::map & attributes); + void recv_mutateRow(); + void mutateRowTs(const Text& tableName, const Text& row, const std::vector & mutations, const int64_t timestamp, const std::map & attributes); + void send_mutateRowTs(const Text& tableName, const Text& row, const std::vector & mutations, const int64_t timestamp, const std::map & attributes); + void recv_mutateRowTs(); + void mutateRows(const Text& tableName, const std::vector & rowBatches, const std::map & attributes); + void send_mutateRows(const Text& tableName, const std::vector & rowBatches, const std::map & attributes); + void recv_mutateRows(); + void mutateRowsTs(const Text& tableName, const std::vector & rowBatches, const int64_t timestamp, const std::map & attributes); + void send_mutateRowsTs(const Text& tableName, const std::vector & rowBatches, const int64_t timestamp, const std::map & attributes); + void recv_mutateRowsTs(); + int64_t atomicIncrement(const Text& tableName, const Text& row, const Text& column, const int64_t value); + void send_atomicIncrement(const Text& tableName, const Text& row, const Text& column, const int64_t value); + int64_t recv_atomicIncrement(); + void deleteAll(const Text& tableName, const Text& row, const Text& column, const std::map & attributes); + void send_deleteAll(const Text& tableName, const Text& row, const Text& column, const std::map & attributes); + void recv_deleteAll(); + void deleteAllTs(const Text& tableName, const Text& row, const Text& column, const int64_t timestamp, const std::map & attributes); + void send_deleteAllTs(const Text& tableName, const Text& row, const Text& column, const int64_t timestamp, const std::map & attributes); + void recv_deleteAllTs(); + void deleteAllRow(const Text& tableName, const Text& row, const std::map & attributes); + void send_deleteAllRow(const Text& tableName, const Text& row, const std::map & attributes); + void recv_deleteAllRow(); + void increment(const TIncrement& increment); + void send_increment(const TIncrement& increment); + void recv_increment(); + void incrementRows(const std::vector & increments); + void send_incrementRows(const std::vector & increments); + void recv_incrementRows(); + void deleteAllRowTs(const Text& tableName, const Text& row, const int64_t timestamp, const std::map & attributes); + void send_deleteAllRowTs(const Text& tableName, const Text& row, const int64_t timestamp, const std::map & attributes); + void recv_deleteAllRowTs(); + ScannerID scannerOpenWithScan(const Text& tableName, const TScan& scan, const std::map & attributes); + void send_scannerOpenWithScan(const Text& tableName, const TScan& scan, const std::map & attributes); + ScannerID recv_scannerOpenWithScan(); + ScannerID scannerOpen(const Text& tableName, const Text& startRow, const std::vector & columns, const std::map & attributes); + void send_scannerOpen(const Text& tableName, const Text& startRow, const std::vector & columns, const std::map & attributes); + ScannerID recv_scannerOpen(); + ScannerID scannerOpenWithStop(const Text& tableName, const Text& startRow, const Text& stopRow, const std::vector & columns, const std::map & attributes); + void send_scannerOpenWithStop(const Text& tableName, const Text& startRow, const Text& stopRow, const std::vector & columns, const std::map & attributes); + ScannerID recv_scannerOpenWithStop(); + ScannerID scannerOpenWithPrefix(const Text& tableName, const Text& startAndPrefix, const std::vector & columns, const std::map & attributes); + void send_scannerOpenWithPrefix(const Text& tableName, const Text& startAndPrefix, const std::vector & columns, const std::map & attributes); + ScannerID recv_scannerOpenWithPrefix(); + ScannerID scannerOpenTs(const Text& tableName, const Text& startRow, const std::vector & columns, const int64_t timestamp, const std::map & attributes); + void send_scannerOpenTs(const Text& tableName, const Text& startRow, const std::vector & columns, const int64_t timestamp, const std::map & attributes); + ScannerID recv_scannerOpenTs(); + ScannerID scannerOpenWithStopTs(const Text& tableName, const Text& startRow, const Text& stopRow, const std::vector & columns, const int64_t timestamp, const std::map & attributes); + void send_scannerOpenWithStopTs(const Text& tableName, const Text& startRow, const Text& stopRow, const std::vector & columns, const int64_t timestamp, const std::map & attributes); + ScannerID recv_scannerOpenWithStopTs(); + void scannerGet(std::vector & _return, const ScannerID id); + void send_scannerGet(const ScannerID id); + void recv_scannerGet(std::vector & _return); + void scannerGetList(std::vector & _return, const ScannerID id, const int32_t nbRows); + void send_scannerGetList(const ScannerID id, const int32_t nbRows); + void recv_scannerGetList(std::vector & _return); + void scannerClose(const ScannerID id); + void send_scannerClose(const ScannerID id); + void recv_scannerClose(); + void getRowOrBefore(std::vector & _return, const Text& tableName, const Text& row, const Text& family); + void send_getRowOrBefore(const Text& tableName, const Text& row, const Text& family); + void recv_getRowOrBefore(std::vector & _return); + void getRegionInfo(TRegionInfo& _return, const Text& row); + void send_getRegionInfo(const Text& row); + void recv_getRegionInfo(TRegionInfo& _return); + protected: + boost::shared_ptr< ::apache::thrift::protocol::TProtocol> piprot_; + boost::shared_ptr< ::apache::thrift::protocol::TProtocol> poprot_; + ::apache::thrift::protocol::TProtocol* iprot_; + ::apache::thrift::protocol::TProtocol* oprot_; +}; + +class HbaseProcessor : public ::apache::thrift::TDispatchProcessor { + protected: + boost::shared_ptr iface_; + virtual bool dispatchCall(::apache::thrift::protocol::TProtocol* iprot, ::apache::thrift::protocol::TProtocol* oprot, const std::string& fname, int32_t seqid, void* callContext); + private: + typedef void (HbaseProcessor::*ProcessFunction)(int32_t, ::apache::thrift::protocol::TProtocol*, ::apache::thrift::protocol::TProtocol*, void*); + typedef std::map ProcessMap; + ProcessMap processMap_; + void process_enableTable(int32_t seqid, ::apache::thrift::protocol::TProtocol* iprot, ::apache::thrift::protocol::TProtocol* oprot, void* callContext); + void process_disableTable(int32_t seqid, ::apache::thrift::protocol::TProtocol* iprot, ::apache::thrift::protocol::TProtocol* oprot, void* callContext); + void process_isTableEnabled(int32_t seqid, ::apache::thrift::protocol::TProtocol* iprot, ::apache::thrift::protocol::TProtocol* oprot, void* callContext); + void process_compact(int32_t seqid, ::apache::thrift::protocol::TProtocol* iprot, ::apache::thrift::protocol::TProtocol* oprot, void* callContext); + void process_majorCompact(int32_t seqid, ::apache::thrift::protocol::TProtocol* iprot, ::apache::thrift::protocol::TProtocol* oprot, void* callContext); + void process_getTableNames(int32_t seqid, ::apache::thrift::protocol::TProtocol* iprot, ::apache::thrift::protocol::TProtocol* oprot, void* callContext); + void process_getColumnDescriptors(int32_t seqid, ::apache::thrift::protocol::TProtocol* iprot, ::apache::thrift::protocol::TProtocol* oprot, void* callContext); + void process_getTableRegions(int32_t seqid, ::apache::thrift::protocol::TProtocol* iprot, ::apache::thrift::protocol::TProtocol* oprot, void* callContext); + void process_createTable(int32_t seqid, ::apache::thrift::protocol::TProtocol* iprot, ::apache::thrift::protocol::TProtocol* oprot, void* callContext); + void process_deleteTable(int32_t seqid, ::apache::thrift::protocol::TProtocol* iprot, ::apache::thrift::protocol::TProtocol* oprot, void* callContext); + void process_get(int32_t seqid, ::apache::thrift::protocol::TProtocol* iprot, ::apache::thrift::protocol::TProtocol* oprot, void* callContext); + void process_getVer(int32_t seqid, ::apache::thrift::protocol::TProtocol* iprot, ::apache::thrift::protocol::TProtocol* oprot, void* callContext); + void process_getVerTs(int32_t seqid, ::apache::thrift::protocol::TProtocol* iprot, ::apache::thrift::protocol::TProtocol* oprot, void* callContext); + void process_getRow(int32_t seqid, ::apache::thrift::protocol::TProtocol* iprot, ::apache::thrift::protocol::TProtocol* oprot, void* callContext); + void process_getRowWithColumns(int32_t seqid, ::apache::thrift::protocol::TProtocol* iprot, ::apache::thrift::protocol::TProtocol* oprot, void* callContext); + void process_getRowTs(int32_t seqid, ::apache::thrift::protocol::TProtocol* iprot, ::apache::thrift::protocol::TProtocol* oprot, void* callContext); + void process_getRowWithColumnsTs(int32_t seqid, ::apache::thrift::protocol::TProtocol* iprot, ::apache::thrift::protocol::TProtocol* oprot, void* callContext); + void process_getRows(int32_t seqid, ::apache::thrift::protocol::TProtocol* iprot, ::apache::thrift::protocol::TProtocol* oprot, void* callContext); + void process_getRowsWithColumns(int32_t seqid, ::apache::thrift::protocol::TProtocol* iprot, ::apache::thrift::protocol::TProtocol* oprot, void* callContext); + void process_getRowsTs(int32_t seqid, ::apache::thrift::protocol::TProtocol* iprot, ::apache::thrift::protocol::TProtocol* oprot, void* callContext); + void process_getRowsWithColumnsTs(int32_t seqid, ::apache::thrift::protocol::TProtocol* iprot, ::apache::thrift::protocol::TProtocol* oprot, void* callContext); + void process_mutateRow(int32_t seqid, ::apache::thrift::protocol::TProtocol* iprot, ::apache::thrift::protocol::TProtocol* oprot, void* callContext); + void process_mutateRowTs(int32_t seqid, ::apache::thrift::protocol::TProtocol* iprot, ::apache::thrift::protocol::TProtocol* oprot, void* callContext); + void process_mutateRows(int32_t seqid, ::apache::thrift::protocol::TProtocol* iprot, ::apache::thrift::protocol::TProtocol* oprot, void* callContext); + void process_mutateRowsTs(int32_t seqid, ::apache::thrift::protocol::TProtocol* iprot, ::apache::thrift::protocol::TProtocol* oprot, void* callContext); + void process_atomicIncrement(int32_t seqid, ::apache::thrift::protocol::TProtocol* iprot, ::apache::thrift::protocol::TProtocol* oprot, void* callContext); + void process_deleteAll(int32_t seqid, ::apache::thrift::protocol::TProtocol* iprot, ::apache::thrift::protocol::TProtocol* oprot, void* callContext); + void process_deleteAllTs(int32_t seqid, ::apache::thrift::protocol::TProtocol* iprot, ::apache::thrift::protocol::TProtocol* oprot, void* callContext); + void process_deleteAllRow(int32_t seqid, ::apache::thrift::protocol::TProtocol* iprot, ::apache::thrift::protocol::TProtocol* oprot, void* callContext); + void process_increment(int32_t seqid, ::apache::thrift::protocol::TProtocol* iprot, ::apache::thrift::protocol::TProtocol* oprot, void* callContext); + void process_incrementRows(int32_t seqid, ::apache::thrift::protocol::TProtocol* iprot, ::apache::thrift::protocol::TProtocol* oprot, void* callContext); + void process_deleteAllRowTs(int32_t seqid, ::apache::thrift::protocol::TProtocol* iprot, ::apache::thrift::protocol::TProtocol* oprot, void* callContext); + void process_scannerOpenWithScan(int32_t seqid, ::apache::thrift::protocol::TProtocol* iprot, ::apache::thrift::protocol::TProtocol* oprot, void* callContext); + void process_scannerOpen(int32_t seqid, ::apache::thrift::protocol::TProtocol* iprot, ::apache::thrift::protocol::TProtocol* oprot, void* callContext); + void process_scannerOpenWithStop(int32_t seqid, ::apache::thrift::protocol::TProtocol* iprot, ::apache::thrift::protocol::TProtocol* oprot, void* callContext); + void process_scannerOpenWithPrefix(int32_t seqid, ::apache::thrift::protocol::TProtocol* iprot, ::apache::thrift::protocol::TProtocol* oprot, void* callContext); + void process_scannerOpenTs(int32_t seqid, ::apache::thrift::protocol::TProtocol* iprot, ::apache::thrift::protocol::TProtocol* oprot, void* callContext); + void process_scannerOpenWithStopTs(int32_t seqid, ::apache::thrift::protocol::TProtocol* iprot, ::apache::thrift::protocol::TProtocol* oprot, void* callContext); + void process_scannerGet(int32_t seqid, ::apache::thrift::protocol::TProtocol* iprot, ::apache::thrift::protocol::TProtocol* oprot, void* callContext); + void process_scannerGetList(int32_t seqid, ::apache::thrift::protocol::TProtocol* iprot, ::apache::thrift::protocol::TProtocol* oprot, void* callContext); + void process_scannerClose(int32_t seqid, ::apache::thrift::protocol::TProtocol* iprot, ::apache::thrift::protocol::TProtocol* oprot, void* callContext); + void process_getRowOrBefore(int32_t seqid, ::apache::thrift::protocol::TProtocol* iprot, ::apache::thrift::protocol::TProtocol* oprot, void* callContext); + void process_getRegionInfo(int32_t seqid, ::apache::thrift::protocol::TProtocol* iprot, ::apache::thrift::protocol::TProtocol* oprot, void* callContext); + public: + HbaseProcessor(boost::shared_ptr iface) : + iface_(iface) { + processMap_["enableTable"] = &HbaseProcessor::process_enableTable; + processMap_["disableTable"] = &HbaseProcessor::process_disableTable; + processMap_["isTableEnabled"] = &HbaseProcessor::process_isTableEnabled; + processMap_["compact"] = &HbaseProcessor::process_compact; + processMap_["majorCompact"] = &HbaseProcessor::process_majorCompact; + processMap_["getTableNames"] = &HbaseProcessor::process_getTableNames; + processMap_["getColumnDescriptors"] = &HbaseProcessor::process_getColumnDescriptors; + processMap_["getTableRegions"] = &HbaseProcessor::process_getTableRegions; + processMap_["createTable"] = &HbaseProcessor::process_createTable; + processMap_["deleteTable"] = &HbaseProcessor::process_deleteTable; + processMap_["get"] = &HbaseProcessor::process_get; + processMap_["getVer"] = &HbaseProcessor::process_getVer; + processMap_["getVerTs"] = &HbaseProcessor::process_getVerTs; + processMap_["getRow"] = &HbaseProcessor::process_getRow; + processMap_["getRowWithColumns"] = &HbaseProcessor::process_getRowWithColumns; + processMap_["getRowTs"] = &HbaseProcessor::process_getRowTs; + processMap_["getRowWithColumnsTs"] = &HbaseProcessor::process_getRowWithColumnsTs; + processMap_["getRows"] = &HbaseProcessor::process_getRows; + processMap_["getRowsWithColumns"] = &HbaseProcessor::process_getRowsWithColumns; + processMap_["getRowsTs"] = &HbaseProcessor::process_getRowsTs; + processMap_["getRowsWithColumnsTs"] = &HbaseProcessor::process_getRowsWithColumnsTs; + processMap_["mutateRow"] = &HbaseProcessor::process_mutateRow; + processMap_["mutateRowTs"] = &HbaseProcessor::process_mutateRowTs; + processMap_["mutateRows"] = &HbaseProcessor::process_mutateRows; + processMap_["mutateRowsTs"] = &HbaseProcessor::process_mutateRowsTs; + processMap_["atomicIncrement"] = &HbaseProcessor::process_atomicIncrement; + processMap_["deleteAll"] = &HbaseProcessor::process_deleteAll; + processMap_["deleteAllTs"] = &HbaseProcessor::process_deleteAllTs; + processMap_["deleteAllRow"] = &HbaseProcessor::process_deleteAllRow; + processMap_["increment"] = &HbaseProcessor::process_increment; + processMap_["incrementRows"] = &HbaseProcessor::process_incrementRows; + processMap_["deleteAllRowTs"] = &HbaseProcessor::process_deleteAllRowTs; + processMap_["scannerOpenWithScan"] = &HbaseProcessor::process_scannerOpenWithScan; + processMap_["scannerOpen"] = &HbaseProcessor::process_scannerOpen; + processMap_["scannerOpenWithStop"] = &HbaseProcessor::process_scannerOpenWithStop; + processMap_["scannerOpenWithPrefix"] = &HbaseProcessor::process_scannerOpenWithPrefix; + processMap_["scannerOpenTs"] = &HbaseProcessor::process_scannerOpenTs; + processMap_["scannerOpenWithStopTs"] = &HbaseProcessor::process_scannerOpenWithStopTs; + processMap_["scannerGet"] = &HbaseProcessor::process_scannerGet; + processMap_["scannerGetList"] = &HbaseProcessor::process_scannerGetList; + processMap_["scannerClose"] = &HbaseProcessor::process_scannerClose; + processMap_["getRowOrBefore"] = &HbaseProcessor::process_getRowOrBefore; + processMap_["getRegionInfo"] = &HbaseProcessor::process_getRegionInfo; + } + + virtual ~HbaseProcessor() {} +}; + +class HbaseProcessorFactory : public ::apache::thrift::TProcessorFactory { + public: + HbaseProcessorFactory(const ::boost::shared_ptr< HbaseIfFactory >& handlerFactory) : + handlerFactory_(handlerFactory) {} + + ::boost::shared_ptr< ::apache::thrift::TProcessor > getProcessor(const ::apache::thrift::TConnectionInfo& connInfo); + + protected: + ::boost::shared_ptr< HbaseIfFactory > handlerFactory_; +}; + +class HbaseMultiface : virtual public HbaseIf { + public: + HbaseMultiface(std::vector >& ifaces) : ifaces_(ifaces) { + } + virtual ~HbaseMultiface() {} + protected: + std::vector > ifaces_; + HbaseMultiface() {} + void add(boost::shared_ptr iface) { + ifaces_.push_back(iface); + } + public: + void enableTable(const Bytes& tableName) { + size_t sz = ifaces_.size(); + size_t i = 0; + for (; i < (sz - 1); ++i) { + ifaces_[i]->enableTable(tableName); + } + ifaces_[i]->enableTable(tableName); + } + + void disableTable(const Bytes& tableName) { + size_t sz = ifaces_.size(); + size_t i = 0; + for (; i < (sz - 1); ++i) { + ifaces_[i]->disableTable(tableName); + } + ifaces_[i]->disableTable(tableName); + } + + bool isTableEnabled(const Bytes& tableName) { + size_t sz = ifaces_.size(); + size_t i = 0; + for (; i < (sz - 1); ++i) { + ifaces_[i]->isTableEnabled(tableName); + } + return ifaces_[i]->isTableEnabled(tableName); + } + + void compact(const Bytes& tableNameOrRegionName) { + size_t sz = ifaces_.size(); + size_t i = 0; + for (; i < (sz - 1); ++i) { + ifaces_[i]->compact(tableNameOrRegionName); + } + ifaces_[i]->compact(tableNameOrRegionName); + } + + void majorCompact(const Bytes& tableNameOrRegionName) { + size_t sz = ifaces_.size(); + size_t i = 0; + for (; i < (sz - 1); ++i) { + ifaces_[i]->majorCompact(tableNameOrRegionName); + } + ifaces_[i]->majorCompact(tableNameOrRegionName); + } + + void getTableNames(std::vector & _return) { + size_t sz = ifaces_.size(); + size_t i = 0; + for (; i < (sz - 1); ++i) { + ifaces_[i]->getTableNames(_return); + } + ifaces_[i]->getTableNames(_return); + return; + } + + void getColumnDescriptors(std::map & _return, const Text& tableName) { + size_t sz = ifaces_.size(); + size_t i = 0; + for (; i < (sz - 1); ++i) { + ifaces_[i]->getColumnDescriptors(_return, tableName); + } + ifaces_[i]->getColumnDescriptors(_return, tableName); + return; + } + + void getTableRegions(std::vector & _return, const Text& tableName) { + size_t sz = ifaces_.size(); + size_t i = 0; + for (; i < (sz - 1); ++i) { + ifaces_[i]->getTableRegions(_return, tableName); + } + ifaces_[i]->getTableRegions(_return, tableName); + return; + } + + void createTable(const Text& tableName, const std::vector & columnFamilies) { + size_t sz = ifaces_.size(); + size_t i = 0; + for (; i < (sz - 1); ++i) { + ifaces_[i]->createTable(tableName, columnFamilies); + } + ifaces_[i]->createTable(tableName, columnFamilies); + } + + void deleteTable(const Text& tableName) { + size_t sz = ifaces_.size(); + size_t i = 0; + for (; i < (sz - 1); ++i) { + ifaces_[i]->deleteTable(tableName); + } + ifaces_[i]->deleteTable(tableName); + } + + void get(std::vector & _return, const Text& tableName, const Text& row, const Text& column, const std::map & attributes) { + size_t sz = ifaces_.size(); + size_t i = 0; + for (; i < (sz - 1); ++i) { + ifaces_[i]->get(_return, tableName, row, column, attributes); + } + ifaces_[i]->get(_return, tableName, row, column, attributes); + return; + } + + void getVer(std::vector & _return, const Text& tableName, const Text& row, const Text& column, const int32_t numVersions, const std::map & attributes) { + size_t sz = ifaces_.size(); + size_t i = 0; + for (; i < (sz - 1); ++i) { + ifaces_[i]->getVer(_return, tableName, row, column, numVersions, attributes); + } + ifaces_[i]->getVer(_return, tableName, row, column, numVersions, attributes); + return; + } + + void getVerTs(std::vector & _return, const Text& tableName, const Text& row, const Text& column, const int64_t timestamp, const int32_t numVersions, const std::map & attributes) { + size_t sz = ifaces_.size(); + size_t i = 0; + for (; i < (sz - 1); ++i) { + ifaces_[i]->getVerTs(_return, tableName, row, column, timestamp, numVersions, attributes); + } + ifaces_[i]->getVerTs(_return, tableName, row, column, timestamp, numVersions, attributes); + return; + } + + void getRow(std::vector & _return, const Text& tableName, const Text& row, const std::map & attributes) { + size_t sz = ifaces_.size(); + size_t i = 0; + for (; i < (sz - 1); ++i) { + ifaces_[i]->getRow(_return, tableName, row, attributes); + } + ifaces_[i]->getRow(_return, tableName, row, attributes); + return; + } + + void getRowWithColumns(std::vector & _return, const Text& tableName, const Text& row, const std::vector & columns, const std::map & attributes) { + size_t sz = ifaces_.size(); + size_t i = 0; + for (; i < (sz - 1); ++i) { + ifaces_[i]->getRowWithColumns(_return, tableName, row, columns, attributes); + } + ifaces_[i]->getRowWithColumns(_return, tableName, row, columns, attributes); + return; + } + + void getRowTs(std::vector & _return, const Text& tableName, const Text& row, const int64_t timestamp, const std::map & attributes) { + size_t sz = ifaces_.size(); + size_t i = 0; + for (; i < (sz - 1); ++i) { + ifaces_[i]->getRowTs(_return, tableName, row, timestamp, attributes); + } + ifaces_[i]->getRowTs(_return, tableName, row, timestamp, attributes); + return; + } + + void getRowWithColumnsTs(std::vector & _return, const Text& tableName, const Text& row, const std::vector & columns, const int64_t timestamp, const std::map & attributes) { + size_t sz = ifaces_.size(); + size_t i = 0; + for (; i < (sz - 1); ++i) { + ifaces_[i]->getRowWithColumnsTs(_return, tableName, row, columns, timestamp, attributes); + } + ifaces_[i]->getRowWithColumnsTs(_return, tableName, row, columns, timestamp, attributes); + return; + } + + void getRows(std::vector & _return, const Text& tableName, const std::vector & rows, const std::map & attributes) { + size_t sz = ifaces_.size(); + size_t i = 0; + for (; i < (sz - 1); ++i) { + ifaces_[i]->getRows(_return, tableName, rows, attributes); + } + ifaces_[i]->getRows(_return, tableName, rows, attributes); + return; + } + + void getRowsWithColumns(std::vector & _return, const Text& tableName, const std::vector & rows, const std::vector & columns, const std::map & attributes) { + size_t sz = ifaces_.size(); + size_t i = 0; + for (; i < (sz - 1); ++i) { + ifaces_[i]->getRowsWithColumns(_return, tableName, rows, columns, attributes); + } + ifaces_[i]->getRowsWithColumns(_return, tableName, rows, columns, attributes); + return; + } + + void getRowsTs(std::vector & _return, const Text& tableName, const std::vector & rows, const int64_t timestamp, const std::map & attributes) { + size_t sz = ifaces_.size(); + size_t i = 0; + for (; i < (sz - 1); ++i) { + ifaces_[i]->getRowsTs(_return, tableName, rows, timestamp, attributes); + } + ifaces_[i]->getRowsTs(_return, tableName, rows, timestamp, attributes); + return; + } + + void getRowsWithColumnsTs(std::vector & _return, const Text& tableName, const std::vector & rows, const std::vector & columns, const int64_t timestamp, const std::map & attributes) { + size_t sz = ifaces_.size(); + size_t i = 0; + for (; i < (sz - 1); ++i) { + ifaces_[i]->getRowsWithColumnsTs(_return, tableName, rows, columns, timestamp, attributes); + } + ifaces_[i]->getRowsWithColumnsTs(_return, tableName, rows, columns, timestamp, attributes); + return; + } + + void mutateRow(const Text& tableName, const Text& row, const std::vector & mutations, const std::map & attributes) { + size_t sz = ifaces_.size(); + size_t i = 0; + for (; i < (sz - 1); ++i) { + ifaces_[i]->mutateRow(tableName, row, mutations, attributes); + } + ifaces_[i]->mutateRow(tableName, row, mutations, attributes); + } + + void mutateRowTs(const Text& tableName, const Text& row, const std::vector & mutations, const int64_t timestamp, const std::map & attributes) { + size_t sz = ifaces_.size(); + size_t i = 0; + for (; i < (sz - 1); ++i) { + ifaces_[i]->mutateRowTs(tableName, row, mutations, timestamp, attributes); + } + ifaces_[i]->mutateRowTs(tableName, row, mutations, timestamp, attributes); + } + + void mutateRows(const Text& tableName, const std::vector & rowBatches, const std::map & attributes) { + size_t sz = ifaces_.size(); + size_t i = 0; + for (; i < (sz - 1); ++i) { + ifaces_[i]->mutateRows(tableName, rowBatches, attributes); + } + ifaces_[i]->mutateRows(tableName, rowBatches, attributes); + } + + void mutateRowsTs(const Text& tableName, const std::vector & rowBatches, const int64_t timestamp, const std::map & attributes) { + size_t sz = ifaces_.size(); + size_t i = 0; + for (; i < (sz - 1); ++i) { + ifaces_[i]->mutateRowsTs(tableName, rowBatches, timestamp, attributes); + } + ifaces_[i]->mutateRowsTs(tableName, rowBatches, timestamp, attributes); + } + + int64_t atomicIncrement(const Text& tableName, const Text& row, const Text& column, const int64_t value) { + size_t sz = ifaces_.size(); + size_t i = 0; + for (; i < (sz - 1); ++i) { + ifaces_[i]->atomicIncrement(tableName, row, column, value); + } + return ifaces_[i]->atomicIncrement(tableName, row, column, value); + } + + void deleteAll(const Text& tableName, const Text& row, const Text& column, const std::map & attributes) { + size_t sz = ifaces_.size(); + size_t i = 0; + for (; i < (sz - 1); ++i) { + ifaces_[i]->deleteAll(tableName, row, column, attributes); + } + ifaces_[i]->deleteAll(tableName, row, column, attributes); + } + + void deleteAllTs(const Text& tableName, const Text& row, const Text& column, const int64_t timestamp, const std::map & attributes) { + size_t sz = ifaces_.size(); + size_t i = 0; + for (; i < (sz - 1); ++i) { + ifaces_[i]->deleteAllTs(tableName, row, column, timestamp, attributes); + } + ifaces_[i]->deleteAllTs(tableName, row, column, timestamp, attributes); + } + + void deleteAllRow(const Text& tableName, const Text& row, const std::map & attributes) { + size_t sz = ifaces_.size(); + size_t i = 0; + for (; i < (sz - 1); ++i) { + ifaces_[i]->deleteAllRow(tableName, row, attributes); + } + ifaces_[i]->deleteAllRow(tableName, row, attributes); + } + + void increment(const TIncrement& increment) { + size_t sz = ifaces_.size(); + size_t i = 0; + for (; i < (sz - 1); ++i) { + ifaces_[i]->increment(increment); + } + ifaces_[i]->increment(increment); + } + + void incrementRows(const std::vector & increments) { + size_t sz = ifaces_.size(); + size_t i = 0; + for (; i < (sz - 1); ++i) { + ifaces_[i]->incrementRows(increments); + } + ifaces_[i]->incrementRows(increments); + } + + void deleteAllRowTs(const Text& tableName, const Text& row, const int64_t timestamp, const std::map & attributes) { + size_t sz = ifaces_.size(); + size_t i = 0; + for (; i < (sz - 1); ++i) { + ifaces_[i]->deleteAllRowTs(tableName, row, timestamp, attributes); + } + ifaces_[i]->deleteAllRowTs(tableName, row, timestamp, attributes); + } + + ScannerID scannerOpenWithScan(const Text& tableName, const TScan& scan, const std::map & attributes) { + size_t sz = ifaces_.size(); + size_t i = 0; + for (; i < (sz - 1); ++i) { + ifaces_[i]->scannerOpenWithScan(tableName, scan, attributes); + } + return ifaces_[i]->scannerOpenWithScan(tableName, scan, attributes); + } + + ScannerID scannerOpen(const Text& tableName, const Text& startRow, const std::vector & columns, const std::map & attributes) { + size_t sz = ifaces_.size(); + size_t i = 0; + for (; i < (sz - 1); ++i) { + ifaces_[i]->scannerOpen(tableName, startRow, columns, attributes); + } + return ifaces_[i]->scannerOpen(tableName, startRow, columns, attributes); + } + + ScannerID scannerOpenWithStop(const Text& tableName, const Text& startRow, const Text& stopRow, const std::vector & columns, const std::map & attributes) { + size_t sz = ifaces_.size(); + size_t i = 0; + for (; i < (sz - 1); ++i) { + ifaces_[i]->scannerOpenWithStop(tableName, startRow, stopRow, columns, attributes); + } + return ifaces_[i]->scannerOpenWithStop(tableName, startRow, stopRow, columns, attributes); + } + + ScannerID scannerOpenWithPrefix(const Text& tableName, const Text& startAndPrefix, const std::vector & columns, const std::map & attributes) { + size_t sz = ifaces_.size(); + size_t i = 0; + for (; i < (sz - 1); ++i) { + ifaces_[i]->scannerOpenWithPrefix(tableName, startAndPrefix, columns, attributes); + } + return ifaces_[i]->scannerOpenWithPrefix(tableName, startAndPrefix, columns, attributes); + } + + ScannerID scannerOpenTs(const Text& tableName, const Text& startRow, const std::vector & columns, const int64_t timestamp, const std::map & attributes) { + size_t sz = ifaces_.size(); + size_t i = 0; + for (; i < (sz - 1); ++i) { + ifaces_[i]->scannerOpenTs(tableName, startRow, columns, timestamp, attributes); + } + return ifaces_[i]->scannerOpenTs(tableName, startRow, columns, timestamp, attributes); + } + + ScannerID scannerOpenWithStopTs(const Text& tableName, const Text& startRow, const Text& stopRow, const std::vector & columns, const int64_t timestamp, const std::map & attributes) { + size_t sz = ifaces_.size(); + size_t i = 0; + for (; i < (sz - 1); ++i) { + ifaces_[i]->scannerOpenWithStopTs(tableName, startRow, stopRow, columns, timestamp, attributes); + } + return ifaces_[i]->scannerOpenWithStopTs(tableName, startRow, stopRow, columns, timestamp, attributes); + } + + void scannerGet(std::vector & _return, const ScannerID id) { + size_t sz = ifaces_.size(); + size_t i = 0; + for (; i < (sz - 1); ++i) { + ifaces_[i]->scannerGet(_return, id); + } + ifaces_[i]->scannerGet(_return, id); + return; + } + + void scannerGetList(std::vector & _return, const ScannerID id, const int32_t nbRows) { + size_t sz = ifaces_.size(); + size_t i = 0; + for (; i < (sz - 1); ++i) { + ifaces_[i]->scannerGetList(_return, id, nbRows); + } + ifaces_[i]->scannerGetList(_return, id, nbRows); + return; + } + + void scannerClose(const ScannerID id) { + size_t sz = ifaces_.size(); + size_t i = 0; + for (; i < (sz - 1); ++i) { + ifaces_[i]->scannerClose(id); + } + ifaces_[i]->scannerClose(id); + } + + void getRowOrBefore(std::vector & _return, const Text& tableName, const Text& row, const Text& family) { + size_t sz = ifaces_.size(); + size_t i = 0; + for (; i < (sz - 1); ++i) { + ifaces_[i]->getRowOrBefore(_return, tableName, row, family); + } + ifaces_[i]->getRowOrBefore(_return, tableName, row, family); + return; + } + + void getRegionInfo(TRegionInfo& _return, const Text& row) { + size_t sz = ifaces_.size(); + size_t i = 0; + for (; i < (sz - 1); ++i) { + ifaces_[i]->getRegionInfo(_return, row); + } + ifaces_[i]->getRegionInfo(_return, row); + return; + } + +}; + +}}}} // namespace + +#endif diff --git a/code/sys_nicmonitor/include/db_com/Hbase_constants.h b/code/sys_nicmonitor/include/db_com/Hbase_constants.h new file mode 100644 index 0000000..d55f33f --- /dev/null +++ b/code/sys_nicmonitor/include/db_com/Hbase_constants.h @@ -0,0 +1,24 @@ +/** + * Autogenerated by Thrift Compiler (0.9.0) + * + * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING + * @generated + */ +#ifndef Hbase_CONSTANTS_H +#define Hbase_CONSTANTS_H + +#include "Hbase_types.h" + +namespace apache { namespace hadoop { namespace hbase { namespace thrift { + +class HbaseConstants { + public: + HbaseConstants(); + +}; + +extern const HbaseConstants g_Hbase_constants; + +}}}} // namespace + +#endif diff --git a/code/sys_nicmonitor/include/db_com/Hbase_types.h b/code/sys_nicmonitor/include/db_com/Hbase_types.h new file mode 100644 index 0000000..ae33c22 --- /dev/null +++ b/code/sys_nicmonitor/include/db_com/Hbase_types.h @@ -0,0 +1,742 @@ +/** + * Autogenerated by Thrift Compiler (0.9.0) + * + * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING + * @generated + */ +#ifndef Hbase_TYPES_H +#define Hbase_TYPES_H + +#include +#include +#include +#include + + + +namespace apache { namespace hadoop { namespace hbase { namespace thrift { + +typedef std::string Text; + +typedef std::string Bytes; + +typedef int32_t ScannerID; + +typedef struct _TCell__isset { + _TCell__isset() : value(false), timestamp(false) {} + bool value; + bool timestamp; +} _TCell__isset; + +class TCell { + public: + + static const char* ascii_fingerprint; // = "1CCCF6FC31CFD1D61BBBB1BAF3590620"; + static const uint8_t binary_fingerprint[16]; // = {0x1C,0xCC,0xF6,0xFC,0x31,0xCF,0xD1,0xD6,0x1B,0xBB,0xB1,0xBA,0xF3,0x59,0x06,0x20}; + + TCell() : value(), timestamp(0) { + } + + virtual ~TCell() throw() {} + + Bytes value; + int64_t timestamp; + + _TCell__isset __isset; + + void __set_value(const Bytes& val) { + value = val; + } + + void __set_timestamp(const int64_t val) { + timestamp = val; + } + + bool operator == (const TCell & rhs) const + { + if (!(value == rhs.value)) + return false; + if (!(timestamp == rhs.timestamp)) + return false; + return true; + } + bool operator != (const TCell &rhs) const { + return !(*this == rhs); + } + + bool operator < (const TCell & ) const; + + uint32_t read(::apache::thrift::protocol::TProtocol* iprot); + uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const; + +}; + +void swap(TCell &a, TCell &b); + +typedef struct _ColumnDescriptor__isset { + _ColumnDescriptor__isset() : name(false), maxVersions(true), compression(true), inMemory(true), bloomFilterType(true), bloomFilterVectorSize(true), bloomFilterNbHashes(true), blockCacheEnabled(true), timeToLive(true) {} + bool name; + bool maxVersions; + bool compression; + bool inMemory; + bool bloomFilterType; + bool bloomFilterVectorSize; + bool bloomFilterNbHashes; + bool blockCacheEnabled; + bool timeToLive; +} _ColumnDescriptor__isset; + +class ColumnDescriptor { + public: + + static const char* ascii_fingerprint; // = "3B18638852FDF9DD911BC1174265F92E"; + static const uint8_t binary_fingerprint[16]; // = {0x3B,0x18,0x63,0x88,0x52,0xFD,0xF9,0xDD,0x91,0x1B,0xC1,0x17,0x42,0x65,0xF9,0x2E}; + + ColumnDescriptor() : name(), maxVersions(3), compression("NONE"), inMemory(false), bloomFilterType("NONE"), bloomFilterVectorSize(0), bloomFilterNbHashes(0), blockCacheEnabled(false), timeToLive(-1) { + } + + virtual ~ColumnDescriptor() throw() {} + + Text name; + int32_t maxVersions; + std::string compression; + bool inMemory; + std::string bloomFilterType; + int32_t bloomFilterVectorSize; + int32_t bloomFilterNbHashes; + bool blockCacheEnabled; + int32_t timeToLive; + + _ColumnDescriptor__isset __isset; + + void __set_name(const Text& val) { + name = val; + } + + void __set_maxVersions(const int32_t val) { + maxVersions = val; + } + + void __set_compression(const std::string& val) { + compression = val; + } + + void __set_inMemory(const bool val) { + inMemory = val; + } + + void __set_bloomFilterType(const std::string& val) { + bloomFilterType = val; + } + + void __set_bloomFilterVectorSize(const int32_t val) { + bloomFilterVectorSize = val; + } + + void __set_bloomFilterNbHashes(const int32_t val) { + bloomFilterNbHashes = val; + } + + void __set_blockCacheEnabled(const bool val) { + blockCacheEnabled = val; + } + + void __set_timeToLive(const int32_t val) { + timeToLive = val; + } + + bool operator == (const ColumnDescriptor & rhs) const + { + if (!(name == rhs.name)) + return false; + if (!(maxVersions == rhs.maxVersions)) + return false; + if (!(compression == rhs.compression)) + return false; + if (!(inMemory == rhs.inMemory)) + return false; + if (!(bloomFilterType == rhs.bloomFilterType)) + return false; + if (!(bloomFilterVectorSize == rhs.bloomFilterVectorSize)) + return false; + if (!(bloomFilterNbHashes == rhs.bloomFilterNbHashes)) + return false; + if (!(blockCacheEnabled == rhs.blockCacheEnabled)) + return false; + if (!(timeToLive == rhs.timeToLive)) + return false; + return true; + } + bool operator != (const ColumnDescriptor &rhs) const { + return !(*this == rhs); + } + + bool operator < (const ColumnDescriptor & ) const; + + uint32_t read(::apache::thrift::protocol::TProtocol* iprot); + uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const; + +}; + +void swap(ColumnDescriptor &a, ColumnDescriptor &b); + +typedef struct _TRegionInfo__isset { + _TRegionInfo__isset() : startKey(false), endKey(false), id(false), name(false), version(false), serverName(false), port(false) {} + bool startKey; + bool endKey; + bool id; + bool name; + bool version; + bool serverName; + bool port; +} _TRegionInfo__isset; + +class TRegionInfo { + public: + + static const char* ascii_fingerprint; // = "B58AB7A239831F8614F7B6709C89DC7B"; + static const uint8_t binary_fingerprint[16]; // = {0xB5,0x8A,0xB7,0xA2,0x39,0x83,0x1F,0x86,0x14,0xF7,0xB6,0x70,0x9C,0x89,0xDC,0x7B}; + + TRegionInfo() : startKey(), endKey(), id(0), name(), version(0), serverName(), port(0) { + } + + virtual ~TRegionInfo() throw() {} + + Text startKey; + Text endKey; + int64_t id; + Text name; + int8_t version; + Text serverName; + int32_t port; + + _TRegionInfo__isset __isset; + + void __set_startKey(const Text& val) { + startKey = val; + } + + void __set_endKey(const Text& val) { + endKey = val; + } + + void __set_id(const int64_t val) { + id = val; + } + + void __set_name(const Text& val) { + name = val; + } + + void __set_version(const int8_t val) { + version = val; + } + + void __set_serverName(const Text& val) { + serverName = val; + } + + void __set_port(const int32_t val) { + port = val; + } + + bool operator == (const TRegionInfo & rhs) const + { + if (!(startKey == rhs.startKey)) + return false; + if (!(endKey == rhs.endKey)) + return false; + if (!(id == rhs.id)) + return false; + if (!(name == rhs.name)) + return false; + if (!(version == rhs.version)) + return false; + if (!(serverName == rhs.serverName)) + return false; + if (!(port == rhs.port)) + return false; + return true; + } + bool operator != (const TRegionInfo &rhs) const { + return !(*this == rhs); + } + + bool operator < (const TRegionInfo & ) const; + + uint32_t read(::apache::thrift::protocol::TProtocol* iprot); + uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const; + +}; + +void swap(TRegionInfo &a, TRegionInfo &b); + +typedef struct _Mutation__isset { + _Mutation__isset() : isDelete(true), column(false), value(false), writeToWAL(true) {} + bool isDelete; + bool column; + bool value; + bool writeToWAL; +} _Mutation__isset; + +class Mutation { + public: + + static const char* ascii_fingerprint; // = "CD9E9D4A6406AD402C90440434AE18A0"; + static const uint8_t binary_fingerprint[16]; // = {0xCD,0x9E,0x9D,0x4A,0x64,0x06,0xAD,0x40,0x2C,0x90,0x44,0x04,0x34,0xAE,0x18,0xA0}; + + Mutation() : isDelete(false), column(), value(), writeToWAL(true) { + } + + virtual ~Mutation() throw() {} + + bool isDelete; + Text column; + Text value; + bool writeToWAL; + + _Mutation__isset __isset; + + void __set_isDelete(const bool val) { + isDelete = val; + } + + void __set_column(const Text& val) { + column = val; + } + + void __set_value(const Text& val) { + value = val; + } + + void __set_writeToWAL(const bool val) { + writeToWAL = val; + } + + bool operator == (const Mutation & rhs) const + { + if (!(isDelete == rhs.isDelete)) + return false; + if (!(column == rhs.column)) + return false; + if (!(value == rhs.value)) + return false; + if (!(writeToWAL == rhs.writeToWAL)) + return false; + return true; + } + bool operator != (const Mutation &rhs) const { + return !(*this == rhs); + } + + bool operator < (const Mutation & ) const; + + uint32_t read(::apache::thrift::protocol::TProtocol* iprot); + uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const; + +}; + +void swap(Mutation &a, Mutation &b); + +typedef struct _BatchMutation__isset { + _BatchMutation__isset() : row(false), mutations(false) {} + bool row; + bool mutations; +} _BatchMutation__isset; + +class BatchMutation { + public: + + static const char* ascii_fingerprint; // = "4B8A4A9E051CAFF532E1C0D54F6AD2AB"; + static const uint8_t binary_fingerprint[16]; // = {0x4B,0x8A,0x4A,0x9E,0x05,0x1C,0xAF,0xF5,0x32,0xE1,0xC0,0xD5,0x4F,0x6A,0xD2,0xAB}; + + BatchMutation() : row() { + } + + virtual ~BatchMutation() throw() {} + + Text row; + std::vector mutations; + + _BatchMutation__isset __isset; + + void __set_row(const Text& val) { + row = val; + } + + void __set_mutations(const std::vector & val) { + mutations = val; + } + + bool operator == (const BatchMutation & rhs) const + { + if (!(row == rhs.row)) + return false; + if (!(mutations == rhs.mutations)) + return false; + return true; + } + bool operator != (const BatchMutation &rhs) const { + return !(*this == rhs); + } + + bool operator < (const BatchMutation & ) const; + + uint32_t read(::apache::thrift::protocol::TProtocol* iprot); + uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const; + +}; + +void swap(BatchMutation &a, BatchMutation &b); + +typedef struct _TIncrement__isset { + _TIncrement__isset() : table(false), row(false), column(false), ammount(false) {} + bool table; + bool row; + bool column; + bool ammount; +} _TIncrement__isset; + +class TIncrement { + public: + + static const char* ascii_fingerprint; // = "5F9965D46A4F3845985AC0F9B81C3C69"; + static const uint8_t binary_fingerprint[16]; // = {0x5F,0x99,0x65,0xD4,0x6A,0x4F,0x38,0x45,0x98,0x5A,0xC0,0xF9,0xB8,0x1C,0x3C,0x69}; + + TIncrement() : table(), row(), column(), ammount(0) { + } + + virtual ~TIncrement() throw() {} + + Text table; + Text row; + Text column; + int64_t ammount; + + _TIncrement__isset __isset; + + void __set_table(const Text& val) { + table = val; + } + + void __set_row(const Text& val) { + row = val; + } + + void __set_column(const Text& val) { + column = val; + } + + void __set_ammount(const int64_t val) { + ammount = val; + } + + bool operator == (const TIncrement & rhs) const + { + if (!(table == rhs.table)) + return false; + if (!(row == rhs.row)) + return false; + if (!(column == rhs.column)) + return false; + if (!(ammount == rhs.ammount)) + return false; + return true; + } + bool operator != (const TIncrement &rhs) const { + return !(*this == rhs); + } + + bool operator < (const TIncrement & ) const; + + uint32_t read(::apache::thrift::protocol::TProtocol* iprot); + uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const; + +}; + +void swap(TIncrement &a, TIncrement &b); + +typedef struct _TRowResult__isset { + _TRowResult__isset() : row(false), columns(false) {} + bool row; + bool columns; +} _TRowResult__isset; + +class TRowResult { + public: + + static const char* ascii_fingerprint; // = "AE98EA4F344566FAFE04FA5E5823D1ED"; + static const uint8_t binary_fingerprint[16]; // = {0xAE,0x98,0xEA,0x4F,0x34,0x45,0x66,0xFA,0xFE,0x04,0xFA,0x5E,0x58,0x23,0xD1,0xED}; + + TRowResult() : row() { + } + + virtual ~TRowResult() throw() {} + + Text row; + std::map columns; + + _TRowResult__isset __isset; + + void __set_row(const Text& val) { + row = val; + } + + void __set_columns(const std::map & val) { + columns = val; + } + + bool operator == (const TRowResult & rhs) const + { + if (!(row == rhs.row)) + return false; + if (!(columns == rhs.columns)) + return false; + return true; + } + bool operator != (const TRowResult &rhs) const { + return !(*this == rhs); + } + + bool operator < (const TRowResult & ) const; + + uint32_t read(::apache::thrift::protocol::TProtocol* iprot); + uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const; + +}; + +void swap(TRowResult &a, TRowResult &b); + +typedef struct _TScan__isset { + _TScan__isset() : startRow(false), stopRow(false), timestamp(false), columns(false), caching(false), filterString(false) {} + bool startRow; + bool stopRow; + bool timestamp; + bool columns; + bool caching; + bool filterString; +} _TScan__isset; + +class TScan { + public: + + static const char* ascii_fingerprint; // = "2C111FDF8CD162886ECCCBB9C9051083"; + static const uint8_t binary_fingerprint[16]; // = {0x2C,0x11,0x1F,0xDF,0x8C,0xD1,0x62,0x88,0x6E,0xCC,0xCB,0xB9,0xC9,0x05,0x10,0x83}; + + TScan() : startRow(), stopRow(), timestamp(0), caching(0), filterString() { + } + + virtual ~TScan() throw() {} + + Text startRow; + Text stopRow; + int64_t timestamp; + std::vector columns; + int32_t caching; + Text filterString; + + _TScan__isset __isset; + + void __set_startRow(const Text& val) { + startRow = val; + __isset.startRow = true; + } + + void __set_stopRow(const Text& val) { + stopRow = val; + __isset.stopRow = true; + } + + void __set_timestamp(const int64_t val) { + timestamp = val; + __isset.timestamp = true; + } + + void __set_columns(const std::vector & val) { + columns = val; + __isset.columns = true; + } + + void __set_caching(const int32_t val) { + caching = val; + __isset.caching = true; + } + + void __set_filterString(const Text& val) { + filterString = val; + __isset.filterString = true; + } + + bool operator == (const TScan & rhs) const + { + if (__isset.startRow != rhs.__isset.startRow) + return false; + else if (__isset.startRow && !(startRow == rhs.startRow)) + return false; + if (__isset.stopRow != rhs.__isset.stopRow) + return false; + else if (__isset.stopRow && !(stopRow == rhs.stopRow)) + return false; + if (__isset.timestamp != rhs.__isset.timestamp) + return false; + else if (__isset.timestamp && !(timestamp == rhs.timestamp)) + return false; + if (__isset.columns != rhs.__isset.columns) + return false; + else if (__isset.columns && !(columns == rhs.columns)) + return false; + if (__isset.caching != rhs.__isset.caching) + return false; + else if (__isset.caching && !(caching == rhs.caching)) + return false; + if (__isset.filterString != rhs.__isset.filterString) + return false; + else if (__isset.filterString && !(filterString == rhs.filterString)) + return false; + return true; + } + bool operator != (const TScan &rhs) const { + return !(*this == rhs); + } + + bool operator < (const TScan & ) const; + + uint32_t read(::apache::thrift::protocol::TProtocol* iprot); + uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const; + +}; + +void swap(TScan &a, TScan &b); + +typedef struct _IOError__isset { + _IOError__isset() : message(false) {} + bool message; +} _IOError__isset; + +class IOError : public ::apache::thrift::TException { + public: + + static const char* ascii_fingerprint; // = "EFB929595D312AC8F305D5A794CFEDA1"; + static const uint8_t binary_fingerprint[16]; // = {0xEF,0xB9,0x29,0x59,0x5D,0x31,0x2A,0xC8,0xF3,0x05,0xD5,0xA7,0x94,0xCF,0xED,0xA1}; + + IOError() : message() { + } + + virtual ~IOError() throw() {} + + std::string message; + + _IOError__isset __isset; + + void __set_message(const std::string& val) { + message = val; + } + + bool operator == (const IOError & rhs) const + { + if (!(message == rhs.message)) + return false; + return true; + } + bool operator != (const IOError &rhs) const { + return !(*this == rhs); + } + + bool operator < (const IOError & ) const; + + uint32_t read(::apache::thrift::protocol::TProtocol* iprot); + uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const; + +}; + +void swap(IOError &a, IOError &b); + +typedef struct _IllegalArgument__isset { + _IllegalArgument__isset() : message(false) {} + bool message; +} _IllegalArgument__isset; + +class IllegalArgument : public ::apache::thrift::TException { + public: + + static const char* ascii_fingerprint; // = "EFB929595D312AC8F305D5A794CFEDA1"; + static const uint8_t binary_fingerprint[16]; // = {0xEF,0xB9,0x29,0x59,0x5D,0x31,0x2A,0xC8,0xF3,0x05,0xD5,0xA7,0x94,0xCF,0xED,0xA1}; + + IllegalArgument() : message() { + } + + virtual ~IllegalArgument() throw() {} + + std::string message; + + _IllegalArgument__isset __isset; + + void __set_message(const std::string& val) { + message = val; + } + + bool operator == (const IllegalArgument & rhs) const + { + if (!(message == rhs.message)) + return false; + return true; + } + bool operator != (const IllegalArgument &rhs) const { + return !(*this == rhs); + } + + bool operator < (const IllegalArgument & ) const; + + uint32_t read(::apache::thrift::protocol::TProtocol* iprot); + uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const; + +}; + +void swap(IllegalArgument &a, IllegalArgument &b); + +typedef struct _AlreadyExists__isset { + _AlreadyExists__isset() : message(false) {} + bool message; +} _AlreadyExists__isset; + +class AlreadyExists : public ::apache::thrift::TException { + public: + + static const char* ascii_fingerprint; // = "EFB929595D312AC8F305D5A794CFEDA1"; + static const uint8_t binary_fingerprint[16]; // = {0xEF,0xB9,0x29,0x59,0x5D,0x31,0x2A,0xC8,0xF3,0x05,0xD5,0xA7,0x94,0xCF,0xED,0xA1}; + + AlreadyExists() : message() { + } + + virtual ~AlreadyExists() throw() {} + + std::string message; + + _AlreadyExists__isset __isset; + + void __set_message(const std::string& val) { + message = val; + } + + bool operator == (const AlreadyExists & rhs) const + { + if (!(message == rhs.message)) + return false; + return true; + } + bool operator != (const AlreadyExists &rhs) const { + return !(*this == rhs); + } + + bool operator < (const AlreadyExists & ) const; + + uint32_t read(::apache::thrift::protocol::TProtocol* iprot); + uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const; + +}; + +void swap(AlreadyExists &a, AlreadyExists &b); + +}}}} // namespace + +#endif diff --git a/code/sys_nicmonitor/include/db_com/MyMutex.h b/code/sys_nicmonitor/include/db_com/MyMutex.h new file mode 100644 index 0000000..fcf6e43 --- /dev/null +++ b/code/sys_nicmonitor/include/db_com/MyMutex.h @@ -0,0 +1,32 @@ +// MyMutex.h: interface for the CMyMutex class. +// +////////////////////////////////////////////////////////////////////// + +#if !defined(AFX_MYMUTEX_H__7EF7FB40_63CF_4215_B3BE_899084B79372__INCLUDED_) +#define AFX_MYMUTEX_H__7EF7FB40_63CF_4215_B3BE_899084B79372__INCLUDED_ + +#if _MSC_VER > 1000 +#pragma once +#endif // _MSC_VER > 1000 +#ifdef _WINDOWS64 +#include +#else +#include +#endif +class CMyMutex +{ +public: + bool unlock(); + bool lock(); + CMyMutex(); + virtual ~CMyMutex(); +private: +#ifdef _WINDOWS64 + CRITICAL_SECTION m_mutex; +#else + pthread_mutex_t m_mutex; +#endif + +}; + +#endif // !defined(AFX_MYMUTEX_H__7EF7FB40_63CF_4215_B3BE_899084B79372__INCLUDED_) diff --git a/code/sys_nicmonitor/include/db_com/cross_region_sync_client.h b/code/sys_nicmonitor/include/db_com/cross_region_sync_client.h new file mode 100644 index 0000000..ba40252 --- /dev/null +++ b/code/sys_nicmonitor/include/db_com/cross_region_sync_client.h @@ -0,0 +1,77 @@ +// +// Created by wutao on 2018/8/30. +// + +#ifndef CROSS_REGION_SYNC_CLIENT_H +#define CROSS_REGION_SYNC_CLIENT_H +#include +//#include "servicesclient.h" +#include "system.h" +#include "db_com/sql_sp_m.h" +//#include "sam_service.h" + +#include "servicemanage.h" +#include "sysadm/scn_service.h" +#include "crossRequest.h" + +#ifdef _WINDOWS64 +#ifdef CROSS_REGION_SYNC_CLIENT_EXPORTS +#define CROSS_REGION_SYNC_CLIENT_API __declspec(dllexport) +#else +#define CROSS_REGION_SYNC_CLIENT_API __declspec(dllimport) +#endif +#else +#define CROSS_REGION_SYNC_CLIENT_API +#endif + +#ifndef MAX_PARA_NAME +#define MAX_PARA_NAME 255 +#endif + +using namespace std; +using namespace NS_SYSADMIN; + +class CROSS_REGION_SYNC_CLIENT_API CrossRegionSyncClient +{ +public: + CrossRegionSyncClient(); + ~CrossRegionSyncClient(); + + short ExecuteSql(const char* sql_str, SEQDBErrorStru& out_db_error, bool region = true);//func_no = 1 --> sql_sp_server func_no = 1 + + short SelectSql(const char* sql_str, unsigned int max_result_num, const SEQOutDataTypeStru& out_data_type, TSelectResultStru& out_select_result, SEQDBErrorStru& out_db_error, bool region = true);//func_no = 2 --> sql_sp_server func_no = 2 + + short ExecuteMultiSql(int sql_num, const StrSeq& seq_sql_str, SEQExecMultiResultStru& seq_exec_multi_result, bool region = true);//func_no = 3 --> sql_sp_server func_no = 3 + + short ExecuteSqlSync(const char* sql_str, SEQDBErrorStru& out_db_error, bool is_sync=false);//func_no = 4 --> sql_sp_server func_no = 1 + + short ExecuteMultiSqlSync(int sql_num, const StrSeq& seq_sql_str, SEQExecMultiResultStru& seq_exec_multi_result, bool is_sync = false);//func_no = 5 --> sql_sp_server func_no = 3 + +private: +#ifdef _BIGENDIAN + const unsigned char g_endian = 1; +#else + const unsigned char g_endian = 0; +#endif + DomainInfo m_local_domain_info; + + ServiceInfo m_local_service_info; + + Handle m_handle; + + CDomainInfo m_cross_domain_info; + + int m_division_handle; + int m_is_other_area; + int m_request_timeout; + + int GetDomainConf(const char* domain_tmp); + int SetServiceHost(); +// int GetHostByAppNo(char* host_name, const int app_no, const short context_no); + int GetHostBySubScnName(char * host_name, const char * sub_scn_name, const char * scn_name); + + char m_host_name[64]; + char m_ip_address[64]; +}; + +#endif //CROSS_REGION_SYNC_CLIENT_H diff --git a/code/sys_nicmonitor/include/db_com/database_rep_m.h b/code/sys_nicmonitor/include/db_com/database_rep_m.h new file mode 100644 index 0000000..1a71c95 --- /dev/null +++ b/code/sys_nicmonitor/include/db_com/database_rep_m.h @@ -0,0 +1,53 @@ +//************************************** +// Generated by mcpp translator +// Version 1.2 +//************************************** + +#ifndef __DATABASE_REP_M_H__ +#define __DATABASE_REP_M_H__ + +#include"mcode/mvector.h" +#include"mcode/mstring.h" +#include"mcode/mstream.h" +#include"mcode/mclient.h" +#include"public_m.h" + + +struct TBindRepDataValue +{ + UDataValue data_value; + unsigned short is_null; + void __write(MLang::OutputStream&__os)const; + void __read(MLang::InputStream&__is); +}; +typedef MLang::VECTOR SEQBindRepDataValue; +struct TBindRepParaStru +{ + unsigned short dci_type; + unsigned int data_size; + void __write(MLang::OutputStream&__os)const; + void __read(MLang::InputStream&__is); +}; +typedef MLang::VECTOR SEQBindRepParaStru; +struct TRepBindStru +{ + MLang::STRING sql_str; + unsigned int row_num; + SEQBindRepParaStru seq_bind_para; + SEQBindRepDataValue seq_bind_value; + TRepBindStru(); + TRepBindStru(const TRepBindStru&); + TRepBindStru&operator=(const TRepBindStru&); + void __write(MLang::OutputStream&__os)const; + void __read(MLang::InputStream&__is); +}; +struct TSqlStu +{ + MLang::VECTOR sql_vec; + TSqlStu(); + TSqlStu(const TSqlStu&); + TSqlStu&operator=(const TSqlStu&); + void __write(MLang::OutputStream&__os)const; + void __read(MLang::InputStream&__is); +}; +#endif diff --git a/code/sys_nicmonitor/include/db_com/db_commit_define.h b/code/sys_nicmonitor/include/db_com/db_commit_define.h new file mode 100644 index 0000000..bed524c --- /dev/null +++ b/code/sys_nicmonitor/include/db_com/db_commit_define.h @@ -0,0 +1,40 @@ +#ifndef DB_COMMIT_DEFINE_H +#define DB_COMMIT_DEFINE_H + +#ifndef _WINDOWS64 +#ifdef _ALPHA +#include +#endif +#endif + +#include "paramanage.h" +//#include "sam_service.h" +//#include "sam_common.h" +#include "system.h" + +#include "pub_ctx.h" + +const string DB_SEPARATOR = " ; "; +const string DB_COMMIT_FILE_SEPARATOR = "\n_NARI_DB_COMMIT_\n"; +const string IN_DIR = "/in/"; +const string OUT_DIR = "/out/"; + +const int ANALAY_FILE_ALLOCAT_BYTE = 10240; +const int READ_MAX_SQL_NUM_ONE_TIME = 200; +const int COMMIT_MAX_SQL_NUM_ONE_TIME = 1000; +const int COMMIT_FILE_NUM_ONE_TIME = 10; +const int SCAN_FILE_NUM_ONE_TIME = 1000; +const int MAX_SQL_SIZE = 100000; +const int GET_DB_LOGIN_TIME_INTERVAL = 3; +const int HIGH = 1; +const int MIDDLE = 2; +const int LOW = 3; +const int NO_SQL_DUP = 0; +const int SQL_DUP = 1; +const int MAX_PARA_NAME = 128; + +#ifdef _WIN64 // Windows compatible version +#define strcasecmp _stricmp +#endif + +#endif diff --git a/code/sys_nicmonitor/include/db_com/db_commit_m.h b/code/sys_nicmonitor/include/db_com/db_commit_m.h new file mode 100644 index 0000000..dae6d67 --- /dev/null +++ b/code/sys_nicmonitor/include/db_com/db_commit_m.h @@ -0,0 +1,83 @@ +//************************************** +// Generated by mcpp translator +// Version 1.2 +//************************************** + +#ifndef __DB_COMMIT_M_H__ +#define __DB_COMMIT_M_H__ + +#ifdef _WINDOWS64 +#ifdef DB_COMMIT_DLL_EXPORTS +#define DB_COMMIT_DLL_API __declspec(dllexport) +#else +#define DB_COMMIT_DLL_API __declspec(dllimport) +#endif +#else +#define DB_COMMIT_DLL_API +#endif + +#include"mcode/mvector.h" +#include"mcode/mstring.h" +#include"mcode/mstream.h" +#include"mcode/mclient.h" +#include"public_m.h" + + +typedef CharSeq CommitLOBValueType; +typedef MLang::VECTOR SEQCommitLOBValueType; +struct DB_COMMIT_DLL_API TSqlCommitStru +{ + MLang::VECTOR strSql; + unsigned char uPrior; + TSqlCommitStru(); + TSqlCommitStru(const TSqlCommitStru&); + TSqlCommitStru&operator=(const TSqlCommitStru&); + void __write(MLang::OutputStream&__os)const; + void __read(MLang::InputStream&__is); +}; +typedef MLang::VECTOR SEQ_SQL_COMMIT; +struct DB_COMMIT_DLL_API TCommitStru +{ + SEQ_SQL_COMMIT seqSqlCommit; + TCommitStru(); + TCommitStru(const TCommitStru&); + TCommitStru&operator=(const TCommitStru&); + void __write(MLang::OutputStream&__os)const; + void __read(MLang::InputStream&__is); +}; +struct DB_COMMIT_DLL_API TBindDataValue +{ + UDataValue data_value; + unsigned short is_null; + void __write(MLang::OutputStream&__os)const; + void __read(MLang::InputStream&__is); +}; +typedef MLang::VECTOR SEQBindDataValue; +struct DB_COMMIT_DLL_API TBindCommitParaStru +{ + MLang::STRING col_name; + unsigned short is_where_condition; + unsigned short dci_type; + unsigned int data_size; + TBindCommitParaStru(); + TBindCommitParaStru(const TBindCommitParaStru&); + TBindCommitParaStru&operator=(const TBindCommitParaStru&); + void __write(MLang::OutputStream&__os)const; + void __read(MLang::InputStream&__is); +}; +typedef MLang::VECTOR SEQBindCommitParaStru; +struct DB_COMMIT_DLL_API TCommitBindStru +{ + MLang::STRING table_name; + unsigned int row_num; + unsigned int col_num; + unsigned int op_type; + SEQBindCommitParaStru seq_bind_para; + SEQBindDataValue seq_bind_value; + TCommitBindStru(); + TCommitBindStru(const TCommitBindStru&); + TCommitBindStru&operator=(const TCommitBindStru&); + void __write(MLang::OutputStream&__os)const; + void __read(MLang::InputStream&__is); +}; +#endif diff --git a/code/sys_nicmonitor/include/db_com/db_error_define.h b/code/sys_nicmonitor/include/db_com/db_error_define.h new file mode 100644 index 0000000..cea782f --- /dev/null +++ b/code/sys_nicmonitor/include/db_com/db_error_define.h @@ -0,0 +1,73 @@ +#ifndef __DB_ERROR_DEFINE_H_ +#define __DB_ERROR_DEFINE_H_ + +const int DB_SUCCESS_DEF = 0; +const int DB_FAIL_DEF = -1; +//common +const int DB_MEM_ALLOC_FAIL = -100; //ڴʧ +const int DB_OPEN_FILE_FAIL = -101; //ļʧ +const int DB_READ_FILE_FAIL = -102; //ȡļʧ +const int DB_WRITE_FILE_FAIL = -103; //дļʧ +const int DB_DLE_FILE_FAIL = -104; //ɾļʧ +const int DB_FILE_EMPTY = -105; //ļСΪ0 +const int DB_STRING_LEN_ZERO = -106; //ַΪ0 +const int DB_INVALID_PARA = -107; //Ч +const int DB_SERVICE_REQUEST_FAIL = -108; //ʧ +const int DB_CONNECT_FAIL = -109; //ݿʧ +const int DB_INVALID_FILE_PATHNAME = -130; //ļȫ·Ƹʽ + +const int DB_TABLE_NOT_EXIST = -200; // +const int DB_OPEN_SYSTABLEINFO_FAIL = -201; //ѯϢʧ +const int DB_OPEN_SYSCOLUMNINFO_FAIL = -202; //ѯϢʧ + +const int DB_SQL_PRE_ANALYS_FAIL = -300; //SQL﷨Ԥ +const int DB_GET_ALIGN_RESULT_FAIL = -301; //GetAlignResultClient +const int DB_CALL_SELECTSQL_FAIL = -302; //SelectSql +const int DB_CALL_MODEL_MODIFY_FAIL = -303; //model_modify +const int DB_NO_RECORDS_FAIL = -304; //޷ļ¼ + +//service +const int DB_REQUEST_SERVICE_FAIL = -401; //ȡӦʧ +const int DB_FILESRV_SAVEFILE_FAIL = -402; //ļдļʧ +const int DB_FILESRV_LISTDIR_FAIL = -403; //ļĿ¼ʧ +const int DB_FILESRV_GETFILE_FAIL = -404; //ļļʧ +const int DB_FILESRV_DELFILE_FAIL = -405; //ļɾļʧ + +//download_server +const int DOWNLOAD_APPNO_MISMATCH = -501; //ָӦ + + + +//model_modify +const int DB_MODEL_INVALID_FILENAME = -1001; //ЧĻļ +const int DB_MODEL_INVALID_FILE_FORMAT = -1002; //ЧĻļʽ +const int DB_MODLE_QUERY_TABLEINFO_FAIL = -1003; //ѯϢʧ +const int DB_MODEL_MODIFY_FAIL = -1004; //ģ͸ʧ +const int DB_MODEL_ROLLBACK_FILES_FAIL = -1005; //ȡļбʧ +const int DB_ROLLBACK_FILE_PART_FAIL = -1006; //ļֻʧ +const int DB_ROLLBACK_FILE_ALL_FAIL = -1007; //ļȫʧ +const int DB_MODEL_LOCKED = -1008; //ģͱ +const int DB_GET_APP_ACTIVE_NODES_FAIL = -1009; //ͨϵͳȡӦýڵʧ +const int DB_DY_DOWN_PART_FAIL = -1010; //̬װʧ +const int DB_GET_TRIGGERRELATION_FAIL = -1011; //ȡϵʧ +const int DB_REMOTE_DYDOWNLOAD_FAIL = -1012; //Զ̶̬װʧ +const int DB_SET_EXIST_FLAG_FAIL = -1013; //model_lock_infoexist_flagʶλʧ +const int DB_GET_EXIST_FLAG_FAIL = -1014; //ȡmodel_lock_infoexist_flagʶλʧ +const int DB_EXIST_FLAG = -1015; //model_lock_infoexist_flagʶλѱλ +const int DB_MODIFY_TYPE_DIFF = -1016; //ͬһModifyTableBySqlsжǷҪ֤һ +const int DB_GET_SYS_DIST_INFO_FAIL = -1017; //ȡӦ÷ֲϢʧ +const int DB_GET_APP_ALLTABLES_FAIL = -1018; //ȡӦװϢʧ +const int DB_GET_IDS_FROM_FILE_FAIL = -1019; //ӻļȡ豸ؼʧ +const int DB_MULTI_KEY_ERROR = -1020; //ؼִ +const int DB_GET_STATIC_RULE_FAIL = -1021; //ȡģ;̬ʧ +const int DB_GET_TRIGGERS_INFO_FAIL = -1022; //ȡϢʧ +const int DB_DISABLE_TRIGGERS_FAIL = -1023; //ôʧ +const int DB_ENABLE_TRIGGERS_FAIL = -1024; //ôʧ + +//model_admin +const int MODEL_INVALID_PARA = -2001; //Ч +const int MODEL_DATASRV_SUBAPP_FULL = -2002; //data_srvСӦú +const int MODEL_GET_ALL_MODEL_FAIL = -2003; //ѯеģϢʧ +const int MODEL_MODEL_VER_NOT_FOUND = -2004; //δҵ +const int MODEL_VERSION_USED = -2005; //ģʹ +#endif diff --git a/code/sys_nicmonitor/include/db_com/db_extern.h b/code/sys_nicmonitor/include/db_com/db_extern.h new file mode 100644 index 0000000..02f565e --- /dev/null +++ b/code/sys_nicmonitor/include/db_com/db_extern.h @@ -0,0 +1,53 @@ +//****************************************************************** +// +// AUTHOR : ZhaoTiger +// +// FUNCTION : ݿģҪõȫֱ +// +// TIME : 2003.05.30 +// +// HISTORY : +// Datetime Action Author Reason +// ------------------------------------------------------------------- +// 2003.05.30 Creation ZhaoTiger +// +//****************************************************************** + +#ifndef _DB_EXTERN_H +#define _DB_EXTERN_H + + +#include "DBAccess.h" +#include "CSqlResultAlign.h" +//#include "sam_common.h" +#include "system.h" +#include "db_def/db_define.h" +#include "db_def/db_struct_public.h" +#include "CDbRepSet.h" + +// ͨݿװ࣬DBAccess.hж +extern CDbAccess g_db_access; +extern CDbAccess g_db_access_lob; + +extern CDbAccess g_hisdb_access; +extern CDbAccess g_hisdb_access_lob; + +// ϵͳװ࣬sam_common.hж +//extern CSamPub sysman_class; + +// ȫֱʾǰݿӵƣΪգζûпݿ⣨1+N +extern string g_cur_db_svr_name; + +// ȫֱʾǰݿƣҪʹ +extern string g_cur_db_name; + +// ȫֱʾǰǷڽСڽУݿл0ʾûзڽС +extern int g_serving_num; + +//extern map g_sample_ext_info_map; +extern bool g_has_init_sample_ext_info; + +extern CDbRepSet g_db_rep_set; + +#endif + diff --git a/code/sys_nicmonitor/include/db_com/db_global.h b/code/sys_nicmonitor/include/db_com/db_global.h new file mode 100644 index 0000000..7783d21 --- /dev/null +++ b/code/sys_nicmonitor/include/db_com/db_global.h @@ -0,0 +1,51 @@ +//****************************************************************** +// +// AUTHOR : ZhaoTiger +// +// FUNCTION : ݿģҪõȫֱ +// +// TIME : 2003.05.30 +// +// HISTORY : +// Datetime Action Author Reason +// ------------------------------------------------------------------- +// 2003.05.30 Creation ZhaoTiger +// +//****************************************************************** + +#ifndef _DB_GLOBAL_H +#define _DB_GLOBAL_H + +#include "DBAccess.h" +#include "CSqlResultAlign.h" +//#include "sam_common.h" +#include "system.h" +#include "db_def/db_define.h" +#include "db_def/db_struct_public.h" +#include "CDbRepSet.h" +// ͨݿװ࣬DBAccess.hж +CDbAccess g_db_access; +CDbAccess g_db_access_lob; + +CDbAccess g_hisdb_access; +CDbAccess g_hisdb_access_lob; + +// ϵͳװ࣬sam_common.hж +//CSamPub sysman_class; + +// ȫֱʾǰݿӵƣΪգζûпݿ⣨1+N +string g_cur_db_svr_name; + +// ȫֱʾǰݿƣҪʹ +string g_cur_db_name; + +// ȫֱʾǰǷڽСڽУݿл0ʾûзڽС +int g_serving_num; + +//map g_sample_ext_info_map; +bool g_has_init_sample_ext_info; + +CDbRepSet g_db_rep_set; + +#endif + diff --git a/code/sys_nicmonitor/include/db_com/db_micro_define.h b/code/sys_nicmonitor/include/db_com/db_micro_define.h new file mode 100644 index 0000000..5df8d4e --- /dev/null +++ b/code/sys_nicmonitor/include/db_com/db_micro_define.h @@ -0,0 +1,11 @@ +#ifndef __DB_MICRO_DEFINE_H_ +#define __DB_MICRO_DEFINE_H_ + +//db_commit +const int DB_COMMIT_SAMPLE = 1; //ͨdb_commitύ +const int DB_COMMIT_SCADA = 2; //ͨdb_commitύSCADA +const int DB_COMMIT_ALARM = 3; //ͨdb_commitύ澯 + +//model_admin +const string MODEL_ADMIN_FILES_HOME = "fileserv/model_admin"; +#endif diff --git a/code/sys_nicmonitor/include/db_com/db_monitor_define.h b/code/sys_nicmonitor/include/db_com/db_monitor_define.h new file mode 100644 index 0000000..db961ee --- /dev/null +++ b/code/sys_nicmonitor/include/db_com/db_monitor_define.h @@ -0,0 +1,148 @@ +#ifndef _DB_MONITOR_DEFINE_H_ +#define _DB_MONITOR_DEFINE_H_ + +#ifndef _WINDOWS64 +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#endif + +#ifndef _WINDOWS64 +#ifdef _ALPHA +#include +#endif +#endif + +#include "paramanage.h" +#include "sysadm/scn_service.h" +#include "system.h" + +#ifndef _LOCAL +#include "db_com/CDbMonitorClient.h" +#endif + +#include "db_com/wholepubtools.h" +#include "pub.h" + +using namespace std; + +const string DB_MONITOR_PROCESS = "db_monitor"; +const string DB_REPLICATE_PROCESS = "database_replicate"; +const string DB_WARN_SERVER_PROCESS = "db_warn_server"; + +#ifndef _WINDOWS64 +const int MASTER_DB_SEM_KEY = 0x1950; +const int DB_NUM_KEY = 0x1951; +const int DB_SERVICE_INFO_SEM_KEY = 0x1952; +const int FILE_SEM_KEY = 0x1953; +const int RIGHT_LOGIN_SEM_KEY = 0x1954; +const int DB_MONITOR_SHM_KEY = 0x200; +#else +const string MASTER_DB_SEM_KEY = "MASTER_DB_SEM_NAME"; +const string DB_NUM_KEY = "DB_NUM_NAME"; +const string DB_SERVICE_INFO_SEM_KEY = "DB_SERVICE_INFO_SEM_NAME"; +const string FILE_SEM_KEY = "FILE_SEM_NAME"; +const string RIGHT_LOGIN_SEM_KEY = "RIGHT_LOGIN_SEM_NAME"; +const string DB_MONITOR_SHM_KEY = "db_monitor.dat"; +#endif +const int DB_MONITOR_SHM_SIZE = 10*1024; +const int DB_SEM_INIT_VAL = 1; +const int MAX_DB_PARA_NAME = 64; +const int READ_DB_CONFIG_INFO_TIME_INTERVAL = 3600*6; + +//Ӧø״̬Ķ +const int APP_STATUS_DUTY = 1; +const int APP_STATUS_STANDBY = 0; +const int APP_STATUS_OTHER = -1; + +const string DEFAULT_DB_SERVICE_PROCESS = "db_commit download_server sql_sp_server query_sample_server sample_data_server sample_modify_server sample_define_server model_modify midhs db_warn_server query_stat_server sample_day_statics_server"; + +const int MAX_REP1_STUB_NUM = 0; + +typedef struct LoginInfoStru +{ + char db_service_name[MAX_DB_PARA_NAME]; + char user_name[MAX_DB_PARA_NAME]; + char user_password[MAX_DB_PARA_NAME]; + char db_service_machine[MAX_DB_PARA_NAME]; + char db_name[MAX_DB_PARA_NAME]; + char db_service_describe[3*MAX_DB_PARA_NAME]; + bool is_switch; + int db_host_prior; + short db_login_status; + char db_err[5*MAX_DB_PARA_NAME]; //ݿϢ + int db_cur_time; //ʱʱ + int direct_access; //ǷΪֱӵݿ 0 1 + bool is_sample_db; //ǷΪ洢 0 1 + + + struct LoginInfoStru & operator= (const struct LoginInfoStru &login_stru) + { + if( this == &login_stru) + { + return *this; + } + + strcpy(db_service_name , login_stru.db_service_name ); + strcpy(user_name , login_stru.user_name); + strcpy(user_password , login_stru.user_password ); + strcpy(db_service_machine , login_stru.db_service_machine); + strcpy(db_name , login_stru.db_name); + strcpy(db_service_describe , login_stru.db_service_describe ); + is_switch = login_stru.is_switch; + db_host_prior = login_stru.db_host_prior; + db_login_status = login_stru.db_login_status; + strcpy(db_err , login_stru.db_err); + db_cur_time = login_stru.db_cur_time; + direct_access = login_stru.direct_access; + is_sample_db = login_stru.is_sample_db; + return *this; + } +}TLoginInfo; + +struct TLoginUserInfo +{ + char user_name[MAX_DB_PARA_NAME]; + char user_password[MAX_DB_PARA_NAME]; + char db_name[MAX_DB_PARA_NAME]; + struct TLoginUserInfo & operator= (const struct TLoginUserInfo &userinfo_stru) + { + if( this == &userinfo_stru) + { + return *this; + } + strcpy(user_name , userinfo_stru.user_name); + strcpy(user_password , userinfo_stru.user_password ); + strcpy(db_name , userinfo_stru.db_name); + return *this; + } +}; +#endif diff --git a/code/sys_nicmonitor/include/db_com/db_monitor_define.h.old b/code/sys_nicmonitor/include/db_com/db_monitor_define.h.old new file mode 100644 index 0000000..a8131a8 --- /dev/null +++ b/code/sys_nicmonitor/include/db_com/db_monitor_define.h.old @@ -0,0 +1,145 @@ +#ifndef _DB_MONITOR_DEFINE_H_ +#define _DB_MONITOR_DEFINE_H_ + +#ifndef _WINDOWS64 +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#endif + +#ifndef _WINDOWS64 +#ifdef _ALPHA +#include +#endif +#endif + +#include "paramanage.h" +//#include "sam_service.h" +#include "system.h" + +#ifndef _LOCAL +#include "db_com/CDbMonitorClient.h" +#endif + +#include "db_com/wholepubtools.h" +#include "pub.h" + +using namespace std; + +const string DB_MONITOR_PROCESS = "db_monitor"; +const string DB_REPLICATE_PROCESS = "database_replicate"; +const string DB_WARN_SERVER_PROCESS = "db_warn_server"; +#ifndef _WINDOWS64 +const int MASTER_DB_SEM_KEY = 0x1950; +const int DB_NUM_KEY = 0x1951; +const int DB_SERVICE_INFO_SEM_KEY = 0x1952; +const int FILE_SEM_KEY = 0x1953; +const int RIGHT_LOGIN_SEM_KEY = 0x1954; +const int DB_MONITOR_SHM_KEY = 0x200; +#else +const string MASTER_DB_SEM_KEY = "MASTER_DB_SEM_NAME"; +const string DB_NUM_KEY = "DB_NUM_NAME"; +const string DB_SERVICE_INFO_SEM_KEY = "DB_SERVICE_INFO_SEM_NAME"; +const string FILE_SEM_KEY = "FILE_SEM_NAME"; +const string RIGHT_LOGIN_SEM_KEY = "RIGHT_LOGIN_SEM_NAME"; +const string DB_MONITOR_SHM_KEY = "db_monitor.dat"; +#endif +const int DB_MONITOR_SHM_SIZE = 10*1024; +const int DB_SEM_INIT_VAL = 1; +const int MAX_DB_PARA_NAME = 64; +const int READ_DB_CONFIG_INFO_TIME_INTERVAL = 3600*6; + +//Ӧø״̬Ķ +const int APP_STATUS_DUTY = 1; +const int APP_STATUS_STANDBY = 0; +const int APP_STATUS_OTHER = -1; + +const string DEFAULT_DB_SERVICE_PROCESS = "db_commit,sql_sp_server,query_sample_server,sample_data_server,sample_modify_server,sample_define_server,model_modify"; + +const int MAX_REP1_STUB_NUM = 0; + +typedef struct LoginInfoStru +{ + char db_service_name[MAX_DB_PARA_NAME]; + char user_name[MAX_DB_PARA_NAME]; + char user_password[MAX_DB_PARA_NAME]; + char db_service_machine[MAX_DB_PARA_NAME]; + char db_name[MAX_DB_PARA_NAME]; + char db_service_describe[3*MAX_DB_PARA_NAME]; + bool is_switch; + int db_host_prior; + short db_login_status; + char db_err[5*MAX_DB_PARA_NAME]; //ݿϢ + int db_cur_time; //ʱʱ + int direct_access; //ǷΪֱӵݿ 0 1 + + + struct LoginInfoStru & operator= (const struct LoginInfoStru &login_stru) + { + if( this == &login_stru) + { + return *this; + } + + strcpy(db_service_name , login_stru.db_service_name ); + strcpy(user_name , login_stru.user_name); + strcpy(user_password , login_stru.user_password ); + strcpy(db_service_machine , login_stru.db_service_machine); + strcpy(db_name , login_stru.db_name); + strcpy(db_service_describe , login_stru.db_service_describe ); + is_switch = login_stru.is_switch; + db_host_prior = login_stru.db_host_prior; + db_login_status = login_stru.db_login_status; + strcpy(db_err , login_stru.db_err); + db_cur_time = login_stru.db_cur_time; + direct_access = login_stru.direct_access; + return *this; + } +}TLoginInfo; + +struct TLoginUserInfo +{ + char user_name[MAX_DB_PARA_NAME]; + char user_password[MAX_DB_PARA_NAME]; + char db_name[MAX_DB_PARA_NAME]; + struct TLoginUserInfo & operator= (const struct TLoginUserInfo &userinfo_stru) + { + if( this == &userinfo_stru) + { + return *this; + } + strcpy(user_name , userinfo_stru.user_name); + strcpy(user_password , userinfo_stru.user_password ); + strcpy(db_name , userinfo_stru.db_name); + return *this; + } +}; +#endif diff --git a/code/sys_nicmonitor/include/db_com/db_monitor_extern.h b/code/sys_nicmonitor/include/db_com/db_monitor_extern.h new file mode 100644 index 0000000..f61612c --- /dev/null +++ b/code/sys_nicmonitor/include/db_com/db_monitor_extern.h @@ -0,0 +1,69 @@ +//****************************************************************** +// +// AUTHOR : LMJ +// +// FUNCTION : ݿģҪõȫֱ +// +// TIME : 2003.12.6 +// +// HISTORY : +// Datetime Action Author Reason +// ------------------------------------------------------------------- +// 2003.12.6 Creation LMJ +// +//****************************************************************** + +#ifndef _DB_MONITOR_EXTERN_H_ +#define _DB_MONITOR_EXTERN_H_ +#include "db_monitor_define.h" +#include "CDbMonitorShm.h" + +#ifndef _LOCAL +#include "SaveLog.h" +#endif + +extern string g_process_name_str; + +extern vector g_db_config_info; +extern vector g_db_config_info_ext; + +extern CDbSem g_master_db_sem; +extern CDbSem g_db_num_sem; +extern CDbSem g_db_service_sem; +extern CDbSem g_file_sem; +extern CDbSem g_right_login_sem; + +#ifndef _LOCAL +extern CDbMonitorClient * g_pInterface; +extern CDbMonitorClient * g_pInterface_self; +#endif + +//extern CErrorLog g_error_log; + + +#ifndef _LOCAL +extern string g_error_log_path; +extern SaveLog g_savelog; +#endif + +extern int g_last_search_time; + +extern bool g_b_ent_no_db; +extern char g_home_path[128]; +extern int g_service_status; + +#ifndef _LOCAL +extern bool isExitFlag; +#endif +extern int gGetLogPath(); +extern int gStringComp(char *des,char *src); +extern string gIntToStr(int nVal); +extern int gGetTimeStrBySeconds(time_t nSeconds, string & strTimeValue); +extern int gStringCopy(char *des,const char *src,int max_len); + +extern void gUsleep(const int usec); +extern void printLoginInfo(TLoginInfo & login_info); + +#endif + + diff --git a/code/sys_nicmonitor/include/db_com/db_monitor_global.h b/code/sys_nicmonitor/include/db_com/db_monitor_global.h new file mode 100644 index 0000000..6314fa1 --- /dev/null +++ b/code/sys_nicmonitor/include/db_com/db_monitor_global.h @@ -0,0 +1,67 @@ +//****************************************************************** +// +// AUTHOR : LMJ +// +// FUNCTION : ݿģҪõȫֱ +// +// TIME : 2003.12.6 +// +// HISTORY : +// Datetime Action Author Reason +// ------------------------------------------------------------------- +// 2003.12.6 Creation LMJ +// +//****************************************************************** + +#ifndef _DB_MONITOR_GLOBAL_H_ +#define _DB_MONITOR_GLOBAL_H_ +#include "db_monitor_define.h" +#include "CDbMonitorShm.h" +#ifndef _LOCAL +#include "SaveLog.h" +#endif + +vector g_db_config_info; +vector g_db_config_info_ext; +vector g_db_name_vec; +vector g_db_node_vec; + +//string g_config_table_str; +string g_process_name_str; + +CDbSem g_master_db_sem; +CDbSem g_db_num_sem; +CDbSem g_db_service_sem; +CDbSem g_file_sem; +CDbSem g_right_login_sem; + +#ifndef _LOCAL +CDbMonitorClient *g_pInterface ; +CDbMonitorClient *g_pInterface_self; +#endif + + +#ifndef _LOCAL +string g_error_log_path; +SaveLog g_savelog; +#endif + +int g_last_search_time; + +bool g_b_ent_no_db; +char g_home_path[128]; +int g_service_status; + +#ifndef _LOCAL +bool isExitFlag; +#endif +int gGetLogPath(); +int gStringComp(char *des,char *src); +string gIntToStr(int nVal); +int gGetTimeStrBySeconds(time_t nSeconds, string & strTimeValue); +int gStringCopy(char *des,const char *src,int max_len); + +void gUsleep(const int usec); +void printLoginInfo(TLoginInfo & login_info); + +#endif diff --git a/code/sys_nicmonitor/include/db_com/db_monitor_m.h b/code/sys_nicmonitor/include/db_com/db_monitor_m.h new file mode 100644 index 0000000..e74dfaa --- /dev/null +++ b/code/sys_nicmonitor/include/db_com/db_monitor_m.h @@ -0,0 +1,57 @@ +//************************************** +// Generated by mcpp translator +// Version 1.3 +//************************************** + +#ifndef __DB_MONITOR_M_H__ +#define __DB_MONITOR_M_H__ + +#include"mcode/mvector.h" +#include"mcode/mstring.h" +#include"mcode/mstream.h" +#include"mcode/mclient.h" + + +typedef MLang::VECTOR StrSeq; +typedef MLang::VECTOR LongSeq; +typedef MLang::VECTOR ShortSeq; +typedef MLang::VECTOR CharSeq; +struct _DbLoginInfo +{ + MLang::STRING user_name; + MLang::STRING user_password; + MLang::STRING db_login_service; + MLang::STRING db_service_machine; + MLang::STRING db_name; + MLang::STRING db_service_describe; + short db_status; + MLang::STRING strError; + bool is_sample_db; + _DbLoginInfo(); + _DbLoginInfo(const _DbLoginInfo&); + _DbLoginInfo&operator=(const _DbLoginInfo&); + void __write(MLang::OutputStream&__os)const; + void __read(MLang::InputStream&__is); +}; +typedef _DbLoginInfo TDbLoginInfo; +typedef MLang::VECTOR SEC_DB_INFO; +struct TDbServiceInfo +{ + SEC_DB_INFO secDbServiceInfo; + TDbServiceInfo(); + TDbServiceInfo(const TDbServiceInfo&); + TDbServiceInfo&operator=(const TDbServiceInfo&); + void __write(MLang::OutputStream&__os)const; + void __read(MLang::InputStream&__is); +}; +typedef MLang::VECTOR SEC_STR_DB_NAME; +struct TDbServiceName +{ + SEC_STR_DB_NAME secDbInfo; + TDbServiceName(); + TDbServiceName(const TDbServiceName&); + TDbServiceName&operator=(const TDbServiceName&); + void __write(MLang::OutputStream&__os)const; + void __read(MLang::InputStream&__is); +}; +#endif diff --git a/code/sys_nicmonitor/include/db_com/db_monitor_m.h.old b/code/sys_nicmonitor/include/db_com/db_monitor_m.h.old new file mode 100644 index 0000000..fe0cf00 --- /dev/null +++ b/code/sys_nicmonitor/include/db_com/db_monitor_m.h.old @@ -0,0 +1,56 @@ +//************************************** +// Generated by mcpp translator +// Version 1.2 +//************************************** + +#ifndef __DB_MONITOR_M_H__ +#define __DB_MONITOR_M_H__ + +#include"mcode/mvector.h" +#include"mcode/mstring.h" +#include"mcode/mstream.h" +#include"mcode/mclient.h" + + +typedef MLang::VECTOR StrSeq; +typedef MLang::VECTOR LongSeq; +typedef MLang::VECTOR ShortSeq; +typedef MLang::VECTOR CharSeq; +struct _DbLoginInfo +{ + MLang::STRING user_name; + MLang::STRING user_password; + MLang::STRING db_login_service; + MLang::STRING db_service_machine; + MLang::STRING db_name; + MLang::STRING db_service_describe; + short db_status; + MLang::STRING strError; + _DbLoginInfo(); + _DbLoginInfo(const _DbLoginInfo&); + _DbLoginInfo&operator=(const _DbLoginInfo&); + void __write(MLang::OutputStream&__os)const; + void __read(MLang::InputStream&__is); +}; +typedef _DbLoginInfo TDbLoginInfo; +typedef MLang::VECTOR SEC_DB_INFO; +struct TDbServiceInfo +{ + SEC_DB_INFO secDbServiceInfo; + TDbServiceInfo(); + TDbServiceInfo(const TDbServiceInfo&); + TDbServiceInfo&operator=(const TDbServiceInfo&); + void __write(MLang::OutputStream&__os)const; + void __read(MLang::InputStream&__is); +}; +typedef MLang::VECTOR SEC_STR_DB_NAME; +struct TDbServiceName +{ + SEC_STR_DB_NAME secDbInfo; + TDbServiceName(); + TDbServiceName(const TDbServiceName&); + TDbServiceName&operator=(const TDbServiceName&); + void __write(MLang::OutputStream&__os)const; + void __read(MLang::InputStream&__is); +}; +#endif diff --git a/code/sys_nicmonitor/include/db_com/db_rep_lib_define.h b/code/sys_nicmonitor/include/db_com/db_rep_lib_define.h new file mode 100644 index 0000000..ef7d2c5 --- /dev/null +++ b/code/sys_nicmonitor/include/db_com/db_rep_lib_define.h @@ -0,0 +1,30 @@ +#ifndef DB_DUP_DEFINE_H +#define DB_DUP_DEFINE_H + +#include "paramanage.h" +#include "system.h" +#include "db_com/wholepubtools.h" + +const string REP_FILE_SEPARATOR = "\n_NARI_D5000_NORMAL_SQL_\n"; +const string REP_IN_DIR_SEPARATOR = "/in/"; +const string REP_OUT_DIR_SEPARATOR = "/out/"; + +const int REP_MAX_FILE_NAME = 255; +const int REP_READ_ALL_DB_NAME_TIME = 20; +const int REP_CHECK_SAVE_RE_COMMIT_DIR_SIZE_TIME_INTERVAL = 60; +const int REP_MAX_SAVE_RECOMMIT_SQL_DIR_SIZE = 1; +const int REP_MAX_PARA_NAME = 128; +const int REP_MAX_PARA_VALUE = 1024; + + +//ZKH ADD FOR LOB REPLICATE +const string LOB_IN_DIR_SEPARATOR = "/lob.in/"; +const string LOB_OUT_DIR_SEPARATOR = "/lob.out/"; +const string LOB_SQL_FLAG = "_NARI_D5000_LOB_SQL_"; +const string LOB_EXECSQL_FLAG = "_NARI_D5000_LOB_EXECSQL_"; + +//add Bind replicate by shihaoqiu 20130313 +const string BIND_IN_DIR_SEPARATOR = "/bind.in/"; +const string BIND_OUT_DIR_SEPARATOR = "/bind.out/"; + +#endif diff --git a/code/sys_nicmonitor/include/db_com/db_stat_m.h b/code/sys_nicmonitor/include/db_com/db_stat_m.h new file mode 100644 index 0000000..aade2c2 --- /dev/null +++ b/code/sys_nicmonitor/include/db_com/db_stat_m.h @@ -0,0 +1,38 @@ +//************************************** +// Generated by mcpp translator +// Version 1.2 +//************************************** + +#ifndef __DB_STAT_M_H__ +#define __DB_STAT_M_H__ + +#include"mcode/mvector.h" +#include"mcode/mstring.h" +#include"mcode/mstream.h" +#include"mcode/mclient.h" + + +typedef MLang::Long TStatKeyID; +typedef MLang::VECTOR LongSeq; +struct TReStatInfo +{ + TStatKeyID keyid; + LongSeq seq_time; + TReStatInfo(); + TReStatInfo(const TReStatInfo&); + TReStatInfo&operator=(const TReStatInfo&); + void __write(MLang::OutputStream&__os)const; + void __read(MLang::InputStream&__is); +}; +typedef MLang::VECTOR SEQReStatInfo; +struct TReStatInParm +{ + int app_no; + SEQReStatInfo seq_restat_info; + TReStatInParm(); + TReStatInParm(const TReStatInParm&); + TReStatInParm&operator=(const TReStatInParm&); + void __write(MLang::OutputStream&__os)const; + void __read(MLang::InputStream&__is); +}; +#endif diff --git a/code/sys_nicmonitor/include/db_com/db_stat_service_interface.h b/code/sys_nicmonitor/include/db_com/db_stat_service_interface.h new file mode 100644 index 0000000..347a8eb --- /dev/null +++ b/code/sys_nicmonitor/include/db_com/db_stat_service_interface.h @@ -0,0 +1,69 @@ +//****************************************************************** +// +// AUTHOR : WangChangpin +// +// FUNCTION : db_monitor ̵Ŀͻ๫ඨ +// +// TIME : 2011.08.23 +// +// HISTORY : +// Datetime Action Author Reason +// ------------------------------------------------------------------- +// 2011.08.23 Creation WangChangpin +// +//****************************************************************** + +#ifndef _DB_STAT_SERVICE_INTERFACE_H +#define _DB_STAT_SERVICE_INTERFACE_H + +#include "db_stat_m.h" +#include "sam_service.h" +#include "system.h" +#include "serviceglobal.h" +#include "pub_ctx.h" +#include "servicesclient.h" + +#include +#include +#include +#include +#include + +using namespace std; + +class db_stat_service_interface +{ + + public: + + db_stat_service_interface(const int port,const int request_timeout_seconds = 300); + ~db_stat_service_interface(); + + //õĽӿںӣIDLӳͷļж + + //ONEWAY + short DbReStat(TReStatInParm& in_para); + //void SyncTagAttribute(); + + //add for remote access + int SetDomainInfo(const DomainInfo& domain_info); //ԶϢͨã + int SetDomainInfo(const char* domain_name, const tSecLabel& sec_label, const int app_no = AP_DATA_SRV, const int ctx_no = AC_REALTIME_NO); + int SetDomainName(const char* domain_name); // + int SetSecLabel(tSecLabel& sec_label); //ñǩ + void ClearDomainName(); //m_DomainNameΪlocal_domain + + private: + DomainInfo m_DomainInfo; + ServiceInfo m_Serviceinfo; + int m_RequestTimeoutSeconds; + char m_IpAddress[64]; + int m_Port; + Handle m_Handle; + char m_HostName[64]; + CServicesManage* m_ServicesManage; + int GetHostByAppNo(char* host_name, const int app_no, const short context_no); + int SetServiceHost(); + +}; +#endif + diff --git a/code/sys_nicmonitor/include/db_com/ds_log.h b/code/sys_nicmonitor/include/db_com/ds_log.h new file mode 100644 index 0000000..c274766 --- /dev/null +++ b/code/sys_nicmonitor/include/db_com/ds_log.h @@ -0,0 +1,39 @@ +// create by shq 20181204 for data_srv log features +// kill -30 [pid] // reload ds_log.sys +////////////////////////////////////////////////////////////////////// + +#if !defined(SAVELOG_DEF) +#define SAVELOG_DEF +#define FILE_MAX_LEN 30000000 + +#include "pthread.h" +#include "MyMutex.h" + +class DSLog +{ +public: + DSLog(); + int reloadConfig(); + int setLog (char *server_name, long maxlen = FILE_MAX_LEN); + virtual ~DSLog(); + + int addlog (char *message); + int addlogdebug (char *message); + +private: + FILE *fp; + CMyMutex m_mutex; + long filemaxlen; + char filename[512]; +// int thisTag; + int _to_file; + int _to_screen; + int _full_log; + char _server_name[64]; + + int checkfile(); + int startlog(); + int gettag(); +}; + +#endif // !defined(SAVELOG_DEF) diff --git a/code/sys_nicmonitor/include/db_com/dy_commit_m.h b/code/sys_nicmonitor/include/db_com/dy_commit_m.h new file mode 100644 index 0000000..f176184 --- /dev/null +++ b/code/sys_nicmonitor/include/db_com/dy_commit_m.h @@ -0,0 +1,103 @@ +//************************************** +// Generated by mcpp translator +// Version 1.2 +//************************************** + +#ifndef __DY_COMMIT_M_H__ +#define __DY_COMMIT_M_H__ + +#ifdef _WINDOWS64 +#ifdef DY_COMMIT_DLL_EXPORTS +#define DY_COMMIT_DLL_API __declspec(dllexport) +#else +#define DY_COMMIT_DLL_API __declspec(dllimport) +#endif +#else +#define DY_COMMIT_DLL_API +#endif + +#include"mcode/mvector.h" +#include"mcode/mstring.h" +#include"mcode/mstream.h" +#include"mcode/mclient.h" + + +typedef MLang::STRING TKeyIDStru; +struct DY_COMMIT_DLL_API TDyTime +{ + MLang::Long second; + short millisecond; + void __write(MLang::OutputStream&__os)const; + void __read(MLang::InputStream&__is); +}; +typedef float TDyValue; +typedef int TDyStat; +typedef MLang::VECTOR SEQDyKeyID; +typedef MLang::VECTOR SEQDyTime; +typedef MLang::VECTOR SEQDyValue; +typedef MLang::VECTOR SEQDyStat; +struct DY_COMMIT_DLL_API TDyCommitVS +{ + int app_no; + int keyid_num; + TDyTime start_time; + int time_num; + int time_inteval; + SEQDyKeyID seq_keyid; + SEQDyValue seq_dy_value; + SEQDyStat seq_dy_stat; + unsigned char modify_flag; + TDyCommitVS(); + TDyCommitVS(const TDyCommitVS&); + TDyCommitVS&operator=(const TDyCommitVS&); + void __write(MLang::OutputStream&__os)const; + void __read(MLang::InputStream&__is); +}; +struct DY_COMMIT_DLL_API TKVSElement +{ + TDyTime dy_time_stamp; + int keyid_num; + SEQDyKeyID seq_keyid; + SEQDyValue seq_dy_value; + SEQDyStat seq_dy_stat; + TKVSElement(); + TKVSElement(const TKVSElement&); + TKVSElement&operator=(const TKVSElement&); + void __write(MLang::OutputStream&__os)const; + void __read(MLang::InputStream&__is); +}; +typedef MLang::VECTOR SEQKVSElement; +struct DY_COMMIT_DLL_API TDyCommitKVS +{ + int app_no; + int sect_num; + SEQKVSElement seq_kvs_element; + unsigned char modify_flag; + TDyCommitKVS(); + TDyCommitKVS(const TDyCommitKVS&); + TDyCommitKVS&operator=(const TDyCommitKVS&); + void __write(MLang::OutputStream&__os)const; + void __read(MLang::InputStream&__is); +}; +struct DY_COMMIT_DLL_API TStringElement +{ + TDyTime dy_time_stamp; + MLang::STRING string_value; + TStringElement(); + TStringElement(const TStringElement&); + TStringElement&operator=(const TStringElement&); + void __write(MLang::OutputStream&__os)const; + void __read(MLang::InputStream&__is); +}; +typedef MLang::VECTOR SEQStringElement; +struct DY_COMMIT_DLL_API TStringCommit +{ + MLang::STRING tag_name; + SEQStringElement seq_string_element; + TStringCommit(); + TStringCommit(const TStringCommit&); + TStringCommit&operator=(const TStringCommit&); + void __write(MLang::OutputStream&__os)const; + void __read(MLang::InputStream&__is); +}; +#endif diff --git a/code/sys_nicmonitor/include/db_com/dy_monitor_define.h b/code/sys_nicmonitor/include/db_com/dy_monitor_define.h new file mode 100644 index 0000000..38eeaf3 --- /dev/null +++ b/code/sys_nicmonitor/include/db_com/dy_monitor_define.h @@ -0,0 +1,137 @@ +#ifndef _DY_MONITOR_DEFINE_H_ +#define _DY_MONITOR_DEFINE_H_ + + +#ifndef _WINDOWS64 +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#ifndef _DB_MONITOR_DEFINE_H_ +#include +#endif + +#endif + +#ifndef _WINDOWS64 +#ifdef _ALPHA +#include +#endif +#endif + +#include "paramanage.h" +#include "sysadm/scn_service.h" +//#include "sam_switch.h" +#include "sysadm/scn_common.h" +#include "system.h" + +#ifndef _LOCAL +#include "db_com/CDyMonitorClient.h" +#endif + +//#include "db_com/wholepubtools.h" +#include "db_com/CCharArray.h" +#include "db_com/CDySem.h" +#include "db_com/CDySemUse.h" +#include "db_com/CDyShm.h" +#include "db_com/CErrorLog.h" +#include "db_com/CFindFile.h" +#include "db_com/CPrecTime.h" + +#include "pub.h" +using namespace std; + +#ifndef PORT_DY_MONITOR_BASE +#define PORT_DY_MONITOR_BASE 11300 +#endif +#ifndef _WINDOWS64 +const int DY_NUM_KEY = 0x1961; +const int DY_FILE_SEM_KEY = 0x1963; +const int DY_SERVICE_INFO_SEM_KEY = 0x2000; +const int DY_MONITOR_SHM_KEY = 0x211; +#else +const string DY_NUM_KEY = "DY_NUM_NAME"; +const string DY_SERVICE_INFO_SEM_KEY = "DY_SERVICE_INFO_SEM_NAME"; +const string DY_FILE_SEM_KEY = "DY_FILE_SEM_NAME"; +const string DY_MONITOR_SHM_KEY = "dy_monitor.dat"; +#endif +const int MAX_DY_COUNT = 256; +const int DY_MONITOR_SHM_SIZE = MAX_DY_COUNT*2048; +const int DY_SEM_INIT_VAL = 1; +const int MAX_DY_PARA_NAME = 64; +const int READ_DY_CONFIG_INFO_TIME_INTERVAL = 600; + +//Ӧø״̬Ķ +const int DY_APP_STATUS_DUTY = 1; +const int DY_APP_STATUS_STANDBY = 0; +const int DY_APP_STATUS_OTHER = -1; + +typedef struct DyLoginInfoStru +{ + char dy_service_name[MAX_DY_PARA_NAME]; + char user_name[MAX_DY_PARA_NAME]; + char user_password[MAX_DY_PARA_NAME]; + char dy_service_machine[MAX_DY_PARA_NAME]; + int dy_service_port; + char dy_name[MAX_DY_PARA_NAME]; + char dy_service_describe[3*MAX_DY_PARA_NAME]; + bool is_switch; + bool is_master_dy; + int dy_host_prior; + short dy_login_status; + char dy_err[5*MAX_DY_PARA_NAME]; //ݿϢ + time_t dy_cur_time; //ʱʱ + int direct_access; //ǷΪֱӵݿ 0 1 + + struct DyLoginInfoStru & operator= (const struct DyLoginInfoStru &login_stru) + { + if( this == &login_stru) + { + return *this; + } + + strcpy(dy_service_name , login_stru.dy_service_name ); + strcpy(user_name , login_stru.user_name); + strcpy(user_password , login_stru.user_password ); + strcpy(dy_service_machine , login_stru.dy_service_machine); + dy_service_port = login_stru.dy_service_port; + strcpy(dy_name , login_stru.dy_name); + strcpy(dy_service_describe , login_stru.dy_service_describe ); + is_switch = login_stru.is_switch; + is_master_dy = login_stru.is_master_dy; + dy_host_prior = login_stru.dy_host_prior; + dy_login_status = login_stru.dy_login_status; + strcpy(dy_err , login_stru.dy_err); + dy_cur_time = login_stru.dy_cur_time; + direct_access = login_stru.direct_access; + return *this; + } +}TLoginDyInfo; + +#endif diff --git a/code/sys_nicmonitor/include/db_com/dy_monitor_m.h b/code/sys_nicmonitor/include/db_com/dy_monitor_m.h new file mode 100644 index 0000000..979663f --- /dev/null +++ b/code/sys_nicmonitor/include/db_com/dy_monitor_m.h @@ -0,0 +1,53 @@ +//************************************** +// Generated by mcpp translator +// Version 1.2 +//************************************** + +#ifndef __DY_MONITOR_M_H__ +#define __DY_MONITOR_M_H__ + +#include"mcode/mvector.h" +#include"mcode/mstring.h" +#include"mcode/mstream.h" +#include"mcode/mclient.h" + + +struct _DyLoginInfo +{ + unsigned char is_master_dy; + MLang::STRING user_name; + MLang::STRING user_password; + MLang::STRING dy_service_name; + MLang::STRING dy_service_machine; + int dy_service_port; + MLang::STRING dy_name; + short dy_status; + MLang::STRING strError; + _DyLoginInfo(); + _DyLoginInfo(const _DyLoginInfo&); + _DyLoginInfo&operator=(const _DyLoginInfo&); + void __write(MLang::OutputStream&__os)const; + void __read(MLang::InputStream&__is); +}; +typedef _DyLoginInfo TDyLoginInfo; +typedef MLang::VECTOR SEC_DY_INFO; +struct TDyServiceInfo +{ + SEC_DY_INFO secDyServiceInfo; + TDyServiceInfo(); + TDyServiceInfo(const TDyServiceInfo&); + TDyServiceInfo&operator=(const TDyServiceInfo&); + void __write(MLang::OutputStream&__os)const; + void __read(MLang::InputStream&__is); +}; +typedef MLang::VECTOR SEC_STR_DY_NAME; +struct TDYServiceName +{ + SEC_STR_DY_NAME secDyInfo; + TDYServiceName(); + TDYServiceName(const TDYServiceName&); + TDYServiceName&operator=(const TDYServiceName&); + void __write(MLang::OutputStream&__os)const; + void __read(MLang::InputStream&__is); +}; +#endif diff --git a/code/sys_nicmonitor/include/db_com/dy_public_m.h b/code/sys_nicmonitor/include/db_com/dy_public_m.h new file mode 100644 index 0000000..1a51b07 --- /dev/null +++ b/code/sys_nicmonitor/include/db_com/dy_public_m.h @@ -0,0 +1,88 @@ +//************************************** +// Generated by mcpp translator +// Version 1.2 +//************************************** + +#ifndef __DY_PUBLIC_M_H__ +#define __DY_PUBLIC_M_H__ + +#ifdef _WINDOWS64 +#ifdef DY_SAMPLE_DEFINE_DLL_EXPORTS +#define DY_SAMPLE_DEFINE_API __declspec(dllexport) +#else +#define DY_SAMPLE_DEFINE_API __declspec(dllimport) +#endif +#else +#define DY_SAMPLE_DEFINE_API +#endif + +#include"mcode/mvector.h" +#include"mcode/mstring.h" +#include"mcode/mstream.h" +#include"mcode/mclient.h" +#include + +typedef std::string TStructKeyID; +const short CT_DEFAULT = 0; +const short CT_STRING = 1; +const short CT_UCHAR = 2; +const short CT_SHORT = 3; +const short CT_INT = 4; +const short CT_DATETIME = 5; +const short CT_FLOAT = 6; +const short CT_DOUBLE = 7; +struct DY_SAMPLE_DEFINE_API UAttrValue +{ +private: + union + { + char* c_string; + unsigned char c_uchar; + short c_short; + int c_int; + int c_time; + float c_float; + double c_double; + char c_default; + }__u_val; + bool __u_init; + unsigned short __u_index; +public: + UAttrValue(); + ~UAttrValue(); + UAttrValue(const UAttrValue&); + UAttrValue&operator=(const UAttrValue&); + short _d()const; + void __clear(); + void __write(MLang::OutputStream&__os)const; + void __read(MLang::InputStream&__is); + void c_string(const char*); + void c_string(const MLang::STRING&); + const char*c_string()const; + void c_uchar(const unsigned char); + const unsigned char c_uchar()const; + void c_short(const short); + const short c_short()const; + void c_int(const int); + const int c_int()const; + void c_time(const int); + const int c_time()const; + void c_float(const float); + const float c_float()const; + void c_double(const double); + const double c_double()const; + void c_default(const char); + const char c_default()const; +}; +struct DY_SAMPLE_DEFINE_API TPointAttribute +{ + MLang::STRING attr_name; + UAttrValue attr_value; + TPointAttribute(); + TPointAttribute(const TPointAttribute&); + TPointAttribute&operator=(const TPointAttribute&); + void __write(MLang::OutputStream&__os)const; + void __read(MLang::InputStream&__is); +}; +typedef MLang::VECTOR SEQPointAttribute; +#endif diff --git a/code/sys_nicmonitor/include/db_com/dy_sample_define_m.h b/code/sys_nicmonitor/include/db_com/dy_sample_define_m.h new file mode 100644 index 0000000..5c0eb51 --- /dev/null +++ b/code/sys_nicmonitor/include/db_com/dy_sample_define_m.h @@ -0,0 +1,225 @@ +//************************************** +// Generated by mcpp translator +// Version 1.2 +//************************************** + +#ifndef __DY_SAMPLE_DEFINE_M_H__ +#define __DY_SAMPLE_DEFINE_M_H__ + +#ifdef _WINDOWS64 +#ifdef DY_SAMPLE_DEFINE_DLL_EXPORTS +#define DY_SAMPLE_DEFINE_API __declspec(dllexport) +#else +#define DY_SAMPLE_DEFINE_API __declspec(dllimport) +#endif +#else +#define DY_SAMPLE_DEFINE_API +#endif + +#include"mcode/mvector.h" +#include"mcode/mstring.h" +#include"mcode/mstream.h" +#include"mcode/mclient.h" +#include"dy_public_m.h" + + +const short OPERATE_SUCCESS = 0; +const short OPERATE_FAIL = -1; +const short IS_YC_SAMPLE = 0; +const short IS_YX_SAMPLE = 1; +struct DY_SAMPLE_DEFINE_API TDySampleInfo +{ + std::string key_id; + SEQPointAttribute seq_point_attr; + TDySampleInfo(); + TDySampleInfo(const TDySampleInfo&); + TDySampleInfo&operator=(const TDySampleInfo&); + void __write(MLang::OutputStream&__os)const; + void __read(MLang::InputStream&__is); +}; +typedef MLang::VECTOR SEQDySampleInfo; +struct DY_SAMPLE_DEFINE_API AddDySampleInParm +{ + int app_no; + unsigned char is_yx; + SEQDySampleInfo seq_dy_sample_info; + AddDySampleInParm(); + AddDySampleInParm(const AddDySampleInParm&); + AddDySampleInParm&operator=(const AddDySampleInParm&); + void __write(MLang::OutputStream&__os)const; + void __read(MLang::InputStream&__is); +}; +struct DY_SAMPLE_DEFINE_API TDySampleResultInfo +{ + short success_flag; + MLang::STRING err_string; + SEQPointAttribute seq_point_attr; + TDySampleResultInfo(); + TDySampleResultInfo(const TDySampleResultInfo&); + TDySampleResultInfo&operator=(const TDySampleResultInfo&); + void __write(MLang::OutputStream&__os)const; + void __read(MLang::InputStream&__is); +}; +typedef MLang::VECTOR SEQDySampleResultInfo; +struct DY_SAMPLE_DEFINE_API AddDySampleOutParm +{ + int app_no; + short success_flag; + MLang::STRING invalid_string; + SEQDySampleResultInfo seq_dy_sample_result_info; + AddDySampleOutParm(); + AddDySampleOutParm(const AddDySampleOutParm&); + AddDySampleOutParm&operator=(const AddDySampleOutParm&); + void __write(MLang::OutputStream&__os)const; + void __read(MLang::InputStream&__is); +}; +struct DY_SAMPLE_DEFINE_API DeleteDySampleInParm +{ + int app_no; + MLang::VECTOR seq_dy_service_name; + MLang::VECTOR seq_tag_name; + DeleteDySampleInParm(); + DeleteDySampleInParm(const DeleteDySampleInParm&); + DeleteDySampleInParm&operator=(const DeleteDySampleInParm&); + void __write(MLang::OutputStream&__os)const; + void __read(MLang::InputStream&__is); +}; +struct DY_SAMPLE_DEFINE_API DeleteDySampleOutParm +{ + int app_no; + short success_flag; + MLang::STRING invalid_string; + SEQDySampleResultInfo seq_dy_sample_result_info; + DeleteDySampleOutParm(); + DeleteDySampleOutParm(const DeleteDySampleOutParm&); + DeleteDySampleOutParm&operator=(const DeleteDySampleOutParm&); + void __write(MLang::OutputStream&__os)const; + void __read(MLang::InputStream&__is); +}; +struct DY_SAMPLE_DEFINE_API PauseDySampleInParm +{ + int app_no; + MLang::VECTOR seq_tag_name; + PauseDySampleInParm(); + PauseDySampleInParm(const PauseDySampleInParm&); + PauseDySampleInParm&operator=(const PauseDySampleInParm&); + void __write(MLang::OutputStream&__os)const; + void __read(MLang::InputStream&__is); +}; +struct DY_SAMPLE_DEFINE_API PauseDySampleOutParm +{ + int app_no; + short success_flag; + MLang::STRING invalid_string; + SEQDySampleResultInfo seq_dy_sample_result_info; + PauseDySampleOutParm(); + PauseDySampleOutParm(const PauseDySampleOutParm&); + PauseDySampleOutParm&operator=(const PauseDySampleOutParm&); + void __write(MLang::OutputStream&__os)const; + void __read(MLang::InputStream&__is); +}; +struct DY_SAMPLE_DEFINE_API RecoverDySampleInParm +{ + int app_no; + MLang::VECTOR seq_tag_name; + RecoverDySampleInParm(); + RecoverDySampleInParm(const RecoverDySampleInParm&); + RecoverDySampleInParm&operator=(const RecoverDySampleInParm&); + void __write(MLang::OutputStream&__os)const; + void __read(MLang::InputStream&__is); +}; +struct DY_SAMPLE_DEFINE_API RecoverDySampleOutParm +{ + int app_no; + short success_flag; + MLang::STRING invalid_string; + SEQDySampleResultInfo seq_dy_sample_result_info; + RecoverDySampleOutParm(); + RecoverDySampleOutParm(const RecoverDySampleOutParm&); + RecoverDySampleOutParm&operator=(const RecoverDySampleOutParm&); + void __write(MLang::OutputStream&__os)const; + void __read(MLang::InputStream&__is); +}; +struct DY_SAMPLE_DEFINE_API RelocateDySampleInParm +{ + int app_no; + int key_num; + MLang::VECTOR seq_key_old; + SEQDySampleInfo seq_dy_sample_info; + RelocateDySampleInParm(); + RelocateDySampleInParm(const RelocateDySampleInParm&); + RelocateDySampleInParm&operator=(const RelocateDySampleInParm&); + void __write(MLang::OutputStream&__os)const; + void __read(MLang::InputStream&__is); +}; +struct DY_SAMPLE_DEFINE_API RelocateDySampleOutParm +{ + int app_no; + short success_flag; + MLang::STRING invalid_string; + SEQDySampleResultInfo seq_dy_sample_result_info; + RelocateDySampleOutParm(); + RelocateDySampleOutParm(const RelocateDySampleOutParm&); + RelocateDySampleOutParm&operator=(const RelocateDySampleOutParm&); + void __write(MLang::OutputStream&__os)const; + void __read(MLang::InputStream&__is); +}; +struct DY_SAMPLE_DEFINE_API GetDyPointAttrInParm +{ + int app_no; + MLang::VECTOR seq_dy_service_name; + MLang::VECTOR seq_tag_name; + GetDyPointAttrInParm(); + GetDyPointAttrInParm(const GetDyPointAttrInParm&); + GetDyPointAttrInParm&operator=(const GetDyPointAttrInParm&); + void __write(MLang::OutputStream&__os)const; + void __read(MLang::InputStream&__is); +}; +struct DY_SAMPLE_DEFINE_API TPointAttrResultInfo +{ + MLang::STRING key_id; + short success_flag; + MLang::STRING err_string; + SEQPointAttribute seq_point_attr; + TPointAttrResultInfo(); + TPointAttrResultInfo(const TPointAttrResultInfo&); + TPointAttrResultInfo&operator=(const TPointAttrResultInfo&); + void __write(MLang::OutputStream&__os)const; + void __read(MLang::InputStream&__is); +}; +typedef MLang::VECTOR SEQPointAttrResultInfo; +struct DY_SAMPLE_DEFINE_API GetDyPointAttrOutParm +{ + int app_no; + short success_flag; + MLang::STRING invalid_string; + SEQPointAttrResultInfo seq_result_info; + GetDyPointAttrOutParm(); + GetDyPointAttrOutParm(const GetDyPointAttrOutParm&); + GetDyPointAttrOutParm&operator=(const GetDyPointAttrOutParm&); + void __write(MLang::OutputStream&__os)const; + void __read(MLang::InputStream&__is); +}; +struct DY_SAMPLE_DEFINE_API ModifyDyPointAttrInParm +{ + int app_no; + SEQDySampleInfo seq_dy_sample_info; + ModifyDyPointAttrInParm(); + ModifyDyPointAttrInParm(const ModifyDyPointAttrInParm&); + ModifyDyPointAttrInParm&operator=(const ModifyDyPointAttrInParm&); + void __write(MLang::OutputStream&__os)const; + void __read(MLang::InputStream&__is); +}; +struct DY_SAMPLE_DEFINE_API ModifyDyPointAttrOutParm +{ + int app_no; + short success_flag; + MLang::STRING invalid_string; + SEQDySampleResultInfo seq_dy_sample_result_info; + ModifyDyPointAttrOutParm(); + ModifyDyPointAttrOutParm(const ModifyDyPointAttrOutParm&); + ModifyDyPointAttrOutParm&operator=(const ModifyDyPointAttrOutParm&); + void __write(MLang::OutputStream&__os)const; + void __read(MLang::InputStream&__is); +}; +#endif diff --git a/code/sys_nicmonitor/include/db_com/dy_sample_define_service_interface.h b/code/sys_nicmonitor/include/db_com/dy_sample_define_service_interface.h new file mode 100644 index 0000000..3b10578 --- /dev/null +++ b/code/sys_nicmonitor/include/db_com/dy_sample_define_service_interface.h @@ -0,0 +1,97 @@ +#ifndef _DY_SAMPLE_DEFINE_SERVICE_INTERFACE_H +#define _DY_SAMPLE_DEFINE_SERVICE_INTERFACE_H + +#ifdef _WINDOWS64 +#ifdef DY_SAMPLE_DEFINE_DLL_EXPORTS +#define DY_SAMPLE_DEFINE_API __declspec(dllexport) +#else +#define DY_SAMPLE_DEFINE_API __declspec(dllimport) +#endif +#else +#define DY_SAMPLE_DEFINE_API +#endif +#ifndef _WINDOWS64 +#include +#include +#else +#include +#include +#endif +#include "dy_sample_define_m.h" +#include "sysadm/scn_service.h" +#include "port_def.h" +#include "mcode/mclient.h" +//#include "serviceglobal.h" +#include "pub_ctx.h" +#include "system.h" +#include "servicemanage.h" +#include "db_com/CDyCfgLocal.h" +//#include "servicesclient.h" + +#include + +using namespace std; +using namespace NS_SYSADMIN; +//#include + +//úҪIDL ļвͬinterface ƽ޸ +/*#define interface_var CDySampleDefineServer_var +#define interface_name CDySampleDefineServer*/ + +class DY_SAMPLE_DEFINE_API dy_sample_define_service_interface +{ + public: + /*interface_var m_Specify_GenerInvoke; + interface_var m_GenerInvoke;*/ + dy_sample_define_service_interface(); + dy_sample_define_service_interface(const int port_no,const int request_timeout_seconds = 300); + ~dy_sample_define_service_interface(); + + //õĽӿںӣIDLӳͷļж + short AddDySampleDefine(const AddDySampleInParm& in_para, + AddDySampleOutParm &out_para); + + short DeleteDySampleDefine(const DeleteDySampleInParm& in_para, + DeleteDySampleOutParm &out_para); + + /*short PauseDySampleDefine(const PauseDySampleInParm& in_para, + PauseDySampleOutParm &out_para); + + short RecoverDySampleDefine(const RecoverDySampleInParm& in_para, + RecoverDySampleOutParm &out_para);*/ + + short GetDyPointAttribute(const GetDyPointAttrInParm& in_para, + GetDyPointAttrOutParm &out_para); + + short ModifyDyPointAttribute(const ModifyDyPointAttrInParm& in_para, + ModifyDyPointAttrOutParm &out_para); + short RelocateDySampleDefine(const RelocateDySampleInParm& in_para, + RelocateDySampleOutParm &out_para);//5 + + //add for remote access + int SetDomainInfo(const DomainInfo& domain_info); //ԶϢͨã + int SetDomainInfo(const char* domain_name, const tSecLabel& sec_label, const int app_no = AP_DATA_SRV, const int ctx_no = AC_REALTIME_NO); + int SetDomainName(const char* domain_name); // + int SetSecLabel(tSecLabel& sec_label); //ñǩ + void ClearDomainName(); //m_DomainNameΪlocal_domain + private: + ServiceInfo m_Serviceinfo; + DomainInfo m_DomainInfo; + CDyCfgLocal m_dy_cfg_read; + int m_RequestTimeoutSeconds; + char m_IpAddress[64]; + int m_Port; + Handle m_Handle; + char m_HostName[64]; + CScnService* m_ServicesManage; + //ǷҪԶȡ˿ں,dy_sample_define_service_interface(()Ч + bool m_is_port_auto_set; + + int GetHostByAppNo(char* host_name, const int app_no, const short context_no); + int SetServiceHost(const int dy_app_no); +}; + +#endif + + + diff --git a/code/sys_nicmonitor/include/db_com/dy_stat_m.h b/code/sys_nicmonitor/include/db_com/dy_stat_m.h new file mode 100644 index 0000000..bf4f4d3 --- /dev/null +++ b/code/sys_nicmonitor/include/db_com/dy_stat_m.h @@ -0,0 +1,47 @@ +//************************************** +// Generated by mcpp translator +// Version 1.2 +//************************************** + +#ifndef __DY_STAT_M_H__ +#define __DY_STAT_M_H__ + +#ifdef _WINDOWS64 +#ifdef DY_STAT_DLL_EXPORTS +#define DY_STAT_DLL_API __declspec(dllexport) +#else +#define DY_STAT_DLL_API __declspec(dllimport) +#endif +#else +#define DY_STAT_DLL_API +#endif +#include"mcode/mvector.h" +#include"mcode/mstring.h" +#include"mcode/mstream.h" +#include"mcode/mclient.h" + + +typedef MLang::Long TDyStatKeyID; +typedef MLang::VECTOR LongSeq; +struct DY_STAT_DLL_API TDyReStatInfo +{ + TDyStatKeyID keyid; + LongSeq seq_time; + TDyReStatInfo(); + TDyReStatInfo(const TDyReStatInfo&); + TDyReStatInfo&operator=(const TDyReStatInfo&); + void __write(MLang::OutputStream&__os)const; + void __read(MLang::InputStream&__is); +}; +typedef MLang::VECTOR SEQDyReStatInfo; +struct DY_STAT_DLL_API TDyReStatInParm +{ + int app_no; + SEQDyReStatInfo seq_dy_restat_info; + TDyReStatInParm(); + TDyReStatInParm(const TDyReStatInParm&); + TDyReStatInParm&operator=(const TDyReStatInParm&); + void __write(MLang::OutputStream&__os)const; + void __read(MLang::InputStream&__is); +}; +#endif diff --git a/code/sys_nicmonitor/include/db_com/dy_stat_service_interface.h b/code/sys_nicmonitor/include/db_com/dy_stat_service_interface.h new file mode 100644 index 0000000..5fb89b8 --- /dev/null +++ b/code/sys_nicmonitor/include/db_com/dy_stat_service_interface.h @@ -0,0 +1,89 @@ +//****************************************************************** +// +// AUTHOR : WangChangpin +// +// FUNCTION : db_monitor ̵Ŀͻ๫ඨ +// +// TIME : 2011.08.23 +// +// HISTORY : +// Datetime Action Author Reason +// ------------------------------------------------------------------- +// 2011.08.23 Creation WangChangpin +// +//****************************************************************** + +#ifndef _DY_STAT_SERVICE_INTERFACE_H +#define _DY_STAT_SERVICE_INTERFACE_H + +#ifdef _WINDOWS64 +#ifdef DY_STAT_DLL_EXPORTS +#define DY_STAT_DLL_API __declspec(dllexport) +#else +#define DY_STAT_DLL_API __declspec(dllimport) +#endif +#else +#define DY_STAT_DLL_API +#endif + +#ifndef _WINDOWS64 +#include +#include +#include + +#include +#include +#else +#include +#include +#endif + +#include "dy_stat_m.h" +#include "sysadm/scn_service.h" +#include "system.h" +//#include "serviceglobal.h" +#include "pub_ctx.h" +#include "servicemanage.h" +#include "db_com/CDyCfgLocal.h" + +using namespace std; +using namespace NS_SYSADMIN; +class DY_STAT_DLL_API dy_stat_service_interface +{ + + public: + + dy_stat_service_interface(const int port,const int request_timeout_seconds = 300); + dy_stat_service_interface(); + ~dy_stat_service_interface(); + + //õĽӿںӣIDLӳͷļж + + //ONEWAY + short DyReStat(TDyReStatInParm& in_para); + //void SyncTagAttribute(); + + //add for remote access + int SetDomainInfo(const DomainInfo& domain_info); //ԶϢͨã + int SetDomainInfo(const char* domain_name, const tSecLabel& sec_label, const int app_no = AP_DATA_SRV, const int ctx_no = AC_REALTIME_NO); + int SetDomainName(const char* domain_name); // + int SetSecLabel(tSecLabel& sec_label); //ñǩ + void ClearDomainName(); //m_DomainNameΪlocal_domain + + private: + DomainInfo m_DomainInfo; + ServiceInfo m_Serviceinfo; + CDyCfgLocal m_dy_cfg_read; + int m_RequestTimeoutSeconds; + char m_IpAddress[64]; +// int m_Port; + Handle m_Handle; + char m_HostName[64]; + CScnService* m_ServicesManage; + //ǷҪԶȡ˿ں,dy_stat_service_interface()Ч + bool m_is_port_auto_set; + int GetHostByAppNo(char* host_name, const int app_no, const short context_no); + int SetServiceHost(const int dy_app_no); + +}; +#endif diff --git a/code/sys_nicmonitor/include/db_com/hiredis.h b/code/sys_nicmonitor/include/db_com/hiredis.h new file mode 100644 index 0000000..1b0d5e6 --- /dev/null +++ b/code/sys_nicmonitor/include/db_com/hiredis.h @@ -0,0 +1,202 @@ +/* + * Copyright (c) 2009-2011, Salvatore Sanfilippo + * Copyright (c) 2010-2014, Pieter Noordhuis + * Copyright (c) 2015, Matt Stancliff , + * Jan-Erik Rediger + * + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * * Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * * Neither the name of Redis nor the names of its contributors may be used + * to endorse or promote products derived from this software without + * specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef __HIREDIS_H +#define __HIREDIS_H +#include "read.h" +#include /* for va_list */ +#include /* for struct timeval */ +#include /* uintXX_t, etc */ +#include "sds.h" /* for sds */ + +#define HIREDIS_MAJOR 0 +#define HIREDIS_MINOR 14 +#define HIREDIS_PATCH 0 +#define HIREDIS_SONAME 0.14 + +/* Connection type can be blocking or non-blocking and is set in the + * least significant bit of the flags field in redisContext. */ +#define REDIS_BLOCK 0x1 + +/* Connection may be disconnected before being free'd. The second bit + * in the flags field is set when the context is connected. */ +#define REDIS_CONNECTED 0x2 + +/* The async API might try to disconnect cleanly and flush the output + * buffer and read all subsequent replies before disconnecting. + * This flag means no new commands can come in and the connection + * should be terminated once all replies have been read. */ +#define REDIS_DISCONNECTING 0x4 + +/* Flag specific to the async API which means that the context should be clean + * up as soon as possible. */ +#define REDIS_FREEING 0x8 + +/* Flag that is set when an async callback is executed. */ +#define REDIS_IN_CALLBACK 0x10 + +/* Flag that is set when the async context has one or more subscriptions. */ +#define REDIS_SUBSCRIBED 0x20 + +/* Flag that is set when monitor mode is active */ +#define REDIS_MONITORING 0x40 + +/* Flag that is set when we should set SO_REUSEADDR before calling bind() */ +#define REDIS_REUSEADDR 0x80 + +#define REDIS_KEEPALIVE_INTERVAL 15 /* seconds */ + +/* number of times we retry to connect in the case of EADDRNOTAVAIL and + * SO_REUSEADDR is being used. */ +#define REDIS_CONNECT_RETRIES 10 + +#ifdef __cplusplus +extern "C" { +#endif + +/* This is the reply object returned by redisCommand() */ +typedef struct redisReply { + int type; /* REDIS_REPLY_* */ + long long integer; /* The integer when type is REDIS_REPLY_INTEGER */ + size_t len; /* Length of string */ + char *str; /* Used for both REDIS_REPLY_ERROR and REDIS_REPLY_STRING */ + size_t elements; /* number of elements, for REDIS_REPLY_ARRAY */ + struct redisReply **element; /* elements vector for REDIS_REPLY_ARRAY */ +} redisReply; + +redisReader *redisReaderCreate(void); + +/* Function to free the reply objects hiredis returns by default. */ +void freeReplyObject(void *reply); + +/* Functions to format a command according to the protocol. */ +int redisvFormatCommand(char **target, const char *format, va_list ap); +int redisFormatCommand(char **target, const char *format, ...); +int redisFormatCommandArgv(char **target, int argc, const char **argv, const size_t *argvlen); +int redisFormatSdsCommandArgv(sds *target, int argc, const char ** argv, const size_t *argvlen); +void redisFreeCommand(char *cmd); +void redisFreeSdsCommand(sds cmd); + +enum redisConnectionType { + REDIS_CONN_TCP, + REDIS_CONN_UNIX +}; + +/* Context for a connection to Redis */ +typedef struct redisContext { + int err; /* Error flags, 0 when there is no error */ + char errstr[128]; /* String representation of error when applicable */ + int fd; + int flags; + char *obuf; /* Write buffer */ + redisReader *reader; /* Protocol reader */ + + enum redisConnectionType connection_type; + struct timeval *timeout; + + struct { + char *host; + char *source_addr; + int port; + } tcp; + + struct { + char *path; + } unix_sock; + + /* For non-blocking connect */ + struct sockadr *saddr; + size_t addrlen; +} redisContext; + +redisContext *redisConnect(const char *ip, int port); +redisContext *redisConnectWithTimeout(const char *ip, int port, const struct timeval tv); +redisContext *redisConnectNonBlock(const char *ip, int port); +redisContext *redisConnectBindNonBlock(const char *ip, int port, + const char *source_addr); +redisContext *redisConnectBindNonBlockWithReuse(const char *ip, int port, + const char *source_addr); +redisContext *redisConnectUnix(const char *path); +redisContext *redisConnectUnixWithTimeout(const char *path, const struct timeval tv); +redisContext *redisConnectUnixNonBlock(const char *path); +redisContext *redisConnectFd(int fd); + +/** + * Reconnect the given context using the saved information. + * + * This re-uses the exact same connect options as in the initial connection. + * host, ip (or path), timeout and bind address are reused, + * flags are used unmodified from the existing context. + * + * Returns REDIS_OK on successful connect or REDIS_ERR otherwise. + */ +int redisReconnect(redisContext *c); + +int redisSetTimeout(redisContext *c, const struct timeval tv); +int redisEnableKeepAlive(redisContext *c); +void redisFree(redisContext *c); +int redisFreeKeepFd(redisContext *c); +int redisBufferRead(redisContext *c); +int redisBufferWrite(redisContext *c, int *done); + +/* In a blocking context, this function first checks if there are unconsumed + * replies to return and returns one if so. Otherwise, it flushes the output + * buffer to the socket and reads until it has a reply. In a non-blocking + * context, it will return unconsumed replies until there are no more. */ +int redisGetReply(redisContext *c, void **reply); +int redisGetReplyFromReader(redisContext *c, void **reply); + +/* Write a formatted command to the output buffer. Use these functions in blocking mode + * to get a pipeline of commands. */ +int redisAppendFormattedCommand(redisContext *c, const char *cmd, size_t len); + +/* Write a command to the output buffer. Use these functions in blocking mode + * to get a pipeline of commands. */ +int redisvAppendCommand(redisContext *c, const char *format, va_list ap); +int redisAppendCommand(redisContext *c, const char *format, ...); +int redisAppendCommandArgv(redisContext *c, int argc, const char **argv, const size_t *argvlen); + +/* Issue a command to Redis. In a blocking context, it is identical to calling + * redisAppendCommand, followed by redisGetReply. The function will return + * NULL if there was an error in performing the request, otherwise it will + * return the reply. In a non-blocking context, it is identical to calling + * only redisAppendCommand and will always return NULL. */ +void *redisvCommand(redisContext *c, const char *format, va_list ap); +void *redisCommand(redisContext *c, const char *format, ...); +void *redisCommandArgv(redisContext *c, int argc, const char **argv, const size_t *argvlen); + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/code/sys_nicmonitor/include/db_com/interpreter_define.h b/code/sys_nicmonitor/include/db_com/interpreter_define.h new file mode 100644 index 0000000..9984344 --- /dev/null +++ b/code/sys_nicmonitor/include/db_com/interpreter_define.h @@ -0,0 +1,164 @@ +//****************************************************************** +// +// AUTHOR : ZhaoTiger +// +// FUNCTION : ͨSQLͷļг +// +// TIME : 2003.10.08 +// +// HISTORY : ӺĹʽ +// Datetime Action Author Reason +// ----------------------------------------------------------------- +// 2003.10.08 Creation ZhaoTiger +// +//****************************************************************** + +#ifndef __SQL_INTREPRETER_DEFINE_H__ +#define __SQL_INTREPRETER_DEFINE_H__ + +//#ifdef _SUN +#if defined(_SUN) || defined(_LINUX) +#define FALSE 0 +#define TRUE 1 +#endif + +#ifdef _WINDOWS32 +#define FALSE 0 +#define TRUE 1 +#endif + +namespace SQL_ANALYSER +{ + +#define KEYWORD_NUM 21 //ؼָ +#define MAX_CONSTANT_STRING_LEN 1024 //ܴĴַ󳤶 +#define MAX_CONSTANT_BINARY_LEN 2048 //ܴĴжƵ󳤶 +#define MAX_IDEN_NUM 1024 //е +#define MAX_IDEN_VALUE_NUM 1024 //ֵе +#define MAX_ORDERBY_NUM 10 //ORDER BYӾе +#define MAX_SYMBOL_LEN 64 //ܴĴбʶ󳤶 +#define MAX_WHERE_CODE_LEN 10000 //WHEREӾ沨ṹ󳤶 +#define MAX_ERRMSG_LEN 200 //ijϢ + +// SQL +#define SQL_TYPE_DELETE 0 +#define SQL_TYPE_INSERT 1 +#define SQL_TYPE_UPDATE 2 +#define SQL_TYPE_SELECT 3 + +/**/ +#define NOT_SYMBOL 100 // ! + +#define ADD_SYMBOL 101 // + +#define SUB_SYMBOL 102 // - +#define MUL_SYMBOL 103 // * +#define DIV_SYMBOL 104 // / +#define MOD_SYMBOL 105 // % +#define XOR_SYMBOL 106 // ^ +#define ANB_SYMBOL 107 // & +#define ORB_SYMBOL 108 // | + +#define GRT_SYMBOL 111 // > +#define GEQ_SYMBOL 112 // >= +#define LSS_SYMBOL 113 // < +#define LEQ_SYMBOL 114 // <= +#define EQU_SYMBOL 115 // = +#define NEQ_SYMBOL 116 // != + +#define LEFT_LARGE_BRACKET 121 // { +#define RIGHT_LARGE_BRACKET 122 // } +#define LEFT_MID_BRACKET 123 // [ +#define RIGHT_MID_BRACKET 124 // ] +#define LEFT_LITTLE_BRACKET 125 // ( +#define RIGHT_LITTLE_BRACKET 126 // ) +#define SEMICOLON 129 // ; +#define COMMA 130 // , +#define POINT 131 // . +#define NOB_SYMBOL 132 // ~ +#define COLON 133 // : + +#define DATABASE_MASK 141 // @ + +#define END_OF_PROGRAM 151 // ַ־ʾ +#define UNRECOGNIZED_TOKEN 152 // ʶַ + + +/**/ +#define KEY_DELETE 0 // DELETE +#define KEY_INSERT 1 // INSERT +#define KEY_UPDATE 2 // UPDATE +#define KEY_SELECT 3 // SELECT +#define KEY_FROM 4 // FROM +#define KEY_WHERE 5 // WHERE +#define KEY_SET 6 // SET +#define KEY_ORDER 7 // ORDER +#define KEY_BY 8 // BY +#define KEY_VALUES 9 // VALUES +#define KEY_AND 10 // AND +#define KEY_NOT 11 // NOT +#define KEY_OR 12 // OR +#define KEY_LIKE 13 // LIKE +#define KEY_IN 14 // IN +#define KEY_TIMESTR 15 // TIMESTR +#define KEY_TIMEINT 16 // TIMEINT +#define KEY_NULL 20 // NULL +#define KEY_RTDBKEY 21 // RTDBKEY +#define KEY_MEASRTDBKEY 22 // MEASRTDBKEY +#define KEY_APPRTDBKEY 23 // APPRTDBKEY + + +/*ʷ򷵻صĵʵ*/ +#define IDENTIFIER 1000 //ʶ +#define INTEGER_VALUE 1001 // +#define REAL_VALUE 1002 //ʵ +#define STRING_VALUE 1003 //ַ +#define BINARY_VALUE 1004 // + + +// WHEREӾ沨ṹݵıʶcode_type +#define CODE_TYPE_IDENTIFIER 0 // ʶͬ +#define CODE_TYPE_OPERATOR 1 // +#define CODE_TYPE_CONSTANT 2 // ֵ + +// ﷨׶еͣԼʽʱҪõ +#define INTPRE_DATATYPE_INT 0 // +#define INTPRE_DATATYPE_REAL 1 +#define INTPRE_DATATYPE_STRING 2 +// #define INTPRE_DATATYPE_BINARY 3 +// #define INTPRE_DATATYPE_KEYID 4 +#define INTPRE_DATATYPE_DATETIME 7 +#define INTPRE_DATATYPE_BOOL 10 +#define INTPRE_DATATYPE_NULL 11 +#define INTPRE_DATATYPE_RTDBKEY 16 +#define INTPRE_DATATYPE_MEASRTDBKEY 17 +#define INTPRE_DATATYPE_APPRTDBKEY 18 +#define INTPRE_DATATYPE_UNKNOWN 100 + + +// ﷨вͣҲ沨еIJ +#define OPERATOR_CODE_ADD 0 // + +#define OPERATOR_CODE_SUB 1 // - +#define OPERATOR_CODE_MUL 2 // * +#define OPERATOR_CODE_DIV 3 // / +#define OPERATOR_CODE_IDV 4 // / ȡ +#define OPERATOR_CODE_MOD 5 // % ȡ +#define OPERATOR_CODE_ANB 6 // & λ +#define OPERATOR_CODE_ORB 7 // | λ +#define OPERATOR_CODE_XOR 8 // ^ λ +#define OPERATOR_CODE_EQU 9 // = +#define OPERATOR_CODE_NEQ 10 // != +#define OPERATOR_CODE_GRT 11 // > +#define OPERATOR_CODE_GEQ 12 // >= ڵ +#define OPERATOR_CODE_LSS 13 // < С +#define OPERATOR_CODE_LEQ 14 // <= Сڵ +#define OPERATOR_CODE_LKE 15 // LIKE ַƥ +#define OPERATOR_CODE_POS 16 // + Ŀ +#define OPERATOR_CODE_NEG 17 // - Ŀ +#define OPERATOR_CODE_AND 18 // AND +#define OPERATOR_CODE_ORR 19 // OR +#define OPERATOR_CODE_NOT 20 // NOT + +} + + +#endif diff --git a/code/sys_nicmonitor/include/db_com/interpreter_struct.h b/code/sys_nicmonitor/include/db_com/interpreter_struct.h new file mode 100644 index 0000000..7f4e2fa --- /dev/null +++ b/code/sys_nicmonitor/include/db_com/interpreter_struct.h @@ -0,0 +1,130 @@ +//****************************************************************** +// +// AUTHOR : ZhaoTiger +// +// FUNCTION : ͨSQLͷļҪṹ +// +// TIME : 2003.10.08 +// +// HISTORY : ӺĹʽ +// Datetime Action Author Reason +// ----------------------------------------------------------------- +// 2003.10.08 Creation ZhaoTiger +// +//****************************************************************** + +#ifndef __SQL_INTREPRETER_STRUCT_H__ +#define __SQL_INTREPRETER_STRUCT_H__ + +#ifdef _WINDOWS32 +#ifdef SQL_ANALYSER_EXPORTS +#define SQL_ANALYSER_API __declspec(dllexport) +#else +#define SQL_ANALYSER_API __declspec(dllimport) +#endif +#else +#define SQL_ANALYSER_API +#endif + +#include "db_api/odb_struct.h" +#include +#include + +using namespace std; + +namespace SQL_ANALYSER +{ + +// ϢЩϢӵø﷨ģij +// ʹ﷨ģԶΪݿ +// ʵʱݿϵ +typedef struct SQL_ANALYSER_API +{ + char col_name[MAX_SYMBOL_LEN]; // + short col_type; // +} TAnalysColumnInfo; + +// WHEREʽʱصһЩϢ +typedef struct SQL_ANALYSER_API +{ + short typ; //ֵͣΪNULLΪINTPRE_DATATYPE_NULL + bool can_like; //ǷLIKELIKE֮ǰֻһ +} ITEM_STRU; + +// 峣UNION +typedef union SQL_ANALYSER_API +{ + //int int_value; // ֵݣUCHARSHORTINTDATETIME + long int_value; // ֵݣUCHARSHORTINTLONGDATETIME + float real_value; // ֵݣFLOATDOUBLE + char string_value[MAX_CONSTANT_STRING_LEN]; // ַݣCHAR(n)STRING(n) + char binary_value[MAX_CONSTANT_BINARY_LEN]; // ݣBINARY(n) + _RTDB_KEY_STRU rtdbkey_value; + _RTDB_KEY_STRU measrtdbkey_value; + _APP_KEY_STRU apprtdbkey_value; +} UConstValueInfo; + +// 峣ṹ +typedef struct SQL_ANALYSER_API +{ + bool is_null; // TRUEʾNULLFALSEʾNULL + short const_type; // NULL + UConstValueInfo const_value; // ֵconst_typeȷʹúη +} TConstInfo; + + +// WHEREӾ沨ṹ +typedef struct SQL_ANALYSER_API +{ + unsigned char code_type; // CODE_TYPE_IDENTIFIER, CODE_TYPE_OPERATOR, CODE_TYPE_CONSTANT + union + { + char iden_name[MAX_SYMBOL_LEN]; + int operator_code; + TConstInfo const_info; + } code_info; +} TWhereAntiPorland; + +// ﷨ +typedef struct SQL_ANALYSER_API +{ + int sql_type; // SQL + string table_name; // FROM Ӿı + vector column_name_vec; // У INSERT / UPDATE / SELECT + vector column_value_vec; // ֵУ INSERT / UPDATE + vector order_name_vec; // ORDER BY У SELECT + vector where_code_vec; // ָWHEREӾ沨ṹָ룬 DELETE / UPDATE / SELECT +} TSqlAnlsResult; + + +// ʷĽṹ +typedef struct SQL_ANALYSER_API +{ + int word_id; + /*ȡĵʵΪؼֵ֣Ϊؼڹؼֱеλ(0ʼ + ȡĵʵΪֵΪӦid (100ʼ + ȡĵʵΪʶֵΪIDENTIFIER + ȡĵʵΪ()ֵΪINTEGER_VALUE + ȡĵʵΪʵֵ֣ΪREAL_VALUE + ȡĵʵΪֵַΪSTRING_VALUE + ȡĵʵΪƣֵΪBINARY_VALUE + ȡʱΪǷֵַΪUNRECOGNIZED_TOKEN + ȡʱѽֵΪEND_OF_PROGRAM + */ + union + { + char ident[MAX_SYMBOL_LEN]; //ȡĵʵΪʶident + float real_value; //ȡĵʵΪʵֵ֣real_value + //int int_value; //ȡĵʵΪֵ֣int_value + long int_value; //ȡĵʵΪ()ֵ֣int_value + char string_value[MAX_CONSTANT_STRING_LEN]; //ȡĵʵΪֵַstring_value + char binary_value[MAX_CONSTANT_BINARY_LEN]; //ȡĵʵΪƣֵbinary_value + } value_union; + + char rtdbkey_value[MAX_CONSTANT_STRING_LEN]; +} LEXICAL_RET_RES_STRU; + +} + + +#endif diff --git a/code/sys_nicmonitor/include/db_com/lexical_anls.h b/code/sys_nicmonitor/include/db_com/lexical_anls.h new file mode 100644 index 0000000..eda7c8d --- /dev/null +++ b/code/sys_nicmonitor/include/db_com/lexical_anls.h @@ -0,0 +1,67 @@ +//****************************************************************** +// +// AUTHOR : ZhaoTiger +// +// FUNCTION : ͨSQLͷļʷṹ +// +// TIME : 2003.10.08 +// +// HISTORY : ӺĹʽ +// Datetime Action Author Reason +// ----------------------------------------------------------------- +// 2003.10.08 Creation ZhaoTiger +// +//****************************************************************** + +#ifndef __SQL_LEXICAL_H__ +#define __SQL_LEXICAL_H__ + +#ifdef _WINDOWS64 +#ifdef SQL_ANALYSER_EXPORTS +#define SQL_ANALYSER_API __declspec(dllexport) +#else +#define SQL_ANALYSER_API __declspec(dllimport) +#endif +#else +#define SQL_ANALYSER_API +#endif + +#include +#include + + +#include "interpreter_define.h" +#include "interpreter_struct.h" + +namespace SQL_ANALYSER +{ + +//ʷ +class SQL_ANALYSER_API CLexicalAnalyser +{ +private : + + char * m_SourceCode; // Դ + int m_CurPos; // ָԴдַλ + int m_Line; // ָԴдַڵ + char m_ErrorMessage[MAX_ERRMSG_LEN]; // Ϣ + + void ErrorProcess(); // + bool OperationSymbol(int &word_id); // ԲĴ + int BinSearchInKeyword(char *word_buf); // ҹؼֱǷΪؼ + +public: + + CLexicalAnalyser(); + ~CLexicalAnalyser(); + + void Initialize(const char *source_buffer); // ʼ + bool InSymbol(LEXICAL_RET_RES_STRU &lexical_ret_res); // ȡһʵĴʷ + void GetErrorMessage(char *err_msg); // õϢ + int GetLine(); // õǰ + void ResetPosition(); // ָԴijʼλ +}; + +} + +#endif diff --git a/code/sys_nicmonitor/include/db_com/public_m.h b/code/sys_nicmonitor/include/db_com/public_m.h new file mode 100644 index 0000000..ce594af --- /dev/null +++ b/code/sys_nicmonitor/include/db_com/public_m.h @@ -0,0 +1,156 @@ +//************************************** +// Generated by mcpp translator +// Version 1.3 +//************************************** + +#ifndef __PUBLIC_M_H__ +#define __PUBLIC_M_H__ + +#include"mcode/mvector.h" +#include"mcode/mstring.h" +#include"mcode/mstream.h" +#include"mcode/mclient.h" + +typedef MLang::VECTOR StrSeq; +typedef MLang::VECTOR LongSeq; +typedef MLang::VECTOR ShortSeq; +typedef MLang::VECTOR CharSeq; +const short C_DATATYPE_DEFAULT = 0; +const short C_DATATYPE_STRING = 1; +const short C_DATATYPE_UCHAR = 2; +const short C_DATATYPE_SHORT = 3; +const short C_DATATYPE_INT = 4; +const short C_DATATYPE_DATETIME = 5; +const short C_DATATYPE_FLOAT = 6; +const short C_DATATYPE_DOUBLE = 7; +const short C_DATATYPE_KEYID = 8; +const short C_DATATYPE_BINARY = 9; +const short C_DATATYPE_TEXT = 10; +const short C_DATATYPE_IMAGE = 11; +const short C_DATATYPE_APPKEYID = 12; +const short C_DATATYPE_APPID = 13; +const short C_DATATYPE_UINT = 14; +const short C_DATATYPE_LONG = 15; +const short C_DATATYPE_RTDBKEY = 16; +const short C_DATATYPE_MEASRTDBKEY = 17; +const short C_DATATYPE_APPRTDBKEY = 18; +typedef MLang::Long TKeyID; +struct TAppKeyID +{ + int app_id; + TKeyID key_id; + void __write(MLang::OutputStream&__os)const; + void __read(MLang::InputStream&__is); +}; +typedef TAppKeyID TAppID; +struct TRtdbKey +{ + MLang::Long table_id; + MLang::Long region_record_column_id; + void __write(MLang::OutputStream&__os)const; + void __read(MLang::InputStream&__is); +}; +struct TAppRtdbKey +{ + int app_id; + TRtdbKey rtdbkey_id; + void __write(MLang::OutputStream&__os)const; + void __read(MLang::InputStream&__is); +}; +struct UDataValue +{ +private: + union + { + char* c_string; + unsigned char c_uchar; + short c_short; + int c_int; + MLang::Long c_time; + float c_float; + double c_double; + TKeyID c_keyid; + CharSeq* c_binary; + CharSeq* c_text; + CharSeq* c_image; + TAppKeyID c_appkeyid; + TAppID c_appid; + char c_default; + unsigned int c_uint; + MLang::Long c_long; + TRtdbKey c_rtdbkey; + TRtdbKey c_measrtdbkey; + TAppRtdbKey c_apprtdbkey; + }__u_val; + bool __u_init; + unsigned short __u_index; +public: + UDataValue(); + ~UDataValue(); + UDataValue(const UDataValue&); + UDataValue&operator=(const UDataValue&); + short _d()const; + void __clear(); + void __write(MLang::OutputStream&__os)const; + void __read(MLang::InputStream&__is); + void c_string(const char*); + void c_string(const MLang::STRING&); + const char*c_string()const; + void c_uchar(const unsigned char); + const unsigned char c_uchar()const; + void c_short(const short); + const short c_short()const; + void c_int(const int); + const int c_int()const; + void c_time(const MLang::Long); + const MLang::Long c_time()const; + void c_float(const float); + const float c_float()const; + void c_double(const double); + const double c_double()const; + void c_keyid(const TKeyID); + const TKeyID c_keyid()const; + void c_binary(const CharSeq&); + const CharSeq&c_binary()const; + CharSeq&c_binary(); + void c_text(const CharSeq&); + const CharSeq&c_text()const; + CharSeq&c_text(); + void c_image(const CharSeq&); + const CharSeq&c_image()const; + CharSeq&c_image(); + void c_appkeyid(const TAppKeyID&); + const TAppKeyID&c_appkeyid()const; + TAppKeyID&c_appkeyid(); + void c_appid(const TAppID&); + const TAppID&c_appid()const; + TAppID&c_appid(); + void c_default(const char); + const char c_default()const; + void c_uint(const unsigned int); + const unsigned int c_uint()const; + void c_long(const MLang::Long); + const MLang::Long c_long()const; + void c_rtdbkey(const TRtdbKey&); + const TRtdbKey&c_rtdbkey()const; + TRtdbKey&c_rtdbkey(); + void c_measrtdbkey(const TRtdbKey&); + const TRtdbKey&c_measrtdbkey()const; + TRtdbKey&c_measrtdbkey(); + void c_apprtdbkey(const TAppRtdbKey&); + const TAppRtdbKey&c_apprtdbkey()const; + TAppRtdbKey&c_apprtdbkey(); +}; +typedef MLang::VECTOR SEQDataValue; +struct TDBErrorStru +{ + unsigned int error_no; + MLang::STRING error_msg; + TDBErrorStru(); + TDBErrorStru(const TDBErrorStru&); + TDBErrorStru&operator=(const TDBErrorStru&); + void __write(MLang::OutputStream&__os)const; + void __read(MLang::InputStream&__is); +}; +typedef MLang::VECTOR SEQDBErrorStru; +#endif diff --git a/code/sys_nicmonitor/include/db_com/query_sample_m.h b/code/sys_nicmonitor/include/db_com/query_sample_m.h new file mode 100644 index 0000000..7509d6f --- /dev/null +++ b/code/sys_nicmonitor/include/db_com/query_sample_m.h @@ -0,0 +1,945 @@ +//************************************** +// Generated by mcpp translator +// Version 1.3 +//************************************** + +#ifndef __QUERY_SAMPLE_M_H__ +#define __QUERY_SAMPLE_M_H__ + +#include"mcode/mvector.h" +#include"mcode/mstring.h" +#include"mcode/mstream.h" +#include"mcode/mclient.h" +#include"public_m.h" + + +const short QUERY_MODE_START = 0; +const short QUERY_MODE_MIDDLE = 1; +const short QUERY_MODE_END = 2; +const short QUERY_MODE_MAX = 3; +const short QUERY_MODE_MIN = 4; +const short QUERY_MODE_AVERAGE = 5; +const short QUERY_YC_SAMPLE = 1; +const short QUERY_YX_SAMPLE = 0; +const short QUERY_SUCCESS = 0; +const short QUERY_FAIL = -1; +const short QUERY_REACH_MAX = 1; +const short QUERY_ALL_ROWS = -1; +const short STA_POLICY_INTELLIGENT = 0; +const short STA_POLICY_NORMAL = 1; +const short STA_POLICY_DAY = 2; +const short STA_POLICY_HOUR = 3; +const short STA_MODE_MAX = 0; +const short STA_MODE_MIN = 1; +const short STA_MODE_AVERAGE = 2; +const short STA_MODE_LOADRATE = 3; +const short STA_WITH_LIMIT = 0; +const short STA_WITHOUT_LIMIT = 1; +const short STA_WITHOUT_ABS = 0; +const short STA_WITH_ABS = 1; +const short SAMPLE_DATATYPE_INT = 0; +const short SAMPLE_DATATYPE_FLOAT = 1; +const short SAMPLE_DATATYPE_STRING = 2; +typedef MLang::VECTOR SEQKeyID; +struct TKeyInfo +{ + MLang::STRING keyid; + int max_result; + TKeyInfo(); + TKeyInfo(const TKeyInfo&); + TKeyInfo&operator=(const TKeyInfo&); + void __write(MLang::OutputStream&__os)const; + void __read(MLang::InputStream&__is); +}; +typedef MLang::VECTOR SEQKeyInfo; +struct TSampleInfo +{ + MLang::STRING sample_name; + MLang::Long start_time; + MLang::Long end_time; + unsigned char is_yc; + int time_pace; + short sample_mode; + int specify_status; + unsigned char status_policy; + short key_num; + SEQKeyInfo seq_keyinfo; + TSampleInfo(); + TSampleInfo(const TSampleInfo&); + TSampleInfo&operator=(const TSampleInfo&); + void __write(MLang::OutputStream&__os)const; + void __read(MLang::InputStream&__is); +}; +typedef MLang::VECTOR SEQSampleInfo; +struct TQuerySampleInParm +{ + int query_id; + SEQSampleInfo seq_sample_info; + TQuerySampleInParm(); + TQuerySampleInParm(const TQuerySampleInParm&); + TQuerySampleInParm&operator=(const TQuerySampleInParm&); + void __write(MLang::OutputStream&__os)const; + void __read(MLang::InputStream&__is); +}; +struct USampleValue +{ +private: + union + { + unsigned char yx_value; + float yc_value; + }__u_val; + bool __u_init; + unsigned short __u_index; +public: + USampleValue(); + ~USampleValue(); + USampleValue(const USampleValue&); + USampleValue&operator=(const USampleValue&); + short _d()const; + void __clear(); + void __write(MLang::OutputStream&__os)const; + void __read(MLang::InputStream&__is); + void yx_value(const unsigned char); + const unsigned char yx_value()const; + void yc_value(const float); + const float yc_value()const; +}; +struct TSampleValueInfo +{ + MLang::Long occur_time; + USampleValue value; + int status; + short is_null; + void __write(MLang::OutputStream&__os)const; + void __read(MLang::InputStream&__is); +}; +typedef MLang::VECTOR SEQSampleValueInfo; +struct TSampleResultInfo +{ + MLang::STRING keyid; + int max_result; + short success_flag; + MLang::STRING err_string; + short reach_max; + int result_num; + SEQSampleValueInfo seq_val; + TSampleResultInfo(); + TSampleResultInfo(const TSampleResultInfo&); + TSampleResultInfo&operator=(const TSampleResultInfo&); + void __write(MLang::OutputStream&__os)const; + void __read(MLang::InputStream&__is); +}; +typedef MLang::VECTOR SEQSampleResultInfo; +struct TSampleResult +{ + MLang::STRING sample_name; + MLang::Long start_time; + MLang::Long end_time; + unsigned char is_yc; + int time_pace; + short sample_mode; + int specify_status; + unsigned char status_policy; + short key_num; + short valid_flag; + MLang::STRING invalid_string; + SEQSampleResultInfo seq_sample_result_info; + TSampleResult(); + TSampleResult(const TSampleResult&); + TSampleResult&operator=(const TSampleResult&); + void __write(MLang::OutputStream&__os)const; + void __read(MLang::InputStream&__is); +}; +typedef MLang::VECTOR SEQSampleResult; +struct TQuerySampleOutParm +{ + int query_id; + SEQSampleResult seq_sample_result; + TQuerySampleOutParm(); + TQuerySampleOutParm(const TQuerySampleOutParm&); + TQuerySampleOutParm&operator=(const TQuerySampleOutParm&); + void __write(MLang::OutputStream&__os)const; + void __read(MLang::InputStream&__is); +}; +struct TStatisticsKeyInfo +{ + MLang::STRING keyid; + TStatisticsKeyInfo(); + TStatisticsKeyInfo(const TStatisticsKeyInfo&); + TStatisticsKeyInfo&operator=(const TStatisticsKeyInfo&); + void __write(MLang::OutputStream&__os)const; + void __read(MLang::InputStream&__is); +}; +typedef MLang::VECTOR SEQStatisticsKeyInfo; +struct TStatisticsInfo +{ + MLang::STRING sample_name; + MLang::Long start_time; + MLang::Long end_time; + unsigned char statistics_policy; + int time_pace; + short statistics_mode; + unsigned char except_limit; + unsigned char is_abs; + short key_num; + SEQStatisticsKeyInfo seq_statistics_keyinfo; + TStatisticsInfo(); + TStatisticsInfo(const TStatisticsInfo&); + TStatisticsInfo&operator=(const TStatisticsInfo&); + void __write(MLang::OutputStream&__os)const; + void __read(MLang::InputStream&__is); +}; +typedef MLang::VECTOR SEQStatisticsInfo; +struct TStatisticsSampleInParm +{ + int query_id; + SEQStatisticsInfo seq_statistics_info; + TStatisticsSampleInParm(); + TStatisticsSampleInParm(const TStatisticsSampleInParm&); + TStatisticsSampleInParm&operator=(const TStatisticsSampleInParm&); + void __write(MLang::OutputStream&__os)const; + void __read(MLang::InputStream&__is); +}; +struct TStatisticsResultInfo +{ + MLang::STRING keyid; + short success_flag; + MLang::STRING err_string; + float value; + MLang::Long occur_time; + short is_null; + TStatisticsResultInfo(); + TStatisticsResultInfo(const TStatisticsResultInfo&); + TStatisticsResultInfo&operator=(const TStatisticsResultInfo&); + void __write(MLang::OutputStream&__os)const; + void __read(MLang::InputStream&__is); +}; +typedef MLang::VECTOR SEQStatisticsResultInfo; +struct TStatisticsResult +{ + MLang::STRING sample_name; + MLang::Long start_time; + MLang::Long end_time; + unsigned char statistics_policy; + unsigned char is_real; + int time_pace; + short statistics_mode; + unsigned char except_limit; + unsigned char is_abs; + short key_num; + short valid_flag; + MLang::STRING invalid_string; + SEQStatisticsResultInfo seq_statistics_result_info; + TStatisticsResult(); + TStatisticsResult(const TStatisticsResult&); + TStatisticsResult&operator=(const TStatisticsResult&); + void __write(MLang::OutputStream&__os)const; + void __read(MLang::InputStream&__is); +}; +typedef MLang::VECTOR SEQStatisticsResult; +struct TStatisticsSampleOutParm +{ + int query_id; + SEQStatisticsResult seq_statistics_result; + TStatisticsSampleOutParm(); + TStatisticsSampleOutParm(const TStatisticsSampleOutParm&); + TStatisticsSampleOutParm&operator=(const TStatisticsSampleOutParm&); + void __write(MLang::OutputStream&__os)const; + void __read(MLang::InputStream&__is); +}; +struct TDiscreteInfo +{ + MLang::STRING sample_name; + MLang::STRING keyid; + unsigned char is_yc; + MLang::Long time_num; + LongSeq seq_timeinfo; + TDiscreteInfo(); + TDiscreteInfo(const TDiscreteInfo&); + TDiscreteInfo&operator=(const TDiscreteInfo&); + void __write(MLang::OutputStream&__os)const; + void __read(MLang::InputStream&__is); +}; +typedef MLang::VECTOR SEQDiscreteInfo; +struct TDiscreteSampleInParm +{ + int query_id; + SEQDiscreteInfo seq_discrete_info; + TDiscreteSampleInParm(); + TDiscreteSampleInParm(const TDiscreteSampleInParm&); + TDiscreteSampleInParm&operator=(const TDiscreteSampleInParm&); + void __write(MLang::OutputStream&__os)const; + void __read(MLang::InputStream&__is); +}; +struct TDiscreteResult +{ + MLang::STRING sample_name; + MLang::STRING keyid; + unsigned char is_yc; + unsigned char is_real; + short success_flag; + MLang::STRING err_string; + int time_num; + SEQSampleValueInfo seq_val; + TDiscreteResult(); + TDiscreteResult(const TDiscreteResult&); + TDiscreteResult&operator=(const TDiscreteResult&); + void __write(MLang::OutputStream&__os)const; + void __read(MLang::InputStream&__is); +}; +typedef MLang::VECTOR SEQDiscreteResult; +struct TDiscreteSampleOutParm +{ + int query_id; + SEQDiscreteResult seq_discrete_result; + TDiscreteSampleOutParm(); + TDiscreteSampleOutParm(const TDiscreteSampleOutParm&); + TDiscreteSampleOutParm&operator=(const TDiscreteSampleOutParm&); + void __write(MLang::OutputStream&__os)const; + void __read(MLang::InputStream&__is); +}; +struct TTriggerSampleInfo +{ + int sample_type; + MLang::STRING sample_name; + MLang::Long start_time; + MLang::Long end_time; + int max_result; + unsigned char offer_id; + LongSeq seq_id; + unsigned char return_all; + short keyid_num; + SEQKeyID seq_keyid; + TTriggerSampleInfo(); + TTriggerSampleInfo(const TTriggerSampleInfo&); + TTriggerSampleInfo&operator=(const TTriggerSampleInfo&); + void __write(MLang::OutputStream&__os)const; + void __read(MLang::InputStream&__is); +}; +typedef MLang::VECTOR SEQTriggerSampleInfo; +struct TTriggerSampleInParm +{ + int query_id; + SEQTriggerSampleInfo seq_trigger_sample_info; + TTriggerSampleInParm(); + TTriggerSampleInParm(const TTriggerSampleInParm&); + TTriggerSampleInParm&operator=(const TTriggerSampleInParm&); + void __write(MLang::OutputStream&__os)const; + void __read(MLang::InputStream&__is); +}; +struct USampleDataValue +{ +private: + union + { + int c_int; + float c_float; + char* c_string; + }__u_val; + bool __u_init; + unsigned short __u_index; +public: + USampleDataValue(); + ~USampleDataValue(); + USampleDataValue(const USampleDataValue&); + USampleDataValue&operator=(const USampleDataValue&); + short _d()const; + void __clear(); + void __write(MLang::OutputStream&__os)const; + void __read(MLang::InputStream&__is); + void c_int(const int); + const int c_int()const; + void c_float(const float); + const float c_float()const; + void c_string(const char*); + void c_string(const MLang::STRING&); + const char*c_string()const; +}; +struct TSampleQueryKeyInfo +{ + MLang::STRING keyid; + MLang::STRING keyid_description; + short keyid_datatype; + short is_success; + MLang::STRING err_string; + short is_null; + USampleDataValue keyid_value; + TSampleQueryKeyInfo(); + TSampleQueryKeyInfo(const TSampleQueryKeyInfo&); + TSampleQueryKeyInfo&operator=(const TSampleQueryKeyInfo&); + void __write(MLang::OutputStream&__os)const; + void __read(MLang::InputStream&__is); +}; +typedef MLang::VECTOR SEQTriggerSampleKeyValue; +struct TTriggerQueryResult +{ + int occur_time; + SEQTriggerSampleKeyValue seq_sample_value; + TTriggerQueryResult(); + TTriggerQueryResult(const TTriggerQueryResult&); + TTriggerQueryResult&operator=(const TTriggerQueryResult&); + void __write(MLang::OutputStream&__os)const; + void __read(MLang::InputStream&__is); +}; +typedef MLang::VECTOR SEQTriggerQueryResult; +struct TTriggerSampleResult +{ + int sample_type; + MLang::STRING sample_name; + MLang::Long start_time; + MLang::Long end_time; + int max_result; + unsigned char offer_id; + LongSeq seq_id; + unsigned char return_all; + short success_flag; + MLang::STRING err_string; + short reach_max; + short keyid_num; + SEQTriggerQueryResult seq_sample_query_result; + TTriggerSampleResult(); + TTriggerSampleResult(const TTriggerSampleResult&); + TTriggerSampleResult&operator=(const TTriggerSampleResult&); + void __write(MLang::OutputStream&__os)const; + void __read(MLang::InputStream&__is); +}; +typedef MLang::VECTOR SEQTriggerSampleResult; +struct TTriggerSampleOutParm +{ + int query_id; + SEQTriggerSampleResult seq_trigger_sample_result; + TTriggerSampleOutParm(); + TTriggerSampleOutParm(const TTriggerSampleOutParm&); + TTriggerSampleOutParm&operator=(const TTriggerSampleOutParm&); + void __write(MLang::OutputStream&__os)const; + void __read(MLang::InputStream&__is); +}; +struct TTriggerStatisticsInfo +{ + int sample_type; + MLang::STRING sample_name; + MLang::Long start_time; + MLang::Long end_time; + short statistics_mode; + unsigned char except_limit; + unsigned char is_abs; + unsigned char offer_id; + LongSeq seq_id; + unsigned char return_all; + short keyid_num; + SEQKeyID seq_keyid; + TTriggerStatisticsInfo(); + TTriggerStatisticsInfo(const TTriggerStatisticsInfo&); + TTriggerStatisticsInfo&operator=(const TTriggerStatisticsInfo&); + void __write(MLang::OutputStream&__os)const; + void __read(MLang::InputStream&__is); +}; +typedef MLang::VECTOR SEQTriggerStatisticsInfo; +struct TTriggerStatisticsInParm +{ + int query_id; + SEQTriggerStatisticsInfo seq_trigger_statistics_info; + TTriggerStatisticsInParm(); + TTriggerStatisticsInParm(const TTriggerStatisticsInParm&); + TTriggerStatisticsInParm&operator=(const TTriggerStatisticsInParm&); + void __write(MLang::OutputStream&__os)const; + void __read(MLang::InputStream&__is); +}; +struct TSampleStatisticsKeyInfo +{ + MLang::STRING keyid; + MLang::STRING keyid_description; + short keyid_datatype; + short is_success; + MLang::STRING err_string; + short is_null; + MLang::Long occur_time; + USampleDataValue keyid_value; + TSampleStatisticsKeyInfo(); + TSampleStatisticsKeyInfo(const TSampleStatisticsKeyInfo&); + TSampleStatisticsKeyInfo&operator=(const TSampleStatisticsKeyInfo&); + void __write(MLang::OutputStream&__os)const; + void __read(MLang::InputStream&__is); +}; +typedef MLang::VECTOR SEQTriggerStatisticsKeyValue; +struct TTriggerStatisticsResult +{ + int sample_type; + MLang::STRING sample_name; + MLang::Long start_time; + MLang::Long end_time; + short statistics_mode; + unsigned char except_limit; + unsigned char is_abs; + unsigned char offer_id; + LongSeq seq_id; + unsigned char return_all; + short success_flag; + MLang::STRING err_string; + short keyid_num; + SEQTriggerStatisticsKeyValue seq_sample_statistics_key_value; + TTriggerStatisticsResult(); + TTriggerStatisticsResult(const TTriggerStatisticsResult&); + TTriggerStatisticsResult&operator=(const TTriggerStatisticsResult&); + void __write(MLang::OutputStream&__os)const; + void __read(MLang::InputStream&__is); +}; +typedef MLang::VECTOR SEQTriggerStatisticsResult; +struct TTriggerStatisticsOutParm +{ + int query_id; + SEQTriggerStatisticsResult seq_trigger_statistics_result; + TTriggerStatisticsOutParm(); + TTriggerStatisticsOutParm(const TTriggerStatisticsOutParm&); + TTriggerStatisticsOutParm&operator=(const TTriggerStatisticsOutParm&); + void __write(MLang::OutputStream&__os)const; + void __read(MLang::InputStream&__is); +}; +struct TTriggerKeyInfo +{ + MLang::STRING sample_name; + MLang::STRING keyid; + TTriggerKeyInfo(); + TTriggerKeyInfo(const TTriggerKeyInfo&); + TTriggerKeyInfo&operator=(const TTriggerKeyInfo&); + void __write(MLang::OutputStream&__os)const; + void __read(MLang::InputStream&__is); +}; +typedef MLang::VECTOR SEQTriggerKeyInfo; +struct TTriggerKeyInfoInParm +{ + SEQTriggerKeyInfo seq_trigger_key_info; + TTriggerKeyInfoInParm(); + TTriggerKeyInfoInParm(const TTriggerKeyInfoInParm&); + TTriggerKeyInfoInParm&operator=(const TTriggerKeyInfoInParm&); + void __write(MLang::OutputStream&__os)const; + void __read(MLang::InputStream&__is); +}; +struct TTriggerReturnInfo +{ + int sample_type; + MLang::STRING sample_name; + unsigned char offer_id; + TTriggerReturnInfo(); + TTriggerReturnInfo(const TTriggerReturnInfo&); + TTriggerReturnInfo&operator=(const TTriggerReturnInfo&); + void __write(MLang::OutputStream&__os)const; + void __read(MLang::InputStream&__is); +}; +typedef MLang::VECTOR SEQTriggerReturnInfo; +struct TTriggerKeyInfoResult +{ + MLang::STRING sample_name; + MLang::STRING keyid; + short success_flag; + MLang::STRING err_string; + SEQTriggerReturnInfo seq_trigger_return_info; + TTriggerKeyInfoResult(); + TTriggerKeyInfoResult(const TTriggerKeyInfoResult&); + TTriggerKeyInfoResult&operator=(const TTriggerKeyInfoResult&); + void __write(MLang::OutputStream&__os)const; + void __read(MLang::InputStream&__is); +}; +typedef MLang::VECTOR SEQTriggerKeyInfoResult; +struct TTriggerKeyInfoOutParm +{ + SEQTriggerKeyInfoResult seq_trigger_key_info_result; + TTriggerKeyInfoOutParm(); + TTriggerKeyInfoOutParm(const TTriggerKeyInfoOutParm&); + TTriggerKeyInfoOutParm&operator=(const TTriggerKeyInfoOutParm&); + void __write(MLang::OutputStream&__os)const; + void __read(MLang::InputStream&__is); +}; +struct TSampleKeyInfo +{ + MLang::STRING sample_name; + SEQKeyID seq_keyid; + TSampleKeyInfo(); + TSampleKeyInfo(const TSampleKeyInfo&); + TSampleKeyInfo&operator=(const TSampleKeyInfo&); + void __write(MLang::OutputStream&__os)const; + void __read(MLang::InputStream&__is); +}; +typedef MLang::VECTOR SEQSampleKeyInfo; +struct TSampleKeyInfoInParm +{ + unsigned char is_yc; + unsigned char is_real; + SEQSampleKeyInfo seq_sample_key_info; + TSampleKeyInfoInParm(); + TSampleKeyInfoInParm(const TSampleKeyInfoInParm&); + TSampleKeyInfoInParm&operator=(const TSampleKeyInfoInParm&); + void __write(MLang::OutputStream&__os)const; + void __read(MLang::InputStream&__is); +}; +struct TSampleReturnInfo +{ + MLang::STRING keyid; + unsigned char is_sample; + int sample_interval; + TSampleReturnInfo(); + TSampleReturnInfo(const TSampleReturnInfo&); + TSampleReturnInfo&operator=(const TSampleReturnInfo&); + void __write(MLang::OutputStream&__os)const; + void __read(MLang::InputStream&__is); +}; +typedef MLang::VECTOR SEQSampleReturnInfo; +struct TSampleKeyInfoResult +{ + MLang::STRING sample_name; + SEQKeyID seq_keyid; + short success_flag; + MLang::STRING err_string; + SEQSampleReturnInfo seq_sample_return_info; + TSampleKeyInfoResult(); + TSampleKeyInfoResult(const TSampleKeyInfoResult&); + TSampleKeyInfoResult&operator=(const TSampleKeyInfoResult&); + void __write(MLang::OutputStream&__os)const; + void __read(MLang::InputStream&__is); +}; +typedef MLang::VECTOR SEQSampleKeyInfoResult; +struct TSampleKeyInfoOutParm +{ + unsigned char is_yc; + unsigned char is_real; + SEQSampleKeyInfoResult seq_sample_key_info_result; + TSampleKeyInfoOutParm(); + TSampleKeyInfoOutParm(const TSampleKeyInfoOutParm&); + TSampleKeyInfoOutParm&operator=(const TSampleKeyInfoOutParm&); + void __write(MLang::OutputStream&__os)const; + void __read(MLang::InputStream&__is); +}; +struct UIdValue +{ +private: + union + { + char* keyid; + int id; + }__u_val; + bool __u_init; + unsigned short __u_index; +public: + UIdValue(); + ~UIdValue(); + UIdValue(const UIdValue&); + UIdValue&operator=(const UIdValue&); + short _d()const; + void __clear(); + void __write(MLang::OutputStream&__os)const; + void __read(MLang::InputStream&__is); + void keyid(const char*); + void keyid(const MLang::STRING&); + const char*keyid()const; + void id(const int); + const int id()const; +}; +struct TStatisticsCond +{ + MLang::STRING cond_col_name; + short condition_num; + SEQDataValue cond_value; + TStatisticsCond(); + TStatisticsCond(const TStatisticsCond&); + TStatisticsCond&operator=(const TStatisticsCond&); + void __write(MLang::OutputStream&__os)const; + void __read(MLang::InputStream&__is); +}; +typedef MLang::VECTOR SEQStatisticsCondInfo; +struct TNumberStatisticsInfo +{ + UIdValue statistics_id; + int statistics_mode; + int statistics_status; + short field_num; + SEQStatisticsCondInfo seq_cond_info; + TNumberStatisticsInfo(); + TNumberStatisticsInfo(const TNumberStatisticsInfo&); + TNumberStatisticsInfo&operator=(const TNumberStatisticsInfo&); + void __write(MLang::OutputStream&__os)const; + void __read(MLang::InputStream&__is); +}; +typedef MLang::VECTOR SEQNumberStatisticsInfo; +struct TNumberStatisticsTypeInfo +{ + MLang::STRING sample_name; + MLang::Long start_time; + MLang::Long end_time; + short key_num; + SEQNumberStatisticsInfo seq_number_statistics_info; + TNumberStatisticsTypeInfo(); + TNumberStatisticsTypeInfo(const TNumberStatisticsTypeInfo&); + TNumberStatisticsTypeInfo&operator=(const TNumberStatisticsTypeInfo&); + void __write(MLang::OutputStream&__os)const; + void __read(MLang::InputStream&__is); +}; +typedef MLang::VECTOR SEQNumStatisticsTypeInfo; +struct TNumberStatisticsInParm +{ + SEQNumStatisticsTypeInfo seq_num_statistics_type_info; + TNumberStatisticsInParm(); + TNumberStatisticsInParm(const TNumberStatisticsInParm&); + TNumberStatisticsInParm&operator=(const TNumberStatisticsInParm&); + void __write(MLang::OutputStream&__os)const; + void __read(MLang::InputStream&__is); +}; +struct TNumStatisticsResultInfo +{ + UIdValue statistics_id; + int statistics_mode; + int statistics_status; + short success_flag; + MLang::STRING err_string; + int value; + TNumStatisticsResultInfo(); + TNumStatisticsResultInfo(const TNumStatisticsResultInfo&); + TNumStatisticsResultInfo&operator=(const TNumStatisticsResultInfo&); + void __write(MLang::OutputStream&__os)const; + void __read(MLang::InputStream&__is); +}; +typedef MLang::VECTOR SEQNumStatisticsResultInfo; +struct TNumStatisticsTypeResult +{ + MLang::STRING sample_name; + MLang::Long start_time; + MLang::Long end_time; + short key_num; + short valid_flag; + MLang::STRING invalid_string; + SEQNumStatisticsResultInfo seq_num_statistics_result_info; + TNumStatisticsTypeResult(); + TNumStatisticsTypeResult(const TNumStatisticsTypeResult&); + TNumStatisticsTypeResult&operator=(const TNumStatisticsTypeResult&); + void __write(MLang::OutputStream&__os)const; + void __read(MLang::InputStream&__is); +}; +typedef MLang::VECTOR SEQNumStatisticsTypeResult; +struct TNumberStatisticsOutParm +{ + SEQNumStatisticsTypeResult seq_num_statistics_type_result; + TNumberStatisticsOutParm(); + TNumberStatisticsOutParm(const TNumberStatisticsOutParm&); + TNumberStatisticsOutParm&operator=(const TNumberStatisticsOutParm&); + void __write(MLang::OutputStream&__os)const; + void __read(MLang::InputStream&__is); +}; +struct TTimeStatisticsInfo +{ + UIdValue statistics_id; + int statistics_mode; + int statistics_status; + short field_num; + SEQStatisticsCondInfo seq_cond_info; + TTimeStatisticsInfo(); + TTimeStatisticsInfo(const TTimeStatisticsInfo&); + TTimeStatisticsInfo&operator=(const TTimeStatisticsInfo&); + void __write(MLang::OutputStream&__os)const; + void __read(MLang::InputStream&__is); +}; +typedef MLang::VECTOR SEQTimeStatisticsInfo; +struct TTimeStatisticsTypeInfo +{ + MLang::STRING sample_name; + MLang::Long start_time; + MLang::Long end_time; + short key_num; + SEQTimeStatisticsInfo seq_time_statistics_info; + TTimeStatisticsTypeInfo(); + TTimeStatisticsTypeInfo(const TTimeStatisticsTypeInfo&); + TTimeStatisticsTypeInfo&operator=(const TTimeStatisticsTypeInfo&); + void __write(MLang::OutputStream&__os)const; + void __read(MLang::InputStream&__is); +}; +typedef MLang::VECTOR SEQTimeStatisticsTypeInfo; +struct TTimeStatisticsInParm +{ + SEQTimeStatisticsTypeInfo seq_time_statistics_type_info; + TTimeStatisticsInParm(); + TTimeStatisticsInParm(const TTimeStatisticsInParm&); + TTimeStatisticsInParm&operator=(const TTimeStatisticsInParm&); + void __write(MLang::OutputStream&__os)const; + void __read(MLang::InputStream&__is); +}; +struct TTimeStatisticsResultInfo +{ + UIdValue statistics_id; + int statistics_mode; + int statistics_status; + short success_flag; + MLang::STRING err_string; + int value; + TTimeStatisticsResultInfo(); + TTimeStatisticsResultInfo(const TTimeStatisticsResultInfo&); + TTimeStatisticsResultInfo&operator=(const TTimeStatisticsResultInfo&); + void __write(MLang::OutputStream&__os)const; + void __read(MLang::InputStream&__is); +}; +typedef MLang::VECTOR SEQTimeStatisticsResultInfo; +struct TTimeStatisticsTypeResult +{ + MLang::STRING sample_name; + MLang::Long start_time; + MLang::Long end_time; + short key_num; + short valid_flag; + MLang::STRING invalid_string; + SEQTimeStatisticsResultInfo seq_time_statistics_result_info; + TTimeStatisticsTypeResult(); + TTimeStatisticsTypeResult(const TTimeStatisticsTypeResult&); + TTimeStatisticsTypeResult&operator=(const TTimeStatisticsTypeResult&); + void __write(MLang::OutputStream&__os)const; + void __read(MLang::InputStream&__is); +}; +typedef MLang::VECTOR SEQTimeStatisticsTypeResult; +struct TTimeStatisticsOutParm +{ + SEQTimeStatisticsTypeResult seq_time_statistics_type_result; + TTimeStatisticsOutParm(); + TTimeStatisticsOutParm(const TTimeStatisticsOutParm&); + TTimeStatisticsOutParm&operator=(const TTimeStatisticsOutParm&); + void __write(MLang::OutputStream&__os)const; + void __read(MLang::InputStream&__is); +}; +struct TSampleInfoFromStat +{ + MLang::STRING sample_name; + MLang::Long start_time; + MLang::Long end_time; + unsigned char source_flag; + short statistics_mode; + short key_num; + SEQKeyID seq_keyid; + TSampleInfoFromStat(); + TSampleInfoFromStat(const TSampleInfoFromStat&); + TSampleInfoFromStat&operator=(const TSampleInfoFromStat&); + void __write(MLang::OutputStream&__os)const; + void __read(MLang::InputStream&__is); +}; +typedef MLang::VECTOR SEQSampleInfoFromStat; +struct TQuerySampleFromStatInParm +{ + int query_id; + SEQSampleInfoFromStat seq_sample_info_from_stat; + TQuerySampleFromStatInParm(); + TQuerySampleFromStatInParm(const TQuerySampleFromStatInParm&); + TQuerySampleFromStatInParm&operator=(const TQuerySampleFromStatInParm&); + void __write(MLang::OutputStream&__os)const; + void __read(MLang::InputStream&__is); +}; +struct TSampleValueFromStatInfo +{ + MLang::Long occur_time; + MLang::Long stat_occur_time; + float value; + int status; + short is_null; + void __write(MLang::OutputStream&__os)const; + void __read(MLang::InputStream&__is); +}; +typedef MLang::VECTOR SEQSampleValueFromStatInfo; +struct TSampleResultFromStatInfo +{ + MLang::STRING keyid; + short success_flag; + MLang::STRING err_string; + int result_num; + SEQSampleValueFromStatInfo seq_val; + TSampleResultFromStatInfo(); + TSampleResultFromStatInfo(const TSampleResultFromStatInfo&); + TSampleResultFromStatInfo&operator=(const TSampleResultFromStatInfo&); + void __write(MLang::OutputStream&__os)const; + void __read(MLang::InputStream&__is); +}; +typedef MLang::VECTOR SEQSampleResultFromStatInfo; +struct TSampleResultFromStat +{ + MLang::STRING sample_name; + MLang::Long start_time; + MLang::Long end_time; + unsigned char source_flag; + short statistics_mode; + short key_num; + short valid_flag; + MLang::STRING invalid_string; + SEQSampleResultFromStatInfo seq_sample_result_from_stat_info; + TSampleResultFromStat(); + TSampleResultFromStat(const TSampleResultFromStat&); + TSampleResultFromStat&operator=(const TSampleResultFromStat&); + void __write(MLang::OutputStream&__os)const; + void __read(MLang::InputStream&__is); +}; +typedef MLang::VECTOR SEQSampleResultFromStat; +struct TQuerySampleFromStatOutParm +{ + int query_id; + SEQSampleResultFromStat seq_sample_result_from_stat; + TQuerySampleFromStatOutParm(); + TQuerySampleFromStatOutParm(const TQuerySampleFromStatOutParm&); + TQuerySampleFromStatOutParm&operator=(const TQuerySampleFromStatOutParm&); + void __write(MLang::OutputStream&__os)const; + void __read(MLang::InputStream&__is); +}; +struct TAllSampleInfo +{ + MLang::STRING sample_name; + SEQKeyID seq_keyid; + unsigned char is_yc; + unsigned char is_real; + LongSeq seq_occur_time; + TAllSampleInfo(); + TAllSampleInfo(const TAllSampleInfo&); + TAllSampleInfo&operator=(const TAllSampleInfo&); + void __write(MLang::OutputStream&__os)const; + void __read(MLang::InputStream&__is); +}; +struct TAllQuerySampleInParm +{ + int query_id; + TAllSampleInfo all_sample_info; + TAllQuerySampleInParm(); + TAllQuerySampleInParm(const TAllQuerySampleInParm&); + TAllQuerySampleInParm&operator=(const TAllQuerySampleInParm&); + void __write(MLang::OutputStream&__os)const; + void __read(MLang::InputStream&__is); +}; +struct TAllSampleValueInfo +{ + MLang::Long occur_time; + MLang::VECTOR seq_value; + LongSeq seq_status; + ShortSeq seq_is_null; + TAllSampleValueInfo(); + TAllSampleValueInfo(const TAllSampleValueInfo&); + TAllSampleValueInfo&operator=(const TAllSampleValueInfo&); + void __write(MLang::OutputStream&__os)const; + void __read(MLang::InputStream&__is); +}; +typedef MLang::VECTOR SEQAllSampleValueInfo; +struct TAllSampleResult +{ + MLang::STRING sample_name; + SEQKeyID seq_keyid; + unsigned char is_yc; + unsigned char is_real; + LongSeq seq_occur_time; + short valid_flag; + MLang::STRING invalid_string; + SEQAllSampleValueInfo seq_all_value; + TAllSampleResult(); + TAllSampleResult(const TAllSampleResult&); + TAllSampleResult&operator=(const TAllSampleResult&); + void __write(MLang::OutputStream&__os)const; + void __read(MLang::InputStream&__is); +}; +struct TAllQuerySampleOutParm +{ + int query_id; + TAllSampleResult all_sample_result; + TAllQuerySampleOutParm(); + TAllQuerySampleOutParm(const TAllQuerySampleOutParm&); + TAllQuerySampleOutParm&operator=(const TAllQuerySampleOutParm&); + void __write(MLang::OutputStream&__os)const; + void __read(MLang::InputStream&__is); +}; +#endif diff --git a/code/sys_nicmonitor/include/db_com/query_sample_pi.h b/code/sys_nicmonitor/include/db_com/query_sample_pi.h new file mode 100644 index 0000000..af63a71 --- /dev/null +++ b/code/sys_nicmonitor/include/db_com/query_sample_pi.h @@ -0,0 +1,444 @@ +//************************************************************************************************** +// +// AUTHOR : ChenPeng +// +// FUNCTION : PIݿѯרIDL +// TIME : 2007.03.06 +// +// HISTORY : +// Datetime Action Author Reason +// ------------------------------------------------------------------------------------------------- +// 2007.03.06 Creation ChenPeng +// 2007.03.13 Add ChenPeng Add PI StatisticsSample API +// 2007.04.11 Add ChenPeng Add PI GetDiscreteSampleResultFromPI() +//************************************************************************************************** + +#include "public.h" +#include "mcode/mtypes.h" + +const short QUERY_YC_SAMPLE_PI = 1; +const short QUERY_YX_SAMPLE_PI = 0; + +const short QUERY_SUCCESS_PI = 0; +const short QUERY_FAIL_PI = -1; +const short QUERY_REACH_MAX_PI = 1; + +//union USampleValuePI switch(short) +//{ +// case 1: unsigned char yx_value; /*YXֵ*/ +// case 2: float yc_value; /*YCֵ*/ +//}; + +struct USampleValuePI +{ + int type; + union{ + unsigned char yx_value;//1 + float yc_value;//2 + }val; +}; + +struct TSampleValueInfoPI +{ + long occur_time; /*ʱ䣬λ*/ + short occur_time_ms; /*ʱ*/ + USampleValuePI value; /*ֵ*/ + int status; /*״̬*/ + short is_null; /*ǷΪ ȡֵ=-1ʾ*/ +}; + +struct TSampleResultInfoPI +{ + TKeyID keyid; /*YXYCID*/ + int max_result; /*ʱ󷵻-1Ϊȫѯ*/ + short success_flag; /*ɹ ȡֵ QUERY_SUCCESSɹȡֵ QUERY_FAILʧ*/ + varchar err_string; /*ʧܴϢsuccess_flag=QUERY_FAILЧ*/ + short reach_max; /*ǷԽ ȡֵ QUERY_REACH_MAXԽ磬ȡֵ QUERY_SUCCESSδԽ*/ + int result_num; /*ؽ,ʱn*/ + vector seq_val; /*YXYCļϢ(ظn)*/ +}; + +struct TSampleResultPI +{ + int app_no; /*Ӧú*/ + long start_time; /*ʼʱ*/ + short start_time_ms; /*ʼʱ䣬λ start_timeͬȷһȷʱ*/ + long end_time; /*ֹʱ*/ + short end_time_ms; /*ֹʱ䣬λ end_timeͬȷһȷʱ*/ + unsigned char arc_mode; /*ȡģʽ + ARC_MODE_EVENƽʱ + ARC_MODE_COMPȡֵ*/ + int time_pace; /*ʱ䲽*/ + short sample_mode; /*ʽ,ݲʵ*/ + int specify_status; /*ָ״̬,ݲʵ*/ + unsigned char status_policy; /*ָ״̬,ݲʵ*/ + short key_num; /*YXYCm*/ + short valid_flag; /*ЧԱ ȡֵ QUERY_SUCCESSЧ + ȡֵ QUERY_FAILЧ*/ + varchar invalid_string; /*ЧϢvalid_flag=QUERY_FAILЧ*/ + vector seq_pi_sample_result_info; /*(ظm)*/ +}; + +struct TQuerySampleOutParmPI +{ + int query_id; /*ѯID첽ѯʱʹ,ݲʵ*/ + vector seq_sample_result_pi; +}; + +struct TKeyInfoPI +{ + TKeyID keyid; /*YXYCID*/ + int max_result; /*ʱ󷵻*/ +}; + +struct TSampleInfoPI +{ + int app_no; /*Ӧú*/ + long start_time; /*ʼʱ䣬λ ʱڵڸʱ*/ + short start_time_ms; /*ʼʱ䣬λ start_timeͬȷһȷʱ*/ + long end_time; /*ֹʱ䣬λ ʱСڸʱ䣬עⲻʱ*/ + short end_time_ms; /*ֹʱ䣬λ end_timeͬȷһȷʱ*/ + unsigned char is_yc; /*YCYX־ ȡֵ QUERY_YC_SAMPLEң⣻ + ȡֵ QUERY_YX_SAMPLEңţ + ȡֵңʱis_realЧ + ͬʱtime_paceΪ1Сʱ + С1Сʱtime_paceǿΪ1Сʱ + sample_modeǿΪQUERY_MODE_START*/ + unsigned char arc_mode; /*̬Ϣݿȡģʽ + + ARC_MODE_EVEN: ÿtime_paceȡһֵ(ֵ) + + ARC_MODE_COMPȡʵʹ鵵ֵ(ʵֵ*/ + int time_pace; /*ʱ䲽λ롣arc_mode=ARC_MODE_EVENʱЧ*/ + short sample_mode; /*ʽ,ݲʵ*/ + int specify_status; /*ָ״̬,ݲʵ*/ + unsigned char status_policy; /*ָ״̬,ݲʵ*/ + short key_num; /*YXYCmԼ֤seq_keyinfo.length()ԺΪ׼*/ + vector seq_keyinfo; /*(ظm)*/ +}; + +struct TQuerySampleInParmPI +{ + int query_id; /*ѯID첽ѯʱʹãʹͬӿڸòЧ첽ѯݲʵ*/ + vector seq_sample_info_pi; +}; + +struct TPMUDataInfo +{ + int app_no; /*Ӧú*/ + long start_time; /*ʼʱ䣬λ ʱڵڸʱ*/ + short start_time_ms; /*ʼʱ䣬λ start_timeͬȷһȷʱ*/ + long end_time; /*ֹʱ䣬λ ʱСڸʱ䣬עⲻʱ*/ + short end_time_ms; /*ֹʱ䣬λ end_timeͬȷһȷʱ*/ + int time_pace; /*ʱ䲽λ */ + unsigned char result_mode; /*ѯģʽ + RESULT_MODE_NO_DIFF: ֲѯǷֵ + RESULT_MODE_DIFF: ֲѯǷֵ*/ + short key_num; /*YXYCmԼ֤seq_keyinfo.length()ԺΪ׼*/ + vector seq_keyid; /*(ظm)*/ +}; + +struct TQueryPMUInParmPI +{ + int query_id; /*ѯID첽ѯʱʹ,첽ѯݲʵ*/ + vector seq_pmu_data_info; +}; + +struct TPMUValueInfo +{ + float value; /*ֵ*/ + int status; /*״̬*/ +}; + +struct TPMUResultInfo +{ + TKeyID keyid; /*YXYCID*/ + short success_flag; /*ɹ ȡֵ QUERY_SUCCESSɹ + ȡֵ QUERY_FAILʧ*/ + varchar err_string; /*ʧܴϢsuccess_flag=QUERY_FAILЧ*/ + vector seq_val; /*YXYCļϢ(ظn)*/ +}; + +struct TPMUResult +{ + int app_no; /*Ӧú*/ + long start_time; /*ʼʱ*/ + short start_time_ms; /*ʼʱ䣬λ start_timeͬȷһȷʱ*/ + long end_time; /*ֹʱ*/ + short end_time_ms; /*ֹʱ䣬λ end_timeͬȷһȷʱ*/ + int time_pace; /*ʱ䲽*/ + short key_num; /*YXYCm*/ + short valid_flag; /*ЧԱ ȡֵ QUERY_SUCCESSЧ + ȡֵ QUERY_FAILЧ*/ + varchar invalid_string; /*ЧϢvalid_flag=QUERY_FAILЧ*/ + vector seq_pmu_result_info; /*(ظm)*/ +}; + +struct TQueryPMUOutParmPI +{ + int query_id; /*ѯID첽ѯʱʹ,ݲʵ*/ + vector seq_pmu_result; +}; + +/******************************************************************************************** +* ѯͳֵ(YCͳ) * +* ָʱΣѯֵСֵֵʱ䣬Сֵʱ䣬ƽֵ * +* ݿԴ * +*********************************************************************************************/ +struct TStatisticsKeyInfoPI +{ + TKeyID keyid; /*YCID*/ +}; + +typedef vector SEQStatisticsKeyInfoPI ; + +struct TStatisticsInfoPI +{ + int app_no; /*Ӧú*/ + long start_time; /*ʼʱ䣬λ ʱڵڸʱ*/ + long end_time; /*ֹʱ䣬λ ʱСڸʱ䣬עⲻʱ*/ + unsigned char statistics_policy; /*ͳƲ + = STA_POLICY_NORMAL 1 ͳƽԴڻ + = STA_POLICY_DAY 2 ͳƽԴͳ + = STA_POLICY_HOUR 3 ͳƽԴСʱͳ + ͳƲԲΪSTA_POLICY_NORMALis_realtime_paceЧ + ڲSTA_POLICY_DAY ʼֹʱΪһĿʼʱ䲢ұ֤ʱαΪһյ(>=1) + ڲSTA_POLICY_HOUR ʼֹʱΪһСʱĿʼʱ䲢ұ֤ʱαΪһСʱ(>=1)*/ + unsigned char is_real; /*ǷΪʵʱ ȡֵ QUERY_RS_SAMPLEʵʱ + ȡֵ QUERY_HS_SAMPLEʷ*/ + int time_pace; /*ʱ䲽λ Ҫ:ڵڲҲΪڵ*/ + short statistics_mode;/*ͳƷʽ*/ + unsigned char except_limit; /*ͳʱǷԽֵͳ ȡֵ STA_WITH_LIMITԽֵͳƣ + ȡֵ STA_WITHOUT_LIMITԽֵͳ*/ + unsigned char is_abs; /*ͳʱǷþֵ ȡֵ STA_WITH_ABSֵͳƣ + ȡֵ STA_WITHOUT_ABSʵֵͳ*/ + short key_num; /*YCmԼ֤seq_statistic_keyinfo.length()ԺΪ׼*/ + SEQStatisticsKeyInfoPI seq_statistics_keyinfo; /*(ظm)*/ +}; + +typedef vector SEQStatisticsInfoPI; + +struct TStatisticsSampleInParmPI +{ + int query_id; /*ѯID첽ѯʱʹãʹͬӿڸòЧ*/ + SEQStatisticsInfoPI seq_statistics_info; +}; + +struct TStatisticsResultInfoPI +{ + TKeyID keyid; /*YCID*/ + short success_flag; /*ɹ ȡֵ QUERY_SUCCESSɹ + ȡֵ QUERY_FAILʧ*/ + varchar err_string; /*ʧܴϢsuccess_flag=QUERY_FAILЧ*/ + float value; /*ͳֵ*/ + long occur_time; /*ͳֵʱ䣬λ룬СͳЧ*/ + short is_null; /*ǷΪ ȡֵ=-1ʾ*/ + +}; +typedef vector SEQStatisticsResultInfoPI; + +struct TStatisticsResultPI +{ + int app_no; /*Ӧú*/ + long start_time; /*ʼʱ*/ + long end_time; /*ֹʱ*/ + unsigned char statistics_policy; /*ͳƲ*/ + unsigned char is_real; /*ǷΪʵʱ */ + int time_pace; /*ʱ䲽*/ + short statistics_mode; /*ͳƷʽ*/ + unsigned char except_limit; /*ͳʱǷԽֵ*/ + unsigned char is_abs; /*ͳʱǷþֵ*/ + short key_num; /*YCm*/ + short valid_flag; /*ЧԱ ȡֵ QUERY_SUCCESSЧ + ȡֵ QUERY_FAILЧ*/ + varchar invalid_string; /*ЧϢvalid_flag=QUERY_FAILЧ*/ + SEQStatisticsResultInfoPI seq_statistics_result_info; /*(ظm)*/ +}; + +typedef vector SEQStatisticsResultPI; + +struct TStatisticsSampleOutParmPI +{ + int query_id; /*ѯID첽ѯʱʹ*/ + SEQStatisticsResultPI seq_statistics_result; +}; + +/******************************************************************************************** +* ѯ(ԴΪͳֵ)ֵֻYC * * +*********************************************************************************************/ +typedef vector SEQKeyIDPI; + +struct TSampleInfoFromStatPI +{ + int app_no; /*Ӧú*/ + long start_time; /*ʼʱ䣬λ ʱڵڸʱ*/ + long end_time; /*ֹʱ䣬λ ʱСڸʱ䣬עⲻʱ*/ + unsigned char source_flag; /*Դ־ ȡֵ 0ԴΪͳƣ + ȡֵ 1ԴΪСʱͳƣʱЧ + */ + short statistics_mode;/*ͳƷʽȡСƽ򸺺*/ + short key_num; /*YCmԼ֤seq_keyid.length()ԺΪ׼*/ + SEQKeyIDPI seq_keyid; /*(ظm)*/ +}; + +typedef vector SEQSampleInfoFromStatPI; + +struct TQuerySampleFromStatInParmPI +{ + int query_id; /*ѯID첽ѯʱʹãʹͬӿڸòЧ*/ + SEQSampleInfoFromStatPI seq_sample_info_from_stat; +}; + +struct TSampleValueFromStatInfoPI +{ + long occur_time; /*ʱ䡣λ + source_flag = 0ʱ侫ȷգ*/ + long stat_occur_time; /*ͳƷʱ䣬ֻСͳƣЧλ*/ + float value; /*ͳYCֵ*/ + int status; /*ͳYC״̬*/ + short is_null; /*ǷΪ ȡֵ=-1ʾ*/ +}; +typedef vector SEQSampleValueFromStatInfoPI; + +struct TSampleResultFromStatInfoPI +{ + TKeyID keyid; /*YCID*/ + short success_flag; /*ɹ ȡֵ QUERY_SUCCESSɹ + ȡֵ QUERY_FAILʧ*/ + varchar err_string; /*ʧܴϢsuccess_flag=QUERY_FAILЧ*/ + int result_num; /*ؽ,ʱn*/ + SEQSampleValueFromStatInfoPI seq_val; /*YCļϢ(ظn)*/ +}; +typedef vector SEQSampleResultFromStatInfoPI; + +struct TSampleResultFromStatPI +{ + int app_no; /*Ӧú*/ + long start_time; /*ʼʱ*/ + long end_time; /*ֹʱ*/ + unsigned char source_flag; /*Դ־*/ + short statistics_mode; /*ͳƷʽ*/ + short key_num; /*YCm*/ + short valid_flag; /*ЧԱ ȡֵ QUERY_SUCCESSЧ + ȡֵ QUERY_FAILЧ*/ + varchar invalid_string; /*ЧϢvalid_flag=QUERY_FAILЧ*/ + SEQSampleResultFromStatInfoPI seq_sample_result_from_stat_info; /*(ظm)*/ +}; +typedef vector SEQSampleResultFromStatPI; + +struct TQuerySampleFromStatOutParmPI +{ + int query_id; /*ѯID첽ѯʱʹ*/ + SEQSampleResultFromStatPI seq_sample_result_from_stat; +}; + +//KEYID󷵻(ͨ)Ϣ +struct TSampleKeyInfoPI +{ + int app_no; // Ӧú + SEQKeyIDPI seq_keyid; // KEYID +}; +typedef vector SEQSampleKeyInfoPI; + +struct TSampleKeyInfoInParmPI +{ + unsigned char is_yc; /*YCYX־ ȡֵ QUERY_YC_SAMPLEң⣻ + ȡֵ QUERY_YX_SAMPLEңţ + ȡֵңʱis_realЧ*/ + unsigned char is_real; /*ǷΪʵʱ ȡֵ QUERY_RS_SAMPLEʵʱ + ȡֵ QUERY_HS_SAMPLEʷ*/ + SEQSampleKeyInfoPI seq_sample_key_info; +}; + +struct TSampleReturnInfoPI +{ + TKeyID keyid; // ָKEYID + unsigned char is_sample; /* ָ(is_yc/is_real)KEYIDǷ + = 1 + = 0 δ*/ + int sample_interval; /* ز(λ) + is_yc = QUERY_YX_SAMPLEʱsample_interval = 3600 + is_yc = QUERY_YC_SAMPLEis_real = QUERY_RS_SAMPLEʱ + sample_interval = 5*/ +}; +typedef vector SEQSampleReturnInfoPI; + +struct TSampleKeyInfoResultPI +{ + int app_no; // Ӧú + SEQKeyIDPI seq_keyid; // KEYID + short success_flag; /* ɹ ȡֵ QUERY_SUCCESSɹ + ȡֵ QUERY_FAILʧ seq_sample_return_info.length=0 */ + varchar err_string; // ʧܴϢsuccess_flag=QUERY_FAILЧ + SEQSampleReturnInfoPI seq_sample_return_info; +}; +typedef vector SEQSampleKeyInfoResultPI; + +struct TSampleKeyInfoOutParmPI +{ + unsigned char is_yc; + unsigned char is_real; + SEQSampleKeyInfoResultPI seq_sample_key_info_result; +}; + +/*************************************************************************** +* ɢѯ * +****************************************************************************/ +struct TDiscreteInfoPI +{ + int app_no; /*Ӧú*/ + TKeyID keyid; /*YXYCID*/ + unsigned char is_yc; /*YCYX־ ȡֵ QUERY_YC_SAMPLEң⣻ + ȡֵ QUERY_YX_SAMPLEңţ + ȡֵңʱis_realЧ*/ + unsigned char is_real; /*ǷΪʵʱ ȡֵ QUERY_RS_SAMPLEʵʱ + ȡֵ QUERY_HS_SAMPLEʷ*/ + int time_num; /*ʱm*/ + LongSeq seq_timeinfo; /*ʱ(ظm)*/ +}; + +typedef vector SEQDiscreteInfoPI; + +struct TDiscreteSampleInParmPI +{ + int query_id; /*ѯID첽ѯʱʹãʹͬӿڸòЧ*/ + SEQDiscreteInfoPI seq_discrete_info; +}; + +typedef vector SEQSampleValueInfoPI; +struct TDiscreteResultPI +{ + int app_no; /*Ӧú*/ + TKeyID keyid; /*YXYCID*/ + unsigned char is_yc; /*YCYX־*/ + unsigned char is_real; /*ǷΪʵʱ*/ + short success_flag; /*ɹ ȡֵ QUERY_SUCCESSɹ + ȡֵ QUERY_FAILʧ*/ + varchar err_string; /*ʧܴϢsuccess_flag=QUERY_FAILЧ*/ + int time_num; /*ؽ,ʱn*/ + SEQSampleValueInfoPI seq_val; /*YXYCļϢ(ظn)*/ +}; + +typedef vector SEQDiscreteResultPI; + +struct TDiscreteSampleOutParmPI +{ + int query_id; /*ѯID첽ѯʱʹ*/ + SEQDiscreteResultPI seq_discrete_result; +}; + +/*interface CQuerySamplePI +{ + //ڴPIȡSCADA + short GetSampleResultFromPI(in TQuerySampleInParmPI in_para, out TQuerySampleOutParmPI out_para); + //ڴPIȡPMUʷ + short GetPMUResultFromPI(in TQueryPMUInParmPI in_para, out TQueryPMUOutParmPI out_para); + //ڴPIȡSCADAͳ + short GetStatisticsSampleResultFromPI(in TStatisticsSampleInParmPI in_para, out TStatisticsSampleOutParmPI out_para); + // + short GetQuerySampleResultFromStatFromPI(in TQuerySampleFromStatInParmPI in_para, out TQuerySampleFromStatOutParmPI out_para); + //ߺKEYIDӦúŵõǷв + short GetSampleInfoByKEYIDFromPI(in TSampleKeyInfoInParmPI in_para, out TSampleKeyInfoOutParmPI out_para); + + short GetDiscreteSampleResultFromPI(in TDiscreteSampleInParmPI in_para, out TDiscreteSampleOutParmPI out_para); +};*/ diff --git a/code/sys_nicmonitor/include/db_com/query_sample_pi_m.h b/code/sys_nicmonitor/include/db_com/query_sample_pi_m.h new file mode 100644 index 0000000..cfd1385 --- /dev/null +++ b/code/sys_nicmonitor/include/db_com/query_sample_pi_m.h @@ -0,0 +1,531 @@ +//************************************** +// Generated by mcpp translator +// Version 1.2 +//************************************** + +#ifndef __QUERY_SAMPLE_PI_M_H__ +#define __QUERY_SAMPLE_PI_M_H__ + +#ifdef _WINDOWS64 +#ifdef DY_QUERY_SAMPLE_DLL_EXPORTS +#define DY_QUERY_SAMPLE_API __declspec(dllexport) +#else +#define DY_QUERY_SAMPLE_API __declspec(dllimport) +#endif +#else +#define DY_QUERY_SAMPLE_API +#endif + +#include"mcode/mvector.h" +#include"mcode/mstring.h" +#include"mcode/mstream.h" +#include"mcode/mclient.h" +#include"public_m.h" + + +const short QUERY_YC_SAMPLE_PI = 1; +const short QUERY_YX_SAMPLE_PI = 0; +const short QUERY_SUCCESS_PI = 0; +const short QUERY_FAIL_PI = -1; +const short QUERY_REACH_MAX_PI = 1; +struct DY_QUERY_SAMPLE_API USampleValuePI +{ +private: + union + { + unsigned char yx_value; + float yc_value; + }__u_val; + bool __u_init; + unsigned short __u_index; +public: + USampleValuePI(); + ~USampleValuePI(); + USampleValuePI(const USampleValuePI&); + USampleValuePI&operator=(const USampleValuePI&); + short _d()const; + void __clear(); + void __write(MLang::OutputStream&__os)const; + void __read(MLang::InputStream&__is); + void yx_value(const unsigned char); + const unsigned char yx_value()const; + void yc_value(const float); + const float yc_value()const; +}; +struct DY_QUERY_SAMPLE_API TSampleValueInfoPI +{ + MLang::Long occur_time; + short occur_time_ms; + USampleValuePI value; + int status; + short is_null; + void __write(MLang::OutputStream&__os)const; + void __read(MLang::InputStream&__is); +}; +struct DY_QUERY_SAMPLE_API TSampleResultInfoPI +{ + MLang::STRING keyid; + int max_result; + short success_flag; + MLang::STRING err_string; + short reach_max; + int result_num; + MLang::VECTOR seq_val; + TSampleResultInfoPI(); + TSampleResultInfoPI(const TSampleResultInfoPI&); + TSampleResultInfoPI&operator=(const TSampleResultInfoPI&); + void __write(MLang::OutputStream&__os)const; + void __read(MLang::InputStream&__is); +}; +struct DY_QUERY_SAMPLE_API TSampleResultPI +{ + int app_no; + MLang::Long start_time; + short start_time_ms; + MLang::Long end_time; + short end_time_ms; + unsigned char arc_mode; + int time_pace; + short sample_mode; + int specify_status; + unsigned char status_policy; + short key_num; + short valid_flag; + MLang::STRING invalid_string; + MLang::VECTOR seq_pi_sample_result_info; + TSampleResultPI(); + TSampleResultPI(const TSampleResultPI&); + TSampleResultPI&operator=(const TSampleResultPI&); + void __write(MLang::OutputStream&__os)const; + void __read(MLang::InputStream&__is); +}; +struct DY_QUERY_SAMPLE_API TQuerySampleOutParmPI +{ + int query_id; + MLang::VECTOR seq_sample_result_pi; + TQuerySampleOutParmPI(); + TQuerySampleOutParmPI(const TQuerySampleOutParmPI&); + TQuerySampleOutParmPI&operator=(const TQuerySampleOutParmPI&); + void __write(MLang::OutputStream&__os)const; + void __read(MLang::InputStream&__is); +}; +struct DY_QUERY_SAMPLE_API DY_QUERY_SAMPLE_API TKeyInfoPI +{ + MLang::STRING keyid; + int max_result; + void __write(MLang::OutputStream&__os)const; + void __read(MLang::InputStream&__is); +}; +struct DY_QUERY_SAMPLE_API TSampleInfoPI +{ + int app_no; + MLang::Long start_time; + short start_time_ms; + MLang::Long end_time; + short end_time_ms; + unsigned char is_yc; + unsigned char arc_mode; + int time_pace; + short sample_mode; + int specify_status; + unsigned char status_policy; + short key_num; + MLang::VECTOR seq_keyinfo; + TSampleInfoPI(); + TSampleInfoPI(const TSampleInfoPI&); + TSampleInfoPI&operator=(const TSampleInfoPI&); + void __write(MLang::OutputStream&__os)const; + void __read(MLang::InputStream&__is); +}; +struct DY_QUERY_SAMPLE_API TQuerySampleInParmPI +{ + int query_id; + MLang::VECTOR seq_sample_info_pi; + TQuerySampleInParmPI(); + TQuerySampleInParmPI(const TQuerySampleInParmPI&); + TQuerySampleInParmPI&operator=(const TQuerySampleInParmPI&); + void __write(MLang::OutputStream&__os)const; + void __read(MLang::InputStream&__is); +}; +struct DY_QUERY_SAMPLE_API TPMUDataInfo +{ + int app_no; + MLang::Long start_time; + short start_time_ms; + MLang::Long end_time; + short end_time_ms; + int time_pace; + unsigned char result_mode; + short key_num; + MLang::VECTOR seq_keyid; + TPMUDataInfo(); + TPMUDataInfo(const TPMUDataInfo&); + TPMUDataInfo&operator=(const TPMUDataInfo&); + void __write(MLang::OutputStream&__os)const; + void __read(MLang::InputStream&__is); +}; +struct DY_QUERY_SAMPLE_API TQueryPMUInParmPI +{ + int query_id; + MLang::VECTOR seq_pmu_data_info; + TQueryPMUInParmPI(); + TQueryPMUInParmPI(const TQueryPMUInParmPI&); + TQueryPMUInParmPI&operator=(const TQueryPMUInParmPI&); + void __write(MLang::OutputStream&__os)const; + void __read(MLang::InputStream&__is); +}; +struct DY_QUERY_SAMPLE_API TPMUValueInfo +{ + float value; + int status; + void __write(MLang::OutputStream&__os)const; + void __read(MLang::InputStream&__is); +}; +struct DY_QUERY_SAMPLE_API TPMUResultInfo +{ + MLang::STRING keyid; + short success_flag; + MLang::STRING err_string; + MLang::VECTOR seq_val; + TPMUResultInfo(); + TPMUResultInfo(const TPMUResultInfo&); + TPMUResultInfo&operator=(const TPMUResultInfo&); + void __write(MLang::OutputStream&__os)const; + void __read(MLang::InputStream&__is); +}; +struct DY_QUERY_SAMPLE_API TPMUResult +{ + int app_no; + MLang::Long start_time; + short start_time_ms; + MLang::Long end_time; + short end_time_ms; + int time_pace; + short key_num; + short valid_flag; + MLang::STRING invalid_string; + MLang::VECTOR seq_pmu_result_info; + TPMUResult(); + TPMUResult(const TPMUResult&); + TPMUResult&operator=(const TPMUResult&); + void __write(MLang::OutputStream&__os)const; + void __read(MLang::InputStream&__is); +}; +struct DY_QUERY_SAMPLE_API DY_QUERY_SAMPLE_API TQueryPMUOutParmPI +{ + int query_id; + MLang::VECTOR seq_pmu_result; + TQueryPMUOutParmPI(); + TQueryPMUOutParmPI(const TQueryPMUOutParmPI&); + TQueryPMUOutParmPI&operator=(const TQueryPMUOutParmPI&); + void __write(MLang::OutputStream&__os)const; + void __read(MLang::InputStream&__is); +}; +struct DY_QUERY_SAMPLE_API DY_QUERY_SAMPLE_API TStatisticsKeyInfoPI +{ + TKeyID keyid; + void __write(MLang::OutputStream&__os)const; + void __read(MLang::InputStream&__is); +}; +typedef MLang::VECTOR SEQStatisticsKeyInfoPI; +struct DY_QUERY_SAMPLE_API TStatisticsInfoPI +{ + int app_no; + MLang::Long start_time; + MLang::Long end_time; + unsigned char statistics_policy; + unsigned char is_real; + int time_pace; + short statistics_mode; + unsigned char except_limit; + unsigned char is_abs; + short key_num; + SEQStatisticsKeyInfoPI seq_statistics_keyinfo; + TStatisticsInfoPI(); + TStatisticsInfoPI(const TStatisticsInfoPI&); + TStatisticsInfoPI&operator=(const TStatisticsInfoPI&); + void __write(MLang::OutputStream&__os)const; + void __read(MLang::InputStream&__is); +}; +typedef MLang::VECTOR SEQStatisticsInfoPI; +struct DY_QUERY_SAMPLE_API TStatisticsSampleInParmPI +{ + int query_id; + SEQStatisticsInfoPI seq_statistics_info; + TStatisticsSampleInParmPI(); + TStatisticsSampleInParmPI(const TStatisticsSampleInParmPI&); + TStatisticsSampleInParmPI&operator=(const TStatisticsSampleInParmPI&); + void __write(MLang::OutputStream&__os)const; + void __read(MLang::InputStream&__is); +}; +struct DY_QUERY_SAMPLE_API TStatisticsResultInfoPI +{ + TKeyID keyid; + short success_flag; + MLang::STRING err_string; + float value; + MLang::Long occur_time; + short is_null; + TStatisticsResultInfoPI(); + TStatisticsResultInfoPI(const TStatisticsResultInfoPI&); + TStatisticsResultInfoPI&operator=(const TStatisticsResultInfoPI&); + void __write(MLang::OutputStream&__os)const; + void __read(MLang::InputStream&__is); +}; +typedef MLang::VECTOR SEQStatisticsResultInfoPI; +struct DY_QUERY_SAMPLE_API TStatisticsResultPI +{ + int app_no; + MLang::Long start_time; + MLang::Long end_time; + unsigned char statistics_policy; + unsigned char is_real; + int time_pace; + short statistics_mode; + unsigned char except_limit; + unsigned char is_abs; + short key_num; + short valid_flag; + MLang::STRING invalid_string; + SEQStatisticsResultInfoPI seq_statistics_result_info; + TStatisticsResultPI(); + TStatisticsResultPI(const TStatisticsResultPI&); + TStatisticsResultPI&operator=(const TStatisticsResultPI&); + void __write(MLang::OutputStream&__os)const; + void __read(MLang::InputStream&__is); +}; +typedef MLang::VECTOR SEQStatisticsResultPI; +struct DY_QUERY_SAMPLE_API TStatisticsSampleOutParmPI +{ + int query_id; + SEQStatisticsResultPI seq_statistics_result; + TStatisticsSampleOutParmPI(); + TStatisticsSampleOutParmPI(const TStatisticsSampleOutParmPI&); + TStatisticsSampleOutParmPI&operator=(const TStatisticsSampleOutParmPI&); + void __write(MLang::OutputStream&__os)const; + void __read(MLang::InputStream&__is); +}; +typedef MLang::VECTOR SEQKeyIDPI; +struct DY_QUERY_SAMPLE_API TSampleInfoFromStatPI +{ + int app_no; + MLang::Long start_time; + MLang::Long end_time; + unsigned char source_flag; + short statistics_mode; + short key_num; + SEQKeyIDPI seq_keyid; + TSampleInfoFromStatPI(); + TSampleInfoFromStatPI(const TSampleInfoFromStatPI&); + TSampleInfoFromStatPI&operator=(const TSampleInfoFromStatPI&); + void __write(MLang::OutputStream&__os)const; + void __read(MLang::InputStream&__is); +}; +typedef MLang::VECTOR SEQSampleInfoFromStatPI; +struct DY_QUERY_SAMPLE_API TQuerySampleFromStatInParmPI +{ + int query_id; + SEQSampleInfoFromStatPI seq_sample_info_from_stat; + TQuerySampleFromStatInParmPI(); + TQuerySampleFromStatInParmPI(const TQuerySampleFromStatInParmPI&); + TQuerySampleFromStatInParmPI&operator=(const TQuerySampleFromStatInParmPI&); + void __write(MLang::OutputStream&__os)const; + void __read(MLang::InputStream&__is); +}; +struct DY_QUERY_SAMPLE_API TSampleValueFromStatInfoPI +{ + MLang::Long occur_time; + MLang::Long stat_occur_time; + float value; + int status; + short is_null; + void __write(MLang::OutputStream&__os)const; + void __read(MLang::InputStream&__is); +}; +typedef MLang::VECTOR SEQSampleValueFromStatInfoPI; +struct DY_QUERY_SAMPLE_API TSampleResultFromStatInfoPI +{ + TKeyID keyid; + short success_flag; + MLang::STRING err_string; + int result_num; + SEQSampleValueFromStatInfoPI seq_val; + TSampleResultFromStatInfoPI(); + TSampleResultFromStatInfoPI(const TSampleResultFromStatInfoPI&); + TSampleResultFromStatInfoPI&operator=(const TSampleResultFromStatInfoPI&); + void __write(MLang::OutputStream&__os)const; + void __read(MLang::InputStream&__is); +}; +typedef MLang::VECTOR SEQSampleResultFromStatInfoPI; +struct DY_QUERY_SAMPLE_API TSampleResultFromStatPI +{ + int app_no; + MLang::Long start_time; + MLang::Long end_time; + unsigned char source_flag; + short statistics_mode; + short key_num; + short valid_flag; + MLang::STRING invalid_string; + SEQSampleResultFromStatInfoPI seq_sample_result_from_stat_info; + TSampleResultFromStatPI(); + TSampleResultFromStatPI(const TSampleResultFromStatPI&); + TSampleResultFromStatPI&operator=(const TSampleResultFromStatPI&); + void __write(MLang::OutputStream&__os)const; + void __read(MLang::InputStream&__is); +}; +typedef MLang::VECTOR SEQSampleResultFromStatPI; +struct DY_QUERY_SAMPLE_API TQuerySampleFromStatOutParmPI +{ + int query_id; + SEQSampleResultFromStatPI seq_sample_result_from_stat; + TQuerySampleFromStatOutParmPI(); + TQuerySampleFromStatOutParmPI(const TQuerySampleFromStatOutParmPI&); + TQuerySampleFromStatOutParmPI&operator=(const TQuerySampleFromStatOutParmPI&); + void __write(MLang::OutputStream&__os)const; + void __read(MLang::InputStream&__is); +}; +struct DY_QUERY_SAMPLE_API TSampleKeyInfoPI +{ + int app_no; + SEQKeyIDPI seq_keyid; + TSampleKeyInfoPI(); + TSampleKeyInfoPI(const TSampleKeyInfoPI&); + TSampleKeyInfoPI&operator=(const TSampleKeyInfoPI&); + void __write(MLang::OutputStream&__os)const; + void __read(MLang::InputStream&__is); +}; +typedef MLang::VECTOR SEQSampleKeyInfoPI; +struct DY_QUERY_SAMPLE_API TSampleKeyInfoInParmPI +{ + unsigned char is_yc; + unsigned char is_real; + SEQSampleKeyInfoPI seq_sample_key_info; + TSampleKeyInfoInParmPI(); + TSampleKeyInfoInParmPI(const TSampleKeyInfoInParmPI&); + TSampleKeyInfoInParmPI&operator=(const TSampleKeyInfoInParmPI&); + void __write(MLang::OutputStream&__os)const; + void __read(MLang::InputStream&__is); +}; +struct DY_QUERY_SAMPLE_API TSampleReturnInfoPI +{ + MLang::STRING keyid; + unsigned char is_sample; + int sample_interval; + void __write(MLang::OutputStream&__os)const; + void __read(MLang::InputStream&__is); +}; +typedef MLang::VECTOR SEQSampleReturnInfoPI; +struct DY_QUERY_SAMPLE_API TSampleKeyInfoResultPI +{ + int app_no; + SEQKeyIDPI seq_keyid; + short success_flag; + MLang::STRING err_string; + SEQSampleReturnInfoPI seq_sample_return_info; + TSampleKeyInfoResultPI(); + TSampleKeyInfoResultPI(const TSampleKeyInfoResultPI&); + TSampleKeyInfoResultPI&operator=(const TSampleKeyInfoResultPI&); + void __write(MLang::OutputStream&__os)const; + void __read(MLang::InputStream&__is); +}; +typedef MLang::VECTOR SEQSampleKeyInfoResultPI; +struct DY_QUERY_SAMPLE_API TSampleKeyInfoOutParmPI +{ + unsigned char is_yc; + unsigned char is_real; + SEQSampleKeyInfoResultPI seq_sample_key_info_result; + TSampleKeyInfoOutParmPI(); + TSampleKeyInfoOutParmPI(const TSampleKeyInfoOutParmPI&); + TSampleKeyInfoOutParmPI&operator=(const TSampleKeyInfoOutParmPI&); + void __write(MLang::OutputStream&__os)const; + void __read(MLang::InputStream&__is); +}; +struct DY_QUERY_SAMPLE_API TDiscreteInfoPI +{ + int app_no; + TKeyID keyid; + unsigned char is_yc; + unsigned char is_real; + int time_num; + LongSeq seq_timeinfo; + TDiscreteInfoPI(); + TDiscreteInfoPI(const TDiscreteInfoPI&); + TDiscreteInfoPI&operator=(const TDiscreteInfoPI&); + void __write(MLang::OutputStream&__os)const; + void __read(MLang::InputStream&__is); +}; +typedef MLang::VECTOR SEQDiscreteInfoPI; +struct DY_QUERY_SAMPLE_API TDiscreteSampleInParmPI +{ + int query_id; + SEQDiscreteInfoPI seq_discrete_info; + TDiscreteSampleInParmPI(); + TDiscreteSampleInParmPI(const TDiscreteSampleInParmPI&); + TDiscreteSampleInParmPI&operator=(const TDiscreteSampleInParmPI&); + void __write(MLang::OutputStream&__os)const; + void __read(MLang::InputStream&__is); +}; +typedef MLang::VECTOR SEQSampleValueInfoPI; +struct DY_QUERY_SAMPLE_API TDiscreteResultPI +{ + int app_no; + TKeyID keyid; + unsigned char is_yc; + unsigned char is_real; + short success_flag; + MLang::STRING err_string; + int time_num; + SEQSampleValueInfoPI seq_val; + TDiscreteResultPI(); + TDiscreteResultPI(const TDiscreteResultPI&); + TDiscreteResultPI&operator=(const TDiscreteResultPI&); + void __write(MLang::OutputStream&__os)const; + void __read(MLang::InputStream&__is); +}; +typedef MLang::VECTOR SEQDiscreteResultPI; +struct DY_QUERY_SAMPLE_API TDiscreteSampleOutParmPI +{ + int query_id; + SEQDiscreteResultPI seq_discrete_result; + TDiscreteSampleOutParmPI(); + TDiscreteSampleOutParmPI(const TDiscreteSampleOutParmPI&); + TDiscreteSampleOutParmPI&operator=(const TDiscreteSampleOutParmPI&); + void __write(MLang::OutputStream&__os)const; + void __read(MLang::InputStream&__is); +}; +struct DY_QUERY_SAMPLE_API TQueryCaseInParaPI +{ + MLang::Long query_time; + int app_no; + unsigned char is_yx; + SEQKeyIDPI seq_keyid; + TQueryCaseInParaPI(); + TQueryCaseInParaPI(const TQueryCaseInParaPI&); + TQueryCaseInParaPI&operator=(const TQueryCaseInParaPI&); + void __write(MLang::OutputStream&__os)const; + void __read(MLang::InputStream&__is); +}; +struct DY_QUERY_SAMPLE_API TCaseValueStatus +{ + USampleValuePI value; + int status; + short is_null; + void __write(MLang::OutputStream&__os)const; + void __read(MLang::InputStream&__is); +}; +typedef MLang::VECTOR SEQValueStatus; +struct DY_QUERY_SAMPLE_API TQueryCaseOutParaPI +{ + MLang::Long query_time; + unsigned char is_yx; + short success_flag; + MLang::STRING err_string; + SEQValueStatus seq_value_status; + TQueryCaseOutParaPI(); + TQueryCaseOutParaPI(const TQueryCaseOutParaPI&); + TQueryCaseOutParaPI&operator=(const TQueryCaseOutParaPI&); + void __write(MLang::OutputStream&__os)const; + void __read(MLang::InputStream&__is); +}; +#endif diff --git a/code/sys_nicmonitor/include/db_com/query_sample_service_interface.h b/code/sys_nicmonitor/include/db_com/query_sample_service_interface.h new file mode 100644 index 0000000..2648013 --- /dev/null +++ b/code/sys_nicmonitor/include/db_com/query_sample_service_interface.h @@ -0,0 +1,202 @@ +//****************************************************************** +// +// AUTHOR : ZhangKeHeng +// +// FUNCTION : QUERY_SAMPLE_SERVER ̵Ŀͻ๫ඨ +// +// TIME : 2003.09.25 +// +// HISTORY : +// Datetime Action Author Reason +// ------------------------------------------------------------------- +// 2003.09.25 Creation ZhangKeHeng +// 2003.11.15 Modify ZhangKeHeng new interface +// 2004.03.31 Modify ZhangKeHeng Add TiggerSample +//****************************************************************** + +#ifndef __QUERY_SAMPLE_SERVICE_INTERFACE_H__ +#define __QUERY_SAMPLE_SERVICE_INTERFACE_H__ + +#ifdef _WINDOWS64 +#ifdef QUERY_SAMPLE_CLIENT_EXPORTS +#define QUERY_SAMPLE_CLIENT __declspec(dllexport) +#else +#define QUERY_SAMPLE_CLIENT __declspec(dllimport) +#endif +#else +#define QUERY_SAMPLE_CLIENT +#endif + +#ifndef _WINDOWS64 +#include +#include +#include +#include +#include +#else +#include +#include +#endif + +#include + +#include "query_sample_m.h" +#include "servicemanage.h" +#include "pub_ctx.h" +#include "system.h" +#include "port_def.h" +#include "paramanage.h" +#include "dcidefine.h" +#include "sysadm/scn_service.h" +using namespace std; +using namespace NS_SYSADMIN; + +class QUERY_SAMPLE_CLIENT query_sample_service_interface +{ +public: + query_sample_service_interface(); + query_sample_service_interface (const int port_no, + const int request_timeout_seconds = 120); + ~query_sample_service_interface(); + int GetCurveData (CurvePara ¶m, time_t timeout, CurveData ** datap, + int &items, ErrorInfo &error); +public: + //ͬõĽӿںӣIDLӳͷļж + short GetQuerySampleResult (const TQuerySampleInParm& in_para, + TQuerySampleOutParm & out_para); + short GetStatisticsSampleResult (const TStatisticsSampleInParm& in_para, + TStatisticsSampleOutParm & out_para); + short GetDiscreteSampleResult (const TDiscreteSampleInParm& in_para, + TDiscreteSampleOutParm & out_para); + short GetTriggerSampleResult (const TTriggerSampleInParm& in_para, + TTriggerSampleOutParm & out_para); + short GetTriggerSampleInfoByKEYID (const TTriggerKeyInfoInParm& in_para, + TTriggerKeyInfoOutParm & out_para); + short GetTriggerStatisticsResult (const TTriggerStatisticsInParm& in_para, + TTriggerStatisticsOutParm & out_para); + short GetNumberStatisticsResult (const TNumberStatisticsInParm& in_para, + TNumberStatisticsOutParm & out_para); + short GetTimeStatisticsResult (const TTimeStatisticsInParm& in_para, + TTimeStatisticsOutParm & out_para); + short GetSampleInfoByKEYID (const TSampleKeyInfoInParm& in_para, + TSampleKeyInfoOutParm & out_para); + short GetQuerySampleResultFromStat (const TQuerySampleFromStatInParm& in_para, + TQuerySampleFromStatOutParm & out_para); + short GetAllQuerySampleResult (const TAllQuerySampleInParm& in_para, + TAllQuerySampleOutParm & out_para); + /*½ӿΪֳ + //첽corbaʼ + short asyn_comm(); + + //1첽ӿ(GetQuerySampleResult) + short PutAsynQuerySampleResult(const TQuerySampleInParm& in_para); + short GetAsynQuerySampleResult(TQuerySampleOutParm & out_para); + */ + + //2첽ӿ(GetStatisticsSampleResult) + short PutAsynStatisticsSampleResult (const TStatisticsSampleInParm& in_para); + short GetAsynStatisticsSampleResult (TStatisticsSampleOutParm & out_para); + + //3첽ӿ(GetDiscreteSampleResult) + short PutAsynDiscreteSampleResult (const TDiscreteSampleInParm& in_para); + short GetAsynDiscreteSampleResult (TDiscreteSampleOutParm & out_para); + + /* + //4첽ӿ(GetTriggerSampleResult) + short PutAsynTriggerSampleResult(const TTriggerSampleInParm& in_para); + short GetAsynTriggerSampleResult(TTriggerSampleOutParm & out_para); + */ + + //D5000첽ӿ + //1첽ӿ(GetQuerySampleResult) + short PutAsynQuerySampleResult (const TQuerySampleInParm& in_para, + Handle &async_Handle); + short GetAsynQuerySampleResult (Handle &async_Handle, + TQuerySampleOutParm & out_para); + + //2첽ӿ(GetStatisticsSampleResult) + short PutAsynStatisticsSampleResult (const TStatisticsSampleInParm& in_para, + Handle &async_Handle); + short GetAsynStatisticsSampleResult (Handle &async_Handle, + TStatisticsSampleOutParm& out_para); + + //3첽ӿ(GetDiscreteSampleResult) + short PutAsynDiscreteSampleResult (const TDiscreteSampleInParm& in_para, + Handle &async_Handle); + short GetAsynDiscreteSampleResult (Handle &async_Handle, + TDiscreteSampleOutParm & out_para); + + + //4첽ӿ(GetTriggerSampleResult) + short PutAsynTriggerSampleResult (const TTriggerSampleInParm& in_para, + Handle &async_Handle); + short GetAsynTriggerSampleResult (Handle &async_Handle, + TTriggerSampleOutParm & out_para); + + //6첽ӿ(GetTriggerStatisticsResult) + short PutAsynTriggerStatisticsResult (const TTriggerStatisticsInParm& in_para, + Handle &async_Handle); + short GetAsynTriggerStatisticsResult (Handle &async_Handle, + TTriggerStatisticsOutParm & out_para); + + //7첽ӿ(GetNumberStatisticsResult) + short PutAsynNumberStatisticsResult (const TNumberStatisticsInParm& in_para, + Handle &async_Handle); + short GetAsynNumberStatisticsResult (Handle &async_Handle, + TNumberStatisticsOutParm & out_para); + + //8첽ӿ(GetTimeStatisticsResult) + short PutAsynTimeStatisticsResult (const TTimeStatisticsInParm& in_para, + Handle &async_Handle); + short GetAsynTimeStatisticsResult (Handle &async_Handle, + TTimeStatisticsOutParm & out_para); + + //10첽ӿ(GetQuerySampleResultFromStat) + short PutAsynQuerySampleResultFromStat (const TQuerySampleFromStatInParm& + in_para, Handle &async_Handle); + short GetAsynQuerySampleResultFromStat (Handle &async_Handle, + TQuerySampleFromStatOutParm & out_para); + + //11첽ӿ(GetAllQuerySampleResult) + short PutAsynAllQuerySampleResult (const TAllQuerySampleInParm& in_para, + Handle &async_Handle); + short GetAsynAllQuerySampleResult (Handle &async_Handle, + TAllQuerySampleOutParm & out_para); + + //add for remote access + int SetDomainInfo (const DomainInfo & domain_info); //ԶϢͨã + int SetDomainInfo (const char *domain_name, const tSecLabel &sec_label, + const int app_no = AP_DATA_SRV, const int ctx_no = AC_REALTIME_NO); + int SetDomainName (const char *domain_name); // + int SetSecLabel (tSecLabel &sec_label); //ñǩ + void ClearDomainName(); //m_DomainNameΪlocal_domain + + void SetRequestTimeoutSeconds (const int timeout); //ʱ +#ifdef _DATASRV_DIVERSION + //DATA_SRVģʽָʵӦ + //app_name = data_srv_dms data_srv + //ȡֵdata_srv + void SetServiceApp(const char* app_name); + void ClearServiceApp(); +#endif +private: + + DomainInfo m_DomainInfo; + ServiceInfo m_Serviceinfo; + char m_IpAddress[64]; + //int m_Port; + int m_RequestTimeoutSeconds; + Handle m_Handle; + char m_HostName[64]; + CScnService *m_ServicesManage; + bool m_is_pure_d5000; //ǰϵͳǷϵD5000 + + int GetHostByAppNo (char* host_name, const int app_no, const short context_no); + int SetServiceHost(); + int getD5000Type(); +#ifdef _DATASRV_DIVERSION + char m_app_name[64]; +#endif +}; + +#endif diff --git a/code/sys_nicmonitor/include/db_com/query_sample_service_pi_interface.h b/code/sys_nicmonitor/include/db_com/query_sample_service_pi_interface.h new file mode 100644 index 0000000..96e67ad --- /dev/null +++ b/code/sys_nicmonitor/include/db_com/query_sample_service_pi_interface.h @@ -0,0 +1,135 @@ +//****************************************************************** +// +// AUTHOR : ZhangKeHeng +// +// FUNCTION : QUERY_SAMPLE_SERVER ̵Ŀͻ๫ඨ +// +// TIME : 2003.09.25 +// +// HISTORY : +// Datetime Action Author Reason +// ------------------------------------------------------------------- +// 2003.09.25 Creation ZhangKeHeng +// 2003.11.15 Modify ZhangKeHeng new interface +// 2004.03.31 Modify ZhangKeHeng Add TiggerSample +//****************************************************************** + +#ifndef __QUERY_SAMPLE_SERVICE_PI_INTERFACE_H__ +#define __QUERY_SAMPLE_SERVICE_PI_INTERFACE_H__ + +#ifdef _WINDOWS64 +#ifdef DY_QUERY_SAMPLE_DLL_EXPORTS +#define DY_QUERY_SAMPLE_API __declspec(dllexport) +#else +#define DY_QUERY_SAMPLE_API __declspec(dllimport) +#endif +#else +#define DY_QUERY_SAMPLE_API +#endif + +const short STA_POLICY_NORMAL_PI = 1; //ʵʱͳ(ͳƽԴڻ) +const short STA_POLICY_DAY_PI = 2; //ͳ(ͳƽԴͳ) +const short STA_POLICY_HOUR_PI = 3; //Сʱͳ(ͳƽԴСʱͳ) + +//ͳģʽ +const short STA_MODE_MAX_PI = 0; //ͳֵ䷢ʱ +const short STA_MODE_MIN_PI = 1; //ͳСֵ䷢ʱ +const short STA_MODE_AVERAGE_PI = 2; //ͳƽֵ +const short STA_MODE_LOADRATE_PI = 3; //ͳƸ + +const short STA_WITH_LIMIT_PI = 0; //Խֵͳƣ +const short STA_WITHOUT_LIMIT_PI = 1; //Խֵͳ + +const short STA_WITHOUT_ABS_PI = 0; //ʵֵͳ +const short STA_WITH_ABS_PI = 1; //ֵͳ + +//ѯģʽ +const short RESULT_MODE_NO_DIFF = 0; //ֲѯǷֵ +const short RESULT_MODE_DIFF = 1; //ֲѯǷֵ + +//ɢѯָ֧ѯ +//456123Ӧ,ѯʱϽʱ䷶Χûֵ: +//123ܲѯ,456ǿǰѯȡֵ +const unsigned char DY_QUERY_INTERPOLATION = 0;//ֵѯ +const unsigned char DY_QUERY_SNAP_FORWARD = 1;//ǰѯ +const unsigned char DY_QUERY_SNAP_BACKWARD = 2;//ѯ +const unsigned char DY_QUERY_SNAP_NEAR = 3;//ֵ +const unsigned char DY_QUERY_SNAP_FORWARD_FORCE = 4;//ǰѯ +const unsigned char DY_QUERY_SNAP_BACKWARD_FORCE = 5;//ѯ +const unsigned char DY_QUERY_SNAP_NEAR_FORCE = 6;//ֵ + +//const unsigned char QUERY_HS_SAMPLE = 0; +//const unsigned char QUERY_RS_SAMPLE = 1; + +#ifndef _WINDOWS64 +#include +#include +#else +#include +#include +#endif + +#include "query_sample_pi_m.h" +#include "sysadm/scn_service.h" +#include "mcode/mclient.h" +//#include "serviceglobal.h" +#include "pub_ctx.h" +#include "port_def.h" +#include "system.h" +#include "servicemanage.h" +#include "db_com/CDyCfgLocal.h" + +using namespace NS_SYSADMIN; +//#include + +class DY_QUERY_SAMPLE_API query_sample_service_pi_interface +{ +// public: +// CQuerySamplePI_var m_Specify_GenerInvoke; +// CQuerySamplePI_var m_GenerInvoke; + public: + + query_sample_service_pi_interface(const int port_no,const int request_timeout_seconds = 300); + query_sample_service_pi_interface(); + + ~query_sample_service_pi_interface(); + + + //PI interface + short GetSampleResultFromPI(const TQuerySampleInParmPI& in_para,TQuerySampleOutParmPI& out_para); + short GetPMUResultFromPI(const TQueryPMUInParmPI& in_para,TQueryPMUOutParmPI& out_para); + short GetSampleInfoByKEYIDFromPI(const TSampleKeyInfoInParmPI& in_para, TSampleKeyInfoOutParmPI& out_para); + short GetStatisticsSampleResultFromPI(const TStatisticsSampleInParmPI& in_para, TStatisticsSampleOutParmPI& out_para); + short GetQuerySampleResultFromStatFromPI(const TQuerySampleFromStatInParmPI& in_para, TQuerySampleFromStatOutParmPI& out_para); + short GetDiscreteSampleResultFromPI(const TDiscreteSampleInParmPI& in_para, TDiscreteSampleOutParmPI& out_para); + + short GetCaseResultFromPI(const TQueryCaseInParaPI& in_para, TQueryCaseOutParaPI& out_para ); + + //add for remote access + int SetDomainInfo(const DomainInfo& domain_info); //ԶϢͨã + int SetDomainInfo(const char* domain_name, const tSecLabel& sec_label, const int app_no = AP_DATA_SRV, const int ctx_no = AC_REALTIME_NO); + int SetDomainName(const char* domain_name); // + int SetSecLabel(tSecLabel& sec_label); //ñǩ + void ClearDomainName(); //m_DomainNameΪlocal_domain + private: + DomainInfo m_DomainInfo; + ServiceInfo m_Serviceinfo; + CDyCfgLocal m_dy_cfg_read; + int m_RequestTimeoutSeconds; + char m_IpAddress[64]; + int m_Port; + Handle m_Handle; + char m_HostName[64]; + CScnService* m_ServicesManage; + + //ǷҪԶȡ˿ں,dy_stat_service_interface()Ч + bool m_is_port_auto_set; + + int GetHostByAppNo(char* host_name, const int app_no, const short context_no); + int SetServiceHost(const int dy_app_no); +}; + +#endif + + + diff --git a/code/sys_nicmonitor/include/db_com/query_stat_m.h b/code/sys_nicmonitor/include/db_com/query_stat_m.h new file mode 100644 index 0000000..db6eff3 --- /dev/null +++ b/code/sys_nicmonitor/include/db_com/query_stat_m.h @@ -0,0 +1,124 @@ +//************************************** +// Generated by mcpp translator +// Version 1.2 +//************************************** + +#ifndef __QUERY_STAT_M_H__ +#define __QUERY_STAT_M_H__ + +#ifdef _WINDOWS64 +#ifdef QUERY_STAT_CLIENT_EXPORTS +#define QUERY_STAT_CLIENT_API __declspec(dllexport) +#else +#define QUERY_STAT_CLIENT_API __declspec(dllimport) +#endif +#else +#define QUERY_STAT_CLIENT_API +#endif + +#include"mcode/mvector.h" +#include"mcode/mstring.h" +#include"mcode/mstream.h" +#include"mcode/mclient.h" +#include"public_m.h" + + +struct QUERY_STAT_CLIENT_API TOneStaInfo +{ + int sta_type; + int sta_status; + MLang::Long start_time; + MLang::Long end_time; + int time_pace; + unsigned char interval_type; + unsigned char sta_policy; + unsigned char result_type; + short key_num; + MLang::VECTOR seq_keyinfo; + SEQDataValue reserve_info; + TOneStaInfo(); + TOneStaInfo(const TOneStaInfo&); + TOneStaInfo&operator=(const TOneStaInfo&); + void __write(MLang::OutputStream&__os)const; + void __read(MLang::InputStream&__is); +}; +typedef MLang::VECTOR SEQOneStaInfo; +struct QUERY_STAT_CLIENT_API TAppStaInfo +{ + int app_id; + SEQOneStaInfo seq_sta_info; + TAppStaInfo(); + TAppStaInfo(const TAppStaInfo&); + TAppStaInfo&operator=(const TAppStaInfo&); + void __write(MLang::OutputStream&__os)const; + void __read(MLang::InputStream&__is); +}; +typedef MLang::VECTOR SEQAppStaInfo; +struct QUERY_STAT_CLIENT_API TAppStaInParm +{ + int query_id; + SEQAppStaInfo seq_app_sta_info; + TAppStaInParm(); + TAppStaInParm(const TAppStaInParm&); + TAppStaInParm&operator=(const TAppStaInParm&); + void __write(MLang::OutputStream&__os)const; + void __read(MLang::InputStream&__is); +}; +struct QUERY_STAT_CLIENT_API TOneStaResultInfo +{ + TKeyID keyid; + short success_flag; + MLang::STRING err_string; + short is_null; + UDataValue stat_result; + TOneStaResultInfo(); + TOneStaResultInfo(const TOneStaResultInfo&); + TOneStaResultInfo&operator=(const TOneStaResultInfo&); + void __write(MLang::OutputStream&__os)const; + void __read(MLang::InputStream&__is); +}; +typedef MLang::VECTOR SEQOneStaResultInfo; +struct QUERY_STAT_CLIENT_API TOneStaResult +{ + int sta_type; + int sta_status; + MLang::Long start_time; + MLang::Long end_time; + int time_pace; + unsigned char interval_type; + unsigned char sta_policy; + unsigned char result_type; + short key_num; + short valid_flag; + MLang::STRING invalid_string; + SEQOneStaResultInfo seq_sta_result_info; + SEQDataValue reserve_info; + TOneStaResult(); + TOneStaResult(const TOneStaResult&); + TOneStaResult&operator=(const TOneStaResult&); + void __write(MLang::OutputStream&__os)const; + void __read(MLang::InputStream&__is); +}; +typedef MLang::VECTOR SEQOneStaResult; +struct QUERY_STAT_CLIENT_API TAppStaResult +{ + int app_id; + SEQOneStaResult seq_sta_result; + TAppStaResult(); + TAppStaResult(const TAppStaResult&); + TAppStaResult&operator=(const TAppStaResult&); + void __write(MLang::OutputStream&__os)const; + void __read(MLang::InputStream&__is); +}; +typedef MLang::VECTOR SEQAppStaResult; +struct QUERY_STAT_CLIENT_API TAppStaOutParm +{ + int query_id; + SEQAppStaResult seq_app_sta_result; + TAppStaOutParm(); + TAppStaOutParm(const TAppStaOutParm&); + TAppStaOutParm&operator=(const TAppStaOutParm&); + void __write(MLang::OutputStream&__os)const; + void __read(MLang::InputStream&__is); +}; +#endif diff --git a/code/sys_nicmonitor/include/db_com/query_stat_service_interface.h b/code/sys_nicmonitor/include/db_com/query_stat_service_interface.h new file mode 100644 index 0000000..bdf5104 --- /dev/null +++ b/code/sys_nicmonitor/include/db_com/query_stat_service_interface.h @@ -0,0 +1,70 @@ +//****************************************************************** +// +// AUTHOR : ShiHaoQiu +// +// FUNCTION : QUERY_STAT_SERVER ̵Ŀͻ๫ඨ +// +// TIME : 2011.05.18 +// +// HISTORY : +// Datetime Action Author Reason +// ------------------------------------------------------------------- +// 2011.05.18 Creation ShiHaoQiu +//****************************************************************** + +#ifndef __QUERY_STAT_SERVICE_INTERFACE_H__ +#define __QUERY_STAT_SERVICE_INTERFACE_H__ + +#ifdef _WINDOWS64 +#ifdef QUERY_STAT_CLIENT_EXPORTS +#define QUERY_STAT_CLIENT_API __declspec(dllexport) +#else +#define QUERY_STAT_CLIENT_API __declspec(dllimport) +#endif +#else +#define QUERY_STAT_CLIENT_API +#endif + +#ifndef _WINDOWS64 +#include +#include +#include +#include +#include +#else +#include +#include +#endif + +#include "query_stat_m.h" +#include "serviceglobal.h" +#include "sam_service.h" +#include "pub_ctx.h" +#include "system.h" + +class QUERY_STAT_CLIENT_API query_stat_service_interface +{ + public: + + query_stat_service_interface(const int port_no,const int request_timeout_seconds = 300); + query_stat_service_interface(); + ~query_stat_service_interface(); + + short GetQueryStat(const TAppStaInParm& in_para,TAppStaOutParm& out_para);//1 +private: + ServiceInfo m_Serviceinfo; + char m_IpAddress[64]; + int m_Port; + Handle m_Handle; + char m_HostName[64]; + CServicesManage* m_ServicesManage; + int m_RequestTimeoutSeconds; + + int GetHostByAppNo(char* host_name, const int app_no, const short context_no); + int SetServiceHost(); +}; + +#endif + + + diff --git a/code/sys_nicmonitor/include/db_com/rdb_commit_client.h b/code/sys_nicmonitor/include/db_com/rdb_commit_client.h new file mode 100644 index 0000000..84aa137 --- /dev/null +++ b/code/sys_nicmonitor/include/db_com/rdb_commit_client.h @@ -0,0 +1,139 @@ +/* + * rdb_commit_server_client.h + * + * Created on: 2017-12-6 + * Author: shq + */ + +#ifndef RDB_COMMIT_SERVER_CLIENT_H_ +#define RDB_COMMIT_SERVER_CLIENT_H_ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include "pthread.h" +#include "system.h" +#include "servicemanage.h" +#include "pub_ctx.h" +#include "sql_sp_m.h" +#include "CServiceLocatorClient.h" +using namespace std; +using namespace servicelocator; +//#ifndef BindTime +//struct BindTime +//{ +// unsigned char TimeHH; /* hours; range is 0 <= hours <=23 */ +// unsigned char TimeMI; /* minutes; range is 0 <= minutes <= 59 */ +// unsigned char TimeSS; /* seconds; range is 0 <= seconds <= 59 */ +//}; +// +//typedef struct BindTime BindTime; +//#endif +//#ifndef BindDate +//struct BindDate +//{ +// unsigned short DateYYYY; /* gregorian year; range is -4712 <= year <= 9999 */ +// unsigned char DateMM; /* month; range is 1 <= month < 12 */ +// unsigned char DateDD; /* day; range is 1 <= day <= 31 */ +// BindTime DateTime; /* time */ +//}; +// +//typedef struct BindDate BindDate; +//#endif + +struct TStage +{ + int app_no; + string module_name; + int context_no; + string domain_name; + int stage; + string stage_message; + string description; + int map_no; + int run_status; +}; + +//Ϣṹ +struct TRdbCommitErrorMsg +{ + int err_no; //DBAccess + string db_err; //ݿϢ +}; + +class RdbCommitClient +{ +public: + RdbCommitClient(char *db_service); + RdbCommitClient(char *db_service, int seconds); + ~RdbCommitClient(); + void SetRequestTimeout(int seconds); + int SetDomainName(vector domain_name); +public: + //ṩsql_spĽӿ(һ) + //21 + short ExecuteSql(const char* sql_str, SEQDBErrorStru& out_db_error); + + //22 + short ExecuteBind(const char * sql_str, SEQBindParaStru &seq_bind_para, char * data_buffer, char * null_flag_buffer, unsigned int row_num, SEQDBErrorStru& out_db_error); + + //23 + short ExecuteMultiSql(int sql_num, const StrSeq& seq_sql_str, SEQExecMultiResultStru& seq_exec_multi_result); + + //úͶȡ״̬Ľӿ + //101 + int GetStage(const int app_no, const char* module_name, int context_no, char* domain = NULL); + + //102 + int SetStage(const int app_no, const char* module_name, const int stage, int context_no = 0, char* domain = NULL); + + //103 + int GetAllStage(vector &ts); + + //104 + int GetStage(TStage &ts); + + //102 + int SetStage(TStage ts); +public: + //һύӿ + //1 ǿһύӿ + int SQLCommitWithSC(char *cmd_string, vector &err_vec); +public: + int SQLCommit(char *cmd_string, int commit_type, vector &err_vec); + int RollbackAllTransaction(); + int RollbackTransactionByDomainname(char* domain); //2 + int ResetWorkState(); + int ResetWorkStateByDomainname(char* domain); //3 + int CommitAllTransaction(); + int CommitTransactionByDomainname(char* domain); //4 + + int SQLCommitWithSCByDomainname(char *cmd_string,char* domain, vector &err_vec); //11 + + //add for remote access + int SetDomainName(const char* domain_name); // + void ClearDomainName(); //m_DomainNameΪlocal_domain +private: + int SetServiceHost(); + ServiceInfo m_Serviceinfo; + DomainInfo m_DomainInfo; + char m_IpAddress[64]; + int m_Port; + Handle m_Handle; + vector v_domain_name; + char m_HostName[64]; + CServiceLocatorClient m_serviceInfoTable; + + pthread_mutex_t m_mutex; + int m_RequestTimeoutSeconds; +}; + + + +#endif diff --git a/code/sys_nicmonitor/include/db_com/rdb_commit_m.h b/code/sys_nicmonitor/include/db_com/rdb_commit_m.h new file mode 100644 index 0000000..a58c8c7 --- /dev/null +++ b/code/sys_nicmonitor/include/db_com/rdb_commit_m.h @@ -0,0 +1,42 @@ +//************************************** +// Generated by mcpp translator +// Version 1.3 +//************************************** + +#ifndef __RDB_COMMIT_M_H__ +#define __RDB_COMMIT_M_H__ + +#include"mcode/mvector.h" +#include"mcode/mstring.h" +#include"mcode/mstream.h" +#include"mcode/mclient.h" + + +struct TStageStru +{ + int app_no; + MLang::STRING module_name; + int context_no; + MLang::STRING domain_name; + int stage; + MLang::STRING stage_message; + MLang::STRING description; + int map_no; + int run_status; + TStageStru(); + TStageStru(const TStageStru&); + TStageStru&operator=(const TStageStru&); + void __write(MLang::OutputStream&__os)const; + void __read(MLang::InputStream&__is); +}; +typedef MLang::VECTOR SEQStageStru; +struct TSEQStageStru +{ + SEQStageStru seq_stage; + TSEQStageStru(); + TSEQStageStru(const TSEQStageStru&); + TSEQStageStru&operator=(const TSEQStageStru&); + void __write(MLang::OutputStream&__os)const; + void __read(MLang::InputStream&__is); +}; +#endif diff --git a/code/sys_nicmonitor/include/db_com/rdb_define.pb.h b/code/sys_nicmonitor/include/db_com/rdb_define.pb.h new file mode 100644 index 0000000..cfca866 --- /dev/null +++ b/code/sys_nicmonitor/include/db_com/rdb_define.pb.h @@ -0,0 +1,4341 @@ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: rdb_define.proto + +#ifndef PROTOBUF_rdb_5fdefine_2eproto__INCLUDED +#define PROTOBUF_rdb_5fdefine_2eproto__INCLUDED + +#include + +#include + +#if GOOGLE_PROTOBUF_VERSION < 2005000 +#error This file was generated by a newer version of protoc which is +#error incompatible with your Protocol Buffer headers. Please update +#error your headers. +#endif +#if 2005000 < GOOGLE_PROTOBUF_MIN_PROTOC_VERSION +#error This file was generated by an older version of protoc which is +#error incompatible with your Protocol Buffer headers. Please +#error regenerate this file with a newer version of protoc. +#endif + +#include +#include +#include +#include +#include +#include +// @@protoc_insertion_point(includes) + +namespace RDB_PROTO { + +// Internal implementation detail -- do not call these. +void protobuf_AddDesc_rdb_5fdefine_2eproto(); +void protobuf_AssignDesc_rdb_5fdefine_2eproto(); +void protobuf_ShutdownFile_rdb_5fdefine_2eproto(); + +class SEQ_STRING; +class SEQ_CHAR; +class SEQ_FLOAT; +class SEQ_INT; +class SEQ_LONG; +class APPKEYID_STRUCT; +class APPID_STRUCT; +class RTDBKEY_STRUCT; +class APPRTDBKDY_STRUCT; +class UNION_DATA_VALUE; +class SEQ_DATA_VALUE; +class DBERROR_STRUCT; +class SEQ_DBERROR; +class RESULT_DATA_VALUE; +class SEQ_RESULT_DATA_VALUE; +class RESULT_FIELD_INFO; +class SEQ_RESULT_FIELD_INFO; +class OUT_DATA_TYPE; +class SEQ_OUT_DATA_TYPE; +class SELECT_RESULT; +class EXEC_MULTI_RESULT; +class SEQ_EXEC_MULTI_RESULT; +class BIND_PARA; +class SEQ_BIND_PARA; + +enum DB_BYTE_T { + BYTE_LITTLE_ENDIAN = 0, + BYTE_BIG_ENDIAN = 1, + BYTE_OTHER = 2 +}; +bool DB_BYTE_T_IsValid(int value); +const DB_BYTE_T DB_BYTE_T_MIN = BYTE_LITTLE_ENDIAN; +const DB_BYTE_T DB_BYTE_T_MAX = BYTE_OTHER; +const int DB_BYTE_T_ARRAYSIZE = DB_BYTE_T_MAX + 1; + +const ::google::protobuf::EnumDescriptor* DB_BYTE_T_descriptor(); +inline const ::std::string& DB_BYTE_T_Name(DB_BYTE_T value) { + return ::google::protobuf::internal::NameOfEnum( + DB_BYTE_T_descriptor(), value); +} +inline bool DB_BYTE_T_Parse( + const ::std::string& name, DB_BYTE_T* value) { + return ::google::protobuf::internal::ParseNamedEnum( + DB_BYTE_T_descriptor(), name, value); +} +// =================================================================== + +class SEQ_STRING : public ::google::protobuf::Message { + public: + SEQ_STRING(); + virtual ~SEQ_STRING(); + + SEQ_STRING(const SEQ_STRING& from); + + inline SEQ_STRING& operator=(const SEQ_STRING& from) { + CopyFrom(from); + return *this; + } + + inline const ::google::protobuf::UnknownFieldSet& unknown_fields() const { + return _unknown_fields_; + } + + inline ::google::protobuf::UnknownFieldSet* mutable_unknown_fields() { + return &_unknown_fields_; + } + + static const ::google::protobuf::Descriptor* descriptor(); + static const SEQ_STRING& default_instance(); + + void Swap(SEQ_STRING* other); + + // implements Message ---------------------------------------------- + + SEQ_STRING* New() const; + void CopyFrom(const ::google::protobuf::Message& from); + void MergeFrom(const ::google::protobuf::Message& from); + void CopyFrom(const SEQ_STRING& from); + void MergeFrom(const SEQ_STRING& from); + void Clear(); + bool IsInitialized() const; + + int ByteSize() const; + bool MergePartialFromCodedStream( + ::google::protobuf::io::CodedInputStream* input); + void SerializeWithCachedSizes( + ::google::protobuf::io::CodedOutputStream* output) const; + ::google::protobuf::uint8* SerializeWithCachedSizesToArray(::google::protobuf::uint8* output) const; + int GetCachedSize() const { return _cached_size_; } + private: + void SharedCtor(); + void SharedDtor(); + void SetCachedSize(int size) const; + public: + + ::google::protobuf::Metadata GetMetadata() const; + + // nested types ---------------------------------------------------- + + // accessors ------------------------------------------------------- + + // repeated bytes vec_string = 1; + inline int vec_string_size() const; + inline void clear_vec_string(); + static const int kVecStringFieldNumber = 1; + inline const ::std::string& vec_string(int index) const; + inline ::std::string* mutable_vec_string(int index); + inline void set_vec_string(int index, const ::std::string& value); + inline void set_vec_string(int index, const char* value); + inline void set_vec_string(int index, const void* value, size_t size); + inline ::std::string* add_vec_string(); + inline void add_vec_string(const ::std::string& value); + inline void add_vec_string(const char* value); + inline void add_vec_string(const void* value, size_t size); + inline const ::google::protobuf::RepeatedPtrField< ::std::string>& vec_string() const; + inline ::google::protobuf::RepeatedPtrField< ::std::string>* mutable_vec_string(); + + // @@protoc_insertion_point(class_scope:RDB_PROTO.SEQ_STRING) + private: + + ::google::protobuf::UnknownFieldSet _unknown_fields_; + + ::google::protobuf::RepeatedPtrField< ::std::string> vec_string_; + + mutable int _cached_size_; + ::google::protobuf::uint32 _has_bits_[(1 + 31) / 32]; + + friend void protobuf_AddDesc_rdb_5fdefine_2eproto(); + friend void protobuf_AssignDesc_rdb_5fdefine_2eproto(); + friend void protobuf_ShutdownFile_rdb_5fdefine_2eproto(); + + void InitAsDefaultInstance(); + static SEQ_STRING* default_instance_; +}; +// ------------------------------------------------------------------- + +class SEQ_CHAR : public ::google::protobuf::Message { + public: + SEQ_CHAR(); + virtual ~SEQ_CHAR(); + + SEQ_CHAR(const SEQ_CHAR& from); + + inline SEQ_CHAR& operator=(const SEQ_CHAR& from) { + CopyFrom(from); + return *this; + } + + inline const ::google::protobuf::UnknownFieldSet& unknown_fields() const { + return _unknown_fields_; + } + + inline ::google::protobuf::UnknownFieldSet* mutable_unknown_fields() { + return &_unknown_fields_; + } + + static const ::google::protobuf::Descriptor* descriptor(); + static const SEQ_CHAR& default_instance(); + + void Swap(SEQ_CHAR* other); + + // implements Message ---------------------------------------------- + + SEQ_CHAR* New() const; + void CopyFrom(const ::google::protobuf::Message& from); + void MergeFrom(const ::google::protobuf::Message& from); + void CopyFrom(const SEQ_CHAR& from); + void MergeFrom(const SEQ_CHAR& from); + void Clear(); + bool IsInitialized() const; + + int ByteSize() const; + bool MergePartialFromCodedStream( + ::google::protobuf::io::CodedInputStream* input); + void SerializeWithCachedSizes( + ::google::protobuf::io::CodedOutputStream* output) const; + ::google::protobuf::uint8* SerializeWithCachedSizesToArray(::google::protobuf::uint8* output) const; + int GetCachedSize() const { return _cached_size_; } + private: + void SharedCtor(); + void SharedDtor(); + void SetCachedSize(int size) const; + public: + + ::google::protobuf::Metadata GetMetadata() const; + + // nested types ---------------------------------------------------- + + // accessors ------------------------------------------------------- + + // optional bytes vec_char = 1; + inline bool has_vec_char() const; + inline void clear_vec_char(); + static const int kVecCharFieldNumber = 1; + inline const ::std::string& vec_char() const; + inline void set_vec_char(const ::std::string& value); + inline void set_vec_char(const char* value); + inline void set_vec_char(const void* value, size_t size); + inline ::std::string* mutable_vec_char(); + inline ::std::string* release_vec_char(); + inline void set_allocated_vec_char(::std::string* vec_char); + + // @@protoc_insertion_point(class_scope:RDB_PROTO.SEQ_CHAR) + private: + inline void set_has_vec_char(); + inline void clear_has_vec_char(); + + ::google::protobuf::UnknownFieldSet _unknown_fields_; + + ::std::string* vec_char_; + + mutable int _cached_size_; + ::google::protobuf::uint32 _has_bits_[(1 + 31) / 32]; + + friend void protobuf_AddDesc_rdb_5fdefine_2eproto(); + friend void protobuf_AssignDesc_rdb_5fdefine_2eproto(); + friend void protobuf_ShutdownFile_rdb_5fdefine_2eproto(); + + void InitAsDefaultInstance(); + static SEQ_CHAR* default_instance_; +}; +// ------------------------------------------------------------------- + +class SEQ_FLOAT : public ::google::protobuf::Message { + public: + SEQ_FLOAT(); + virtual ~SEQ_FLOAT(); + + SEQ_FLOAT(const SEQ_FLOAT& from); + + inline SEQ_FLOAT& operator=(const SEQ_FLOAT& from) { + CopyFrom(from); + return *this; + } + + inline const ::google::protobuf::UnknownFieldSet& unknown_fields() const { + return _unknown_fields_; + } + + inline ::google::protobuf::UnknownFieldSet* mutable_unknown_fields() { + return &_unknown_fields_; + } + + static const ::google::protobuf::Descriptor* descriptor(); + static const SEQ_FLOAT& default_instance(); + + void Swap(SEQ_FLOAT* other); + + // implements Message ---------------------------------------------- + + SEQ_FLOAT* New() const; + void CopyFrom(const ::google::protobuf::Message& from); + void MergeFrom(const ::google::protobuf::Message& from); + void CopyFrom(const SEQ_FLOAT& from); + void MergeFrom(const SEQ_FLOAT& from); + void Clear(); + bool IsInitialized() const; + + int ByteSize() const; + bool MergePartialFromCodedStream( + ::google::protobuf::io::CodedInputStream* input); + void SerializeWithCachedSizes( + ::google::protobuf::io::CodedOutputStream* output) const; + ::google::protobuf::uint8* SerializeWithCachedSizesToArray(::google::protobuf::uint8* output) const; + int GetCachedSize() const { return _cached_size_; } + private: + void SharedCtor(); + void SharedDtor(); + void SetCachedSize(int size) const; + public: + + ::google::protobuf::Metadata GetMetadata() const; + + // nested types ---------------------------------------------------- + + // accessors ------------------------------------------------------- + + // repeated float vec_float = 1; + inline int vec_float_size() const; + inline void clear_vec_float(); + static const int kVecFloatFieldNumber = 1; + inline float vec_float(int index) const; + inline void set_vec_float(int index, float value); + inline void add_vec_float(float value); + inline const ::google::protobuf::RepeatedField< float >& + vec_float() const; + inline ::google::protobuf::RepeatedField< float >* + mutable_vec_float(); + + // @@protoc_insertion_point(class_scope:RDB_PROTO.SEQ_FLOAT) + private: + + ::google::protobuf::UnknownFieldSet _unknown_fields_; + + ::google::protobuf::RepeatedField< float > vec_float_; + + mutable int _cached_size_; + ::google::protobuf::uint32 _has_bits_[(1 + 31) / 32]; + + friend void protobuf_AddDesc_rdb_5fdefine_2eproto(); + friend void protobuf_AssignDesc_rdb_5fdefine_2eproto(); + friend void protobuf_ShutdownFile_rdb_5fdefine_2eproto(); + + void InitAsDefaultInstance(); + static SEQ_FLOAT* default_instance_; +}; +// ------------------------------------------------------------------- + +class SEQ_INT : public ::google::protobuf::Message { + public: + SEQ_INT(); + virtual ~SEQ_INT(); + + SEQ_INT(const SEQ_INT& from); + + inline SEQ_INT& operator=(const SEQ_INT& from) { + CopyFrom(from); + return *this; + } + + inline const ::google::protobuf::UnknownFieldSet& unknown_fields() const { + return _unknown_fields_; + } + + inline ::google::protobuf::UnknownFieldSet* mutable_unknown_fields() { + return &_unknown_fields_; + } + + static const ::google::protobuf::Descriptor* descriptor(); + static const SEQ_INT& default_instance(); + + void Swap(SEQ_INT* other); + + // implements Message ---------------------------------------------- + + SEQ_INT* New() const; + void CopyFrom(const ::google::protobuf::Message& from); + void MergeFrom(const ::google::protobuf::Message& from); + void CopyFrom(const SEQ_INT& from); + void MergeFrom(const SEQ_INT& from); + void Clear(); + bool IsInitialized() const; + + int ByteSize() const; + bool MergePartialFromCodedStream( + ::google::protobuf::io::CodedInputStream* input); + void SerializeWithCachedSizes( + ::google::protobuf::io::CodedOutputStream* output) const; + ::google::protobuf::uint8* SerializeWithCachedSizesToArray(::google::protobuf::uint8* output) const; + int GetCachedSize() const { return _cached_size_; } + private: + void SharedCtor(); + void SharedDtor(); + void SetCachedSize(int size) const; + public: + + ::google::protobuf::Metadata GetMetadata() const; + + // nested types ---------------------------------------------------- + + // accessors ------------------------------------------------------- + + // repeated int32 vec_int = 1; + inline int vec_int_size() const; + inline void clear_vec_int(); + static const int kVecIntFieldNumber = 1; + inline ::google::protobuf::int32 vec_int(int index) const; + inline void set_vec_int(int index, ::google::protobuf::int32 value); + inline void add_vec_int(::google::protobuf::int32 value); + inline const ::google::protobuf::RepeatedField< ::google::protobuf::int32 >& + vec_int() const; + inline ::google::protobuf::RepeatedField< ::google::protobuf::int32 >* + mutable_vec_int(); + + // @@protoc_insertion_point(class_scope:RDB_PROTO.SEQ_INT) + private: + + ::google::protobuf::UnknownFieldSet _unknown_fields_; + + ::google::protobuf::RepeatedField< ::google::protobuf::int32 > vec_int_; + + mutable int _cached_size_; + ::google::protobuf::uint32 _has_bits_[(1 + 31) / 32]; + + friend void protobuf_AddDesc_rdb_5fdefine_2eproto(); + friend void protobuf_AssignDesc_rdb_5fdefine_2eproto(); + friend void protobuf_ShutdownFile_rdb_5fdefine_2eproto(); + + void InitAsDefaultInstance(); + static SEQ_INT* default_instance_; +}; +// ------------------------------------------------------------------- + +class SEQ_LONG : public ::google::protobuf::Message { + public: + SEQ_LONG(); + virtual ~SEQ_LONG(); + + SEQ_LONG(const SEQ_LONG& from); + + inline SEQ_LONG& operator=(const SEQ_LONG& from) { + CopyFrom(from); + return *this; + } + + inline const ::google::protobuf::UnknownFieldSet& unknown_fields() const { + return _unknown_fields_; + } + + inline ::google::protobuf::UnknownFieldSet* mutable_unknown_fields() { + return &_unknown_fields_; + } + + static const ::google::protobuf::Descriptor* descriptor(); + static const SEQ_LONG& default_instance(); + + void Swap(SEQ_LONG* other); + + // implements Message ---------------------------------------------- + + SEQ_LONG* New() const; + void CopyFrom(const ::google::protobuf::Message& from); + void MergeFrom(const ::google::protobuf::Message& from); + void CopyFrom(const SEQ_LONG& from); + void MergeFrom(const SEQ_LONG& from); + void Clear(); + bool IsInitialized() const; + + int ByteSize() const; + bool MergePartialFromCodedStream( + ::google::protobuf::io::CodedInputStream* input); + void SerializeWithCachedSizes( + ::google::protobuf::io::CodedOutputStream* output) const; + ::google::protobuf::uint8* SerializeWithCachedSizesToArray(::google::protobuf::uint8* output) const; + int GetCachedSize() const { return _cached_size_; } + private: + void SharedCtor(); + void SharedDtor(); + void SetCachedSize(int size) const; + public: + + ::google::protobuf::Metadata GetMetadata() const; + + // nested types ---------------------------------------------------- + + // accessors ------------------------------------------------------- + + // repeated int64 vec_long = 1; + inline int vec_long_size() const; + inline void clear_vec_long(); + static const int kVecLongFieldNumber = 1; + inline ::google::protobuf::int64 vec_long(int index) const; + inline void set_vec_long(int index, ::google::protobuf::int64 value); + inline void add_vec_long(::google::protobuf::int64 value); + inline const ::google::protobuf::RepeatedField< ::google::protobuf::int64 >& + vec_long() const; + inline ::google::protobuf::RepeatedField< ::google::protobuf::int64 >* + mutable_vec_long(); + + // @@protoc_insertion_point(class_scope:RDB_PROTO.SEQ_LONG) + private: + + ::google::protobuf::UnknownFieldSet _unknown_fields_; + + ::google::protobuf::RepeatedField< ::google::protobuf::int64 > vec_long_; + + mutable int _cached_size_; + ::google::protobuf::uint32 _has_bits_[(1 + 31) / 32]; + + friend void protobuf_AddDesc_rdb_5fdefine_2eproto(); + friend void protobuf_AssignDesc_rdb_5fdefine_2eproto(); + friend void protobuf_ShutdownFile_rdb_5fdefine_2eproto(); + + void InitAsDefaultInstance(); + static SEQ_LONG* default_instance_; +}; +// ------------------------------------------------------------------- + +class APPKEYID_STRUCT : public ::google::protobuf::Message { + public: + APPKEYID_STRUCT(); + virtual ~APPKEYID_STRUCT(); + + APPKEYID_STRUCT(const APPKEYID_STRUCT& from); + + inline APPKEYID_STRUCT& operator=(const APPKEYID_STRUCT& from) { + CopyFrom(from); + return *this; + } + + inline const ::google::protobuf::UnknownFieldSet& unknown_fields() const { + return _unknown_fields_; + } + + inline ::google::protobuf::UnknownFieldSet* mutable_unknown_fields() { + return &_unknown_fields_; + } + + static const ::google::protobuf::Descriptor* descriptor(); + static const APPKEYID_STRUCT& default_instance(); + + void Swap(APPKEYID_STRUCT* other); + + // implements Message ---------------------------------------------- + + APPKEYID_STRUCT* New() const; + void CopyFrom(const ::google::protobuf::Message& from); + void MergeFrom(const ::google::protobuf::Message& from); + void CopyFrom(const APPKEYID_STRUCT& from); + void MergeFrom(const APPKEYID_STRUCT& from); + void Clear(); + bool IsInitialized() const; + + int ByteSize() const; + bool MergePartialFromCodedStream( + ::google::protobuf::io::CodedInputStream* input); + void SerializeWithCachedSizes( + ::google::protobuf::io::CodedOutputStream* output) const; + ::google::protobuf::uint8* SerializeWithCachedSizesToArray(::google::protobuf::uint8* output) const; + int GetCachedSize() const { return _cached_size_; } + private: + void SharedCtor(); + void SharedDtor(); + void SetCachedSize(int size) const; + public: + + ::google::protobuf::Metadata GetMetadata() const; + + // nested types ---------------------------------------------------- + + // accessors ------------------------------------------------------- + + // optional int32 app_id = 1; + inline bool has_app_id() const; + inline void clear_app_id(); + static const int kAppIdFieldNumber = 1; + inline ::google::protobuf::int32 app_id() const; + inline void set_app_id(::google::protobuf::int32 value); + + // optional int64 key_id = 2; + inline bool has_key_id() const; + inline void clear_key_id(); + static const int kKeyIdFieldNumber = 2; + inline ::google::protobuf::int64 key_id() const; + inline void set_key_id(::google::protobuf::int64 value); + + // @@protoc_insertion_point(class_scope:RDB_PROTO.APPKEYID_STRUCT) + private: + inline void set_has_app_id(); + inline void clear_has_app_id(); + inline void set_has_key_id(); + inline void clear_has_key_id(); + + ::google::protobuf::UnknownFieldSet _unknown_fields_; + + ::google::protobuf::int64 key_id_; + ::google::protobuf::int32 app_id_; + + mutable int _cached_size_; + ::google::protobuf::uint32 _has_bits_[(2 + 31) / 32]; + + friend void protobuf_AddDesc_rdb_5fdefine_2eproto(); + friend void protobuf_AssignDesc_rdb_5fdefine_2eproto(); + friend void protobuf_ShutdownFile_rdb_5fdefine_2eproto(); + + void InitAsDefaultInstance(); + static APPKEYID_STRUCT* default_instance_; +}; +// ------------------------------------------------------------------- + +class APPID_STRUCT : public ::google::protobuf::Message { + public: + APPID_STRUCT(); + virtual ~APPID_STRUCT(); + + APPID_STRUCT(const APPID_STRUCT& from); + + inline APPID_STRUCT& operator=(const APPID_STRUCT& from) { + CopyFrom(from); + return *this; + } + + inline const ::google::protobuf::UnknownFieldSet& unknown_fields() const { + return _unknown_fields_; + } + + inline ::google::protobuf::UnknownFieldSet* mutable_unknown_fields() { + return &_unknown_fields_; + } + + static const ::google::protobuf::Descriptor* descriptor(); + static const APPID_STRUCT& default_instance(); + + void Swap(APPID_STRUCT* other); + + // implements Message ---------------------------------------------- + + APPID_STRUCT* New() const; + void CopyFrom(const ::google::protobuf::Message& from); + void MergeFrom(const ::google::protobuf::Message& from); + void CopyFrom(const APPID_STRUCT& from); + void MergeFrom(const APPID_STRUCT& from); + void Clear(); + bool IsInitialized() const; + + int ByteSize() const; + bool MergePartialFromCodedStream( + ::google::protobuf::io::CodedInputStream* input); + void SerializeWithCachedSizes( + ::google::protobuf::io::CodedOutputStream* output) const; + ::google::protobuf::uint8* SerializeWithCachedSizesToArray(::google::protobuf::uint8* output) const; + int GetCachedSize() const { return _cached_size_; } + private: + void SharedCtor(); + void SharedDtor(); + void SetCachedSize(int size) const; + public: + + ::google::protobuf::Metadata GetMetadata() const; + + // nested types ---------------------------------------------------- + + // accessors ------------------------------------------------------- + + // optional int32 app_id = 1; + inline bool has_app_id() const; + inline void clear_app_id(); + static const int kAppIdFieldNumber = 1; + inline ::google::protobuf::int32 app_id() const; + inline void set_app_id(::google::protobuf::int32 value); + + // optional int64 key_id = 2; + inline bool has_key_id() const; + inline void clear_key_id(); + static const int kKeyIdFieldNumber = 2; + inline ::google::protobuf::int64 key_id() const; + inline void set_key_id(::google::protobuf::int64 value); + + // @@protoc_insertion_point(class_scope:RDB_PROTO.APPID_STRUCT) + private: + inline void set_has_app_id(); + inline void clear_has_app_id(); + inline void set_has_key_id(); + inline void clear_has_key_id(); + + ::google::protobuf::UnknownFieldSet _unknown_fields_; + + ::google::protobuf::int64 key_id_; + ::google::protobuf::int32 app_id_; + + mutable int _cached_size_; + ::google::protobuf::uint32 _has_bits_[(2 + 31) / 32]; + + friend void protobuf_AddDesc_rdb_5fdefine_2eproto(); + friend void protobuf_AssignDesc_rdb_5fdefine_2eproto(); + friend void protobuf_ShutdownFile_rdb_5fdefine_2eproto(); + + void InitAsDefaultInstance(); + static APPID_STRUCT* default_instance_; +}; +// ------------------------------------------------------------------- + +class RTDBKEY_STRUCT : public ::google::protobuf::Message { + public: + RTDBKEY_STRUCT(); + virtual ~RTDBKEY_STRUCT(); + + RTDBKEY_STRUCT(const RTDBKEY_STRUCT& from); + + inline RTDBKEY_STRUCT& operator=(const RTDBKEY_STRUCT& from) { + CopyFrom(from); + return *this; + } + + inline const ::google::protobuf::UnknownFieldSet& unknown_fields() const { + return _unknown_fields_; + } + + inline ::google::protobuf::UnknownFieldSet* mutable_unknown_fields() { + return &_unknown_fields_; + } + + static const ::google::protobuf::Descriptor* descriptor(); + static const RTDBKEY_STRUCT& default_instance(); + + void Swap(RTDBKEY_STRUCT* other); + + // implements Message ---------------------------------------------- + + RTDBKEY_STRUCT* New() const; + void CopyFrom(const ::google::protobuf::Message& from); + void MergeFrom(const ::google::protobuf::Message& from); + void CopyFrom(const RTDBKEY_STRUCT& from); + void MergeFrom(const RTDBKEY_STRUCT& from); + void Clear(); + bool IsInitialized() const; + + int ByteSize() const; + bool MergePartialFromCodedStream( + ::google::protobuf::io::CodedInputStream* input); + void SerializeWithCachedSizes( + ::google::protobuf::io::CodedOutputStream* output) const; + ::google::protobuf::uint8* SerializeWithCachedSizesToArray(::google::protobuf::uint8* output) const; + int GetCachedSize() const { return _cached_size_; } + private: + void SharedCtor(); + void SharedDtor(); + void SetCachedSize(int size) const; + public: + + ::google::protobuf::Metadata GetMetadata() const; + + // nested types ---------------------------------------------------- + + // accessors ------------------------------------------------------- + + // optional sint64 table_column_id = 1; + inline bool has_table_column_id() const; + inline void clear_table_column_id(); + static const int kTableColumnIdFieldNumber = 1; + inline ::google::protobuf::int64 table_column_id() const; + inline void set_table_column_id(::google::protobuf::int64 value); + + // optional sint64 region_record_id = 2; + inline bool has_region_record_id() const; + inline void clear_region_record_id(); + static const int kRegionRecordIdFieldNumber = 2; + inline ::google::protobuf::int64 region_record_id() const; + inline void set_region_record_id(::google::protobuf::int64 value); + + // @@protoc_insertion_point(class_scope:RDB_PROTO.RTDBKEY_STRUCT) + private: + inline void set_has_table_column_id(); + inline void clear_has_table_column_id(); + inline void set_has_region_record_id(); + inline void clear_has_region_record_id(); + + ::google::protobuf::UnknownFieldSet _unknown_fields_; + + ::google::protobuf::int64 table_column_id_; + ::google::protobuf::int64 region_record_id_; + + mutable int _cached_size_; + ::google::protobuf::uint32 _has_bits_[(2 + 31) / 32]; + + friend void protobuf_AddDesc_rdb_5fdefine_2eproto(); + friend void protobuf_AssignDesc_rdb_5fdefine_2eproto(); + friend void protobuf_ShutdownFile_rdb_5fdefine_2eproto(); + + void InitAsDefaultInstance(); + static RTDBKEY_STRUCT* default_instance_; +}; +// ------------------------------------------------------------------- + +class APPRTDBKDY_STRUCT : public ::google::protobuf::Message { + public: + APPRTDBKDY_STRUCT(); + virtual ~APPRTDBKDY_STRUCT(); + + APPRTDBKDY_STRUCT(const APPRTDBKDY_STRUCT& from); + + inline APPRTDBKDY_STRUCT& operator=(const APPRTDBKDY_STRUCT& from) { + CopyFrom(from); + return *this; + } + + inline const ::google::protobuf::UnknownFieldSet& unknown_fields() const { + return _unknown_fields_; + } + + inline ::google::protobuf::UnknownFieldSet* mutable_unknown_fields() { + return &_unknown_fields_; + } + + static const ::google::protobuf::Descriptor* descriptor(); + static const APPRTDBKDY_STRUCT& default_instance(); + + void Swap(APPRTDBKDY_STRUCT* other); + + // implements Message ---------------------------------------------- + + APPRTDBKDY_STRUCT* New() const; + void CopyFrom(const ::google::protobuf::Message& from); + void MergeFrom(const ::google::protobuf::Message& from); + void CopyFrom(const APPRTDBKDY_STRUCT& from); + void MergeFrom(const APPRTDBKDY_STRUCT& from); + void Clear(); + bool IsInitialized() const; + + int ByteSize() const; + bool MergePartialFromCodedStream( + ::google::protobuf::io::CodedInputStream* input); + void SerializeWithCachedSizes( + ::google::protobuf::io::CodedOutputStream* output) const; + ::google::protobuf::uint8* SerializeWithCachedSizesToArray(::google::protobuf::uint8* output) const; + int GetCachedSize() const { return _cached_size_; } + private: + void SharedCtor(); + void SharedDtor(); + void SetCachedSize(int size) const; + public: + + ::google::protobuf::Metadata GetMetadata() const; + + // nested types ---------------------------------------------------- + + // accessors ------------------------------------------------------- + + // optional int32 app_id = 1; + inline bool has_app_id() const; + inline void clear_app_id(); + static const int kAppIdFieldNumber = 1; + inline ::google::protobuf::int32 app_id() const; + inline void set_app_id(::google::protobuf::int32 value); + + // optional .RDB_PROTO.RTDBKEY_STRUCT key_id = 2; + inline bool has_key_id() const; + inline void clear_key_id(); + static const int kKeyIdFieldNumber = 2; + inline const ::RDB_PROTO::RTDBKEY_STRUCT& key_id() const; + inline ::RDB_PROTO::RTDBKEY_STRUCT* mutable_key_id(); + inline ::RDB_PROTO::RTDBKEY_STRUCT* release_key_id(); + inline void set_allocated_key_id(::RDB_PROTO::RTDBKEY_STRUCT* key_id); + + // @@protoc_insertion_point(class_scope:RDB_PROTO.APPRTDBKDY_STRUCT) + private: + inline void set_has_app_id(); + inline void clear_has_app_id(); + inline void set_has_key_id(); + inline void clear_has_key_id(); + + ::google::protobuf::UnknownFieldSet _unknown_fields_; + + ::RDB_PROTO::RTDBKEY_STRUCT* key_id_; + ::google::protobuf::int32 app_id_; + + mutable int _cached_size_; + ::google::protobuf::uint32 _has_bits_[(2 + 31) / 32]; + + friend void protobuf_AddDesc_rdb_5fdefine_2eproto(); + friend void protobuf_AssignDesc_rdb_5fdefine_2eproto(); + friend void protobuf_ShutdownFile_rdb_5fdefine_2eproto(); + + void InitAsDefaultInstance(); + static APPRTDBKDY_STRUCT* default_instance_; +}; +// ------------------------------------------------------------------- + +class UNION_DATA_VALUE : public ::google::protobuf::Message { + public: + UNION_DATA_VALUE(); + virtual ~UNION_DATA_VALUE(); + + UNION_DATA_VALUE(const UNION_DATA_VALUE& from); + + inline UNION_DATA_VALUE& operator=(const UNION_DATA_VALUE& from) { + CopyFrom(from); + return *this; + } + + inline const ::google::protobuf::UnknownFieldSet& unknown_fields() const { + return _unknown_fields_; + } + + inline ::google::protobuf::UnknownFieldSet* mutable_unknown_fields() { + return &_unknown_fields_; + } + + static const ::google::protobuf::Descriptor* descriptor(); + static const UNION_DATA_VALUE& default_instance(); + + void Swap(UNION_DATA_VALUE* other); + + // implements Message ---------------------------------------------- + + UNION_DATA_VALUE* New() const; + void CopyFrom(const ::google::protobuf::Message& from); + void MergeFrom(const ::google::protobuf::Message& from); + void CopyFrom(const UNION_DATA_VALUE& from); + void MergeFrom(const UNION_DATA_VALUE& from); + void Clear(); + bool IsInitialized() const; + + int ByteSize() const; + bool MergePartialFromCodedStream( + ::google::protobuf::io::CodedInputStream* input); + void SerializeWithCachedSizes( + ::google::protobuf::io::CodedOutputStream* output) const; + ::google::protobuf::uint8* SerializeWithCachedSizesToArray(::google::protobuf::uint8* output) const; + int GetCachedSize() const { return _cached_size_; } + private: + void SharedCtor(); + void SharedDtor(); + void SetCachedSize(int size) const; + public: + + ::google::protobuf::Metadata GetMetadata() const; + + // nested types ---------------------------------------------------- + + // accessors ------------------------------------------------------- + + // optional int32 type = 1; + inline bool has_type() const; + inline void clear_type(); + static const int kTypeFieldNumber = 1; + inline ::google::protobuf::int32 type() const; + inline void set_type(::google::protobuf::int32 value); + + // optional bytes c_string = 2; + inline bool has_c_string() const; + inline void clear_c_string(); + static const int kCStringFieldNumber = 2; + inline const ::std::string& c_string() const; + inline void set_c_string(const ::std::string& value); + inline void set_c_string(const char* value); + inline void set_c_string(const void* value, size_t size); + inline ::std::string* mutable_c_string(); + inline ::std::string* release_c_string(); + inline void set_allocated_c_string(::std::string* c_string); + + // optional uint32 c_uchar = 3; + inline bool has_c_uchar() const; + inline void clear_c_uchar(); + static const int kCUcharFieldNumber = 3; + inline ::google::protobuf::uint32 c_uchar() const; + inline void set_c_uchar(::google::protobuf::uint32 value); + + // optional int32 c_short = 4; + inline bool has_c_short() const; + inline void clear_c_short(); + static const int kCShortFieldNumber = 4; + inline ::google::protobuf::int32 c_short() const; + inline void set_c_short(::google::protobuf::int32 value); + + // optional int32 c_int = 5; + inline bool has_c_int() const; + inline void clear_c_int(); + static const int kCIntFieldNumber = 5; + inline ::google::protobuf::int32 c_int() const; + inline void set_c_int(::google::protobuf::int32 value); + + // optional int64 c_time = 6; + inline bool has_c_time() const; + inline void clear_c_time(); + static const int kCTimeFieldNumber = 6; + inline ::google::protobuf::int64 c_time() const; + inline void set_c_time(::google::protobuf::int64 value); + + // optional float c_float = 7; + inline bool has_c_float() const; + inline void clear_c_float(); + static const int kCFloatFieldNumber = 7; + inline float c_float() const; + inline void set_c_float(float value); + + // optional double c_double = 8; + inline bool has_c_double() const; + inline void clear_c_double(); + static const int kCDoubleFieldNumber = 8; + inline double c_double() const; + inline void set_c_double(double value); + + // optional int64 c_keyid = 9; + inline bool has_c_keyid() const; + inline void clear_c_keyid(); + static const int kCKeyidFieldNumber = 9; + inline ::google::protobuf::int64 c_keyid() const; + inline void set_c_keyid(::google::protobuf::int64 value); + + // optional .RDB_PROTO.SEQ_CHAR c_binary = 10; + inline bool has_c_binary() const; + inline void clear_c_binary(); + static const int kCBinaryFieldNumber = 10; + inline const ::RDB_PROTO::SEQ_CHAR& c_binary() const; + inline ::RDB_PROTO::SEQ_CHAR* mutable_c_binary(); + inline ::RDB_PROTO::SEQ_CHAR* release_c_binary(); + inline void set_allocated_c_binary(::RDB_PROTO::SEQ_CHAR* c_binary); + + // optional .RDB_PROTO.SEQ_CHAR c_text = 11; + inline bool has_c_text() const; + inline void clear_c_text(); + static const int kCTextFieldNumber = 11; + inline const ::RDB_PROTO::SEQ_CHAR& c_text() const; + inline ::RDB_PROTO::SEQ_CHAR* mutable_c_text(); + inline ::RDB_PROTO::SEQ_CHAR* release_c_text(); + inline void set_allocated_c_text(::RDB_PROTO::SEQ_CHAR* c_text); + + // optional .RDB_PROTO.SEQ_CHAR c_image = 12; + inline bool has_c_image() const; + inline void clear_c_image(); + static const int kCImageFieldNumber = 12; + inline const ::RDB_PROTO::SEQ_CHAR& c_image() const; + inline ::RDB_PROTO::SEQ_CHAR* mutable_c_image(); + inline ::RDB_PROTO::SEQ_CHAR* release_c_image(); + inline void set_allocated_c_image(::RDB_PROTO::SEQ_CHAR* c_image); + + // optional .RDB_PROTO.APPKEYID_STRUCT c_appkeyid = 13; + inline bool has_c_appkeyid() const; + inline void clear_c_appkeyid(); + static const int kCAppkeyidFieldNumber = 13; + inline const ::RDB_PROTO::APPKEYID_STRUCT& c_appkeyid() const; + inline ::RDB_PROTO::APPKEYID_STRUCT* mutable_c_appkeyid(); + inline ::RDB_PROTO::APPKEYID_STRUCT* release_c_appkeyid(); + inline void set_allocated_c_appkeyid(::RDB_PROTO::APPKEYID_STRUCT* c_appkeyid); + + // optional .RDB_PROTO.APPID_STRUCT c_appid = 14; + inline bool has_c_appid() const; + inline void clear_c_appid(); + static const int kCAppidFieldNumber = 14; + inline const ::RDB_PROTO::APPID_STRUCT& c_appid() const; + inline ::RDB_PROTO::APPID_STRUCT* mutable_c_appid(); + inline ::RDB_PROTO::APPID_STRUCT* release_c_appid(); + inline void set_allocated_c_appid(::RDB_PROTO::APPID_STRUCT* c_appid); + + // optional bytes c_default = 15; + inline bool has_c_default() const; + inline void clear_c_default(); + static const int kCDefaultFieldNumber = 15; + inline const ::std::string& c_default() const; + inline void set_c_default(const ::std::string& value); + inline void set_c_default(const char* value); + inline void set_c_default(const void* value, size_t size); + inline ::std::string* mutable_c_default(); + inline ::std::string* release_c_default(); + inline void set_allocated_c_default(::std::string* c_default); + + // optional uint32 c_uint = 16; + inline bool has_c_uint() const; + inline void clear_c_uint(); + static const int kCUintFieldNumber = 16; + inline ::google::protobuf::uint32 c_uint() const; + inline void set_c_uint(::google::protobuf::uint32 value); + + // optional int64 c_long = 17; + inline bool has_c_long() const; + inline void clear_c_long(); + static const int kCLongFieldNumber = 17; + inline ::google::protobuf::int64 c_long() const; + inline void set_c_long(::google::protobuf::int64 value); + + // optional .RDB_PROTO.RTDBKEY_STRUCT c_rtdbkeyid = 18; + inline bool has_c_rtdbkeyid() const; + inline void clear_c_rtdbkeyid(); + static const int kCRtdbkeyidFieldNumber = 18; + inline const ::RDB_PROTO::RTDBKEY_STRUCT& c_rtdbkeyid() const; + inline ::RDB_PROTO::RTDBKEY_STRUCT* mutable_c_rtdbkeyid(); + inline ::RDB_PROTO::RTDBKEY_STRUCT* release_c_rtdbkeyid(); + inline void set_allocated_c_rtdbkeyid(::RDB_PROTO::RTDBKEY_STRUCT* c_rtdbkeyid); + + // optional .RDB_PROTO.RTDBKEY_STRUCT c_measrtdbkeyid = 19; + inline bool has_c_measrtdbkeyid() const; + inline void clear_c_measrtdbkeyid(); + static const int kCMeasrtdbkeyidFieldNumber = 19; + inline const ::RDB_PROTO::RTDBKEY_STRUCT& c_measrtdbkeyid() const; + inline ::RDB_PROTO::RTDBKEY_STRUCT* mutable_c_measrtdbkeyid(); + inline ::RDB_PROTO::RTDBKEY_STRUCT* release_c_measrtdbkeyid(); + inline void set_allocated_c_measrtdbkeyid(::RDB_PROTO::RTDBKEY_STRUCT* c_measrtdbkeyid); + + // optional .RDB_PROTO.APPRTDBKDY_STRUCT c_apprtdbkey = 20; + inline bool has_c_apprtdbkey() const; + inline void clear_c_apprtdbkey(); + static const int kCApprtdbkeyFieldNumber = 20; + inline const ::RDB_PROTO::APPRTDBKDY_STRUCT& c_apprtdbkey() const; + inline ::RDB_PROTO::APPRTDBKDY_STRUCT* mutable_c_apprtdbkey(); + inline ::RDB_PROTO::APPRTDBKDY_STRUCT* release_c_apprtdbkey(); + inline void set_allocated_c_apprtdbkey(::RDB_PROTO::APPRTDBKDY_STRUCT* c_apprtdbkey); + + // @@protoc_insertion_point(class_scope:RDB_PROTO.UNION_DATA_VALUE) + private: + inline void set_has_type(); + inline void clear_has_type(); + inline void set_has_c_string(); + inline void clear_has_c_string(); + inline void set_has_c_uchar(); + inline void clear_has_c_uchar(); + inline void set_has_c_short(); + inline void clear_has_c_short(); + inline void set_has_c_int(); + inline void clear_has_c_int(); + inline void set_has_c_time(); + inline void clear_has_c_time(); + inline void set_has_c_float(); + inline void clear_has_c_float(); + inline void set_has_c_double(); + inline void clear_has_c_double(); + inline void set_has_c_keyid(); + inline void clear_has_c_keyid(); + inline void set_has_c_binary(); + inline void clear_has_c_binary(); + inline void set_has_c_text(); + inline void clear_has_c_text(); + inline void set_has_c_image(); + inline void clear_has_c_image(); + inline void set_has_c_appkeyid(); + inline void clear_has_c_appkeyid(); + inline void set_has_c_appid(); + inline void clear_has_c_appid(); + inline void set_has_c_default(); + inline void clear_has_c_default(); + inline void set_has_c_uint(); + inline void clear_has_c_uint(); + inline void set_has_c_long(); + inline void clear_has_c_long(); + inline void set_has_c_rtdbkeyid(); + inline void clear_has_c_rtdbkeyid(); + inline void set_has_c_measrtdbkeyid(); + inline void clear_has_c_measrtdbkeyid(); + inline void set_has_c_apprtdbkey(); + inline void clear_has_c_apprtdbkey(); + + ::google::protobuf::UnknownFieldSet _unknown_fields_; + + ::std::string* c_string_; + ::google::protobuf::int32 type_; + ::google::protobuf::uint32 c_uchar_; + ::google::protobuf::int32 c_short_; + ::google::protobuf::int32 c_int_; + ::google::protobuf::int64 c_time_; + double c_double_; + ::google::protobuf::int64 c_keyid_; + ::RDB_PROTO::SEQ_CHAR* c_binary_; + ::RDB_PROTO::SEQ_CHAR* c_text_; + float c_float_; + ::google::protobuf::uint32 c_uint_; + ::RDB_PROTO::SEQ_CHAR* c_image_; + ::RDB_PROTO::APPKEYID_STRUCT* c_appkeyid_; + ::RDB_PROTO::APPID_STRUCT* c_appid_; + ::std::string* c_default_; + ::google::protobuf::int64 c_long_; + ::RDB_PROTO::RTDBKEY_STRUCT* c_rtdbkeyid_; + ::RDB_PROTO::RTDBKEY_STRUCT* c_measrtdbkeyid_; + ::RDB_PROTO::APPRTDBKDY_STRUCT* c_apprtdbkey_; + + mutable int _cached_size_; + ::google::protobuf::uint32 _has_bits_[(20 + 31) / 32]; + + friend void protobuf_AddDesc_rdb_5fdefine_2eproto(); + friend void protobuf_AssignDesc_rdb_5fdefine_2eproto(); + friend void protobuf_ShutdownFile_rdb_5fdefine_2eproto(); + + void InitAsDefaultInstance(); + static UNION_DATA_VALUE* default_instance_; +}; +// ------------------------------------------------------------------- + +class SEQ_DATA_VALUE : public ::google::protobuf::Message { + public: + SEQ_DATA_VALUE(); + virtual ~SEQ_DATA_VALUE(); + + SEQ_DATA_VALUE(const SEQ_DATA_VALUE& from); + + inline SEQ_DATA_VALUE& operator=(const SEQ_DATA_VALUE& from) { + CopyFrom(from); + return *this; + } + + inline const ::google::protobuf::UnknownFieldSet& unknown_fields() const { + return _unknown_fields_; + } + + inline ::google::protobuf::UnknownFieldSet* mutable_unknown_fields() { + return &_unknown_fields_; + } + + static const ::google::protobuf::Descriptor* descriptor(); + static const SEQ_DATA_VALUE& default_instance(); + + void Swap(SEQ_DATA_VALUE* other); + + // implements Message ---------------------------------------------- + + SEQ_DATA_VALUE* New() const; + void CopyFrom(const ::google::protobuf::Message& from); + void MergeFrom(const ::google::protobuf::Message& from); + void CopyFrom(const SEQ_DATA_VALUE& from); + void MergeFrom(const SEQ_DATA_VALUE& from); + void Clear(); + bool IsInitialized() const; + + int ByteSize() const; + bool MergePartialFromCodedStream( + ::google::protobuf::io::CodedInputStream* input); + void SerializeWithCachedSizes( + ::google::protobuf::io::CodedOutputStream* output) const; + ::google::protobuf::uint8* SerializeWithCachedSizesToArray(::google::protobuf::uint8* output) const; + int GetCachedSize() const { return _cached_size_; } + private: + void SharedCtor(); + void SharedDtor(); + void SetCachedSize(int size) const; + public: + + ::google::protobuf::Metadata GetMetadata() const; + + // nested types ---------------------------------------------------- + + // accessors ------------------------------------------------------- + + // repeated .RDB_PROTO.UNION_DATA_VALUE vec_data = 1; + inline int vec_data_size() const; + inline void clear_vec_data(); + static const int kVecDataFieldNumber = 1; + inline const ::RDB_PROTO::UNION_DATA_VALUE& vec_data(int index) const; + inline ::RDB_PROTO::UNION_DATA_VALUE* mutable_vec_data(int index); + inline ::RDB_PROTO::UNION_DATA_VALUE* add_vec_data(); + inline const ::google::protobuf::RepeatedPtrField< ::RDB_PROTO::UNION_DATA_VALUE >& + vec_data() const; + inline ::google::protobuf::RepeatedPtrField< ::RDB_PROTO::UNION_DATA_VALUE >* + mutable_vec_data(); + + // @@protoc_insertion_point(class_scope:RDB_PROTO.SEQ_DATA_VALUE) + private: + + ::google::protobuf::UnknownFieldSet _unknown_fields_; + + ::google::protobuf::RepeatedPtrField< ::RDB_PROTO::UNION_DATA_VALUE > vec_data_; + + mutable int _cached_size_; + ::google::protobuf::uint32 _has_bits_[(1 + 31) / 32]; + + friend void protobuf_AddDesc_rdb_5fdefine_2eproto(); + friend void protobuf_AssignDesc_rdb_5fdefine_2eproto(); + friend void protobuf_ShutdownFile_rdb_5fdefine_2eproto(); + + void InitAsDefaultInstance(); + static SEQ_DATA_VALUE* default_instance_; +}; +// ------------------------------------------------------------------- + +class DBERROR_STRUCT : public ::google::protobuf::Message { + public: + DBERROR_STRUCT(); + virtual ~DBERROR_STRUCT(); + + DBERROR_STRUCT(const DBERROR_STRUCT& from); + + inline DBERROR_STRUCT& operator=(const DBERROR_STRUCT& from) { + CopyFrom(from); + return *this; + } + + inline const ::google::protobuf::UnknownFieldSet& unknown_fields() const { + return _unknown_fields_; + } + + inline ::google::protobuf::UnknownFieldSet* mutable_unknown_fields() { + return &_unknown_fields_; + } + + static const ::google::protobuf::Descriptor* descriptor(); + static const DBERROR_STRUCT& default_instance(); + + void Swap(DBERROR_STRUCT* other); + + // implements Message ---------------------------------------------- + + DBERROR_STRUCT* New() const; + void CopyFrom(const ::google::protobuf::Message& from); + void MergeFrom(const ::google::protobuf::Message& from); + void CopyFrom(const DBERROR_STRUCT& from); + void MergeFrom(const DBERROR_STRUCT& from); + void Clear(); + bool IsInitialized() const; + + int ByteSize() const; + bool MergePartialFromCodedStream( + ::google::protobuf::io::CodedInputStream* input); + void SerializeWithCachedSizes( + ::google::protobuf::io::CodedOutputStream* output) const; + ::google::protobuf::uint8* SerializeWithCachedSizesToArray(::google::protobuf::uint8* output) const; + int GetCachedSize() const { return _cached_size_; } + private: + void SharedCtor(); + void SharedDtor(); + void SetCachedSize(int size) const; + public: + + ::google::protobuf::Metadata GetMetadata() const; + + // nested types ---------------------------------------------------- + + // accessors ------------------------------------------------------- + + // optional uint32 error_no = 1; + inline bool has_error_no() const; + inline void clear_error_no(); + static const int kErrorNoFieldNumber = 1; + inline ::google::protobuf::uint32 error_no() const; + inline void set_error_no(::google::protobuf::uint32 value); + + // optional bytes error_msg = 2; + inline bool has_error_msg() const; + inline void clear_error_msg(); + static const int kErrorMsgFieldNumber = 2; + inline const ::std::string& error_msg() const; + inline void set_error_msg(const ::std::string& value); + inline void set_error_msg(const char* value); + inline void set_error_msg(const void* value, size_t size); + inline ::std::string* mutable_error_msg(); + inline ::std::string* release_error_msg(); + inline void set_allocated_error_msg(::std::string* error_msg); + + // @@protoc_insertion_point(class_scope:RDB_PROTO.DBERROR_STRUCT) + private: + inline void set_has_error_no(); + inline void clear_has_error_no(); + inline void set_has_error_msg(); + inline void clear_has_error_msg(); + + ::google::protobuf::UnknownFieldSet _unknown_fields_; + + ::std::string* error_msg_; + ::google::protobuf::uint32 error_no_; + + mutable int _cached_size_; + ::google::protobuf::uint32 _has_bits_[(2 + 31) / 32]; + + friend void protobuf_AddDesc_rdb_5fdefine_2eproto(); + friend void protobuf_AssignDesc_rdb_5fdefine_2eproto(); + friend void protobuf_ShutdownFile_rdb_5fdefine_2eproto(); + + void InitAsDefaultInstance(); + static DBERROR_STRUCT* default_instance_; +}; +// ------------------------------------------------------------------- + +class SEQ_DBERROR : public ::google::protobuf::Message { + public: + SEQ_DBERROR(); + virtual ~SEQ_DBERROR(); + + SEQ_DBERROR(const SEQ_DBERROR& from); + + inline SEQ_DBERROR& operator=(const SEQ_DBERROR& from) { + CopyFrom(from); + return *this; + } + + inline const ::google::protobuf::UnknownFieldSet& unknown_fields() const { + return _unknown_fields_; + } + + inline ::google::protobuf::UnknownFieldSet* mutable_unknown_fields() { + return &_unknown_fields_; + } + + static const ::google::protobuf::Descriptor* descriptor(); + static const SEQ_DBERROR& default_instance(); + + void Swap(SEQ_DBERROR* other); + + // implements Message ---------------------------------------------- + + SEQ_DBERROR* New() const; + void CopyFrom(const ::google::protobuf::Message& from); + void MergeFrom(const ::google::protobuf::Message& from); + void CopyFrom(const SEQ_DBERROR& from); + void MergeFrom(const SEQ_DBERROR& from); + void Clear(); + bool IsInitialized() const; + + int ByteSize() const; + bool MergePartialFromCodedStream( + ::google::protobuf::io::CodedInputStream* input); + void SerializeWithCachedSizes( + ::google::protobuf::io::CodedOutputStream* output) const; + ::google::protobuf::uint8* SerializeWithCachedSizesToArray(::google::protobuf::uint8* output) const; + int GetCachedSize() const { return _cached_size_; } + private: + void SharedCtor(); + void SharedDtor(); + void SetCachedSize(int size) const; + public: + + ::google::protobuf::Metadata GetMetadata() const; + + // nested types ---------------------------------------------------- + + // accessors ------------------------------------------------------- + + // repeated .RDB_PROTO.DBERROR_STRUCT vec_error = 1; + inline int vec_error_size() const; + inline void clear_vec_error(); + static const int kVecErrorFieldNumber = 1; + inline const ::RDB_PROTO::DBERROR_STRUCT& vec_error(int index) const; + inline ::RDB_PROTO::DBERROR_STRUCT* mutable_vec_error(int index); + inline ::RDB_PROTO::DBERROR_STRUCT* add_vec_error(); + inline const ::google::protobuf::RepeatedPtrField< ::RDB_PROTO::DBERROR_STRUCT >& + vec_error() const; + inline ::google::protobuf::RepeatedPtrField< ::RDB_PROTO::DBERROR_STRUCT >* + mutable_vec_error(); + + // @@protoc_insertion_point(class_scope:RDB_PROTO.SEQ_DBERROR) + private: + + ::google::protobuf::UnknownFieldSet _unknown_fields_; + + ::google::protobuf::RepeatedPtrField< ::RDB_PROTO::DBERROR_STRUCT > vec_error_; + + mutable int _cached_size_; + ::google::protobuf::uint32 _has_bits_[(1 + 31) / 32]; + + friend void protobuf_AddDesc_rdb_5fdefine_2eproto(); + friend void protobuf_AssignDesc_rdb_5fdefine_2eproto(); + friend void protobuf_ShutdownFile_rdb_5fdefine_2eproto(); + + void InitAsDefaultInstance(); + static SEQ_DBERROR* default_instance_; +}; +// ------------------------------------------------------------------- + +class RESULT_DATA_VALUE : public ::google::protobuf::Message { + public: + RESULT_DATA_VALUE(); + virtual ~RESULT_DATA_VALUE(); + + RESULT_DATA_VALUE(const RESULT_DATA_VALUE& from); + + inline RESULT_DATA_VALUE& operator=(const RESULT_DATA_VALUE& from) { + CopyFrom(from); + return *this; + } + + inline const ::google::protobuf::UnknownFieldSet& unknown_fields() const { + return _unknown_fields_; + } + + inline ::google::protobuf::UnknownFieldSet* mutable_unknown_fields() { + return &_unknown_fields_; + } + + static const ::google::protobuf::Descriptor* descriptor(); + static const RESULT_DATA_VALUE& default_instance(); + + void Swap(RESULT_DATA_VALUE* other); + + // implements Message ---------------------------------------------- + + RESULT_DATA_VALUE* New() const; + void CopyFrom(const ::google::protobuf::Message& from); + void MergeFrom(const ::google::protobuf::Message& from); + void CopyFrom(const RESULT_DATA_VALUE& from); + void MergeFrom(const RESULT_DATA_VALUE& from); + void Clear(); + bool IsInitialized() const; + + int ByteSize() const; + bool MergePartialFromCodedStream( + ::google::protobuf::io::CodedInputStream* input); + void SerializeWithCachedSizes( + ::google::protobuf::io::CodedOutputStream* output) const; + ::google::protobuf::uint8* SerializeWithCachedSizesToArray(::google::protobuf::uint8* output) const; + int GetCachedSize() const { return _cached_size_; } + private: + void SharedCtor(); + void SharedDtor(); + void SetCachedSize(int size) const; + public: + + ::google::protobuf::Metadata GetMetadata() const; + + // nested types ---------------------------------------------------- + + // accessors ------------------------------------------------------- + + // required bool is_null = 1; + inline bool has_is_null() const; + inline void clear_is_null(); + static const int kIsNullFieldNumber = 1; + inline bool is_null() const; + inline void set_is_null(bool value); + + // required .RDB_PROTO.UNION_DATA_VALUE data_value = 2; + inline bool has_data_value() const; + inline void clear_data_value(); + static const int kDataValueFieldNumber = 2; + inline const ::RDB_PROTO::UNION_DATA_VALUE& data_value() const; + inline ::RDB_PROTO::UNION_DATA_VALUE* mutable_data_value(); + inline ::RDB_PROTO::UNION_DATA_VALUE* release_data_value(); + inline void set_allocated_data_value(::RDB_PROTO::UNION_DATA_VALUE* data_value); + + // @@protoc_insertion_point(class_scope:RDB_PROTO.RESULT_DATA_VALUE) + private: + inline void set_has_is_null(); + inline void clear_has_is_null(); + inline void set_has_data_value(); + inline void clear_has_data_value(); + + ::google::protobuf::UnknownFieldSet _unknown_fields_; + + ::RDB_PROTO::UNION_DATA_VALUE* data_value_; + bool is_null_; + + mutable int _cached_size_; + ::google::protobuf::uint32 _has_bits_[(2 + 31) / 32]; + + friend void protobuf_AddDesc_rdb_5fdefine_2eproto(); + friend void protobuf_AssignDesc_rdb_5fdefine_2eproto(); + friend void protobuf_ShutdownFile_rdb_5fdefine_2eproto(); + + void InitAsDefaultInstance(); + static RESULT_DATA_VALUE* default_instance_; +}; +// ------------------------------------------------------------------- + +class SEQ_RESULT_DATA_VALUE : public ::google::protobuf::Message { + public: + SEQ_RESULT_DATA_VALUE(); + virtual ~SEQ_RESULT_DATA_VALUE(); + + SEQ_RESULT_DATA_VALUE(const SEQ_RESULT_DATA_VALUE& from); + + inline SEQ_RESULT_DATA_VALUE& operator=(const SEQ_RESULT_DATA_VALUE& from) { + CopyFrom(from); + return *this; + } + + inline const ::google::protobuf::UnknownFieldSet& unknown_fields() const { + return _unknown_fields_; + } + + inline ::google::protobuf::UnknownFieldSet* mutable_unknown_fields() { + return &_unknown_fields_; + } + + static const ::google::protobuf::Descriptor* descriptor(); + static const SEQ_RESULT_DATA_VALUE& default_instance(); + + void Swap(SEQ_RESULT_DATA_VALUE* other); + + // implements Message ---------------------------------------------- + + SEQ_RESULT_DATA_VALUE* New() const; + void CopyFrom(const ::google::protobuf::Message& from); + void MergeFrom(const ::google::protobuf::Message& from); + void CopyFrom(const SEQ_RESULT_DATA_VALUE& from); + void MergeFrom(const SEQ_RESULT_DATA_VALUE& from); + void Clear(); + bool IsInitialized() const; + + int ByteSize() const; + bool MergePartialFromCodedStream( + ::google::protobuf::io::CodedInputStream* input); + void SerializeWithCachedSizes( + ::google::protobuf::io::CodedOutputStream* output) const; + ::google::protobuf::uint8* SerializeWithCachedSizesToArray(::google::protobuf::uint8* output) const; + int GetCachedSize() const { return _cached_size_; } + private: + void SharedCtor(); + void SharedDtor(); + void SetCachedSize(int size) const; + public: + + ::google::protobuf::Metadata GetMetadata() const; + + // nested types ---------------------------------------------------- + + // accessors ------------------------------------------------------- + + // repeated .RDB_PROTO.RESULT_DATA_VALUE vec_result_data_value = 1; + inline int vec_result_data_value_size() const; + inline void clear_vec_result_data_value(); + static const int kVecResultDataValueFieldNumber = 1; + inline const ::RDB_PROTO::RESULT_DATA_VALUE& vec_result_data_value(int index) const; + inline ::RDB_PROTO::RESULT_DATA_VALUE* mutable_vec_result_data_value(int index); + inline ::RDB_PROTO::RESULT_DATA_VALUE* add_vec_result_data_value(); + inline const ::google::protobuf::RepeatedPtrField< ::RDB_PROTO::RESULT_DATA_VALUE >& + vec_result_data_value() const; + inline ::google::protobuf::RepeatedPtrField< ::RDB_PROTO::RESULT_DATA_VALUE >* + mutable_vec_result_data_value(); + + // @@protoc_insertion_point(class_scope:RDB_PROTO.SEQ_RESULT_DATA_VALUE) + private: + + ::google::protobuf::UnknownFieldSet _unknown_fields_; + + ::google::protobuf::RepeatedPtrField< ::RDB_PROTO::RESULT_DATA_VALUE > vec_result_data_value_; + + mutable int _cached_size_; + ::google::protobuf::uint32 _has_bits_[(1 + 31) / 32]; + + friend void protobuf_AddDesc_rdb_5fdefine_2eproto(); + friend void protobuf_AssignDesc_rdb_5fdefine_2eproto(); + friend void protobuf_ShutdownFile_rdb_5fdefine_2eproto(); + + void InitAsDefaultInstance(); + static SEQ_RESULT_DATA_VALUE* default_instance_; +}; +// ------------------------------------------------------------------- + +class RESULT_FIELD_INFO : public ::google::protobuf::Message { + public: + RESULT_FIELD_INFO(); + virtual ~RESULT_FIELD_INFO(); + + RESULT_FIELD_INFO(const RESULT_FIELD_INFO& from); + + inline RESULT_FIELD_INFO& operator=(const RESULT_FIELD_INFO& from) { + CopyFrom(from); + return *this; + } + + inline const ::google::protobuf::UnknownFieldSet& unknown_fields() const { + return _unknown_fields_; + } + + inline ::google::protobuf::UnknownFieldSet* mutable_unknown_fields() { + return &_unknown_fields_; + } + + static const ::google::protobuf::Descriptor* descriptor(); + static const RESULT_FIELD_INFO& default_instance(); + + void Swap(RESULT_FIELD_INFO* other); + + // implements Message ---------------------------------------------- + + RESULT_FIELD_INFO* New() const; + void CopyFrom(const ::google::protobuf::Message& from); + void MergeFrom(const ::google::protobuf::Message& from); + void CopyFrom(const RESULT_FIELD_INFO& from); + void MergeFrom(const RESULT_FIELD_INFO& from); + void Clear(); + bool IsInitialized() const; + + int ByteSize() const; + bool MergePartialFromCodedStream( + ::google::protobuf::io::CodedInputStream* input); + void SerializeWithCachedSizes( + ::google::protobuf::io::CodedOutputStream* output) const; + ::google::protobuf::uint8* SerializeWithCachedSizesToArray(::google::protobuf::uint8* output) const; + int GetCachedSize() const { return _cached_size_; } + private: + void SharedCtor(); + void SharedDtor(); + void SetCachedSize(int size) const; + public: + + ::google::protobuf::Metadata GetMetadata() const; + + // nested types ---------------------------------------------------- + + // accessors ------------------------------------------------------- + + // required int32 data_type = 1; + inline bool has_data_type() const; + inline void clear_data_type(); + static const int kDataTypeFieldNumber = 1; + inline ::google::protobuf::int32 data_type() const; + inline void set_data_type(::google::protobuf::int32 value); + + // required int32 data_len = 2; + inline bool has_data_len() const; + inline void clear_data_len(); + static const int kDataLenFieldNumber = 2; + inline ::google::protobuf::int32 data_len() const; + inline void set_data_len(::google::protobuf::int32 value); + + // required bytes col_name = 3; + inline bool has_col_name() const; + inline void clear_col_name(); + static const int kColNameFieldNumber = 3; + inline const ::std::string& col_name() const; + inline void set_col_name(const ::std::string& value); + inline void set_col_name(const char* value); + inline void set_col_name(const void* value, size_t size); + inline ::std::string* mutable_col_name(); + inline ::std::string* release_col_name(); + inline void set_allocated_col_name(::std::string* col_name); + + // @@protoc_insertion_point(class_scope:RDB_PROTO.RESULT_FIELD_INFO) + private: + inline void set_has_data_type(); + inline void clear_has_data_type(); + inline void set_has_data_len(); + inline void clear_has_data_len(); + inline void set_has_col_name(); + inline void clear_has_col_name(); + + ::google::protobuf::UnknownFieldSet _unknown_fields_; + + ::google::protobuf::int32 data_type_; + ::google::protobuf::int32 data_len_; + ::std::string* col_name_; + + mutable int _cached_size_; + ::google::protobuf::uint32 _has_bits_[(3 + 31) / 32]; + + friend void protobuf_AddDesc_rdb_5fdefine_2eproto(); + friend void protobuf_AssignDesc_rdb_5fdefine_2eproto(); + friend void protobuf_ShutdownFile_rdb_5fdefine_2eproto(); + + void InitAsDefaultInstance(); + static RESULT_FIELD_INFO* default_instance_; +}; +// ------------------------------------------------------------------- + +class SEQ_RESULT_FIELD_INFO : public ::google::protobuf::Message { + public: + SEQ_RESULT_FIELD_INFO(); + virtual ~SEQ_RESULT_FIELD_INFO(); + + SEQ_RESULT_FIELD_INFO(const SEQ_RESULT_FIELD_INFO& from); + + inline SEQ_RESULT_FIELD_INFO& operator=(const SEQ_RESULT_FIELD_INFO& from) { + CopyFrom(from); + return *this; + } + + inline const ::google::protobuf::UnknownFieldSet& unknown_fields() const { + return _unknown_fields_; + } + + inline ::google::protobuf::UnknownFieldSet* mutable_unknown_fields() { + return &_unknown_fields_; + } + + static const ::google::protobuf::Descriptor* descriptor(); + static const SEQ_RESULT_FIELD_INFO& default_instance(); + + void Swap(SEQ_RESULT_FIELD_INFO* other); + + // implements Message ---------------------------------------------- + + SEQ_RESULT_FIELD_INFO* New() const; + void CopyFrom(const ::google::protobuf::Message& from); + void MergeFrom(const ::google::protobuf::Message& from); + void CopyFrom(const SEQ_RESULT_FIELD_INFO& from); + void MergeFrom(const SEQ_RESULT_FIELD_INFO& from); + void Clear(); + bool IsInitialized() const; + + int ByteSize() const; + bool MergePartialFromCodedStream( + ::google::protobuf::io::CodedInputStream* input); + void SerializeWithCachedSizes( + ::google::protobuf::io::CodedOutputStream* output) const; + ::google::protobuf::uint8* SerializeWithCachedSizesToArray(::google::protobuf::uint8* output) const; + int GetCachedSize() const { return _cached_size_; } + private: + void SharedCtor(); + void SharedDtor(); + void SetCachedSize(int size) const; + public: + + ::google::protobuf::Metadata GetMetadata() const; + + // nested types ---------------------------------------------------- + + // accessors ------------------------------------------------------- + + // repeated .RDB_PROTO.RESULT_FIELD_INFO vec_result_field_info = 1; + inline int vec_result_field_info_size() const; + inline void clear_vec_result_field_info(); + static const int kVecResultFieldInfoFieldNumber = 1; + inline const ::RDB_PROTO::RESULT_FIELD_INFO& vec_result_field_info(int index) const; + inline ::RDB_PROTO::RESULT_FIELD_INFO* mutable_vec_result_field_info(int index); + inline ::RDB_PROTO::RESULT_FIELD_INFO* add_vec_result_field_info(); + inline const ::google::protobuf::RepeatedPtrField< ::RDB_PROTO::RESULT_FIELD_INFO >& + vec_result_field_info() const; + inline ::google::protobuf::RepeatedPtrField< ::RDB_PROTO::RESULT_FIELD_INFO >* + mutable_vec_result_field_info(); + + // @@protoc_insertion_point(class_scope:RDB_PROTO.SEQ_RESULT_FIELD_INFO) + private: + + ::google::protobuf::UnknownFieldSet _unknown_fields_; + + ::google::protobuf::RepeatedPtrField< ::RDB_PROTO::RESULT_FIELD_INFO > vec_result_field_info_; + + mutable int _cached_size_; + ::google::protobuf::uint32 _has_bits_[(1 + 31) / 32]; + + friend void protobuf_AddDesc_rdb_5fdefine_2eproto(); + friend void protobuf_AssignDesc_rdb_5fdefine_2eproto(); + friend void protobuf_ShutdownFile_rdb_5fdefine_2eproto(); + + void InitAsDefaultInstance(); + static SEQ_RESULT_FIELD_INFO* default_instance_; +}; +// ------------------------------------------------------------------- + +class OUT_DATA_TYPE : public ::google::protobuf::Message { + public: + OUT_DATA_TYPE(); + virtual ~OUT_DATA_TYPE(); + + OUT_DATA_TYPE(const OUT_DATA_TYPE& from); + + inline OUT_DATA_TYPE& operator=(const OUT_DATA_TYPE& from) { + CopyFrom(from); + return *this; + } + + inline const ::google::protobuf::UnknownFieldSet& unknown_fields() const { + return _unknown_fields_; + } + + inline ::google::protobuf::UnknownFieldSet* mutable_unknown_fields() { + return &_unknown_fields_; + } + + static const ::google::protobuf::Descriptor* descriptor(); + static const OUT_DATA_TYPE& default_instance(); + + void Swap(OUT_DATA_TYPE* other); + + // implements Message ---------------------------------------------- + + OUT_DATA_TYPE* New() const; + void CopyFrom(const ::google::protobuf::Message& from); + void MergeFrom(const ::google::protobuf::Message& from); + void CopyFrom(const OUT_DATA_TYPE& from); + void MergeFrom(const OUT_DATA_TYPE& from); + void Clear(); + bool IsInitialized() const; + + int ByteSize() const; + bool MergePartialFromCodedStream( + ::google::protobuf::io::CodedInputStream* input); + void SerializeWithCachedSizes( + ::google::protobuf::io::CodedOutputStream* output) const; + ::google::protobuf::uint8* SerializeWithCachedSizesToArray(::google::protobuf::uint8* output) const; + int GetCachedSize() const { return _cached_size_; } + private: + void SharedCtor(); + void SharedDtor(); + void SetCachedSize(int size) const; + public: + + ::google::protobuf::Metadata GetMetadata() const; + + // nested types ---------------------------------------------------- + + // accessors ------------------------------------------------------- + + // required int32 out_field_position = 1; + inline bool has_out_field_position() const; + inline void clear_out_field_position(); + static const int kOutFieldPositionFieldNumber = 1; + inline ::google::protobuf::int32 out_field_position() const; + inline void set_out_field_position(::google::protobuf::int32 value); + + // required int32 out_field_datatype = 2; + inline bool has_out_field_datatype() const; + inline void clear_out_field_datatype(); + static const int kOutFieldDatatypeFieldNumber = 2; + inline ::google::protobuf::int32 out_field_datatype() const; + inline void set_out_field_datatype(::google::protobuf::int32 value); + + // @@protoc_insertion_point(class_scope:RDB_PROTO.OUT_DATA_TYPE) + private: + inline void set_has_out_field_position(); + inline void clear_has_out_field_position(); + inline void set_has_out_field_datatype(); + inline void clear_has_out_field_datatype(); + + ::google::protobuf::UnknownFieldSet _unknown_fields_; + + ::google::protobuf::int32 out_field_position_; + ::google::protobuf::int32 out_field_datatype_; + + mutable int _cached_size_; + ::google::protobuf::uint32 _has_bits_[(2 + 31) / 32]; + + friend void protobuf_AddDesc_rdb_5fdefine_2eproto(); + friend void protobuf_AssignDesc_rdb_5fdefine_2eproto(); + friend void protobuf_ShutdownFile_rdb_5fdefine_2eproto(); + + void InitAsDefaultInstance(); + static OUT_DATA_TYPE* default_instance_; +}; +// ------------------------------------------------------------------- + +class SEQ_OUT_DATA_TYPE : public ::google::protobuf::Message { + public: + SEQ_OUT_DATA_TYPE(); + virtual ~SEQ_OUT_DATA_TYPE(); + + SEQ_OUT_DATA_TYPE(const SEQ_OUT_DATA_TYPE& from); + + inline SEQ_OUT_DATA_TYPE& operator=(const SEQ_OUT_DATA_TYPE& from) { + CopyFrom(from); + return *this; + } + + inline const ::google::protobuf::UnknownFieldSet& unknown_fields() const { + return _unknown_fields_; + } + + inline ::google::protobuf::UnknownFieldSet* mutable_unknown_fields() { + return &_unknown_fields_; + } + + static const ::google::protobuf::Descriptor* descriptor(); + static const SEQ_OUT_DATA_TYPE& default_instance(); + + void Swap(SEQ_OUT_DATA_TYPE* other); + + // implements Message ---------------------------------------------- + + SEQ_OUT_DATA_TYPE* New() const; + void CopyFrom(const ::google::protobuf::Message& from); + void MergeFrom(const ::google::protobuf::Message& from); + void CopyFrom(const SEQ_OUT_DATA_TYPE& from); + void MergeFrom(const SEQ_OUT_DATA_TYPE& from); + void Clear(); + bool IsInitialized() const; + + int ByteSize() const; + bool MergePartialFromCodedStream( + ::google::protobuf::io::CodedInputStream* input); + void SerializeWithCachedSizes( + ::google::protobuf::io::CodedOutputStream* output) const; + ::google::protobuf::uint8* SerializeWithCachedSizesToArray(::google::protobuf::uint8* output) const; + int GetCachedSize() const { return _cached_size_; } + private: + void SharedCtor(); + void SharedDtor(); + void SetCachedSize(int size) const; + public: + + ::google::protobuf::Metadata GetMetadata() const; + + // nested types ---------------------------------------------------- + + // accessors ------------------------------------------------------- + + // repeated .RDB_PROTO.OUT_DATA_TYPE vec_out_data_type = 1; + inline int vec_out_data_type_size() const; + inline void clear_vec_out_data_type(); + static const int kVecOutDataTypeFieldNumber = 1; + inline const ::RDB_PROTO::OUT_DATA_TYPE& vec_out_data_type(int index) const; + inline ::RDB_PROTO::OUT_DATA_TYPE* mutable_vec_out_data_type(int index); + inline ::RDB_PROTO::OUT_DATA_TYPE* add_vec_out_data_type(); + inline const ::google::protobuf::RepeatedPtrField< ::RDB_PROTO::OUT_DATA_TYPE >& + vec_out_data_type() const; + inline ::google::protobuf::RepeatedPtrField< ::RDB_PROTO::OUT_DATA_TYPE >* + mutable_vec_out_data_type(); + + // @@protoc_insertion_point(class_scope:RDB_PROTO.SEQ_OUT_DATA_TYPE) + private: + + ::google::protobuf::UnknownFieldSet _unknown_fields_; + + ::google::protobuf::RepeatedPtrField< ::RDB_PROTO::OUT_DATA_TYPE > vec_out_data_type_; + + mutable int _cached_size_; + ::google::protobuf::uint32 _has_bits_[(1 + 31) / 32]; + + friend void protobuf_AddDesc_rdb_5fdefine_2eproto(); + friend void protobuf_AssignDesc_rdb_5fdefine_2eproto(); + friend void protobuf_ShutdownFile_rdb_5fdefine_2eproto(); + + void InitAsDefaultInstance(); + static SEQ_OUT_DATA_TYPE* default_instance_; +}; +// ------------------------------------------------------------------- + +class SELECT_RESULT : public ::google::protobuf::Message { + public: + SELECT_RESULT(); + virtual ~SELECT_RESULT(); + + SELECT_RESULT(const SELECT_RESULT& from); + + inline SELECT_RESULT& operator=(const SELECT_RESULT& from) { + CopyFrom(from); + return *this; + } + + inline const ::google::protobuf::UnknownFieldSet& unknown_fields() const { + return _unknown_fields_; + } + + inline ::google::protobuf::UnknownFieldSet* mutable_unknown_fields() { + return &_unknown_fields_; + } + + static const ::google::protobuf::Descriptor* descriptor(); + static const SELECT_RESULT& default_instance(); + + void Swap(SELECT_RESULT* other); + + // implements Message ---------------------------------------------- + + SELECT_RESULT* New() const; + void CopyFrom(const ::google::protobuf::Message& from); + void MergeFrom(const ::google::protobuf::Message& from); + void CopyFrom(const SELECT_RESULT& from); + void MergeFrom(const SELECT_RESULT& from); + void Clear(); + bool IsInitialized() const; + + int ByteSize() const; + bool MergePartialFromCodedStream( + ::google::protobuf::io::CodedInputStream* input); + void SerializeWithCachedSizes( + ::google::protobuf::io::CodedOutputStream* output) const; + ::google::protobuf::uint8* SerializeWithCachedSizesToArray(::google::protobuf::uint8* output) const; + int GetCachedSize() const { return _cached_size_; } + private: + void SharedCtor(); + void SharedDtor(); + void SetCachedSize(int size) const; + public: + + ::google::protobuf::Metadata GetMetadata() const; + + // nested types ---------------------------------------------------- + + // accessors ------------------------------------------------------- + + // required int32 field_num = 1; + inline bool has_field_num() const; + inline void clear_field_num(); + static const int kFieldNumFieldNumber = 1; + inline ::google::protobuf::int32 field_num() const; + inline void set_field_num(::google::protobuf::int32 value); + + // required .RDB_PROTO.SEQ_RESULT_FIELD_INFO field_info = 2; + inline bool has_field_info() const; + inline void clear_field_info(); + static const int kFieldInfoFieldNumber = 2; + inline const ::RDB_PROTO::SEQ_RESULT_FIELD_INFO& field_info() const; + inline ::RDB_PROTO::SEQ_RESULT_FIELD_INFO* mutable_field_info(); + inline ::RDB_PROTO::SEQ_RESULT_FIELD_INFO* release_field_info(); + inline void set_allocated_field_info(::RDB_PROTO::SEQ_RESULT_FIELD_INFO* field_info); + + // required uint32 data_num = 3; + inline bool has_data_num() const; + inline void clear_data_num(); + static const int kDataNumFieldNumber = 3; + inline ::google::protobuf::uint32 data_num() const; + inline void set_data_num(::google::protobuf::uint32 value); + + // required .RDB_PROTO.SEQ_RESULT_DATA_VALUE data_value_seq = 4; + inline bool has_data_value_seq() const; + inline void clear_data_value_seq(); + static const int kDataValueSeqFieldNumber = 4; + inline const ::RDB_PROTO::SEQ_RESULT_DATA_VALUE& data_value_seq() const; + inline ::RDB_PROTO::SEQ_RESULT_DATA_VALUE* mutable_data_value_seq(); + inline ::RDB_PROTO::SEQ_RESULT_DATA_VALUE* release_data_value_seq(); + inline void set_allocated_data_value_seq(::RDB_PROTO::SEQ_RESULT_DATA_VALUE* data_value_seq); + + // @@protoc_insertion_point(class_scope:RDB_PROTO.SELECT_RESULT) + private: + inline void set_has_field_num(); + inline void clear_has_field_num(); + inline void set_has_field_info(); + inline void clear_has_field_info(); + inline void set_has_data_num(); + inline void clear_has_data_num(); + inline void set_has_data_value_seq(); + inline void clear_has_data_value_seq(); + + ::google::protobuf::UnknownFieldSet _unknown_fields_; + + ::RDB_PROTO::SEQ_RESULT_FIELD_INFO* field_info_; + ::google::protobuf::int32 field_num_; + ::google::protobuf::uint32 data_num_; + ::RDB_PROTO::SEQ_RESULT_DATA_VALUE* data_value_seq_; + + mutable int _cached_size_; + ::google::protobuf::uint32 _has_bits_[(4 + 31) / 32]; + + friend void protobuf_AddDesc_rdb_5fdefine_2eproto(); + friend void protobuf_AssignDesc_rdb_5fdefine_2eproto(); + friend void protobuf_ShutdownFile_rdb_5fdefine_2eproto(); + + void InitAsDefaultInstance(); + static SELECT_RESULT* default_instance_; +}; +// ------------------------------------------------------------------- + +class EXEC_MULTI_RESULT : public ::google::protobuf::Message { + public: + EXEC_MULTI_RESULT(); + virtual ~EXEC_MULTI_RESULT(); + + EXEC_MULTI_RESULT(const EXEC_MULTI_RESULT& from); + + inline EXEC_MULTI_RESULT& operator=(const EXEC_MULTI_RESULT& from) { + CopyFrom(from); + return *this; + } + + inline const ::google::protobuf::UnknownFieldSet& unknown_fields() const { + return _unknown_fields_; + } + + inline ::google::protobuf::UnknownFieldSet* mutable_unknown_fields() { + return &_unknown_fields_; + } + + static const ::google::protobuf::Descriptor* descriptor(); + static const EXEC_MULTI_RESULT& default_instance(); + + void Swap(EXEC_MULTI_RESULT* other); + + // implements Message ---------------------------------------------- + + EXEC_MULTI_RESULT* New() const; + void CopyFrom(const ::google::protobuf::Message& from); + void MergeFrom(const ::google::protobuf::Message& from); + void CopyFrom(const EXEC_MULTI_RESULT& from); + void MergeFrom(const EXEC_MULTI_RESULT& from); + void Clear(); + bool IsInitialized() const; + + int ByteSize() const; + bool MergePartialFromCodedStream( + ::google::protobuf::io::CodedInputStream* input); + void SerializeWithCachedSizes( + ::google::protobuf::io::CodedOutputStream* output) const; + ::google::protobuf::uint8* SerializeWithCachedSizesToArray(::google::protobuf::uint8* output) const; + int GetCachedSize() const { return _cached_size_; } + private: + void SharedCtor(); + void SharedDtor(); + void SetCachedSize(int size) const; + public: + + ::google::protobuf::Metadata GetMetadata() const; + + // nested types ---------------------------------------------------- + + // accessors ------------------------------------------------------- + + // required bool is_success = 1; + inline bool has_is_success() const; + inline void clear_is_success(); + static const int kIsSuccessFieldNumber = 1; + inline bool is_success() const; + inline void set_is_success(bool value); + + // required .RDB_PROTO.DBERROR_STRUCT db_error = 2; + inline bool has_db_error() const; + inline void clear_db_error(); + static const int kDbErrorFieldNumber = 2; + inline const ::RDB_PROTO::DBERROR_STRUCT& db_error() const; + inline ::RDB_PROTO::DBERROR_STRUCT* mutable_db_error(); + inline ::RDB_PROTO::DBERROR_STRUCT* release_db_error(); + inline void set_allocated_db_error(::RDB_PROTO::DBERROR_STRUCT* db_error); + + // @@protoc_insertion_point(class_scope:RDB_PROTO.EXEC_MULTI_RESULT) + private: + inline void set_has_is_success(); + inline void clear_has_is_success(); + inline void set_has_db_error(); + inline void clear_has_db_error(); + + ::google::protobuf::UnknownFieldSet _unknown_fields_; + + ::RDB_PROTO::DBERROR_STRUCT* db_error_; + bool is_success_; + + mutable int _cached_size_; + ::google::protobuf::uint32 _has_bits_[(2 + 31) / 32]; + + friend void protobuf_AddDesc_rdb_5fdefine_2eproto(); + friend void protobuf_AssignDesc_rdb_5fdefine_2eproto(); + friend void protobuf_ShutdownFile_rdb_5fdefine_2eproto(); + + void InitAsDefaultInstance(); + static EXEC_MULTI_RESULT* default_instance_; +}; +// ------------------------------------------------------------------- + +class SEQ_EXEC_MULTI_RESULT : public ::google::protobuf::Message { + public: + SEQ_EXEC_MULTI_RESULT(); + virtual ~SEQ_EXEC_MULTI_RESULT(); + + SEQ_EXEC_MULTI_RESULT(const SEQ_EXEC_MULTI_RESULT& from); + + inline SEQ_EXEC_MULTI_RESULT& operator=(const SEQ_EXEC_MULTI_RESULT& from) { + CopyFrom(from); + return *this; + } + + inline const ::google::protobuf::UnknownFieldSet& unknown_fields() const { + return _unknown_fields_; + } + + inline ::google::protobuf::UnknownFieldSet* mutable_unknown_fields() { + return &_unknown_fields_; + } + + static const ::google::protobuf::Descriptor* descriptor(); + static const SEQ_EXEC_MULTI_RESULT& default_instance(); + + void Swap(SEQ_EXEC_MULTI_RESULT* other); + + // implements Message ---------------------------------------------- + + SEQ_EXEC_MULTI_RESULT* New() const; + void CopyFrom(const ::google::protobuf::Message& from); + void MergeFrom(const ::google::protobuf::Message& from); + void CopyFrom(const SEQ_EXEC_MULTI_RESULT& from); + void MergeFrom(const SEQ_EXEC_MULTI_RESULT& from); + void Clear(); + bool IsInitialized() const; + + int ByteSize() const; + bool MergePartialFromCodedStream( + ::google::protobuf::io::CodedInputStream* input); + void SerializeWithCachedSizes( + ::google::protobuf::io::CodedOutputStream* output) const; + ::google::protobuf::uint8* SerializeWithCachedSizesToArray(::google::protobuf::uint8* output) const; + int GetCachedSize() const { return _cached_size_; } + private: + void SharedCtor(); + void SharedDtor(); + void SetCachedSize(int size) const; + public: + + ::google::protobuf::Metadata GetMetadata() const; + + // nested types ---------------------------------------------------- + + // accessors ------------------------------------------------------- + + // repeated .RDB_PROTO.EXEC_MULTI_RESULT vec_exec_multi_result = 1; + inline int vec_exec_multi_result_size() const; + inline void clear_vec_exec_multi_result(); + static const int kVecExecMultiResultFieldNumber = 1; + inline const ::RDB_PROTO::EXEC_MULTI_RESULT& vec_exec_multi_result(int index) const; + inline ::RDB_PROTO::EXEC_MULTI_RESULT* mutable_vec_exec_multi_result(int index); + inline ::RDB_PROTO::EXEC_MULTI_RESULT* add_vec_exec_multi_result(); + inline const ::google::protobuf::RepeatedPtrField< ::RDB_PROTO::EXEC_MULTI_RESULT >& + vec_exec_multi_result() const; + inline ::google::protobuf::RepeatedPtrField< ::RDB_PROTO::EXEC_MULTI_RESULT >* + mutable_vec_exec_multi_result(); + + // @@protoc_insertion_point(class_scope:RDB_PROTO.SEQ_EXEC_MULTI_RESULT) + private: + + ::google::protobuf::UnknownFieldSet _unknown_fields_; + + ::google::protobuf::RepeatedPtrField< ::RDB_PROTO::EXEC_MULTI_RESULT > vec_exec_multi_result_; + + mutable int _cached_size_; + ::google::protobuf::uint32 _has_bits_[(1 + 31) / 32]; + + friend void protobuf_AddDesc_rdb_5fdefine_2eproto(); + friend void protobuf_AssignDesc_rdb_5fdefine_2eproto(); + friend void protobuf_ShutdownFile_rdb_5fdefine_2eproto(); + + void InitAsDefaultInstance(); + static SEQ_EXEC_MULTI_RESULT* default_instance_; +}; +// ------------------------------------------------------------------- + +class BIND_PARA : public ::google::protobuf::Message { + public: + BIND_PARA(); + virtual ~BIND_PARA(); + + BIND_PARA(const BIND_PARA& from); + + inline BIND_PARA& operator=(const BIND_PARA& from) { + CopyFrom(from); + return *this; + } + + inline const ::google::protobuf::UnknownFieldSet& unknown_fields() const { + return _unknown_fields_; + } + + inline ::google::protobuf::UnknownFieldSet* mutable_unknown_fields() { + return &_unknown_fields_; + } + + static const ::google::protobuf::Descriptor* descriptor(); + static const BIND_PARA& default_instance(); + + void Swap(BIND_PARA* other); + + // implements Message ---------------------------------------------- + + BIND_PARA* New() const; + void CopyFrom(const ::google::protobuf::Message& from); + void MergeFrom(const ::google::protobuf::Message& from); + void CopyFrom(const BIND_PARA& from); + void MergeFrom(const BIND_PARA& from); + void Clear(); + bool IsInitialized() const; + + int ByteSize() const; + bool MergePartialFromCodedStream( + ::google::protobuf::io::CodedInputStream* input); + void SerializeWithCachedSizes( + ::google::protobuf::io::CodedOutputStream* output) const; + ::google::protobuf::uint8* SerializeWithCachedSizesToArray(::google::protobuf::uint8* output) const; + int GetCachedSize() const { return _cached_size_; } + private: + void SharedCtor(); + void SharedDtor(); + void SetCachedSize(int size) const; + public: + + ::google::protobuf::Metadata GetMetadata() const; + + // nested types ---------------------------------------------------- + + // accessors ------------------------------------------------------- + + // required uint32 dci_type = 1; + inline bool has_dci_type() const; + inline void clear_dci_type(); + static const int kDciTypeFieldNumber = 1; + inline ::google::protobuf::uint32 dci_type() const; + inline void set_dci_type(::google::protobuf::uint32 value); + + // required int32 data_size = 2; + inline bool has_data_size() const; + inline void clear_data_size(); + static const int kDataSizeFieldNumber = 2; + inline ::google::protobuf::int32 data_size() const; + inline void set_data_size(::google::protobuf::int32 value); + + // @@protoc_insertion_point(class_scope:RDB_PROTO.BIND_PARA) + private: + inline void set_has_dci_type(); + inline void clear_has_dci_type(); + inline void set_has_data_size(); + inline void clear_has_data_size(); + + ::google::protobuf::UnknownFieldSet _unknown_fields_; + + ::google::protobuf::uint32 dci_type_; + ::google::protobuf::int32 data_size_; + + mutable int _cached_size_; + ::google::protobuf::uint32 _has_bits_[(2 + 31) / 32]; + + friend void protobuf_AddDesc_rdb_5fdefine_2eproto(); + friend void protobuf_AssignDesc_rdb_5fdefine_2eproto(); + friend void protobuf_ShutdownFile_rdb_5fdefine_2eproto(); + + void InitAsDefaultInstance(); + static BIND_PARA* default_instance_; +}; +// ------------------------------------------------------------------- + +class SEQ_BIND_PARA : public ::google::protobuf::Message { + public: + SEQ_BIND_PARA(); + virtual ~SEQ_BIND_PARA(); + + SEQ_BIND_PARA(const SEQ_BIND_PARA& from); + + inline SEQ_BIND_PARA& operator=(const SEQ_BIND_PARA& from) { + CopyFrom(from); + return *this; + } + + inline const ::google::protobuf::UnknownFieldSet& unknown_fields() const { + return _unknown_fields_; + } + + inline ::google::protobuf::UnknownFieldSet* mutable_unknown_fields() { + return &_unknown_fields_; + } + + static const ::google::protobuf::Descriptor* descriptor(); + static const SEQ_BIND_PARA& default_instance(); + + void Swap(SEQ_BIND_PARA* other); + + // implements Message ---------------------------------------------- + + SEQ_BIND_PARA* New() const; + void CopyFrom(const ::google::protobuf::Message& from); + void MergeFrom(const ::google::protobuf::Message& from); + void CopyFrom(const SEQ_BIND_PARA& from); + void MergeFrom(const SEQ_BIND_PARA& from); + void Clear(); + bool IsInitialized() const; + + int ByteSize() const; + bool MergePartialFromCodedStream( + ::google::protobuf::io::CodedInputStream* input); + void SerializeWithCachedSizes( + ::google::protobuf::io::CodedOutputStream* output) const; + ::google::protobuf::uint8* SerializeWithCachedSizesToArray(::google::protobuf::uint8* output) const; + int GetCachedSize() const { return _cached_size_; } + private: + void SharedCtor(); + void SharedDtor(); + void SetCachedSize(int size) const; + public: + + ::google::protobuf::Metadata GetMetadata() const; + + // nested types ---------------------------------------------------- + + // accessors ------------------------------------------------------- + + // repeated .RDB_PROTO.BIND_PARA vec_bind_para = 1; + inline int vec_bind_para_size() const; + inline void clear_vec_bind_para(); + static const int kVecBindParaFieldNumber = 1; + inline const ::RDB_PROTO::BIND_PARA& vec_bind_para(int index) const; + inline ::RDB_PROTO::BIND_PARA* mutable_vec_bind_para(int index); + inline ::RDB_PROTO::BIND_PARA* add_vec_bind_para(); + inline const ::google::protobuf::RepeatedPtrField< ::RDB_PROTO::BIND_PARA >& + vec_bind_para() const; + inline ::google::protobuf::RepeatedPtrField< ::RDB_PROTO::BIND_PARA >* + mutable_vec_bind_para(); + + // @@protoc_insertion_point(class_scope:RDB_PROTO.SEQ_BIND_PARA) + private: + + ::google::protobuf::UnknownFieldSet _unknown_fields_; + + ::google::protobuf::RepeatedPtrField< ::RDB_PROTO::BIND_PARA > vec_bind_para_; + + mutable int _cached_size_; + ::google::protobuf::uint32 _has_bits_[(1 + 31) / 32]; + + friend void protobuf_AddDesc_rdb_5fdefine_2eproto(); + friend void protobuf_AssignDesc_rdb_5fdefine_2eproto(); + friend void protobuf_ShutdownFile_rdb_5fdefine_2eproto(); + + void InitAsDefaultInstance(); + static SEQ_BIND_PARA* default_instance_; +}; +// =================================================================== + + +// =================================================================== + +// SEQ_STRING + +// repeated bytes vec_string = 1; +inline int SEQ_STRING::vec_string_size() const { + return vec_string_.size(); +} +inline void SEQ_STRING::clear_vec_string() { + vec_string_.Clear(); +} +inline const ::std::string& SEQ_STRING::vec_string(int index) const { + return vec_string_.Get(index); +} +inline ::std::string* SEQ_STRING::mutable_vec_string(int index) { + return vec_string_.Mutable(index); +} +inline void SEQ_STRING::set_vec_string(int index, const ::std::string& value) { + vec_string_.Mutable(index)->assign(value); +} +inline void SEQ_STRING::set_vec_string(int index, const char* value) { + vec_string_.Mutable(index)->assign(value); +} +inline void SEQ_STRING::set_vec_string(int index, const void* value, size_t size) { + vec_string_.Mutable(index)->assign( + reinterpret_cast(value), size); +} +inline ::std::string* SEQ_STRING::add_vec_string() { + return vec_string_.Add(); +} +inline void SEQ_STRING::add_vec_string(const ::std::string& value) { + vec_string_.Add()->assign(value); +} +inline void SEQ_STRING::add_vec_string(const char* value) { + vec_string_.Add()->assign(value); +} +inline void SEQ_STRING::add_vec_string(const void* value, size_t size) { + vec_string_.Add()->assign(reinterpret_cast(value), size); +} +inline const ::google::protobuf::RepeatedPtrField< ::std::string>& +SEQ_STRING::vec_string() const { + return vec_string_; +} +inline ::google::protobuf::RepeatedPtrField< ::std::string>* +SEQ_STRING::mutable_vec_string() { + return &vec_string_; +} + +// ------------------------------------------------------------------- + +// SEQ_CHAR + +// optional bytes vec_char = 1; +inline bool SEQ_CHAR::has_vec_char() const { + return (_has_bits_[0] & 0x00000001u) != 0; +} +inline void SEQ_CHAR::set_has_vec_char() { + _has_bits_[0] |= 0x00000001u; +} +inline void SEQ_CHAR::clear_has_vec_char() { + _has_bits_[0] &= ~0x00000001u; +} +inline void SEQ_CHAR::clear_vec_char() { + if (vec_char_ != &::google::protobuf::internal::kEmptyString) { + vec_char_->clear(); + } + clear_has_vec_char(); +} +inline const ::std::string& SEQ_CHAR::vec_char() const { + return *vec_char_; +} +inline void SEQ_CHAR::set_vec_char(const ::std::string& value) { + set_has_vec_char(); + if (vec_char_ == &::google::protobuf::internal::kEmptyString) { + vec_char_ = new ::std::string; + } + vec_char_->assign(value); +} +inline void SEQ_CHAR::set_vec_char(const char* value) { + set_has_vec_char(); + if (vec_char_ == &::google::protobuf::internal::kEmptyString) { + vec_char_ = new ::std::string; + } + vec_char_->assign(value); +} +inline void SEQ_CHAR::set_vec_char(const void* value, size_t size) { + set_has_vec_char(); + if (vec_char_ == &::google::protobuf::internal::kEmptyString) { + vec_char_ = new ::std::string; + } + vec_char_->assign(reinterpret_cast(value), size); +} +inline ::std::string* SEQ_CHAR::mutable_vec_char() { + set_has_vec_char(); + if (vec_char_ == &::google::protobuf::internal::kEmptyString) { + vec_char_ = new ::std::string; + } + return vec_char_; +} +inline ::std::string* SEQ_CHAR::release_vec_char() { + clear_has_vec_char(); + if (vec_char_ == &::google::protobuf::internal::kEmptyString) { + return NULL; + } else { + ::std::string* temp = vec_char_; + vec_char_ = const_cast< ::std::string*>(&::google::protobuf::internal::kEmptyString); + return temp; + } +} +inline void SEQ_CHAR::set_allocated_vec_char(::std::string* vec_char) { + if (vec_char_ != &::google::protobuf::internal::kEmptyString) { + delete vec_char_; + } + if (vec_char) { + set_has_vec_char(); + vec_char_ = vec_char; + } else { + clear_has_vec_char(); + vec_char_ = const_cast< ::std::string*>(&::google::protobuf::internal::kEmptyString); + } +} + +// ------------------------------------------------------------------- + +// SEQ_FLOAT + +// repeated float vec_float = 1; +inline int SEQ_FLOAT::vec_float_size() const { + return vec_float_.size(); +} +inline void SEQ_FLOAT::clear_vec_float() { + vec_float_.Clear(); +} +inline float SEQ_FLOAT::vec_float(int index) const { + return vec_float_.Get(index); +} +inline void SEQ_FLOAT::set_vec_float(int index, float value) { + vec_float_.Set(index, value); +} +inline void SEQ_FLOAT::add_vec_float(float value) { + vec_float_.Add(value); +} +inline const ::google::protobuf::RepeatedField< float >& +SEQ_FLOAT::vec_float() const { + return vec_float_; +} +inline ::google::protobuf::RepeatedField< float >* +SEQ_FLOAT::mutable_vec_float() { + return &vec_float_; +} + +// ------------------------------------------------------------------- + +// SEQ_INT + +// repeated int32 vec_int = 1; +inline int SEQ_INT::vec_int_size() const { + return vec_int_.size(); +} +inline void SEQ_INT::clear_vec_int() { + vec_int_.Clear(); +} +inline ::google::protobuf::int32 SEQ_INT::vec_int(int index) const { + return vec_int_.Get(index); +} +inline void SEQ_INT::set_vec_int(int index, ::google::protobuf::int32 value) { + vec_int_.Set(index, value); +} +inline void SEQ_INT::add_vec_int(::google::protobuf::int32 value) { + vec_int_.Add(value); +} +inline const ::google::protobuf::RepeatedField< ::google::protobuf::int32 >& +SEQ_INT::vec_int() const { + return vec_int_; +} +inline ::google::protobuf::RepeatedField< ::google::protobuf::int32 >* +SEQ_INT::mutable_vec_int() { + return &vec_int_; +} + +// ------------------------------------------------------------------- + +// SEQ_LONG + +// repeated int64 vec_long = 1; +inline int SEQ_LONG::vec_long_size() const { + return vec_long_.size(); +} +inline void SEQ_LONG::clear_vec_long() { + vec_long_.Clear(); +} +inline ::google::protobuf::int64 SEQ_LONG::vec_long(int index) const { + return vec_long_.Get(index); +} +inline void SEQ_LONG::set_vec_long(int index, ::google::protobuf::int64 value) { + vec_long_.Set(index, value); +} +inline void SEQ_LONG::add_vec_long(::google::protobuf::int64 value) { + vec_long_.Add(value); +} +inline const ::google::protobuf::RepeatedField< ::google::protobuf::int64 >& +SEQ_LONG::vec_long() const { + return vec_long_; +} +inline ::google::protobuf::RepeatedField< ::google::protobuf::int64 >* +SEQ_LONG::mutable_vec_long() { + return &vec_long_; +} + +// ------------------------------------------------------------------- + +// APPKEYID_STRUCT + +// optional int32 app_id = 1; +inline bool APPKEYID_STRUCT::has_app_id() const { + return (_has_bits_[0] & 0x00000001u) != 0; +} +inline void APPKEYID_STRUCT::set_has_app_id() { + _has_bits_[0] |= 0x00000001u; +} +inline void APPKEYID_STRUCT::clear_has_app_id() { + _has_bits_[0] &= ~0x00000001u; +} +inline void APPKEYID_STRUCT::clear_app_id() { + app_id_ = 0; + clear_has_app_id(); +} +inline ::google::protobuf::int32 APPKEYID_STRUCT::app_id() const { + return app_id_; +} +inline void APPKEYID_STRUCT::set_app_id(::google::protobuf::int32 value) { + set_has_app_id(); + app_id_ = value; +} + +// optional int64 key_id = 2; +inline bool APPKEYID_STRUCT::has_key_id() const { + return (_has_bits_[0] & 0x00000002u) != 0; +} +inline void APPKEYID_STRUCT::set_has_key_id() { + _has_bits_[0] |= 0x00000002u; +} +inline void APPKEYID_STRUCT::clear_has_key_id() { + _has_bits_[0] &= ~0x00000002u; +} +inline void APPKEYID_STRUCT::clear_key_id() { + key_id_ = GOOGLE_LONGLONG(0); + clear_has_key_id(); +} +inline ::google::protobuf::int64 APPKEYID_STRUCT::key_id() const { + return key_id_; +} +inline void APPKEYID_STRUCT::set_key_id(::google::protobuf::int64 value) { + set_has_key_id(); + key_id_ = value; +} + +// ------------------------------------------------------------------- + +// APPID_STRUCT + +// optional int32 app_id = 1; +inline bool APPID_STRUCT::has_app_id() const { + return (_has_bits_[0] & 0x00000001u) != 0; +} +inline void APPID_STRUCT::set_has_app_id() { + _has_bits_[0] |= 0x00000001u; +} +inline void APPID_STRUCT::clear_has_app_id() { + _has_bits_[0] &= ~0x00000001u; +} +inline void APPID_STRUCT::clear_app_id() { + app_id_ = 0; + clear_has_app_id(); +} +inline ::google::protobuf::int32 APPID_STRUCT::app_id() const { + return app_id_; +} +inline void APPID_STRUCT::set_app_id(::google::protobuf::int32 value) { + set_has_app_id(); + app_id_ = value; +} + +// optional int64 key_id = 2; +inline bool APPID_STRUCT::has_key_id() const { + return (_has_bits_[0] & 0x00000002u) != 0; +} +inline void APPID_STRUCT::set_has_key_id() { + _has_bits_[0] |= 0x00000002u; +} +inline void APPID_STRUCT::clear_has_key_id() { + _has_bits_[0] &= ~0x00000002u; +} +inline void APPID_STRUCT::clear_key_id() { + key_id_ = GOOGLE_LONGLONG(0); + clear_has_key_id(); +} +inline ::google::protobuf::int64 APPID_STRUCT::key_id() const { + return key_id_; +} +inline void APPID_STRUCT::set_key_id(::google::protobuf::int64 value) { + set_has_key_id(); + key_id_ = value; +} + +// ------------------------------------------------------------------- + +// RTDBKEY_STRUCT + +// optional sint64 table_column_id = 1; +inline bool RTDBKEY_STRUCT::has_table_column_id() const { + return (_has_bits_[0] & 0x00000001u) != 0; +} +inline void RTDBKEY_STRUCT::set_has_table_column_id() { + _has_bits_[0] |= 0x00000001u; +} +inline void RTDBKEY_STRUCT::clear_has_table_column_id() { + _has_bits_[0] &= ~0x00000001u; +} +inline void RTDBKEY_STRUCT::clear_table_column_id() { + table_column_id_ = GOOGLE_LONGLONG(0); + clear_has_table_column_id(); +} +inline ::google::protobuf::int64 RTDBKEY_STRUCT::table_column_id() const { + return table_column_id_; +} +inline void RTDBKEY_STRUCT::set_table_column_id(::google::protobuf::int64 value) { + set_has_table_column_id(); + table_column_id_ = value; +} + +// optional sint64 region_record_id = 2; +inline bool RTDBKEY_STRUCT::has_region_record_id() const { + return (_has_bits_[0] & 0x00000002u) != 0; +} +inline void RTDBKEY_STRUCT::set_has_region_record_id() { + _has_bits_[0] |= 0x00000002u; +} +inline void RTDBKEY_STRUCT::clear_has_region_record_id() { + _has_bits_[0] &= ~0x00000002u; +} +inline void RTDBKEY_STRUCT::clear_region_record_id() { + region_record_id_ = GOOGLE_LONGLONG(0); + clear_has_region_record_id(); +} +inline ::google::protobuf::int64 RTDBKEY_STRUCT::region_record_id() const { + return region_record_id_; +} +inline void RTDBKEY_STRUCT::set_region_record_id(::google::protobuf::int64 value) { + set_has_region_record_id(); + region_record_id_ = value; +} + +// ------------------------------------------------------------------- + +// APPRTDBKDY_STRUCT + +// optional int32 app_id = 1; +inline bool APPRTDBKDY_STRUCT::has_app_id() const { + return (_has_bits_[0] & 0x00000001u) != 0; +} +inline void APPRTDBKDY_STRUCT::set_has_app_id() { + _has_bits_[0] |= 0x00000001u; +} +inline void APPRTDBKDY_STRUCT::clear_has_app_id() { + _has_bits_[0] &= ~0x00000001u; +} +inline void APPRTDBKDY_STRUCT::clear_app_id() { + app_id_ = 0; + clear_has_app_id(); +} +inline ::google::protobuf::int32 APPRTDBKDY_STRUCT::app_id() const { + return app_id_; +} +inline void APPRTDBKDY_STRUCT::set_app_id(::google::protobuf::int32 value) { + set_has_app_id(); + app_id_ = value; +} + +// optional .RDB_PROTO.RTDBKEY_STRUCT key_id = 2; +inline bool APPRTDBKDY_STRUCT::has_key_id() const { + return (_has_bits_[0] & 0x00000002u) != 0; +} +inline void APPRTDBKDY_STRUCT::set_has_key_id() { + _has_bits_[0] |= 0x00000002u; +} +inline void APPRTDBKDY_STRUCT::clear_has_key_id() { + _has_bits_[0] &= ~0x00000002u; +} +inline void APPRTDBKDY_STRUCT::clear_key_id() { + if (key_id_ != NULL) key_id_->::RDB_PROTO::RTDBKEY_STRUCT::Clear(); + clear_has_key_id(); +} +inline const ::RDB_PROTO::RTDBKEY_STRUCT& APPRTDBKDY_STRUCT::key_id() const { + return key_id_ != NULL ? *key_id_ : *default_instance_->key_id_; +} +inline ::RDB_PROTO::RTDBKEY_STRUCT* APPRTDBKDY_STRUCT::mutable_key_id() { + set_has_key_id(); + if (key_id_ == NULL) key_id_ = new ::RDB_PROTO::RTDBKEY_STRUCT; + return key_id_; +} +inline ::RDB_PROTO::RTDBKEY_STRUCT* APPRTDBKDY_STRUCT::release_key_id() { + clear_has_key_id(); + ::RDB_PROTO::RTDBKEY_STRUCT* temp = key_id_; + key_id_ = NULL; + return temp; +} +inline void APPRTDBKDY_STRUCT::set_allocated_key_id(::RDB_PROTO::RTDBKEY_STRUCT* key_id) { + delete key_id_; + key_id_ = key_id; + if (key_id) { + set_has_key_id(); + } else { + clear_has_key_id(); + } +} + +// ------------------------------------------------------------------- + +// UNION_DATA_VALUE + +// optional int32 type = 1; +inline bool UNION_DATA_VALUE::has_type() const { + return (_has_bits_[0] & 0x00000001u) != 0; +} +inline void UNION_DATA_VALUE::set_has_type() { + _has_bits_[0] |= 0x00000001u; +} +inline void UNION_DATA_VALUE::clear_has_type() { + _has_bits_[0] &= ~0x00000001u; +} +inline void UNION_DATA_VALUE::clear_type() { + type_ = 0; + clear_has_type(); +} +inline ::google::protobuf::int32 UNION_DATA_VALUE::type() const { + return type_; +} +inline void UNION_DATA_VALUE::set_type(::google::protobuf::int32 value) { + set_has_type(); + type_ = value; +} + +// optional bytes c_string = 2; +inline bool UNION_DATA_VALUE::has_c_string() const { + return (_has_bits_[0] & 0x00000002u) != 0; +} +inline void UNION_DATA_VALUE::set_has_c_string() { + _has_bits_[0] |= 0x00000002u; +} +inline void UNION_DATA_VALUE::clear_has_c_string() { + _has_bits_[0] &= ~0x00000002u; +} +inline void UNION_DATA_VALUE::clear_c_string() { + if (c_string_ != &::google::protobuf::internal::kEmptyString) { + c_string_->clear(); + } + clear_has_c_string(); +} +inline const ::std::string& UNION_DATA_VALUE::c_string() const { + return *c_string_; +} +inline void UNION_DATA_VALUE::set_c_string(const ::std::string& value) { + set_has_c_string(); + if (c_string_ == &::google::protobuf::internal::kEmptyString) { + c_string_ = new ::std::string; + } + c_string_->assign(value); +} +inline void UNION_DATA_VALUE::set_c_string(const char* value) { + set_has_c_string(); + if (c_string_ == &::google::protobuf::internal::kEmptyString) { + c_string_ = new ::std::string; + } + c_string_->assign(value); +} +inline void UNION_DATA_VALUE::set_c_string(const void* value, size_t size) { + set_has_c_string(); + if (c_string_ == &::google::protobuf::internal::kEmptyString) { + c_string_ = new ::std::string; + } + c_string_->assign(reinterpret_cast(value), size); +} +inline ::std::string* UNION_DATA_VALUE::mutable_c_string() { + set_has_c_string(); + if (c_string_ == &::google::protobuf::internal::kEmptyString) { + c_string_ = new ::std::string; + } + return c_string_; +} +inline ::std::string* UNION_DATA_VALUE::release_c_string() { + clear_has_c_string(); + if (c_string_ == &::google::protobuf::internal::kEmptyString) { + return NULL; + } else { + ::std::string* temp = c_string_; + c_string_ = const_cast< ::std::string*>(&::google::protobuf::internal::kEmptyString); + return temp; + } +} +inline void UNION_DATA_VALUE::set_allocated_c_string(::std::string* c_string) { + if (c_string_ != &::google::protobuf::internal::kEmptyString) { + delete c_string_; + } + if (c_string) { + set_has_c_string(); + c_string_ = c_string; + } else { + clear_has_c_string(); + c_string_ = const_cast< ::std::string*>(&::google::protobuf::internal::kEmptyString); + } +} + +// optional uint32 c_uchar = 3; +inline bool UNION_DATA_VALUE::has_c_uchar() const { + return (_has_bits_[0] & 0x00000004u) != 0; +} +inline void UNION_DATA_VALUE::set_has_c_uchar() { + _has_bits_[0] |= 0x00000004u; +} +inline void UNION_DATA_VALUE::clear_has_c_uchar() { + _has_bits_[0] &= ~0x00000004u; +} +inline void UNION_DATA_VALUE::clear_c_uchar() { + c_uchar_ = 0u; + clear_has_c_uchar(); +} +inline ::google::protobuf::uint32 UNION_DATA_VALUE::c_uchar() const { + return c_uchar_; +} +inline void UNION_DATA_VALUE::set_c_uchar(::google::protobuf::uint32 value) { + set_has_c_uchar(); + c_uchar_ = value; +} + +// optional int32 c_short = 4; +inline bool UNION_DATA_VALUE::has_c_short() const { + return (_has_bits_[0] & 0x00000008u) != 0; +} +inline void UNION_DATA_VALUE::set_has_c_short() { + _has_bits_[0] |= 0x00000008u; +} +inline void UNION_DATA_VALUE::clear_has_c_short() { + _has_bits_[0] &= ~0x00000008u; +} +inline void UNION_DATA_VALUE::clear_c_short() { + c_short_ = 0; + clear_has_c_short(); +} +inline ::google::protobuf::int32 UNION_DATA_VALUE::c_short() const { + return c_short_; +} +inline void UNION_DATA_VALUE::set_c_short(::google::protobuf::int32 value) { + set_has_c_short(); + c_short_ = value; +} + +// optional int32 c_int = 5; +inline bool UNION_DATA_VALUE::has_c_int() const { + return (_has_bits_[0] & 0x00000010u) != 0; +} +inline void UNION_DATA_VALUE::set_has_c_int() { + _has_bits_[0] |= 0x00000010u; +} +inline void UNION_DATA_VALUE::clear_has_c_int() { + _has_bits_[0] &= ~0x00000010u; +} +inline void UNION_DATA_VALUE::clear_c_int() { + c_int_ = 0; + clear_has_c_int(); +} +inline ::google::protobuf::int32 UNION_DATA_VALUE::c_int() const { + return c_int_; +} +inline void UNION_DATA_VALUE::set_c_int(::google::protobuf::int32 value) { + set_has_c_int(); + c_int_ = value; +} + +// optional int64 c_time = 6; +inline bool UNION_DATA_VALUE::has_c_time() const { + return (_has_bits_[0] & 0x00000020u) != 0; +} +inline void UNION_DATA_VALUE::set_has_c_time() { + _has_bits_[0] |= 0x00000020u; +} +inline void UNION_DATA_VALUE::clear_has_c_time() { + _has_bits_[0] &= ~0x00000020u; +} +inline void UNION_DATA_VALUE::clear_c_time() { + c_time_ = GOOGLE_LONGLONG(0); + clear_has_c_time(); +} +inline ::google::protobuf::int64 UNION_DATA_VALUE::c_time() const { + return c_time_; +} +inline void UNION_DATA_VALUE::set_c_time(::google::protobuf::int64 value) { + set_has_c_time(); + c_time_ = value; +} + +// optional float c_float = 7; +inline bool UNION_DATA_VALUE::has_c_float() const { + return (_has_bits_[0] & 0x00000040u) != 0; +} +inline void UNION_DATA_VALUE::set_has_c_float() { + _has_bits_[0] |= 0x00000040u; +} +inline void UNION_DATA_VALUE::clear_has_c_float() { + _has_bits_[0] &= ~0x00000040u; +} +inline void UNION_DATA_VALUE::clear_c_float() { + c_float_ = 0; + clear_has_c_float(); +} +inline float UNION_DATA_VALUE::c_float() const { + return c_float_; +} +inline void UNION_DATA_VALUE::set_c_float(float value) { + set_has_c_float(); + c_float_ = value; +} + +// optional double c_double = 8; +inline bool UNION_DATA_VALUE::has_c_double() const { + return (_has_bits_[0] & 0x00000080u) != 0; +} +inline void UNION_DATA_VALUE::set_has_c_double() { + _has_bits_[0] |= 0x00000080u; +} +inline void UNION_DATA_VALUE::clear_has_c_double() { + _has_bits_[0] &= ~0x00000080u; +} +inline void UNION_DATA_VALUE::clear_c_double() { + c_double_ = 0; + clear_has_c_double(); +} +inline double UNION_DATA_VALUE::c_double() const { + return c_double_; +} +inline void UNION_DATA_VALUE::set_c_double(double value) { + set_has_c_double(); + c_double_ = value; +} + +// optional int64 c_keyid = 9; +inline bool UNION_DATA_VALUE::has_c_keyid() const { + return (_has_bits_[0] & 0x00000100u) != 0; +} +inline void UNION_DATA_VALUE::set_has_c_keyid() { + _has_bits_[0] |= 0x00000100u; +} +inline void UNION_DATA_VALUE::clear_has_c_keyid() { + _has_bits_[0] &= ~0x00000100u; +} +inline void UNION_DATA_VALUE::clear_c_keyid() { + c_keyid_ = GOOGLE_LONGLONG(0); + clear_has_c_keyid(); +} +inline ::google::protobuf::int64 UNION_DATA_VALUE::c_keyid() const { + return c_keyid_; +} +inline void UNION_DATA_VALUE::set_c_keyid(::google::protobuf::int64 value) { + set_has_c_keyid(); + c_keyid_ = value; +} + +// optional .RDB_PROTO.SEQ_CHAR c_binary = 10; +inline bool UNION_DATA_VALUE::has_c_binary() const { + return (_has_bits_[0] & 0x00000200u) != 0; +} +inline void UNION_DATA_VALUE::set_has_c_binary() { + _has_bits_[0] |= 0x00000200u; +} +inline void UNION_DATA_VALUE::clear_has_c_binary() { + _has_bits_[0] &= ~0x00000200u; +} +inline void UNION_DATA_VALUE::clear_c_binary() { + if (c_binary_ != NULL) c_binary_->::RDB_PROTO::SEQ_CHAR::Clear(); + clear_has_c_binary(); +} +inline const ::RDB_PROTO::SEQ_CHAR& UNION_DATA_VALUE::c_binary() const { + return c_binary_ != NULL ? *c_binary_ : *default_instance_->c_binary_; +} +inline ::RDB_PROTO::SEQ_CHAR* UNION_DATA_VALUE::mutable_c_binary() { + set_has_c_binary(); + if (c_binary_ == NULL) c_binary_ = new ::RDB_PROTO::SEQ_CHAR; + return c_binary_; +} +inline ::RDB_PROTO::SEQ_CHAR* UNION_DATA_VALUE::release_c_binary() { + clear_has_c_binary(); + ::RDB_PROTO::SEQ_CHAR* temp = c_binary_; + c_binary_ = NULL; + return temp; +} +inline void UNION_DATA_VALUE::set_allocated_c_binary(::RDB_PROTO::SEQ_CHAR* c_binary) { + delete c_binary_; + c_binary_ = c_binary; + if (c_binary) { + set_has_c_binary(); + } else { + clear_has_c_binary(); + } +} + +// optional .RDB_PROTO.SEQ_CHAR c_text = 11; +inline bool UNION_DATA_VALUE::has_c_text() const { + return (_has_bits_[0] & 0x00000400u) != 0; +} +inline void UNION_DATA_VALUE::set_has_c_text() { + _has_bits_[0] |= 0x00000400u; +} +inline void UNION_DATA_VALUE::clear_has_c_text() { + _has_bits_[0] &= ~0x00000400u; +} +inline void UNION_DATA_VALUE::clear_c_text() { + if (c_text_ != NULL) c_text_->::RDB_PROTO::SEQ_CHAR::Clear(); + clear_has_c_text(); +} +inline const ::RDB_PROTO::SEQ_CHAR& UNION_DATA_VALUE::c_text() const { + return c_text_ != NULL ? *c_text_ : *default_instance_->c_text_; +} +inline ::RDB_PROTO::SEQ_CHAR* UNION_DATA_VALUE::mutable_c_text() { + set_has_c_text(); + if (c_text_ == NULL) c_text_ = new ::RDB_PROTO::SEQ_CHAR; + return c_text_; +} +inline ::RDB_PROTO::SEQ_CHAR* UNION_DATA_VALUE::release_c_text() { + clear_has_c_text(); + ::RDB_PROTO::SEQ_CHAR* temp = c_text_; + c_text_ = NULL; + return temp; +} +inline void UNION_DATA_VALUE::set_allocated_c_text(::RDB_PROTO::SEQ_CHAR* c_text) { + delete c_text_; + c_text_ = c_text; + if (c_text) { + set_has_c_text(); + } else { + clear_has_c_text(); + } +} + +// optional .RDB_PROTO.SEQ_CHAR c_image = 12; +inline bool UNION_DATA_VALUE::has_c_image() const { + return (_has_bits_[0] & 0x00000800u) != 0; +} +inline void UNION_DATA_VALUE::set_has_c_image() { + _has_bits_[0] |= 0x00000800u; +} +inline void UNION_DATA_VALUE::clear_has_c_image() { + _has_bits_[0] &= ~0x00000800u; +} +inline void UNION_DATA_VALUE::clear_c_image() { + if (c_image_ != NULL) c_image_->::RDB_PROTO::SEQ_CHAR::Clear(); + clear_has_c_image(); +} +inline const ::RDB_PROTO::SEQ_CHAR& UNION_DATA_VALUE::c_image() const { + return c_image_ != NULL ? *c_image_ : *default_instance_->c_image_; +} +inline ::RDB_PROTO::SEQ_CHAR* UNION_DATA_VALUE::mutable_c_image() { + set_has_c_image(); + if (c_image_ == NULL) c_image_ = new ::RDB_PROTO::SEQ_CHAR; + return c_image_; +} +inline ::RDB_PROTO::SEQ_CHAR* UNION_DATA_VALUE::release_c_image() { + clear_has_c_image(); + ::RDB_PROTO::SEQ_CHAR* temp = c_image_; + c_image_ = NULL; + return temp; +} +inline void UNION_DATA_VALUE::set_allocated_c_image(::RDB_PROTO::SEQ_CHAR* c_image) { + delete c_image_; + c_image_ = c_image; + if (c_image) { + set_has_c_image(); + } else { + clear_has_c_image(); + } +} + +// optional .RDB_PROTO.APPKEYID_STRUCT c_appkeyid = 13; +inline bool UNION_DATA_VALUE::has_c_appkeyid() const { + return (_has_bits_[0] & 0x00001000u) != 0; +} +inline void UNION_DATA_VALUE::set_has_c_appkeyid() { + _has_bits_[0] |= 0x00001000u; +} +inline void UNION_DATA_VALUE::clear_has_c_appkeyid() { + _has_bits_[0] &= ~0x00001000u; +} +inline void UNION_DATA_VALUE::clear_c_appkeyid() { + if (c_appkeyid_ != NULL) c_appkeyid_->::RDB_PROTO::APPKEYID_STRUCT::Clear(); + clear_has_c_appkeyid(); +} +inline const ::RDB_PROTO::APPKEYID_STRUCT& UNION_DATA_VALUE::c_appkeyid() const { + return c_appkeyid_ != NULL ? *c_appkeyid_ : *default_instance_->c_appkeyid_; +} +inline ::RDB_PROTO::APPKEYID_STRUCT* UNION_DATA_VALUE::mutable_c_appkeyid() { + set_has_c_appkeyid(); + if (c_appkeyid_ == NULL) c_appkeyid_ = new ::RDB_PROTO::APPKEYID_STRUCT; + return c_appkeyid_; +} +inline ::RDB_PROTO::APPKEYID_STRUCT* UNION_DATA_VALUE::release_c_appkeyid() { + clear_has_c_appkeyid(); + ::RDB_PROTO::APPKEYID_STRUCT* temp = c_appkeyid_; + c_appkeyid_ = NULL; + return temp; +} +inline void UNION_DATA_VALUE::set_allocated_c_appkeyid(::RDB_PROTO::APPKEYID_STRUCT* c_appkeyid) { + delete c_appkeyid_; + c_appkeyid_ = c_appkeyid; + if (c_appkeyid) { + set_has_c_appkeyid(); + } else { + clear_has_c_appkeyid(); + } +} + +// optional .RDB_PROTO.APPID_STRUCT c_appid = 14; +inline bool UNION_DATA_VALUE::has_c_appid() const { + return (_has_bits_[0] & 0x00002000u) != 0; +} +inline void UNION_DATA_VALUE::set_has_c_appid() { + _has_bits_[0] |= 0x00002000u; +} +inline void UNION_DATA_VALUE::clear_has_c_appid() { + _has_bits_[0] &= ~0x00002000u; +} +inline void UNION_DATA_VALUE::clear_c_appid() { + if (c_appid_ != NULL) c_appid_->::RDB_PROTO::APPID_STRUCT::Clear(); + clear_has_c_appid(); +} +inline const ::RDB_PROTO::APPID_STRUCT& UNION_DATA_VALUE::c_appid() const { + return c_appid_ != NULL ? *c_appid_ : *default_instance_->c_appid_; +} +inline ::RDB_PROTO::APPID_STRUCT* UNION_DATA_VALUE::mutable_c_appid() { + set_has_c_appid(); + if (c_appid_ == NULL) c_appid_ = new ::RDB_PROTO::APPID_STRUCT; + return c_appid_; +} +inline ::RDB_PROTO::APPID_STRUCT* UNION_DATA_VALUE::release_c_appid() { + clear_has_c_appid(); + ::RDB_PROTO::APPID_STRUCT* temp = c_appid_; + c_appid_ = NULL; + return temp; +} +inline void UNION_DATA_VALUE::set_allocated_c_appid(::RDB_PROTO::APPID_STRUCT* c_appid) { + delete c_appid_; + c_appid_ = c_appid; + if (c_appid) { + set_has_c_appid(); + } else { + clear_has_c_appid(); + } +} + +// optional bytes c_default = 15; +inline bool UNION_DATA_VALUE::has_c_default() const { + return (_has_bits_[0] & 0x00004000u) != 0; +} +inline void UNION_DATA_VALUE::set_has_c_default() { + _has_bits_[0] |= 0x00004000u; +} +inline void UNION_DATA_VALUE::clear_has_c_default() { + _has_bits_[0] &= ~0x00004000u; +} +inline void UNION_DATA_VALUE::clear_c_default() { + if (c_default_ != &::google::protobuf::internal::kEmptyString) { + c_default_->clear(); + } + clear_has_c_default(); +} +inline const ::std::string& UNION_DATA_VALUE::c_default() const { + return *c_default_; +} +inline void UNION_DATA_VALUE::set_c_default(const ::std::string& value) { + set_has_c_default(); + if (c_default_ == &::google::protobuf::internal::kEmptyString) { + c_default_ = new ::std::string; + } + c_default_->assign(value); +} +inline void UNION_DATA_VALUE::set_c_default(const char* value) { + set_has_c_default(); + if (c_default_ == &::google::protobuf::internal::kEmptyString) { + c_default_ = new ::std::string; + } + c_default_->assign(value); +} +inline void UNION_DATA_VALUE::set_c_default(const void* value, size_t size) { + set_has_c_default(); + if (c_default_ == &::google::protobuf::internal::kEmptyString) { + c_default_ = new ::std::string; + } + c_default_->assign(reinterpret_cast(value), size); +} +inline ::std::string* UNION_DATA_VALUE::mutable_c_default() { + set_has_c_default(); + if (c_default_ == &::google::protobuf::internal::kEmptyString) { + c_default_ = new ::std::string; + } + return c_default_; +} +inline ::std::string* UNION_DATA_VALUE::release_c_default() { + clear_has_c_default(); + if (c_default_ == &::google::protobuf::internal::kEmptyString) { + return NULL; + } else { + ::std::string* temp = c_default_; + c_default_ = const_cast< ::std::string*>(&::google::protobuf::internal::kEmptyString); + return temp; + } +} +inline void UNION_DATA_VALUE::set_allocated_c_default(::std::string* c_default) { + if (c_default_ != &::google::protobuf::internal::kEmptyString) { + delete c_default_; + } + if (c_default) { + set_has_c_default(); + c_default_ = c_default; + } else { + clear_has_c_default(); + c_default_ = const_cast< ::std::string*>(&::google::protobuf::internal::kEmptyString); + } +} + +// optional uint32 c_uint = 16; +inline bool UNION_DATA_VALUE::has_c_uint() const { + return (_has_bits_[0] & 0x00008000u) != 0; +} +inline void UNION_DATA_VALUE::set_has_c_uint() { + _has_bits_[0] |= 0x00008000u; +} +inline void UNION_DATA_VALUE::clear_has_c_uint() { + _has_bits_[0] &= ~0x00008000u; +} +inline void UNION_DATA_VALUE::clear_c_uint() { + c_uint_ = 0u; + clear_has_c_uint(); +} +inline ::google::protobuf::uint32 UNION_DATA_VALUE::c_uint() const { + return c_uint_; +} +inline void UNION_DATA_VALUE::set_c_uint(::google::protobuf::uint32 value) { + set_has_c_uint(); + c_uint_ = value; +} + +// optional int64 c_long = 17; +inline bool UNION_DATA_VALUE::has_c_long() const { + return (_has_bits_[0] & 0x00010000u) != 0; +} +inline void UNION_DATA_VALUE::set_has_c_long() { + _has_bits_[0] |= 0x00010000u; +} +inline void UNION_DATA_VALUE::clear_has_c_long() { + _has_bits_[0] &= ~0x00010000u; +} +inline void UNION_DATA_VALUE::clear_c_long() { + c_long_ = GOOGLE_LONGLONG(0); + clear_has_c_long(); +} +inline ::google::protobuf::int64 UNION_DATA_VALUE::c_long() const { + return c_long_; +} +inline void UNION_DATA_VALUE::set_c_long(::google::protobuf::int64 value) { + set_has_c_long(); + c_long_ = value; +} + +// optional .RDB_PROTO.RTDBKEY_STRUCT c_rtdbkeyid = 18; +inline bool UNION_DATA_VALUE::has_c_rtdbkeyid() const { + return (_has_bits_[0] & 0x00020000u) != 0; +} +inline void UNION_DATA_VALUE::set_has_c_rtdbkeyid() { + _has_bits_[0] |= 0x00020000u; +} +inline void UNION_DATA_VALUE::clear_has_c_rtdbkeyid() { + _has_bits_[0] &= ~0x00020000u; +} +inline void UNION_DATA_VALUE::clear_c_rtdbkeyid() { + if (c_rtdbkeyid_ != NULL) c_rtdbkeyid_->::RDB_PROTO::RTDBKEY_STRUCT::Clear(); + clear_has_c_rtdbkeyid(); +} +inline const ::RDB_PROTO::RTDBKEY_STRUCT& UNION_DATA_VALUE::c_rtdbkeyid() const { + return c_rtdbkeyid_ != NULL ? *c_rtdbkeyid_ : *default_instance_->c_rtdbkeyid_; +} +inline ::RDB_PROTO::RTDBKEY_STRUCT* UNION_DATA_VALUE::mutable_c_rtdbkeyid() { + set_has_c_rtdbkeyid(); + if (c_rtdbkeyid_ == NULL) c_rtdbkeyid_ = new ::RDB_PROTO::RTDBKEY_STRUCT; + return c_rtdbkeyid_; +} +inline ::RDB_PROTO::RTDBKEY_STRUCT* UNION_DATA_VALUE::release_c_rtdbkeyid() { + clear_has_c_rtdbkeyid(); + ::RDB_PROTO::RTDBKEY_STRUCT* temp = c_rtdbkeyid_; + c_rtdbkeyid_ = NULL; + return temp; +} +inline void UNION_DATA_VALUE::set_allocated_c_rtdbkeyid(::RDB_PROTO::RTDBKEY_STRUCT* c_rtdbkeyid) { + delete c_rtdbkeyid_; + c_rtdbkeyid_ = c_rtdbkeyid; + if (c_rtdbkeyid) { + set_has_c_rtdbkeyid(); + } else { + clear_has_c_rtdbkeyid(); + } +} + +// optional .RDB_PROTO.RTDBKEY_STRUCT c_measrtdbkeyid = 19; +inline bool UNION_DATA_VALUE::has_c_measrtdbkeyid() const { + return (_has_bits_[0] & 0x00040000u) != 0; +} +inline void UNION_DATA_VALUE::set_has_c_measrtdbkeyid() { + _has_bits_[0] |= 0x00040000u; +} +inline void UNION_DATA_VALUE::clear_has_c_measrtdbkeyid() { + _has_bits_[0] &= ~0x00040000u; +} +inline void UNION_DATA_VALUE::clear_c_measrtdbkeyid() { + if (c_measrtdbkeyid_ != NULL) c_measrtdbkeyid_->::RDB_PROTO::RTDBKEY_STRUCT::Clear(); + clear_has_c_measrtdbkeyid(); +} +inline const ::RDB_PROTO::RTDBKEY_STRUCT& UNION_DATA_VALUE::c_measrtdbkeyid() const { + return c_measrtdbkeyid_ != NULL ? *c_measrtdbkeyid_ : *default_instance_->c_measrtdbkeyid_; +} +inline ::RDB_PROTO::RTDBKEY_STRUCT* UNION_DATA_VALUE::mutable_c_measrtdbkeyid() { + set_has_c_measrtdbkeyid(); + if (c_measrtdbkeyid_ == NULL) c_measrtdbkeyid_ = new ::RDB_PROTO::RTDBKEY_STRUCT; + return c_measrtdbkeyid_; +} +inline ::RDB_PROTO::RTDBKEY_STRUCT* UNION_DATA_VALUE::release_c_measrtdbkeyid() { + clear_has_c_measrtdbkeyid(); + ::RDB_PROTO::RTDBKEY_STRUCT* temp = c_measrtdbkeyid_; + c_measrtdbkeyid_ = NULL; + return temp; +} +inline void UNION_DATA_VALUE::set_allocated_c_measrtdbkeyid(::RDB_PROTO::RTDBKEY_STRUCT* c_measrtdbkeyid) { + delete c_measrtdbkeyid_; + c_measrtdbkeyid_ = c_measrtdbkeyid; + if (c_measrtdbkeyid) { + set_has_c_measrtdbkeyid(); + } else { + clear_has_c_measrtdbkeyid(); + } +} + +// optional .RDB_PROTO.APPRTDBKDY_STRUCT c_apprtdbkey = 20; +inline bool UNION_DATA_VALUE::has_c_apprtdbkey() const { + return (_has_bits_[0] & 0x00080000u) != 0; +} +inline void UNION_DATA_VALUE::set_has_c_apprtdbkey() { + _has_bits_[0] |= 0x00080000u; +} +inline void UNION_DATA_VALUE::clear_has_c_apprtdbkey() { + _has_bits_[0] &= ~0x00080000u; +} +inline void UNION_DATA_VALUE::clear_c_apprtdbkey() { + if (c_apprtdbkey_ != NULL) c_apprtdbkey_->::RDB_PROTO::APPRTDBKDY_STRUCT::Clear(); + clear_has_c_apprtdbkey(); +} +inline const ::RDB_PROTO::APPRTDBKDY_STRUCT& UNION_DATA_VALUE::c_apprtdbkey() const { + return c_apprtdbkey_ != NULL ? *c_apprtdbkey_ : *default_instance_->c_apprtdbkey_; +} +inline ::RDB_PROTO::APPRTDBKDY_STRUCT* UNION_DATA_VALUE::mutable_c_apprtdbkey() { + set_has_c_apprtdbkey(); + if (c_apprtdbkey_ == NULL) c_apprtdbkey_ = new ::RDB_PROTO::APPRTDBKDY_STRUCT; + return c_apprtdbkey_; +} +inline ::RDB_PROTO::APPRTDBKDY_STRUCT* UNION_DATA_VALUE::release_c_apprtdbkey() { + clear_has_c_apprtdbkey(); + ::RDB_PROTO::APPRTDBKDY_STRUCT* temp = c_apprtdbkey_; + c_apprtdbkey_ = NULL; + return temp; +} +inline void UNION_DATA_VALUE::set_allocated_c_apprtdbkey(::RDB_PROTO::APPRTDBKDY_STRUCT* c_apprtdbkey) { + delete c_apprtdbkey_; + c_apprtdbkey_ = c_apprtdbkey; + if (c_apprtdbkey) { + set_has_c_apprtdbkey(); + } else { + clear_has_c_apprtdbkey(); + } +} + +// ------------------------------------------------------------------- + +// SEQ_DATA_VALUE + +// repeated .RDB_PROTO.UNION_DATA_VALUE vec_data = 1; +inline int SEQ_DATA_VALUE::vec_data_size() const { + return vec_data_.size(); +} +inline void SEQ_DATA_VALUE::clear_vec_data() { + vec_data_.Clear(); +} +inline const ::RDB_PROTO::UNION_DATA_VALUE& SEQ_DATA_VALUE::vec_data(int index) const { + return vec_data_.Get(index); +} +inline ::RDB_PROTO::UNION_DATA_VALUE* SEQ_DATA_VALUE::mutable_vec_data(int index) { + return vec_data_.Mutable(index); +} +inline ::RDB_PROTO::UNION_DATA_VALUE* SEQ_DATA_VALUE::add_vec_data() { + return vec_data_.Add(); +} +inline const ::google::protobuf::RepeatedPtrField< ::RDB_PROTO::UNION_DATA_VALUE >& +SEQ_DATA_VALUE::vec_data() const { + return vec_data_; +} +inline ::google::protobuf::RepeatedPtrField< ::RDB_PROTO::UNION_DATA_VALUE >* +SEQ_DATA_VALUE::mutable_vec_data() { + return &vec_data_; +} + +// ------------------------------------------------------------------- + +// DBERROR_STRUCT + +// optional uint32 error_no = 1; +inline bool DBERROR_STRUCT::has_error_no() const { + return (_has_bits_[0] & 0x00000001u) != 0; +} +inline void DBERROR_STRUCT::set_has_error_no() { + _has_bits_[0] |= 0x00000001u; +} +inline void DBERROR_STRUCT::clear_has_error_no() { + _has_bits_[0] &= ~0x00000001u; +} +inline void DBERROR_STRUCT::clear_error_no() { + error_no_ = 0u; + clear_has_error_no(); +} +inline ::google::protobuf::uint32 DBERROR_STRUCT::error_no() const { + return error_no_; +} +inline void DBERROR_STRUCT::set_error_no(::google::protobuf::uint32 value) { + set_has_error_no(); + error_no_ = value; +} + +// optional bytes error_msg = 2; +inline bool DBERROR_STRUCT::has_error_msg() const { + return (_has_bits_[0] & 0x00000002u) != 0; +} +inline void DBERROR_STRUCT::set_has_error_msg() { + _has_bits_[0] |= 0x00000002u; +} +inline void DBERROR_STRUCT::clear_has_error_msg() { + _has_bits_[0] &= ~0x00000002u; +} +inline void DBERROR_STRUCT::clear_error_msg() { + if (error_msg_ != &::google::protobuf::internal::kEmptyString) { + error_msg_->clear(); + } + clear_has_error_msg(); +} +inline const ::std::string& DBERROR_STRUCT::error_msg() const { + return *error_msg_; +} +inline void DBERROR_STRUCT::set_error_msg(const ::std::string& value) { + set_has_error_msg(); + if (error_msg_ == &::google::protobuf::internal::kEmptyString) { + error_msg_ = new ::std::string; + } + error_msg_->assign(value); +} +inline void DBERROR_STRUCT::set_error_msg(const char* value) { + set_has_error_msg(); + if (error_msg_ == &::google::protobuf::internal::kEmptyString) { + error_msg_ = new ::std::string; + } + error_msg_->assign(value); +} +inline void DBERROR_STRUCT::set_error_msg(const void* value, size_t size) { + set_has_error_msg(); + if (error_msg_ == &::google::protobuf::internal::kEmptyString) { + error_msg_ = new ::std::string; + } + error_msg_->assign(reinterpret_cast(value), size); +} +inline ::std::string* DBERROR_STRUCT::mutable_error_msg() { + set_has_error_msg(); + if (error_msg_ == &::google::protobuf::internal::kEmptyString) { + error_msg_ = new ::std::string; + } + return error_msg_; +} +inline ::std::string* DBERROR_STRUCT::release_error_msg() { + clear_has_error_msg(); + if (error_msg_ == &::google::protobuf::internal::kEmptyString) { + return NULL; + } else { + ::std::string* temp = error_msg_; + error_msg_ = const_cast< ::std::string*>(&::google::protobuf::internal::kEmptyString); + return temp; + } +} +inline void DBERROR_STRUCT::set_allocated_error_msg(::std::string* error_msg) { + if (error_msg_ != &::google::protobuf::internal::kEmptyString) { + delete error_msg_; + } + if (error_msg) { + set_has_error_msg(); + error_msg_ = error_msg; + } else { + clear_has_error_msg(); + error_msg_ = const_cast< ::std::string*>(&::google::protobuf::internal::kEmptyString); + } +} + +// ------------------------------------------------------------------- + +// SEQ_DBERROR + +// repeated .RDB_PROTO.DBERROR_STRUCT vec_error = 1; +inline int SEQ_DBERROR::vec_error_size() const { + return vec_error_.size(); +} +inline void SEQ_DBERROR::clear_vec_error() { + vec_error_.Clear(); +} +inline const ::RDB_PROTO::DBERROR_STRUCT& SEQ_DBERROR::vec_error(int index) const { + return vec_error_.Get(index); +} +inline ::RDB_PROTO::DBERROR_STRUCT* SEQ_DBERROR::mutable_vec_error(int index) { + return vec_error_.Mutable(index); +} +inline ::RDB_PROTO::DBERROR_STRUCT* SEQ_DBERROR::add_vec_error() { + return vec_error_.Add(); +} +inline const ::google::protobuf::RepeatedPtrField< ::RDB_PROTO::DBERROR_STRUCT >& +SEQ_DBERROR::vec_error() const { + return vec_error_; +} +inline ::google::protobuf::RepeatedPtrField< ::RDB_PROTO::DBERROR_STRUCT >* +SEQ_DBERROR::mutable_vec_error() { + return &vec_error_; +} + +// ------------------------------------------------------------------- + +// RESULT_DATA_VALUE + +// required bool is_null = 1; +inline bool RESULT_DATA_VALUE::has_is_null() const { + return (_has_bits_[0] & 0x00000001u) != 0; +} +inline void RESULT_DATA_VALUE::set_has_is_null() { + _has_bits_[0] |= 0x00000001u; +} +inline void RESULT_DATA_VALUE::clear_has_is_null() { + _has_bits_[0] &= ~0x00000001u; +} +inline void RESULT_DATA_VALUE::clear_is_null() { + is_null_ = false; + clear_has_is_null(); +} +inline bool RESULT_DATA_VALUE::is_null() const { + return is_null_; +} +inline void RESULT_DATA_VALUE::set_is_null(bool value) { + set_has_is_null(); + is_null_ = value; +} + +// required .RDB_PROTO.UNION_DATA_VALUE data_value = 2; +inline bool RESULT_DATA_VALUE::has_data_value() const { + return (_has_bits_[0] & 0x00000002u) != 0; +} +inline void RESULT_DATA_VALUE::set_has_data_value() { + _has_bits_[0] |= 0x00000002u; +} +inline void RESULT_DATA_VALUE::clear_has_data_value() { + _has_bits_[0] &= ~0x00000002u; +} +inline void RESULT_DATA_VALUE::clear_data_value() { + if (data_value_ != NULL) data_value_->::RDB_PROTO::UNION_DATA_VALUE::Clear(); + clear_has_data_value(); +} +inline const ::RDB_PROTO::UNION_DATA_VALUE& RESULT_DATA_VALUE::data_value() const { + return data_value_ != NULL ? *data_value_ : *default_instance_->data_value_; +} +inline ::RDB_PROTO::UNION_DATA_VALUE* RESULT_DATA_VALUE::mutable_data_value() { + set_has_data_value(); + if (data_value_ == NULL) data_value_ = new ::RDB_PROTO::UNION_DATA_VALUE; + return data_value_; +} +inline ::RDB_PROTO::UNION_DATA_VALUE* RESULT_DATA_VALUE::release_data_value() { + clear_has_data_value(); + ::RDB_PROTO::UNION_DATA_VALUE* temp = data_value_; + data_value_ = NULL; + return temp; +} +inline void RESULT_DATA_VALUE::set_allocated_data_value(::RDB_PROTO::UNION_DATA_VALUE* data_value) { + delete data_value_; + data_value_ = data_value; + if (data_value) { + set_has_data_value(); + } else { + clear_has_data_value(); + } +} + +// ------------------------------------------------------------------- + +// SEQ_RESULT_DATA_VALUE + +// repeated .RDB_PROTO.RESULT_DATA_VALUE vec_result_data_value = 1; +inline int SEQ_RESULT_DATA_VALUE::vec_result_data_value_size() const { + return vec_result_data_value_.size(); +} +inline void SEQ_RESULT_DATA_VALUE::clear_vec_result_data_value() { + vec_result_data_value_.Clear(); +} +inline const ::RDB_PROTO::RESULT_DATA_VALUE& SEQ_RESULT_DATA_VALUE::vec_result_data_value(int index) const { + return vec_result_data_value_.Get(index); +} +inline ::RDB_PROTO::RESULT_DATA_VALUE* SEQ_RESULT_DATA_VALUE::mutable_vec_result_data_value(int index) { + return vec_result_data_value_.Mutable(index); +} +inline ::RDB_PROTO::RESULT_DATA_VALUE* SEQ_RESULT_DATA_VALUE::add_vec_result_data_value() { + return vec_result_data_value_.Add(); +} +inline const ::google::protobuf::RepeatedPtrField< ::RDB_PROTO::RESULT_DATA_VALUE >& +SEQ_RESULT_DATA_VALUE::vec_result_data_value() const { + return vec_result_data_value_; +} +inline ::google::protobuf::RepeatedPtrField< ::RDB_PROTO::RESULT_DATA_VALUE >* +SEQ_RESULT_DATA_VALUE::mutable_vec_result_data_value() { + return &vec_result_data_value_; +} + +// ------------------------------------------------------------------- + +// RESULT_FIELD_INFO + +// required int32 data_type = 1; +inline bool RESULT_FIELD_INFO::has_data_type() const { + return (_has_bits_[0] & 0x00000001u) != 0; +} +inline void RESULT_FIELD_INFO::set_has_data_type() { + _has_bits_[0] |= 0x00000001u; +} +inline void RESULT_FIELD_INFO::clear_has_data_type() { + _has_bits_[0] &= ~0x00000001u; +} +inline void RESULT_FIELD_INFO::clear_data_type() { + data_type_ = 0; + clear_has_data_type(); +} +inline ::google::protobuf::int32 RESULT_FIELD_INFO::data_type() const { + return data_type_; +} +inline void RESULT_FIELD_INFO::set_data_type(::google::protobuf::int32 value) { + set_has_data_type(); + data_type_ = value; +} + +// required int32 data_len = 2; +inline bool RESULT_FIELD_INFO::has_data_len() const { + return (_has_bits_[0] & 0x00000002u) != 0; +} +inline void RESULT_FIELD_INFO::set_has_data_len() { + _has_bits_[0] |= 0x00000002u; +} +inline void RESULT_FIELD_INFO::clear_has_data_len() { + _has_bits_[0] &= ~0x00000002u; +} +inline void RESULT_FIELD_INFO::clear_data_len() { + data_len_ = 0; + clear_has_data_len(); +} +inline ::google::protobuf::int32 RESULT_FIELD_INFO::data_len() const { + return data_len_; +} +inline void RESULT_FIELD_INFO::set_data_len(::google::protobuf::int32 value) { + set_has_data_len(); + data_len_ = value; +} + +// required bytes col_name = 3; +inline bool RESULT_FIELD_INFO::has_col_name() const { + return (_has_bits_[0] & 0x00000004u) != 0; +} +inline void RESULT_FIELD_INFO::set_has_col_name() { + _has_bits_[0] |= 0x00000004u; +} +inline void RESULT_FIELD_INFO::clear_has_col_name() { + _has_bits_[0] &= ~0x00000004u; +} +inline void RESULT_FIELD_INFO::clear_col_name() { + if (col_name_ != &::google::protobuf::internal::kEmptyString) { + col_name_->clear(); + } + clear_has_col_name(); +} +inline const ::std::string& RESULT_FIELD_INFO::col_name() const { + return *col_name_; +} +inline void RESULT_FIELD_INFO::set_col_name(const ::std::string& value) { + set_has_col_name(); + if (col_name_ == &::google::protobuf::internal::kEmptyString) { + col_name_ = new ::std::string; + } + col_name_->assign(value); +} +inline void RESULT_FIELD_INFO::set_col_name(const char* value) { + set_has_col_name(); + if (col_name_ == &::google::protobuf::internal::kEmptyString) { + col_name_ = new ::std::string; + } + col_name_->assign(value); +} +inline void RESULT_FIELD_INFO::set_col_name(const void* value, size_t size) { + set_has_col_name(); + if (col_name_ == &::google::protobuf::internal::kEmptyString) { + col_name_ = new ::std::string; + } + col_name_->assign(reinterpret_cast(value), size); +} +inline ::std::string* RESULT_FIELD_INFO::mutable_col_name() { + set_has_col_name(); + if (col_name_ == &::google::protobuf::internal::kEmptyString) { + col_name_ = new ::std::string; + } + return col_name_; +} +inline ::std::string* RESULT_FIELD_INFO::release_col_name() { + clear_has_col_name(); + if (col_name_ == &::google::protobuf::internal::kEmptyString) { + return NULL; + } else { + ::std::string* temp = col_name_; + col_name_ = const_cast< ::std::string*>(&::google::protobuf::internal::kEmptyString); + return temp; + } +} +inline void RESULT_FIELD_INFO::set_allocated_col_name(::std::string* col_name) { + if (col_name_ != &::google::protobuf::internal::kEmptyString) { + delete col_name_; + } + if (col_name) { + set_has_col_name(); + col_name_ = col_name; + } else { + clear_has_col_name(); + col_name_ = const_cast< ::std::string*>(&::google::protobuf::internal::kEmptyString); + } +} + +// ------------------------------------------------------------------- + +// SEQ_RESULT_FIELD_INFO + +// repeated .RDB_PROTO.RESULT_FIELD_INFO vec_result_field_info = 1; +inline int SEQ_RESULT_FIELD_INFO::vec_result_field_info_size() const { + return vec_result_field_info_.size(); +} +inline void SEQ_RESULT_FIELD_INFO::clear_vec_result_field_info() { + vec_result_field_info_.Clear(); +} +inline const ::RDB_PROTO::RESULT_FIELD_INFO& SEQ_RESULT_FIELD_INFO::vec_result_field_info(int index) const { + return vec_result_field_info_.Get(index); +} +inline ::RDB_PROTO::RESULT_FIELD_INFO* SEQ_RESULT_FIELD_INFO::mutable_vec_result_field_info(int index) { + return vec_result_field_info_.Mutable(index); +} +inline ::RDB_PROTO::RESULT_FIELD_INFO* SEQ_RESULT_FIELD_INFO::add_vec_result_field_info() { + return vec_result_field_info_.Add(); +} +inline const ::google::protobuf::RepeatedPtrField< ::RDB_PROTO::RESULT_FIELD_INFO >& +SEQ_RESULT_FIELD_INFO::vec_result_field_info() const { + return vec_result_field_info_; +} +inline ::google::protobuf::RepeatedPtrField< ::RDB_PROTO::RESULT_FIELD_INFO >* +SEQ_RESULT_FIELD_INFO::mutable_vec_result_field_info() { + return &vec_result_field_info_; +} + +// ------------------------------------------------------------------- + +// OUT_DATA_TYPE + +// required int32 out_field_position = 1; +inline bool OUT_DATA_TYPE::has_out_field_position() const { + return (_has_bits_[0] & 0x00000001u) != 0; +} +inline void OUT_DATA_TYPE::set_has_out_field_position() { + _has_bits_[0] |= 0x00000001u; +} +inline void OUT_DATA_TYPE::clear_has_out_field_position() { + _has_bits_[0] &= ~0x00000001u; +} +inline void OUT_DATA_TYPE::clear_out_field_position() { + out_field_position_ = 0; + clear_has_out_field_position(); +} +inline ::google::protobuf::int32 OUT_DATA_TYPE::out_field_position() const { + return out_field_position_; +} +inline void OUT_DATA_TYPE::set_out_field_position(::google::protobuf::int32 value) { + set_has_out_field_position(); + out_field_position_ = value; +} + +// required int32 out_field_datatype = 2; +inline bool OUT_DATA_TYPE::has_out_field_datatype() const { + return (_has_bits_[0] & 0x00000002u) != 0; +} +inline void OUT_DATA_TYPE::set_has_out_field_datatype() { + _has_bits_[0] |= 0x00000002u; +} +inline void OUT_DATA_TYPE::clear_has_out_field_datatype() { + _has_bits_[0] &= ~0x00000002u; +} +inline void OUT_DATA_TYPE::clear_out_field_datatype() { + out_field_datatype_ = 0; + clear_has_out_field_datatype(); +} +inline ::google::protobuf::int32 OUT_DATA_TYPE::out_field_datatype() const { + return out_field_datatype_; +} +inline void OUT_DATA_TYPE::set_out_field_datatype(::google::protobuf::int32 value) { + set_has_out_field_datatype(); + out_field_datatype_ = value; +} + +// ------------------------------------------------------------------- + +// SEQ_OUT_DATA_TYPE + +// repeated .RDB_PROTO.OUT_DATA_TYPE vec_out_data_type = 1; +inline int SEQ_OUT_DATA_TYPE::vec_out_data_type_size() const { + return vec_out_data_type_.size(); +} +inline void SEQ_OUT_DATA_TYPE::clear_vec_out_data_type() { + vec_out_data_type_.Clear(); +} +inline const ::RDB_PROTO::OUT_DATA_TYPE& SEQ_OUT_DATA_TYPE::vec_out_data_type(int index) const { + return vec_out_data_type_.Get(index); +} +inline ::RDB_PROTO::OUT_DATA_TYPE* SEQ_OUT_DATA_TYPE::mutable_vec_out_data_type(int index) { + return vec_out_data_type_.Mutable(index); +} +inline ::RDB_PROTO::OUT_DATA_TYPE* SEQ_OUT_DATA_TYPE::add_vec_out_data_type() { + return vec_out_data_type_.Add(); +} +inline const ::google::protobuf::RepeatedPtrField< ::RDB_PROTO::OUT_DATA_TYPE >& +SEQ_OUT_DATA_TYPE::vec_out_data_type() const { + return vec_out_data_type_; +} +inline ::google::protobuf::RepeatedPtrField< ::RDB_PROTO::OUT_DATA_TYPE >* +SEQ_OUT_DATA_TYPE::mutable_vec_out_data_type() { + return &vec_out_data_type_; +} + +// ------------------------------------------------------------------- + +// SELECT_RESULT + +// required int32 field_num = 1; +inline bool SELECT_RESULT::has_field_num() const { + return (_has_bits_[0] & 0x00000001u) != 0; +} +inline void SELECT_RESULT::set_has_field_num() { + _has_bits_[0] |= 0x00000001u; +} +inline void SELECT_RESULT::clear_has_field_num() { + _has_bits_[0] &= ~0x00000001u; +} +inline void SELECT_RESULT::clear_field_num() { + field_num_ = 0; + clear_has_field_num(); +} +inline ::google::protobuf::int32 SELECT_RESULT::field_num() const { + return field_num_; +} +inline void SELECT_RESULT::set_field_num(::google::protobuf::int32 value) { + set_has_field_num(); + field_num_ = value; +} + +// required .RDB_PROTO.SEQ_RESULT_FIELD_INFO field_info = 2; +inline bool SELECT_RESULT::has_field_info() const { + return (_has_bits_[0] & 0x00000002u) != 0; +} +inline void SELECT_RESULT::set_has_field_info() { + _has_bits_[0] |= 0x00000002u; +} +inline void SELECT_RESULT::clear_has_field_info() { + _has_bits_[0] &= ~0x00000002u; +} +inline void SELECT_RESULT::clear_field_info() { + if (field_info_ != NULL) field_info_->::RDB_PROTO::SEQ_RESULT_FIELD_INFO::Clear(); + clear_has_field_info(); +} +inline const ::RDB_PROTO::SEQ_RESULT_FIELD_INFO& SELECT_RESULT::field_info() const { + return field_info_ != NULL ? *field_info_ : *default_instance_->field_info_; +} +inline ::RDB_PROTO::SEQ_RESULT_FIELD_INFO* SELECT_RESULT::mutable_field_info() { + set_has_field_info(); + if (field_info_ == NULL) field_info_ = new ::RDB_PROTO::SEQ_RESULT_FIELD_INFO; + return field_info_; +} +inline ::RDB_PROTO::SEQ_RESULT_FIELD_INFO* SELECT_RESULT::release_field_info() { + clear_has_field_info(); + ::RDB_PROTO::SEQ_RESULT_FIELD_INFO* temp = field_info_; + field_info_ = NULL; + return temp; +} +inline void SELECT_RESULT::set_allocated_field_info(::RDB_PROTO::SEQ_RESULT_FIELD_INFO* field_info) { + delete field_info_; + field_info_ = field_info; + if (field_info) { + set_has_field_info(); + } else { + clear_has_field_info(); + } +} + +// required uint32 data_num = 3; +inline bool SELECT_RESULT::has_data_num() const { + return (_has_bits_[0] & 0x00000004u) != 0; +} +inline void SELECT_RESULT::set_has_data_num() { + _has_bits_[0] |= 0x00000004u; +} +inline void SELECT_RESULT::clear_has_data_num() { + _has_bits_[0] &= ~0x00000004u; +} +inline void SELECT_RESULT::clear_data_num() { + data_num_ = 0u; + clear_has_data_num(); +} +inline ::google::protobuf::uint32 SELECT_RESULT::data_num() const { + return data_num_; +} +inline void SELECT_RESULT::set_data_num(::google::protobuf::uint32 value) { + set_has_data_num(); + data_num_ = value; +} + +// required .RDB_PROTO.SEQ_RESULT_DATA_VALUE data_value_seq = 4; +inline bool SELECT_RESULT::has_data_value_seq() const { + return (_has_bits_[0] & 0x00000008u) != 0; +} +inline void SELECT_RESULT::set_has_data_value_seq() { + _has_bits_[0] |= 0x00000008u; +} +inline void SELECT_RESULT::clear_has_data_value_seq() { + _has_bits_[0] &= ~0x00000008u; +} +inline void SELECT_RESULT::clear_data_value_seq() { + if (data_value_seq_ != NULL) data_value_seq_->::RDB_PROTO::SEQ_RESULT_DATA_VALUE::Clear(); + clear_has_data_value_seq(); +} +inline const ::RDB_PROTO::SEQ_RESULT_DATA_VALUE& SELECT_RESULT::data_value_seq() const { + return data_value_seq_ != NULL ? *data_value_seq_ : *default_instance_->data_value_seq_; +} +inline ::RDB_PROTO::SEQ_RESULT_DATA_VALUE* SELECT_RESULT::mutable_data_value_seq() { + set_has_data_value_seq(); + if (data_value_seq_ == NULL) data_value_seq_ = new ::RDB_PROTO::SEQ_RESULT_DATA_VALUE; + return data_value_seq_; +} +inline ::RDB_PROTO::SEQ_RESULT_DATA_VALUE* SELECT_RESULT::release_data_value_seq() { + clear_has_data_value_seq(); + ::RDB_PROTO::SEQ_RESULT_DATA_VALUE* temp = data_value_seq_; + data_value_seq_ = NULL; + return temp; +} +inline void SELECT_RESULT::set_allocated_data_value_seq(::RDB_PROTO::SEQ_RESULT_DATA_VALUE* data_value_seq) { + delete data_value_seq_; + data_value_seq_ = data_value_seq; + if (data_value_seq) { + set_has_data_value_seq(); + } else { + clear_has_data_value_seq(); + } +} + +// ------------------------------------------------------------------- + +// EXEC_MULTI_RESULT + +// required bool is_success = 1; +inline bool EXEC_MULTI_RESULT::has_is_success() const { + return (_has_bits_[0] & 0x00000001u) != 0; +} +inline void EXEC_MULTI_RESULT::set_has_is_success() { + _has_bits_[0] |= 0x00000001u; +} +inline void EXEC_MULTI_RESULT::clear_has_is_success() { + _has_bits_[0] &= ~0x00000001u; +} +inline void EXEC_MULTI_RESULT::clear_is_success() { + is_success_ = false; + clear_has_is_success(); +} +inline bool EXEC_MULTI_RESULT::is_success() const { + return is_success_; +} +inline void EXEC_MULTI_RESULT::set_is_success(bool value) { + set_has_is_success(); + is_success_ = value; +} + +// required .RDB_PROTO.DBERROR_STRUCT db_error = 2; +inline bool EXEC_MULTI_RESULT::has_db_error() const { + return (_has_bits_[0] & 0x00000002u) != 0; +} +inline void EXEC_MULTI_RESULT::set_has_db_error() { + _has_bits_[0] |= 0x00000002u; +} +inline void EXEC_MULTI_RESULT::clear_has_db_error() { + _has_bits_[0] &= ~0x00000002u; +} +inline void EXEC_MULTI_RESULT::clear_db_error() { + if (db_error_ != NULL) db_error_->::RDB_PROTO::DBERROR_STRUCT::Clear(); + clear_has_db_error(); +} +inline const ::RDB_PROTO::DBERROR_STRUCT& EXEC_MULTI_RESULT::db_error() const { + return db_error_ != NULL ? *db_error_ : *default_instance_->db_error_; +} +inline ::RDB_PROTO::DBERROR_STRUCT* EXEC_MULTI_RESULT::mutable_db_error() { + set_has_db_error(); + if (db_error_ == NULL) db_error_ = new ::RDB_PROTO::DBERROR_STRUCT; + return db_error_; +} +inline ::RDB_PROTO::DBERROR_STRUCT* EXEC_MULTI_RESULT::release_db_error() { + clear_has_db_error(); + ::RDB_PROTO::DBERROR_STRUCT* temp = db_error_; + db_error_ = NULL; + return temp; +} +inline void EXEC_MULTI_RESULT::set_allocated_db_error(::RDB_PROTO::DBERROR_STRUCT* db_error) { + delete db_error_; + db_error_ = db_error; + if (db_error) { + set_has_db_error(); + } else { + clear_has_db_error(); + } +} + +// ------------------------------------------------------------------- + +// SEQ_EXEC_MULTI_RESULT + +// repeated .RDB_PROTO.EXEC_MULTI_RESULT vec_exec_multi_result = 1; +inline int SEQ_EXEC_MULTI_RESULT::vec_exec_multi_result_size() const { + return vec_exec_multi_result_.size(); +} +inline void SEQ_EXEC_MULTI_RESULT::clear_vec_exec_multi_result() { + vec_exec_multi_result_.Clear(); +} +inline const ::RDB_PROTO::EXEC_MULTI_RESULT& SEQ_EXEC_MULTI_RESULT::vec_exec_multi_result(int index) const { + return vec_exec_multi_result_.Get(index); +} +inline ::RDB_PROTO::EXEC_MULTI_RESULT* SEQ_EXEC_MULTI_RESULT::mutable_vec_exec_multi_result(int index) { + return vec_exec_multi_result_.Mutable(index); +} +inline ::RDB_PROTO::EXEC_MULTI_RESULT* SEQ_EXEC_MULTI_RESULT::add_vec_exec_multi_result() { + return vec_exec_multi_result_.Add(); +} +inline const ::google::protobuf::RepeatedPtrField< ::RDB_PROTO::EXEC_MULTI_RESULT >& +SEQ_EXEC_MULTI_RESULT::vec_exec_multi_result() const { + return vec_exec_multi_result_; +} +inline ::google::protobuf::RepeatedPtrField< ::RDB_PROTO::EXEC_MULTI_RESULT >* +SEQ_EXEC_MULTI_RESULT::mutable_vec_exec_multi_result() { + return &vec_exec_multi_result_; +} + +// ------------------------------------------------------------------- + +// BIND_PARA + +// required uint32 dci_type = 1; +inline bool BIND_PARA::has_dci_type() const { + return (_has_bits_[0] & 0x00000001u) != 0; +} +inline void BIND_PARA::set_has_dci_type() { + _has_bits_[0] |= 0x00000001u; +} +inline void BIND_PARA::clear_has_dci_type() { + _has_bits_[0] &= ~0x00000001u; +} +inline void BIND_PARA::clear_dci_type() { + dci_type_ = 0u; + clear_has_dci_type(); +} +inline ::google::protobuf::uint32 BIND_PARA::dci_type() const { + return dci_type_; +} +inline void BIND_PARA::set_dci_type(::google::protobuf::uint32 value) { + set_has_dci_type(); + dci_type_ = value; +} + +// required int32 data_size = 2; +inline bool BIND_PARA::has_data_size() const { + return (_has_bits_[0] & 0x00000002u) != 0; +} +inline void BIND_PARA::set_has_data_size() { + _has_bits_[0] |= 0x00000002u; +} +inline void BIND_PARA::clear_has_data_size() { + _has_bits_[0] &= ~0x00000002u; +} +inline void BIND_PARA::clear_data_size() { + data_size_ = 0; + clear_has_data_size(); +} +inline ::google::protobuf::int32 BIND_PARA::data_size() const { + return data_size_; +} +inline void BIND_PARA::set_data_size(::google::protobuf::int32 value) { + set_has_data_size(); + data_size_ = value; +} + +// ------------------------------------------------------------------- + +// SEQ_BIND_PARA + +// repeated .RDB_PROTO.BIND_PARA vec_bind_para = 1; +inline int SEQ_BIND_PARA::vec_bind_para_size() const { + return vec_bind_para_.size(); +} +inline void SEQ_BIND_PARA::clear_vec_bind_para() { + vec_bind_para_.Clear(); +} +inline const ::RDB_PROTO::BIND_PARA& SEQ_BIND_PARA::vec_bind_para(int index) const { + return vec_bind_para_.Get(index); +} +inline ::RDB_PROTO::BIND_PARA* SEQ_BIND_PARA::mutable_vec_bind_para(int index) { + return vec_bind_para_.Mutable(index); +} +inline ::RDB_PROTO::BIND_PARA* SEQ_BIND_PARA::add_vec_bind_para() { + return vec_bind_para_.Add(); +} +inline const ::google::protobuf::RepeatedPtrField< ::RDB_PROTO::BIND_PARA >& +SEQ_BIND_PARA::vec_bind_para() const { + return vec_bind_para_; +} +inline ::google::protobuf::RepeatedPtrField< ::RDB_PROTO::BIND_PARA >* +SEQ_BIND_PARA::mutable_vec_bind_para() { + return &vec_bind_para_; +} + + +// @@protoc_insertion_point(namespace_scope) + +} // namespace RDB_PROTO + +#ifndef SWIG +namespace google { +namespace protobuf { + +template <> +inline const EnumDescriptor* GetEnumDescriptor< ::RDB_PROTO::DB_BYTE_T>() { + return ::RDB_PROTO::DB_BYTE_T_descriptor(); +} + +} // namespace google +} // namespace protobuf +#endif // SWIG + +// @@protoc_insertion_point(global_scope) + +#endif // PROTOBUF_rdb_5fdefine_2eproto__INCLUDED diff --git a/code/sys_nicmonitor/include/db_com/read.h b/code/sys_nicmonitor/include/db_com/read.h new file mode 100644 index 0000000..2988aa4 --- /dev/null +++ b/code/sys_nicmonitor/include/db_com/read.h @@ -0,0 +1,111 @@ +/* + * Copyright (c) 2009-2011, Salvatore Sanfilippo + * Copyright (c) 2010-2011, Pieter Noordhuis + * + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * * Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * * Neither the name of Redis nor the names of its contributors may be used + * to endorse or promote products derived from this software without + * specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + + +#ifndef __HIREDIS_READ_H +#define __HIREDIS_READ_H +#include /* for size_t */ + +#define REDIS_ERR -1 +#define REDIS_OK 0 + +/* When an error occurs, the err flag in a context is set to hold the type of + * error that occurred. REDIS_ERR_IO means there was an I/O error and you + * should use the "errno" variable to find out what is wrong. + * For other values, the "errstr" field will hold a description. */ +#define REDIS_ERR_IO 1 /* Error in read or write */ +#define REDIS_ERR_EOF 3 /* End of file */ +#define REDIS_ERR_PROTOCOL 4 /* Protocol error */ +#define REDIS_ERR_OOM 5 /* Out of memory */ +#define REDIS_ERR_OTHER 2 /* Everything else... */ + +#define REDIS_REPLY_STRING 1 +#define REDIS_REPLY_ARRAY 2 +#define REDIS_REPLY_INTEGER 3 +#define REDIS_REPLY_NIL 4 +#define REDIS_REPLY_STATUS 5 +#define REDIS_REPLY_ERROR 6 + +#define REDIS_READER_MAX_BUF (1024*16) /* Default max unused reader buffer. */ + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct redisReadTask { + int type; + int elements; /* number of elements in multibulk container */ + int idx; /* index in parent (array) object */ + void *obj; /* holds user-generated value for a read task */ + struct redisReadTask *parent; /* parent task */ + void *privdata; /* user-settable arbitrary field */ +} redisReadTask; + +typedef struct redisReplyObjectFunctions { + void *(*createString)(const redisReadTask*, char*, size_t); + void *(*createArray)(const redisReadTask*, int); + void *(*createInteger)(const redisReadTask*, long long); + void *(*createNil)(const redisReadTask*); + void (*freeObject)(void*); +} redisReplyObjectFunctions; + +typedef struct redisReader { + int err; /* Error flags, 0 when there is no error */ + char errstr[128]; /* String representation of error when applicable */ + + char *buf; /* Read buffer */ + size_t pos; /* Buffer cursor */ + size_t len; /* Buffer length */ + size_t maxbuf; /* Max length of unused buffer */ + + redisReadTask rstack[9]; + int ridx; /* Index of current read task */ + void *reply; /* Temporary reply pointer */ + + redisReplyObjectFunctions *fn; + void *privdata; +} redisReader; + +/* Public API for the protocol parser. */ +redisReader *redisReaderCreateWithFunctions(redisReplyObjectFunctions *fn); +void redisReaderFree(redisReader *r); +int redisReaderFeed(redisReader *r, const char *buf, size_t len); +int redisReaderGetReply(redisReader *r, void **reply); + +#define redisReaderSetPrivdata(_r, _p) (int)(((redisReader*)(_r))->privdata = (_p)) +#define redisReaderGetObject(_r) (((redisReader*)(_r))->reply) +#define redisReaderGetError(_r) (((redisReader*)(_r))->errstr) + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/code/sys_nicmonitor/include/db_com/rtdbkey_defs.h b/code/sys_nicmonitor/include/db_com/rtdbkey_defs.h new file mode 100644 index 0000000..f72f3a8 --- /dev/null +++ b/code/sys_nicmonitor/include/db_com/rtdbkey_defs.h @@ -0,0 +1,52 @@ +/* + * rtdbkey_defs.h + * + * Created on: 2018-6-23 + * Author: lihao + */ + +#ifndef RTDBKEY_DEFS_H_ +#define RTDBKEY_DEFS_H_ + +#include "common_types.h" + +//ϵݿvarchar +const cmnInt32 RTDBKEY_LEN_IN_DB = 20; +const cmnInt32 MEASRTDBKEY_LEN_IN_DB = 30; +const cmnInt32 APPRTDBKEY_LEN_IN_DB = 40; + +//RTDBKEYͶӦԭʼÿַ +const cmnInt32 RTDBKEY_LEN_10 = 10; +const cmnInt32 RTDBKEY_LEN_14 = 14; +const cmnInt32 RTDBKEY_LEN_18 = 18; +const cmnInt32 RTDBKEY_LEN_20 = 20; + +const cmnInt32 COLUMN_ID_LEN = 4; +const cmnInt32 COLUMN_ID_OFFSET = 10000; + +//IDÿַ +//ÿɷʽ: +//RTDBKEY + "_" + COLUMN_ID_LEN +const cmnInt32 MEASRTDBKEY_LEN_15 = 15; +const cmnInt32 MEASRTDBKEY_LEN_19 = 19; +const cmnInt32 MEASRTDBKEY_LEN_23 = 23; +const cmnInt32 MEASRTDBKEY_LEN_25 = 25; + +const cmnInt32 APP_ID_LEN = 10; + +//ӦתIDÿַ +//ÿɷʽ: +//RTDBKEY + "_" + COLUMN_ID_LEN + "_" + APP_ID_LEN +const cmnInt32 APPRTDBKEY_LEN_26 = 26; +const cmnInt32 APPRTDBKEY_LEN_30 = 30; +const cmnInt32 APPRTDBKEY_LEN_34 = 34; +const cmnInt32 APPRTDBKEY_LEN_36 = 36; + +const cmnInt32 SG_MODEL_TABLE_NO_MAX = 9999; +const cmnInt32 RTDB_MODEL_TABLE_NO_MIN = 100000; +const cmnInt32 RTDB_MODEL_TABLE_NO_MAX = 999999; +const cmnInt32 SG_MODEL_TABLE_NO_LENGTH = 4; //ͨýṹģͱIDʹ4λ +const cmnInt32 RTDB_MODEL_TABLE_NO_LENGTH = 6; //չŴ100000ʼ,6λ +const cmnInt32 REGION_NO_LENGTH = 6; //ų + +#endif /* RTDBKEY_DEFS_H_ */ diff --git a/code/sys_nicmonitor/include/db_com/sample_data_client_base.h b/code/sys_nicmonitor/include/db_com/sample_data_client_base.h new file mode 100644 index 0000000..c7b513d --- /dev/null +++ b/code/sys_nicmonitor/include/db_com/sample_data_client_base.h @@ -0,0 +1,68 @@ +//****************************************************************** +// +// AUTHOR : ZhaoTiger +// +// FUNCTION : SAMPLE_DATA_SERVER ̵Ŀͻ๫ඨ +// +// TIME : 2003.12.16 +// +// HISTORY : +// Datetime Action Author Reason +// ------------------------------------------------------------------- +// 2003.12.16 Creation ZhaoTiger +// +//****************************************************************** + +#ifndef __SAMPLE_DATA_CLIENT_BASE_H__ +#define __SAMPLE_DATA_CLIENT_BASE_H__ + +#include "sample_data_m.h" + +#include +#include +#include +#include +#include "servicesclient.h" +#include +#include "system.h" + +class sample_data_client_base +{ + public: + + sample_data_client_base(int port); + sample_data_client_base(int port, int seconds); + sample_data_client_base(); + ~sample_data_client_base(); + void SetRequestTimeout(int seconds); + + //õĽӿںӣIDLӳͷļж + short SampleFutureData(const TFutSmpDataInPara& futsmp_in_para, + TFutSmpDataOutPara & futsmp_out_para);//1 + short BatchSampleFutureData(const TBatchFutSmpDataInPara& batchfutsmp_in_para);//2 + + //add for remote access + int SetDomainInfo(const DomainInfo& domain_info); //ԶϢͨã + int SetDomainInfo(const char* domain_name, const tSecLabel& sec_label, const int app_no = AP_DATA_SRV, const int ctx_no = AC_REALTIME_NO); + int SetDomainName(const char* domain_name); // + int SetSecLabel(tSecLabel& sec_label); //ñǩ + void ClearDomainName(); //m_DomainNameΪlocal_domain + + private: + + DomainInfo m_DomainInfo; + ServiceInfo m_Serviceinfo; + char m_IpAddress[64]; + int m_Port; + Handle m_Handle; + char m_HostName[64]; + int m_RequestTimeoutSeconds; + + int GetHostByAppNo(char* host_name, const int app_no, const short context_no); + int SetServiceHost(); +}; + +#endif + + + diff --git a/code/sys_nicmonitor/include/db_com/sample_data_m.h b/code/sys_nicmonitor/include/db_com/sample_data_m.h new file mode 100644 index 0000000..9a0cfa5 --- /dev/null +++ b/code/sys_nicmonitor/include/db_com/sample_data_m.h @@ -0,0 +1,99 @@ +//************************************** +// Generated by mcpp translator +// Version 1.2 +//************************************** + +#ifndef __SAMPLE_DATA_M_H__ +#define __SAMPLE_DATA_M_H__ + +#include"mcode/mvector.h" +#include"mcode/mstring.h" +#include"mcode/mstream.h" +#include"mcode/mclient.h" +#include"public_m.h" + + +struct TFutSmpDataValue +{ + MLang::Long sample_time; + float sample_value; + int sample_status; + void __write(MLang::OutputStream&__os)const; + void __read(MLang::InputStream&__is); +}; +typedef MLang::VECTOR SEQFutSmpDataValue; +struct TFutSmpDataInfo +{ + TKeyID key_id; + SEQFutSmpDataValue seq_sample_value; + TFutSmpDataInfo(); + TFutSmpDataInfo(const TFutSmpDataInfo&); + TFutSmpDataInfo&operator=(const TFutSmpDataInfo&); + void __write(MLang::OutputStream&__os)const; + void __read(MLang::InputStream&__is); +}; +typedef MLang::VECTOR SEQFutSmpDataInfo; +struct TFutSmpDataReturn +{ + TKeyID key_id; + short is_success; + MLang::STRING fail_reason; + TFutSmpDataReturn(); + TFutSmpDataReturn(const TFutSmpDataReturn&); + TFutSmpDataReturn&operator=(const TFutSmpDataReturn&); + void __write(MLang::OutputStream&__os)const; + void __read(MLang::InputStream&__is); +}; +typedef MLang::VECTOR SEQFutSmpDataReturn; +struct TFutSmpDataInPara +{ + int app_no; + SEQFutSmpDataInfo seq_sample_data; + TFutSmpDataInPara(); + TFutSmpDataInPara(const TFutSmpDataInPara&); + TFutSmpDataInPara&operator=(const TFutSmpDataInPara&); + void __write(MLang::OutputStream&__os)const; + void __read(MLang::InputStream&__is); +}; +struct TFutSmpDataOutPara +{ + int app_no; + MLang::STRING fail_reason; + SEQFutSmpDataReturn seq_sample_return; + TFutSmpDataOutPara(); + TFutSmpDataOutPara(const TFutSmpDataOutPara&); + TFutSmpDataOutPara&operator=(const TFutSmpDataOutPara&); + void __write(MLang::OutputStream&__os)const; + void __read(MLang::InputStream&__is); +}; +struct TBatchFutSmpDataValue +{ + TKeyID key_id; + float sample_value; + int sample_status; + void __write(MLang::OutputStream&__os)const; + void __read(MLang::InputStream&__is); +}; +typedef MLang::VECTOR SEQBatchFutSmpDataValue; +struct TBatchFutSmpDataInfo +{ + MLang::Long sample_time; + SEQBatchFutSmpDataValue seq_sample_value; + TBatchFutSmpDataInfo(); + TBatchFutSmpDataInfo(const TBatchFutSmpDataInfo&); + TBatchFutSmpDataInfo&operator=(const TBatchFutSmpDataInfo&); + void __write(MLang::OutputStream&__os)const; + void __read(MLang::InputStream&__is); +}; +typedef MLang::VECTOR SEQBatchFutSmpDataInfo; +struct TBatchFutSmpDataInPara +{ + int app_no; + SEQBatchFutSmpDataInfo seq_sample_data; + TBatchFutSmpDataInPara(); + TBatchFutSmpDataInPara(const TBatchFutSmpDataInPara&); + TBatchFutSmpDataInPara&operator=(const TBatchFutSmpDataInPara&); + void __write(MLang::OutputStream&__os)const; + void __read(MLang::InputStream&__is); +}; +#endif diff --git a/code/sys_nicmonitor/include/db_com/sample_define_m.h b/code/sys_nicmonitor/include/db_com/sample_define_m.h new file mode 100644 index 0000000..beaeced --- /dev/null +++ b/code/sys_nicmonitor/include/db_com/sample_define_m.h @@ -0,0 +1,57 @@ +//************************************** +// Generated by mcpp translator +// Version 1.3 +//************************************** + +#ifndef __SAMPLE_DEFINE_M_H__ +#define __SAMPLE_DEFINE_M_H__ + +#include"mcode/mvector.h" +#include"mcode/mstring.h" +#include"mcode/mstream.h" +#include"mcode/mclient.h" +#include"public_m.h" + + +//typedef TRtdbKey TNewKeyID; +typedef MLang::STRING TNewKeyID; +typedef MLang::VECTOR KeyIDSEQ; +struct TKeyIDSEQ +{ + KeyIDSEQ key_id; + TKeyIDSEQ(); + TKeyIDSEQ(const TKeyIDSEQ&); + TKeyIDSEQ&operator=(const TKeyIDSEQ&); + void __write(MLang::OutputStream&__os)const; + void __read(MLang::InputStream&__is); +}; +struct TAddYCSamDefReqStru +{ + TNewKeyID key_id; + short sample_interval; + TAddYCSamDefReqStru(); + TAddYCSamDefReqStru(const TAddYCSamDefReqStru&); + TAddYCSamDefReqStru&operator=(const TAddYCSamDefReqStru&); + void __write(MLang::OutputStream&__os)const; + void __read(MLang::InputStream&__is); +}; +typedef MLang::VECTOR SEQAddYCSamDefReq; +struct TSEQAddYCSamDefReq +{ + SEQAddYCSamDefReq key_id; + TSEQAddYCSamDefReq(); + TSEQAddYCSamDefReq(const TSEQAddYCSamDefReq&); + TSEQAddYCSamDefReq&operator=(const TSEQAddYCSamDefReq&); + void __write(MLang::OutputStream&__os)const; + void __read(MLang::InputStream&__is); +}; +struct TStrSeq +{ + StrSeq str_seq; + TStrSeq(); + TStrSeq(const TStrSeq&); + TStrSeq&operator=(const TStrSeq&); + void __write(MLang::OutputStream&__os)const; + void __read(MLang::InputStream&__is); +}; +#endif diff --git a/code/sys_nicmonitor/include/db_com/sample_define_service_interface.h b/code/sys_nicmonitor/include/db_com/sample_define_service_interface.h new file mode 100644 index 0000000..3161e7a --- /dev/null +++ b/code/sys_nicmonitor/include/db_com/sample_define_service_interface.h @@ -0,0 +1,93 @@ +//****************************************************************** +// +// AUTHOR : ZhaoTiger +// +// FUNCTION : SAMPLE_DEFINE_SERVER ̵Ŀͻ๫ඨ +// +// TIME : 2003.08.27 +// +// HISTORY : +// Datetime Action Author Reason +// ------------------------------------------------------------------- +// 2003.08.27 Creation ZhaoTiger +// +//****************************************************************** + +#ifndef __SAMPLE_DEFINE_SERVICE_INTERFACE_H__ +#define __SAMPLE_DEFINE_SERVICE_INTERFACE_H__ + +#ifdef _WINDOWS64 +#ifdef SAMPLE_DEFINE_EXPORTS +#define SAMPLE_DEFINE_API __declspec(dllexport) +#else +#define SAMPLE_DEFINE_API __declspec(dllimport) +#endif +#else +#define SAMPLE_DEFINE_API +#endif + +#ifndef _WINDOWS64 +#include +#include +#include +#include +#include +#else +#include +#include +#endif + +#include "sample_define_m.h" +// 2018 +// #include "sam_service.h" +#include "servicemanage.h" +#include "sysadm/scn_service.h" +#include "pub_ctx.h" +#include "system.h" + +using namespace std; + +//úҪIDL ļвͬinterface ƽ޸ + +class SAMPLE_DEFINE_API sample_define_service_interface +{ +public: + + sample_define_service_interface(int specify_port, const int request_timeout_seconds = 100); + ~sample_define_service_interface(); + + //õĽӿںӣIDLӳͷļж + short AddYXSampleDefine(string sample_name, const KeyIDSEQ& seq_key_id); //1 + short DeleteYXSampleDefine(string sample_name, const KeyIDSEQ& seq_key_id); //2 +// short AddYCRecallDefine(string sample_name, const KeyIDSEQ& seq_key_id); //3 +// short DeleteYCRecallDefine(string sample_name, const KeyIDSEQ& seq_key_id); //4 + short AddYCSampleDefine(string sample_name, const SEQAddYCSamDefReq& seq_add_yc_req); //5 + short DeleteYCSampleDefine(string sample_name, const KeyIDSEQ& seq_key_id); //6 + short PauseYCSampleDefine(string sample_name, const KeyIDSEQ& seq_key_id); //7 + short RecoverYCSampleDefine(string sample_name, const KeyIDSEQ& seq_key_id); //8 + // 2018 + short AddSampleDefineByID(string sample_name, const StrSeq& seq_record_id); //9 + + //add for remote access + int SetDomainInfo(const DomainInfo& domain_info); //ԶϢͨã + int SetDomainInfo(const char* domain_name, const tSecLabel& sec_label, const int app_no = AP_DATA_SRV, const int ctx_no = AC_REALTIME_NO); + int SetDomainName(const char* domain_name); // + int SetSecLabel(tSecLabel& sec_label); //ñǩ + void ClearDomainName(); //m_DomainNameΪlocal_domain + +private: + DomainInfo m_DomainInfo; + ServiceInfo m_Serviceinfo; + int m_RequestTimeoutSeconds; + char m_IpAddress[64]; + int m_Port; + Handle m_Handle; + char m_HostName[64]; + + int GetHostByAppNo(char* host_name, const int app_no, const short context_no); + int SetServiceHost(); + +}; + +#endif + diff --git a/code/sys_nicmonitor/include/db_com/sample_modify_m.h b/code/sys_nicmonitor/include/db_com/sample_modify_m.h new file mode 100644 index 0000000..2cb2296 --- /dev/null +++ b/code/sys_nicmonitor/include/db_com/sample_modify_m.h @@ -0,0 +1,343 @@ +//************************************** +// Generated by mcpp translator +// Version 1.2 +//************************************** + +#ifndef __SAMPLE_MODIFY_M_H__ +#define __SAMPLE_MODIFY_M_H__ + +#ifdef _WINDOWS64 +#ifdef SAMPLE_MODIFY_CLIENT_EXPORTS +#define SAMPLE_MODIFY_CLIENT_API __declspec(dllexport) +#else +#define SAMPLE_MODIFY_CLIENT_API __declspec(dllimport) +#endif +#else +#define SAMPLE_MODIFY_CLIENT_API +#endif + +#include"mcode/mvector.h" +#include"mcode/mstring.h" +#include"mcode/mstream.h" +#include"mcode/mclient.h" +#include"public_m.h" + + +const short MODIFY_SUCCESS = 0; +const short MODIFY_FAIL = -1; +const short MODIFY_WARNING = -1; +const short MODIFY_YC_SAMPLE = 1; +const short MODIFY_YX_SAMPLE = 0; +const short SYNC_RS_HS = 1; +const short NOT_SYNC_RS_HS = 0; +const short MODIFY_RS_SAMPLE = 1; +const short MODIFY_HS_SAMPLE = 0; +const short SET_MODIFY = 1; +const short NOT_MODIFY = 0; +const short TRI_DATATYPE_INT = 0; +const short TRI_DATATYPE_FLOAT = 1; +const short TRI_DATATYPE_STRING = 2; +struct SAMPLE_MODIFY_CLIENT_API TValueInfo +{ + MLang::Long time; + float value; + int stat; + void __write(MLang::OutputStream&__os)const; + void __read(MLang::InputStream&__is); +}; +typedef MLang::VECTOR SEQTValueInfo; +struct SAMPLE_MODIFY_CLIENT_API TModifyInfo +{ + int app_no; + TKeyID keyid; + unsigned char is_yc; + unsigned char is_real; + unsigned char is_sync; + unsigned char is_modify_value; + unsigned char is_modify_stat; + short time_num; + SEQTValueInfo seq_valueinfo; + TModifyInfo(); + TModifyInfo(const TModifyInfo&); + TModifyInfo&operator=(const TModifyInfo&); + void __write(MLang::OutputStream&__os)const; + void __read(MLang::InputStream&__is); +}; +typedef MLang::VECTOR SEQModifyInfo; +struct SAMPLE_MODIFY_CLIENT_API TSampleModifyInParm +{ + SEQModifyInfo seq_modify_info; + TSampleModifyInParm(); + TSampleModifyInParm(const TSampleModifyInParm&); + TSampleModifyInParm&operator=(const TSampleModifyInParm&); + void __write(MLang::OutputStream&__os)const; + void __read(MLang::InputStream&__is); +}; +struct SAMPLE_MODIFY_CLIENT_API TSampleModifyExInParm +{ + MLang::STRING node_name; + MLang::STRING user_name; + MLang::STRING proc_name; + SEQModifyInfo seq_modify_info; + TSampleModifyExInParm(); + TSampleModifyExInParm(const TSampleModifyExInParm&); + TSampleModifyExInParm&operator=(const TSampleModifyExInParm&); + void __write(MLang::OutputStream&__os)const; + void __read(MLang::InputStream&__is); +}; +struct SAMPLE_MODIFY_CLIENT_API TModifyErrInfo +{ + MLang::Long time; + MLang::STRING err_string; + TModifyErrInfo(); + TModifyErrInfo(const TModifyErrInfo&); + TModifyErrInfo&operator=(const TModifyErrInfo&); + void __write(MLang::OutputStream&__os)const; + void __read(MLang::InputStream&__is); +}; +typedef MLang::VECTOR SEQModifyErrInfo; +struct SAMPLE_MODIFY_CLIENT_API TModifyResultInfo +{ + short success_flag; + short fail_num; + SEQModifyErrInfo seq_errinfo; + short warning_flag; + short warning_num; + SEQModifyErrInfo seq_warninginfo; + TModifyResultInfo(); + TModifyResultInfo(const TModifyResultInfo&); + TModifyResultInfo&operator=(const TModifyResultInfo&); + void __write(MLang::OutputStream&__os)const; + void __read(MLang::InputStream&__is); +}; +struct SAMPLE_MODIFY_CLIENT_API TModifyResult +{ + int app_no; + TKeyID keyid; + unsigned char is_yc; + unsigned char is_sync; + unsigned char is_real; + unsigned char is_modify_value; + unsigned char is_modify_stat; + short time_num; + short valid_flag; + MLang::STRING invalid_string; + TModifyResultInfo modify_result_info; + TModifyResult(); + TModifyResult(const TModifyResult&); + TModifyResult&operator=(const TModifyResult&); + void __write(MLang::OutputStream&__os)const; + void __read(MLang::InputStream&__is); +}; +typedef MLang::VECTOR SEQModifyResult; +struct SAMPLE_MODIFY_CLIENT_API TSampleModifyOutParm +{ + SEQModifyResult seq_modify_result; + TSampleModifyOutParm(); + TSampleModifyOutParm(const TSampleModifyOutParm&); + TSampleModifyOutParm&operator=(const TSampleModifyOutParm&); + void __write(MLang::OutputStream&__os)const; + void __read(MLang::InputStream&__is); +}; +struct SAMPLE_MODIFY_CLIENT_API TSampleModifyExOutParm +{ + MLang::STRING node_name; + MLang::STRING user_name; + MLang::STRING proc_name; + SEQModifyResult seq_modify_result; + TSampleModifyExOutParm(); + TSampleModifyExOutParm(const TSampleModifyExOutParm&); + TSampleModifyExOutParm&operator=(const TSampleModifyExOutParm&); + void __write(MLang::OutputStream&__os)const; + void __read(MLang::InputStream&__is); +}; +struct SAMPLE_MODIFY_CLIENT_API TBatchValueInfo +{ + float value; + int stat; + void __write(MLang::OutputStream&__os)const; + void __read(MLang::InputStream&__is); +}; +typedef MLang::VECTOR SEQBatchValueInfo; +struct SAMPLE_MODIFY_CLIENT_API TBatchModifyInfo +{ + int app_no; + unsigned char is_yc; + unsigned char is_real; + unsigned char is_sync; + unsigned char is_modify_value; + unsigned char is_modify_stat; + MLang::Long occur_time; + MLang::VECTOR seq_keyid; + int keyid_num; + SEQBatchValueInfo seq_batch_value_info; + TBatchModifyInfo(); + TBatchModifyInfo(const TBatchModifyInfo&); + TBatchModifyInfo&operator=(const TBatchModifyInfo&); + void __write(MLang::OutputStream&__os)const; + void __read(MLang::InputStream&__is); +}; +typedef MLang::VECTOR SEQBatchModifyInfo; +struct SAMPLE_MODIFY_CLIENT_API TBatchSampleModifyInParm +{ + int modify_id; + SEQBatchModifyInfo seq_batch_modify_info; + TBatchSampleModifyInParm(); + TBatchSampleModifyInParm(const TBatchSampleModifyInParm&); + TBatchSampleModifyInParm&operator=(const TBatchSampleModifyInParm&); + void __write(MLang::OutputStream&__os)const; + void __read(MLang::InputStream&__is); +}; +struct SAMPLE_MODIFY_CLIENT_API TBatchModifyResultInfo +{ + short success_flag; + MLang::STRING err_string; + TBatchModifyResultInfo(); + TBatchModifyResultInfo(const TBatchModifyResultInfo&); + TBatchModifyResultInfo&operator=(const TBatchModifyResultInfo&); + void __write(MLang::OutputStream&__os)const; + void __read(MLang::InputStream&__is); +}; +typedef MLang::VECTOR SEQBatchModifyResultInfo; +struct SAMPLE_MODIFY_CLIENT_API TBatchModifyResult +{ + int app_no; + unsigned char is_yc; + unsigned char is_real; + unsigned char is_sync; + unsigned char is_modify_value; + unsigned char is_modify_stat; + MLang::Long occur_time; + MLang::VECTOR seq_keyid; + int keyid_num; + short valid_flag; + MLang::STRING invalid_string; + SEQBatchModifyResultInfo seq_batch_modify_result_info; + TBatchModifyResult(); + TBatchModifyResult(const TBatchModifyResult&); + TBatchModifyResult&operator=(const TBatchModifyResult&); + void __write(MLang::OutputStream&__os)const; + void __read(MLang::InputStream&__is); +}; +typedef MLang::VECTOR SEQBatchModifyResult; +struct SAMPLE_MODIFY_CLIENT_API TBatchSampleModifyOutParm +{ + int modify_id; + SEQBatchModifyResult seq_batch_modify_result; + TBatchSampleModifyOutParm(); + TBatchSampleModifyOutParm(const TBatchSampleModifyOutParm&); + TBatchSampleModifyOutParm&operator=(const TBatchSampleModifyOutParm&); + void __write(MLang::OutputStream&__os)const; + void __read(MLang::InputStream&__is); +}; +struct SAMPLE_MODIFY_CLIENT_API TReStatInfo +{ + TKeyID keyid; + LongSeq seq_time; + TReStatInfo(); + TReStatInfo(const TReStatInfo&); + TReStatInfo&operator=(const TReStatInfo&); + void __write(MLang::OutputStream&__os)const; + void __read(MLang::InputStream&__is); +}; +typedef MLang::VECTOR SEQReStatInfo; +struct SAMPLE_MODIFY_CLIENT_API TReStatInfoInParm +{ + int app_no; + SEQReStatInfo seq_re_stat_info; + TReStatInfoInParm(); + TReStatInfoInParm(const TReStatInfoInParm&); + TReStatInfoInParm&operator=(const TReStatInfoInParm&); + void __write(MLang::OutputStream&__os)const; + void __read(MLang::InputStream&__is); +}; +struct SAMPLE_MODIFY_CLIENT_API UTriDataValue +{ +private: + union + { + int c_int; + float c_float; + char* c_string; + }__u_val; + bool __u_init; + unsigned short __u_index; +public: + UTriDataValue(); + ~UTriDataValue(); + UTriDataValue(const UTriDataValue&); + UTriDataValue&operator=(const UTriDataValue&); + short _d()const; + void __clear(); + void __write(MLang::OutputStream&__os)const; + void __read(MLang::InputStream&__is); + void c_int(const int); + const int c_int()const; + void c_float(const float); + const float c_float()const; + void c_string(const char*); + void c_string(const MLang::STRING&); + const char*c_string()const; +}; +struct SAMPLE_MODIFY_CLIENT_API TTriKeyValueInfo +{ + TKeyID keyid; + short keyid_datatype; + UTriDataValue keyid_value; + void __write(MLang::OutputStream&__os)const; + void __read(MLang::InputStream&__is); +}; +typedef MLang::VECTOR SEQTriKeyValueInfo; +struct SAMPLE_MODIFY_CLIENT_API TTriSampleModifyInfo +{ + MLang::Long occur_time; + SEQTriKeyValueInfo seq_tri_key_value_info; + TTriSampleModifyInfo(); + TTriSampleModifyInfo(const TTriSampleModifyInfo&); + TTriSampleModifyInfo&operator=(const TTriSampleModifyInfo&); + void __write(MLang::OutputStream&__os)const; + void __read(MLang::InputStream&__is); +}; +typedef MLang::VECTOR SEQTriSampleModifyInfo; +struct SAMPLE_MODIFY_CLIENT_API TTriSampleModifyInfoInPara +{ + int sample_type; + int app_no; + unsigned char offer_id; + MLang::Long id; + MLang::Long user_id; + MLang::Long host_id; + MLang::STRING program_name; + int modify_policy; + int reserve_1; + int reserve_2; + int reserve_3; + SEQTriSampleModifyInfo seq_tri_sample_modify_info; + TTriSampleModifyInfoInPara(); + TTriSampleModifyInfoInPara(const TTriSampleModifyInfoInPara&); + TTriSampleModifyInfoInPara&operator=(const TTriSampleModifyInfoInPara&); + void __write(MLang::OutputStream&__os)const; + void __read(MLang::InputStream&__is); +}; +struct SAMPLE_MODIFY_CLIENT_API TTriSampleModifyInfoOutPara +{ + int sample_type; + int app_no; + unsigned char offer_id; + MLang::Long id; + MLang::Long user_id; + MLang::Long host_id; + MLang::STRING program_name; + int modify_policy; + int reserve_1; + int reserve_2; + int reserve_3; + short success_flag; + MLang::STRING fail_string; + TTriSampleModifyInfoOutPara(); + TTriSampleModifyInfoOutPara(const TTriSampleModifyInfoOutPara&); + TTriSampleModifyInfoOutPara&operator=(const TTriSampleModifyInfoOutPara&); + void __write(MLang::OutputStream&__os)const; + void __read(MLang::InputStream&__is); +}; +#endif diff --git a/code/sys_nicmonitor/include/db_com/sample_modify_service_interface.h b/code/sys_nicmonitor/include/db_com/sample_modify_service_interface.h new file mode 100644 index 0000000..c4ca54f --- /dev/null +++ b/code/sys_nicmonitor/include/db_com/sample_modify_service_interface.h @@ -0,0 +1,99 @@ +//****************************************************************** +// +// AUTHOR : ZhangKeHeng +// +// FUNCTION : SAMPLE_MODIFY_SERVER ̵Ŀͻ๫ඨ +// +// TIME : 2003.09.26 +// +// HISTORY : +// Datetime Action Author Reason +// ------------------------------------------------------------------- +// 2003.09.26 Creation ZhangKeHeng +// 2005.12.13 Modify ZhangKeHeng Add TriggerModify +// 2006.02.22 Mdifyy ZhangKeHeng Add Warn +//****************************************************************** + +#ifndef __SAMPLE_MODIFY_SERVICE_INTERFACE_H__ +#define __SAMPLE_MODIFY_SERVICE_INTERFACE_H__ + +#ifdef _WINDOWS64 +#ifdef SAMPLE_MODIFY_CLIENT_EXPORTS +#define SAMPLE_MODIFY_CLIENT_API __declspec(dllexport) +#else +#define SAMPLE_MODIFY_CLIENT_API __declspec(dllimport) +#endif +#else +#define SAMPLE_MODIFY_CLIENT_API +#endif + +#ifndef _WINDOWS64 +#include +#include +#include +#include +#include +#else +#include +#include +#endif + +#include "sample_modify_m.h" +#include "servicesclient.h" +#include +#include "system.h" + +class SAMPLE_MODIFY_CLIENT_API sample_modify_service_interface +{ + public: + + sample_modify_service_interface(); + sample_modify_service_interface(int port,const int request_timeout_seconds = 300); + ~sample_modify_service_interface(); + void SetRequestTimeout(int seconds); + + //õĽӿںӣIDLӳͷļж + short SampleModify(const TSampleModifyInParm& in_para, TSampleModifyOutParm & out_para);//1 + short BatchSampleModify(const TBatchSampleModifyInParm& in_para, TBatchSampleModifyOutParm & out_para);//2 + + //ONEWAY + short ReStatisticsOneWay(const TReStatInfoInParm& in_para);//3 + + short TriSampleModify(const TTriSampleModifyInfoInPara& in_para, TTriSampleModifyInfoOutPara & out_para);//4 + + short SampleModifyEx(const TSampleModifyExInParm& in_para, TSampleModifyExOutParm & out_para);//5 + + //20141023 Ӷʷ֧ + short SampleModifyCache(const TSampleModifyInParm& in_para, TSampleModifyOutParm & out_para);//11 + short SampleModifyHis(const TSampleModifyInParm& in_para, TSampleModifyOutParm & out_para);//12 + short SampleModifyExCache(const TSampleModifyExInParm& in_para, TSampleModifyExOutParm & out_para);//13 + short SampleModifyExHis(const TSampleModifyExInParm& in_para, TSampleModifyExOutParm & out_para);//14 + + short BatchSampleModifyCache(const TBatchSampleModifyInParm& in_para, TBatchSampleModifyOutParm & out_para);//15 + short BatchSampleModifyHis(const TBatchSampleModifyInParm& in_para, TBatchSampleModifyOutParm & out_para);//16 + //20141023 end + + //add for remote access + int SetDomainInfo(const DomainInfo& domain_info); //ԶϢͨã + int SetDomainInfo(const char* domain_name, const tSecLabel& sec_label, const int app_no = AP_DATA_SRV, const int ctx_no = AC_REALTIME_NO); + int SetDomainName(const char* domain_name); // + int SetSecLabel(tSecLabel& sec_label); //ñǩ + void ClearDomainName(); //m_DomainNameΪlocal_domain + + private: + DomainInfo m_DomainInfo; + ServiceInfo m_Serviceinfo; + char m_IpAddress[64]; + int m_Port; + Handle m_Handle; + char m_HostName[64]; + int m_RequestTimeoutSeconds; + + int GetHostByAppNo(char* host_name, const int app_no, const short context_no); + int SetServiceHost(); +}; + +#endif + + + diff --git a/code/sys_nicmonitor/include/db_com/sds.h b/code/sys_nicmonitor/include/db_com/sds.h new file mode 100644 index 0000000..13be75a --- /dev/null +++ b/code/sys_nicmonitor/include/db_com/sds.h @@ -0,0 +1,273 @@ +/* SDSLib 2.0 -- A C dynamic strings library + * + * Copyright (c) 2006-2015, Salvatore Sanfilippo + * Copyright (c) 2015, Oran Agra + * Copyright (c) 2015, Redis Labs, Inc + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * * Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * * Neither the name of Redis nor the names of its contributors may be used + * to endorse or promote products derived from this software without + * specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef __SDS_H +#define __SDS_H + +#define SDS_MAX_PREALLOC (1024*1024) + +#include +#include +#include + +typedef char *sds; + +/* Note: sdshdr5 is never used, we just access the flags byte directly. + * However is here to document the layout of type 5 SDS strings. */ +struct __attribute__ ((__packed__)) sdshdr5 { + unsigned char flags; /* 3 lsb of type, and 5 msb of string length */ + char buf[]; +}; +struct __attribute__ ((__packed__)) sdshdr8 { + uint8_t len; /* used */ + uint8_t alloc; /* excluding the header and null terminator */ + unsigned char flags; /* 3 lsb of type, 5 unused bits */ + char buf[]; +}; +struct __attribute__ ((__packed__)) sdshdr16 { + uint16_t len; /* used */ + uint16_t alloc; /* excluding the header and null terminator */ + unsigned char flags; /* 3 lsb of type, 5 unused bits */ + char buf[]; +}; +struct __attribute__ ((__packed__)) sdshdr32 { + uint32_t len; /* used */ + uint32_t alloc; /* excluding the header and null terminator */ + unsigned char flags; /* 3 lsb of type, 5 unused bits */ + char buf[]; +}; +struct __attribute__ ((__packed__)) sdshdr64 { + uint64_t len; /* used */ + uint64_t alloc; /* excluding the header and null terminator */ + unsigned char flags; /* 3 lsb of type, 5 unused bits */ + char buf[]; +}; + +#define SDS_TYPE_5 0 +#define SDS_TYPE_8 1 +#define SDS_TYPE_16 2 +#define SDS_TYPE_32 3 +#define SDS_TYPE_64 4 +#define SDS_TYPE_MASK 7 +#define SDS_TYPE_BITS 3 +#define SDS_HDR_VAR(T,s) struct sdshdr##T *sh = (struct sdshdr##T *)((s)-(sizeof(struct sdshdr##T))); +#define SDS_HDR(T,s) ((struct sdshdr##T *)((s)-(sizeof(struct sdshdr##T)))) +#define SDS_TYPE_5_LEN(f) ((f)>>SDS_TYPE_BITS) + +static inline size_t sdslen(const sds s) { + unsigned char flags = s[-1]; + switch(flags&SDS_TYPE_MASK) { + case SDS_TYPE_5: + return SDS_TYPE_5_LEN(flags); + case SDS_TYPE_8: + return SDS_HDR(8,s)->len; + case SDS_TYPE_16: + return SDS_HDR(16,s)->len; + case SDS_TYPE_32: + return SDS_HDR(32,s)->len; + case SDS_TYPE_64: + return SDS_HDR(64,s)->len; + } + return 0; +} + +static inline size_t sdsavail(const sds s) { + unsigned char flags = s[-1]; + switch(flags&SDS_TYPE_MASK) { + case SDS_TYPE_5: { + return 0; + } + case SDS_TYPE_8: { + SDS_HDR_VAR(8,s); + return sh->alloc - sh->len; + } + case SDS_TYPE_16: { + SDS_HDR_VAR(16,s); + return sh->alloc - sh->len; + } + case SDS_TYPE_32: { + SDS_HDR_VAR(32,s); + return sh->alloc - sh->len; + } + case SDS_TYPE_64: { + SDS_HDR_VAR(64,s); + return sh->alloc - sh->len; + } + } + return 0; +} + +static inline void sdssetlen(sds s, size_t newlen) { + unsigned char flags = s[-1]; + switch(flags&SDS_TYPE_MASK) { + case SDS_TYPE_5: + { + unsigned char *fp = ((unsigned char*)s)-1; + *fp = SDS_TYPE_5 | (newlen << SDS_TYPE_BITS); + } + break; + case SDS_TYPE_8: + SDS_HDR(8,s)->len = newlen; + break; + case SDS_TYPE_16: + SDS_HDR(16,s)->len = newlen; + break; + case SDS_TYPE_32: + SDS_HDR(32,s)->len = newlen; + break; + case SDS_TYPE_64: + SDS_HDR(64,s)->len = newlen; + break; + } +} + +static inline void sdsinclen(sds s, size_t inc) { + unsigned char flags = s[-1]; + switch(flags&SDS_TYPE_MASK) { + case SDS_TYPE_5: + { + unsigned char *fp = ((unsigned char*)s)-1; + unsigned char newlen = SDS_TYPE_5_LEN(flags)+inc; + *fp = SDS_TYPE_5 | (newlen << SDS_TYPE_BITS); + } + break; + case SDS_TYPE_8: + SDS_HDR(8,s)->len += inc; + break; + case SDS_TYPE_16: + SDS_HDR(16,s)->len += inc; + break; + case SDS_TYPE_32: + SDS_HDR(32,s)->len += inc; + break; + case SDS_TYPE_64: + SDS_HDR(64,s)->len += inc; + break; + } +} + +/* sdsalloc() = sdsavail() + sdslen() */ +static inline size_t sdsalloc(const sds s) { + unsigned char flags = s[-1]; + switch(flags&SDS_TYPE_MASK) { + case SDS_TYPE_5: + return SDS_TYPE_5_LEN(flags); + case SDS_TYPE_8: + return SDS_HDR(8,s)->alloc; + case SDS_TYPE_16: + return SDS_HDR(16,s)->alloc; + case SDS_TYPE_32: + return SDS_HDR(32,s)->alloc; + case SDS_TYPE_64: + return SDS_HDR(64,s)->alloc; + } + return 0; +} + +static inline void sdssetalloc(sds s, size_t newlen) { + unsigned char flags = s[-1]; + switch(flags&SDS_TYPE_MASK) { + case SDS_TYPE_5: + /* Nothing to do, this type has no total allocation info. */ + break; + case SDS_TYPE_8: + SDS_HDR(8,s)->alloc = newlen; + break; + case SDS_TYPE_16: + SDS_HDR(16,s)->alloc = newlen; + break; + case SDS_TYPE_32: + SDS_HDR(32,s)->alloc = newlen; + break; + case SDS_TYPE_64: + SDS_HDR(64,s)->alloc = newlen; + break; + } +} + +sds sdsnewlen(const void *init, size_t initlen); +sds sdsnew(const char *init); +sds sdsempty(void); +sds sdsdup(const sds s); +void sdsfree(sds s); +sds sdsgrowzero(sds s, size_t len); +sds sdscatlen(sds s, const void *t, size_t len); +sds sdscat(sds s, const char *t); +sds sdscatsds(sds s, const sds t); +sds sdscpylen(sds s, const char *t, size_t len); +sds sdscpy(sds s, const char *t); + +sds sdscatvprintf(sds s, const char *fmt, va_list ap); +#ifdef __GNUC__ +sds sdscatprintf(sds s, const char *fmt, ...) + __attribute__((format(printf, 2, 3))); +#else +sds sdscatprintf(sds s, const char *fmt, ...); +#endif + +sds sdscatfmt(sds s, char const *fmt, ...); +sds sdstrim(sds s, const char *cset); +void sdsrange(sds s, int start, int end); +void sdsupdatelen(sds s); +void sdsclear(sds s); +int sdscmp(const sds s1, const sds s2); +sds *sdssplitlen(const char *s, int len, const char *sep, int seplen, int *count); +void sdsfreesplitres(sds *tokens, int count); +void sdstolower(sds s); +void sdstoupper(sds s); +sds sdsfromlonglong(long long value); +sds sdscatrepr(sds s, const char *p, size_t len); +sds *sdssplitargs(const char *line, int *argc); +sds sdsmapchars(sds s, const char *from, const char *to, size_t setlen); +sds sdsjoin(char **argv, int argc, char *sep); +sds sdsjoinsds(sds *argv, int argc, const char *sep, size_t seplen); + +/* Low level functions exposed to the user API */ +sds sdsMakeRoomFor(sds s, size_t addlen); +void sdsIncrLen(sds s, int incr); +sds sdsRemoveFreeSpace(sds s); +size_t sdsAllocSize(sds s); +void *sdsAllocPtr(sds s); + +/* Export the allocator used by SDS to the program using SDS. + * Sometimes the program SDS is linked to, may use a different set of + * allocators, but may want to allocate or free things that SDS will + * respectively free or allocate. */ +void *sds_malloc(size_t size); +void *sds_realloc(void *ptr, size_t size); +void sds_free(void *ptr); + +#ifdef REDIS_TEST +int sdsTest(int argc, char *argv[]); +#endif + +#endif diff --git a/code/sys_nicmonitor/include/db_com/server_define.h b/code/sys_nicmonitor/include/db_com/server_define.h new file mode 100644 index 0000000..ae61767 --- /dev/null +++ b/code/sys_nicmonitor/include/db_com/server_define.h @@ -0,0 +1,83 @@ +//****************************************************************** +// +// AUTHOR : ZhaoTiger +// +// FUNCTION : ݿģҪõг +// +// TIME : 2003.06.02 +// +// HISTORY : +// Datetime Action Author Reason +// ------------------------------------------------------------------- +// 2003.06.02 Creation ZhaoTiger +// +//****************************************************************** + +#ifndef _SERVER_DEFINE_H +#define _SERVER_DEFINE_H + +typedef unsigned char uchar; +typedef unsigned short ushort; +typedef unsigned int uint; + +#define MAX_TABLE_NAME_ENG_LEN 32 +#define MAX_TABLE_NAME_CHN_LEN 64 +#define MAX_COLUMN_NAME_ENG_LEN 32 +#define MAX_COLUMN_NAME_CHN_LEN 64 +#define MAX_MENU_NAME_LEN 40 + +#define MAX_STRING_DATA_LEN 4096 +#define MAX_FAIL_REASON_LEN 200 + +#define MODIFY_OP_INSERT 0 +#define MODIFY_OP_DELETE 1 +#define MODIFY_OP_UPDATE 2 +#define MODIFY_OP_DELALL 3 + +#define KEY_GENERATE_NONE 0 +#define KEY_GENERATE_TABLE 1 +#define KEY_GENERATE_NORMAL 2 + +// Ϣdata_type, sys_menu_infoеIJ˵ֵ +// ͳһݿ +#define UNI_DATATYPE_CHAR 1 +#define UNI_DATATYPE_STRING 2 +#define UNI_DATATYPE_UCHAR 3 +#define UNI_DATATYPE_SHORT 4 +#define UNI_DATATYPE_INT 5 +#define UNI_DATATYPE_FLOAT 6 +#define UNI_DATATYPE_DOUBLE 7 +#define UNI_DATATYPE_DATETIME 8 +#define UNI_DATATYPE_KEYID 9 +#define UNI_DATATYPE_BINARY 10 +#define UNI_DATATYPE_TEXT 11 +#define UNI_DATATYPE_IMAGE 12 +#define UNI_DATATYPE_APPKEYID 13 +#define UNI_DATATYPE_APPID 14 +#define UNI_DATATYPE_LONG 15 +#define UNI_DATATYPE_RTDBKEY 16 +#define UNI_DATATYPE_MEASRTDBKEY 17 +#define UNI_DATATYPE_APPRTDBKEY 18 + +// +#define DB_SERVER_SUCCESS 0 +#define DB_SERVER_ERR_NO_TABLE -1 +#define DB_SERVER_ERR_QUERY_FAIL -2 +#define DB_SERVER_ERR_MEMORY_FAIL -3 +#define DB_SERVER_ERR_WRONG_APP -4 +#define DB_SERVER_ERR_NO_COLUMN -5 +#define DB_SERVER_ERR_WRONG_DATATYPE -6 +#define DB_SERVER_ERR_WRONG_REC_APP -7 +#define DB_SERVER_ERR_WRONG_KEY_INFO -8 +#define DB_SERVER_ERR_NO_MATCH -9 + +#define DB_SERVER_ERR_NO_TABLE_STR "ñ" +#define DB_SERVER_ERR_QUERY_FAIL_STR "̳" +#define DB_SERVER_ERR_MEMORY_FAIL_STR "ڴ" +#define DB_SERVER_ERR_WRONG_APP_STR "Ӧúų" +#define DB_SERVER_ERR_NO_COLUMN_STR "SQLSELECTӾû" +#define DB_SERVER_ERR_WRONG_DATATYPE_STR "ֵ֧" +#define DB_SERVER_ERR_WRONG_REC_APP_STR "ȱrecord_app" +#define DB_SERVER_ERR_WRONG_KEY_INFO_STR "װʱؼϢ" +#define DB_SERVER_ERR_NO_MATCH_STR "ƥ" +#endif diff --git a/code/sys_nicmonitor/include/db_com/sheetdataclient.h b/code/sys_nicmonitor/include/db_com/sheetdataclient.h new file mode 100644 index 0000000..bb5b5d6 --- /dev/null +++ b/code/sys_nicmonitor/include/db_com/sheetdataclient.h @@ -0,0 +1,98 @@ +/*********************************************/ +/*********Name :hisclient.h*******************/ +/*********************************************/ +#ifndef _HISCLIENT_H +#define _HISCLIENT_H + +#ifdef _WINDOWS64 +#ifdef HIS_CLIENT_EXPORTS +#define HIS_CLIENT_API __declspec(dllexport) +#else +#define HIS_CLIENT_API __declspec(dllimport) +#endif +#else +#define HIS_CLIENT_API +#endif + +#include +#include +#include +#include +#include + +#ifdef _WINDOWS64 +#include +#include +#include +#else +#include +#include +#include +#include +#include +#include +#include +#include +#endif + +#include "servicemanage.h" + +#define ONE_PACKAGE_SIZE 100000 + +#ifdef _WIN64 +extern unsigned char g_endian; +extern unsigned char net_endian; +#else +extern unsigned char g_endian; +extern unsigned char net_endian; +#endif + +typedef struct HisInfo +{ + int code_id; //ӿڲʹãûʱҪָṩΪselectupdateinsertdeleteȸݲ͡ + int appsid; //Ӧõid + char resververd[32]; //ռ䣬ṹıʱԴгһãﵽֽṹС䣬Ա֤ǰijԼ + // int sid; //Sid + // int sourcetype; //ڲⲿ + // int timemode ; //ǷҪʱԡ +} HisInfo_struct; // + +#define MAX_COL_DATA_LEN 300 + +class HIS_CLIENT_API SheetDataClientInterface +{ +public: + void GetSheetDataClient (CurvePara ¶m, vector &attr, + vector &data, vector &colname, const char* where_str, + const char* order_by, ErrorInfo &error); + + SheetDataClientInterface(); + virtual ~SheetDataClientInterface(); + + bool SetDomainInfo (DomainInfo *domainInfo); + bool CleanDomainInfo (void); + + //danath Ҫ첽ͼύӿ 20120223 + int SetSheetDataAsync (char *model_name, vector &rec, + ErrorInfo &error); + //20141023 end + + int GetCurveData (CurvePara ¶m, time_t timeout, CurveData ** datap, + int &items, ErrorInfo &error); + int SetCurveData (CurvePara ¶m, CurveData *curvedatap, ub2 items, + ErrorInfo &error); + int GetCurveData (CurvePara ¶m, time_t timeout,CurveData ** datap, + int &items,ErrorInfo &error,bool is_cache, bool is_retry); + + int SetCurveDataAsync (CurvePara ¶m, char * user_name, + char * host_name, char * proc_name, CurveData *curvedatap, ub2 items, ErrorInfo &error,bool is_cache, bool is_retry); + + +private: + int RestSocket (int no = 1); + Handle requesthandle; + Handle requesthandle_async; + ServiceInfo servicep; + DomainInfo *domain_info; +}; +#endif diff --git a/code/sys_nicmonitor/include/db_com/sheetdataclient.h0604 b/code/sys_nicmonitor/include/db_com/sheetdataclient.h0604 new file mode 100644 index 0000000..f8086cf --- /dev/null +++ b/code/sys_nicmonitor/include/db_com/sheetdataclient.h0604 @@ -0,0 +1,86 @@ +/*********************************************/ +/*********Name :hisclient.h*******************/ +/*********************************************/ +#ifndef _HISCLIENT_H +#define _HISCLIENT_H + +#ifdef _WINDOWS64 +#ifdef HIS_CLIENT_EXPORTS +#define HIS_CLIENT_API __declspec(dllexport) +#else +#define HIS_CLIENT_API __declspec(dllimport) +#endif +#else +#define HIS_CLIENT_API +#endif + +#include +#include +#include +#include +#include + +#ifdef _WINDOWS64 +#include +#include +#include +#else +#include +#include +#include +#include +#include +#include +#include +#include +#endif + +#include "servicemanage.h" + +#define ONE_PACKAGE_SIZE 100000 + +#ifdef _WIN64 +extern unsigned char g_endian; +extern unsigned char net_endian; +#else +extern unsigned char g_endian; +extern unsigned char net_endian; +#endif + +typedef struct HisInfo +{ + int code_id; //ӿڲʹãûʱҪָṩΪselectupdateinsertdeleteȸݲ͡ + int appsid; //Ӧõid + char resververd[32]; //ռ䣬ṹıʱԴгһãﵽֽṹС䣬Ա֤ǰijԼ + // int sid; //Sid + // int sourcetype; //ڲⲿ + // int timemode ; //ǷҪʱԡ +} HisInfo_struct; // + +#define MAX_COL_DATA_LEN 300 + +class HIS_CLIENT_API SheetDataClientInterface +{ +public: + void GetSheetDataClient (CurvePara ¶m, vector &attr, + vector &data, vector &colname, const char* where_str, + const char* order_by, ErrorInfo &error); + + SheetDataClientInterface(); + virtual ~SheetDataClientInterface(); + + bool SetDomainInfo (DomainInfo *domainInfo); + bool CleanDomainInfo (void); + + //danath Ҫ첽ͼύӿ 20120223 + int SetSheetDataAsync (char *model_name, vector &rec, + ErrorInfo &error); + //20141023 end +private: + int RestSocket (int no = 1); + Handle requesthandle; + Handle requesthandle_async; + ServiceInfo servicep; + DomainInfo *domain_info; +}; +#endif diff --git a/code/sys_nicmonitor/include/db_com/sql_sp_client_base.h b/code/sys_nicmonitor/include/db_com/sql_sp_client_base.h new file mode 100644 index 0000000..69a6488 --- /dev/null +++ b/code/sys_nicmonitor/include/db_com/sql_sp_client_base.h @@ -0,0 +1,148 @@ +//****************************************************************** +// +// AUTHOR : JiXuechun +// +// FUNCTION : SQL_SP_SERVER ̵Ŀͻ๫ඨ +// +// TIME : 2009.06.02 +// +// HISTORY : +// Datetime Action Author Reason +// ------------------------------------------------------------------- +// 2009.06.02 Creation JiXuechun +// 2011.01.13 Add ChenPeng ӱ󶨽ӿ +// 2011.09.23 Add CuiWeiYe ع캯 +//****************************************************************** + +#ifndef __SQL_SP_CLIENT_BASE_H__ +#define __SQL_SP_CLIENT_BASE_H__ + +#ifdef _WINDOWS64 +#ifdef SQL_SP_CLIENT_EXPORTS +#define SQL_SP_CLIENT_API __declspec(dllexport) +#else +#define SQL_SP_CLIENT_API __declspec(dllimport) +#endif +#else +#define SQL_SP_CLIENT_API +#endif + +#ifndef _WINDOWS64 +#include +#include +#include +#include +#include +#else +#include +#include +#endif + +#include + +#include "servicemanage.h" +#include "system.h" +#include "sql_sp_m.h" +#include "sysadm/scn_service.h" +#include "pub_ctx.h" +#include "logclient.h" + +#include "rdb_define.pb.h" +#include "sql_sp_define.h" + +using namespace std; + +#define BIND_CHR 1 /* ַ unsigned char */ +#define BIND_INT 3 /* short int long */ +#define BIND_FLT 4 /* float double */ +#define BIND_STR 5 /* ַstring */ +#define BIND_ODT 156 /* date*/ + +struct BindTime +{ + unsigned char TimeHH; /* hours; range is 0 <= hours <=23 */ + unsigned char TimeMI; /* minutes; range is 0 <= minutes <= 59 */ + unsigned char TimeSS; /* seconds; range is 0 <= seconds <= 59 */ +}; +typedef struct BindTime BindTime; + +struct BindDate +{ + unsigned short DateYYYY; /* gregorian year; range is -4712 <= year <= 9999 */ + unsigned char DateMM; /* month; range is 1 <= month < 12 */ + unsigned char DateDD; /* day; range is 1 <= day <= 31 */ + BindTime DateTime; /* time */ +}; +typedef struct BindDate BindDate; + +//namespace SQL_SP_SERVER +//{ +class SQL_SP_CLIENT_API sql_sp_client_base +{ +public: + + sql_sp_client_base(); + sql_sp_client_base(int port); + sql_sp_client_base(int port, int seconds); + ~sql_sp_client_base(); + void SetRequestTimeout(int seconds); + + short SelectSql(const char* sql_str, unsigned int max_result_num, const SEQOutDataTypeStru& out_data_type, TSelectResultStru& out_select_result, SEQDBErrorStru& out_db_error); + //Զ̵Ķ̰߳ȫ + //short SelectSql(const char* sql_str, unsigned int max_result_num, const SEQOutDataTypeStru& out_data_type, TSelectResultStru& out_select_result, SEQDBErrorStru& out_db_error,DomainInfo_name &domain_info); + + // protobuf + short SelectSql(const char* sql_str, unsigned int max_result_num, const SQL_SP_DEFINE::VEC_OUT_DATA_TYPE & out_data_type, SQL_SP_DEFINE::SELECT_RESULT & out_select_result, SQL_SP_DEFINE::VEC_DB_ERROR & out_db_error); + + short SelectSqlUsingGS(const char* sql_str, unsigned int max_result_num, const SEQOutDataTypeStru& out_data_type, TSelectResultStru& out_select_result, SEQDBErrorStru& out_db_error); + + short ExecuteSql(const char* sql_str, SEQDBErrorStru& out_db_error); + // protobuf + short ExecuteSql(const char* sql_str, SQL_SP_DEFINE::VEC_DB_ERROR & out_db_error); + + short ExecuteBind(const char * sql_str, SEQBindParaStru &seq_bind_para, char * data_buffer, char * null_flag_buffer, unsigned int row_num, SEQDBErrorStru& out_db_error); + + short ExecuteSqlUsingGS(const char* sql_str, SEQDBErrorStru& out_db_error); + + short ExecuteMultiSql(int sql_num, const StrSeq& seq_sql_str, SEQExecMultiResultStru& seq_exec_multi_result); + + short ExecuteMultiSqlUsingGS(int sql_num, const StrSeq& seq_sql_str, SEQExecMultiResultStru& seq_exec_multi_result); + + short ExecuteSpWithReturn(const char* package_name, const char* procedure_name, const StrSeq& para_seq, unsigned int max_result_num, const SEQOutDataTypeStru& out_data_type, TSelectResultStru& out_select_result, SEQDBErrorStru& out_db_error); + + short ExecuteSpWithoutReturn(const char* package_name, const char* procedure_name, const StrSeq& para_seq, SEQDBErrorStru& out_db_error); + + short ExecuteSqlWithLOB(const char* sql_str, SEQDBErrorStru& out_db_error); + short SelectSqlWithLOB(const char* sql_str, unsigned int max_result_num, SEQOutDataTypeStru& out_data_type, TSelectResultStru& out_select_result, SEQDBErrorStru& out_db_error); + short InsertSqlWithLOB(const char* sql_insert, const char* sql_select, const SEQLOBValueType& seq_lob_value, SEQDBErrorStru& out_db_error); + short UpdateSqlWithLOB(const char* sql_update, const char* sql_select, const SEQLOBValueType& seq_lob_value, SEQDBErrorStru& out_db_error); + short ExecuteSqlEx(const char* sql_str, SEQDBErrorStru& out_db_error, short rep_flag); + short ExecuteMultiSqlEx(int sql_num, const StrSeq& seq_sql_str, SEQExecMultiResultStru seq_exec_multi_result, short rep_flag); + short ExecuteSpWithoutReturnEx(const char* package_name, const char* procedure_name, const StrSeq& para_seq, SEQDBErrorStru& out_db_error, short rep_flag); + short ExecuteSqlWithLOBEx(const char* sql_str, SEQDBErrorStru& out_db_error, short rep_flag); + short InsertSqlWithLOBEx(const char* sql_insert, const char* sql_select, const SEQLOBValueType& seq_lob_value, SEQDBErrorStru& out_db_error, short rep_flag); + short UpdateSqlWithLOBEx(const char* sql_update, const char* sql_select, const SEQLOBValueType& seq_lob_value, SEQDBErrorStru& out_db_error, short rep_flag); + short ExecuteSqlUsingGSEx(const char* sql_str, SEQDBErrorStru& out_db_error, short rep_flag); + short ExecuteMultiSqlUsingGSEx(int sql_num, const StrSeq& seq_sql_str, SEQExecMultiResultStru seq_exec_multi_result, short rep_flag); + //add for remote access + int SetDomainInfo(const DomainInfo& domain_info); //ԶϢͨã + int SetDomainInfo(const char* domain_name, const tSecLabel& sec_label, const int app_no = AP_DATA_SRV, const int ctx_no = AC_REALTIME_NO); + int SetDomainName(const char* domain_name); // + int SetSecLabel(tSecLabel& sec_label); //ñǩ + void ClearDomainName(); //m_DomainNameΪlocal_domain +private: + DomainInfo m_DomainInfo; + ServiceInfo m_Serviceinfo; + char m_IpAddress[64]; + int m_Port; + Handle m_Handle; + char m_HostName[64]; + int m_RequestTimeoutSeconds; + + int SetServiceHost(); + int GetHostByAppNo(char* host_name, const int app_no, const short context_no); +}; +//} + +#endif + diff --git a/code/sys_nicmonitor/include/db_com/sql_sp_define.h b/code/sys_nicmonitor/include/db_com/sql_sp_define.h new file mode 100644 index 0000000..71c52b4 --- /dev/null +++ b/code/sys_nicmonitor/include/db_com/sql_sp_define.h @@ -0,0 +1,210 @@ +// +// Created by wutao on 2020/1/7. +// + +#ifndef SQL_SP_DLL_SQL_SP_DEFINE_H +#define SQL_SP_DLL_SQL_SP_DEFINE_H + +#include +#include + +using namespace std; + +namespace SQL_SP_DEFINE +{ + const short C_DATATYPE_DEFAULT = 0; + const short C_DATATYPE_STRING = 1; + const short C_DATATYPE_UCHAR = 2; + const short C_DATATYPE_SHORT = 3; + const short C_DATATYPE_INT = 4; + const short C_DATATYPE_DATETIME = 5; + const short C_DATATYPE_FLOAT = 6; + const short C_DATATYPE_DOUBLE = 7; + const short C_DATATYPE_KEYID = 8; + const short C_DATATYPE_BINARY = 9; + const short C_DATATYPE_TEXT = 10; + const short C_DATATYPE_IMAGE = 11; + const short C_DATATYPE_APPKEYID = 12; + const short C_DATATYPE_APPID = 13; + const short C_DATATYPE_UINT = 14; + const short C_DATATYPE_LONG = 15; + const short C_DATATYPE_RTDBKEY = 16; + const short C_DATATYPE_MEASRTDBKEY = 17; + const short C_DATATYPE_APPRTDBKEY = 18; + + // public_m + typedef vector VEC_STRING; + typedef vector VEC_LONG; + typedef vector VEC_SHORT; + typedef vector VEC_CHAR; + typedef long KEY_ID; + + struct APP_KEY_ID + { + int app_id; + KEY_ID key_id; + }; + + typedef APP_KEY_ID APP_ID; + + struct RTDB_KEY + { + long table_id; + long region_record_column_id; + }; + + struct APP_RTDB_KEY + { + int app_id; + RTDB_KEY rtdbkey_id; + }; + + struct DATA_VALUE + { + private: + union + { + char* c_string; + unsigned char c_uchar; + short c_short; + int c_int; + long c_time; + float c_float; + double c_double; + KEY_ID c_keyid; + VEC_CHAR* c_binary; + VEC_CHAR* c_text; + VEC_CHAR* c_image; + APP_KEY_ID c_appkeyid; + APP_ID c_appid; + char c_default; + unsigned int c_uint; + long c_long; + RTDB_KEY c_rtdbkey; + RTDB_KEY c_measrtdbkey; + APP_RTDB_KEY c_apprtdbkey; + }__u_val; + bool __u_init; + unsigned short __u_index; + public: + DATA_VALUE(); + ~DATA_VALUE(); + DATA_VALUE(const DATA_VALUE&); + DATA_VALUE&operator=(const DATA_VALUE&); + short _d()const; + void __clear(); + void c_string(const char*); + void c_string(const string&); + const char*c_string()const; + void c_uchar(const unsigned char); + const unsigned char c_uchar()const; + void c_short(const short); + const short c_short()const; + void c_int(const int); + const int c_int()const; + void c_time(const long); + const long c_time()const; + void c_float(const float); + const float c_float()const; + void c_double(const double); + const double c_double()const; + void c_keyid(const KEY_ID); + const KEY_ID c_keyid()const; + void c_binary(const VEC_CHAR&); + const VEC_CHAR&c_binary()const; + VEC_CHAR&c_binary(); + void c_text(const VEC_CHAR&); + const VEC_CHAR&c_text()const; + VEC_CHAR&c_text(); + void c_image(const VEC_CHAR&); + const VEC_CHAR&c_image()const; + VEC_CHAR&c_image(); + void c_appkeyid(const APP_KEY_ID&); + const APP_KEY_ID&c_appkeyid()const; + APP_KEY_ID&c_appkeyid(); + void c_appid(const APP_ID&); + const APP_ID&c_appid()const; + APP_ID&c_appid(); + void c_default(const char); + const char c_default()const; + void c_uint(const unsigned int); + const unsigned int c_uint()const; + void c_long(const long); + const long c_long()const; + void c_rtdbkey(const RTDB_KEY&); + const RTDB_KEY&c_rtdbkey()const; + RTDB_KEY&c_rtdbkey(); + void c_measrtdbkey(const RTDB_KEY&); + const RTDB_KEY&c_measrtdbkey()const; + RTDB_KEY&c_measrtdbkey(); + void c_apprtdbkey(const APP_RTDB_KEY&); + const APP_RTDB_KEY&c_apprtdbkey()const; + APP_RTDB_KEY&c_apprtdbkey(); + }; + + typedef vector VEC_DATA_VALUE; + + struct DB_ERROR + { + unsigned int error_no; + string error_msg; + }; + + typedef vector VEC_DB_ERROR; + + // sql_sp_m + struct RESULT_DATA_VALUE + { + bool is_null; + DATA_VALUE data_value; + }; + + typedef vector VEC_RESULT_DATA_VALUE; + + struct RESULT_FIELD_INFO + { + short data_type; + short data_len; + char col_name[64]; + }; + + typedef vector VEC_RESULT_FIELD_INFO; + + struct OUT_DATA_TYPE + { + short out_field_position; + short out_field_datatype; + }; + + typedef vector VEC_OUT_DATA_TYPE; + + struct SELECT_RESULT + { + short field_num; + VEC_RESULT_FIELD_INFO field_info; + unsigned int data_num; + VEC_RESULT_DATA_VALUE data_value_seq; + }; + + struct EXEC_MULTI_RESULT + { + bool is_success; + DB_ERROR db_error; + }; + + typedef vector VEC_EXEC_MULTI_RESULT; + +// typedef VEC_CHAR LOB_VALUE_TYPE; +// typedef vec VEC_LOB_VALUE_TYPE; + + struct BIND_PARA + { + unsigned short dci_type; + unsigned int data_size; + }; + + typedef vector VEC_BIND_PARA; +} + + +#endif //SQL_SP_DLL_SQL_SP_DEFINE_H diff --git a/code/sys_nicmonitor/include/db_com/sql_sp_m.h b/code/sys_nicmonitor/include/db_com/sql_sp_m.h new file mode 100644 index 0000000..8d8993b --- /dev/null +++ b/code/sys_nicmonitor/include/db_com/sql_sp_m.h @@ -0,0 +1,84 @@ +//************************************** +// Generated by mcpp translator +// Version 1.2 +//************************************** + +#ifndef __SQL_SP_M_H__ +#define __SQL_SP_M_H__ + +#include"mcode/mvector.h" +#include"mcode/mstring.h" +#include"mcode/mstream.h" +#include"mcode/mclient.h" +#include"public_m.h" + + +const int QUERY_ALL_RESULT = -1; +struct TResultDataValue +{ + bool is_null; + UDataValue data_value; + void __write (MLang::OutputStream&__os)const; + void __read (MLang::InputStream&__is); +}; +typedef MLang::VECTOR SEQResultDataValue; +struct TResultFieldInfo +{ + short data_type; + short data_len; + char col_name[64]; + void __write (MLang::OutputStream&__os)const; + void __read (MLang::InputStream&__is); +}; +typedef MLang::VECTOR SEQResultFieldInfo; +struct TOutDataTypeStru +{ + short out_field_position; + short out_field_datatype; + void __write (MLang::OutputStream&__os)const; + void __read (MLang::InputStream&__is); +}; +typedef MLang::VECTOR SEQOutDataTypeStru; +struct TSelectResultStru +{ + short field_num; + SEQResultFieldInfo field_info; + unsigned int data_num; + SEQResultDataValue data_value_seq; + TSelectResultStru(); + TSelectResultStru (const TSelectResultStru&); + TSelectResultStru&operator= (const TSelectResultStru&); + void __write (MLang::OutputStream&__os)const; + void __read (MLang::InputStream&__is); +}; +struct TExecMultiResultStru +{ + bool is_success; + TDBErrorStru db_error; + TExecMultiResultStru(); + TExecMultiResultStru (const TExecMultiResultStru&); + TExecMultiResultStru&operator= (const TExecMultiResultStru&); + void __write (MLang::OutputStream&__os)const; + void __read (MLang::InputStream&__is); +}; +typedef MLang::VECTOR SEQExecMultiResultStru; +typedef CharSeq LOBValueType; +typedef MLang::VECTOR SEQLOBValueType; +struct TSEQLOBValueType +{ + SEQLOBValueType seq_lob_value; + TSEQLOBValueType(); + TSEQLOBValueType (const TSEQLOBValueType&); + TSEQLOBValueType&operator= (const TSEQLOBValueType&); + void __write (MLang::OutputStream&__os)const; + void __read (MLang::InputStream&__is); +}; +struct TBindParaStru +{ + unsigned short dci_type; + unsigned int data_size; + void __write (MLang::OutputStream&__os)const; + void __read (MLang::InputStream&__is); +}; +typedef MLang::VECTOR SEQBindParaStru; +#endif diff --git a/code/sys_nicmonitor/include/db_com/sql_sp_send_client_base.h b/code/sys_nicmonitor/include/db_com/sql_sp_send_client_base.h new file mode 100644 index 0000000..5c33b43 --- /dev/null +++ b/code/sys_nicmonitor/include/db_com/sql_sp_send_client_base.h @@ -0,0 +1,125 @@ +//****************************************************************** +// +// AUTHOR : JiXuechun +// +// FUNCTION : SQL_SP_SERVER ̵Ŀͻ๫ඨ +// +// TIME : 2009.06.02 +// +// HISTORY : +// Datetime Action Author Reason +// ------------------------------------------------------------------- +// 2009.06.02 Creation JiXuechun +// 2011.01.13 Add ChenPeng ӱ󶨽ӿ +// 2011.09.23 Add CuiWeiYe ع캯 +//****************************************************************** + +#ifndef __SQL_SP_SEND_CLIENT_BASE_H__ +#define __SQL_SP_SEND_CLIENT_BASE_H__ + +#include "sql_sp_m.h" + +#include +#include +#include +#include +#include "servicesclient.h" +#include +#include "system.h" + +#define BIND_CHR 1 /* ַ unsigned char */ +#define BIND_INT 3 /* short int long */ +#define BIND_FLT 4 /* float double */ +#define BIND_STR 5 /* ַstring */ +#define BIND_ODT 156 /* date*/ + +using namespace std; + +//struct BindTime +//{ +// unsigned char TimeHH; /* hours; range is 0 <= hours <=23 */ +// unsigned char TimeMI; /* minutes; range is 0 <= minutes <= 59 */ +// unsigned char TimeSS; /* seconds; range is 0 <= seconds <= 59 */ +//}; +//typedef struct BindTime BindTime; + + +//struct BindDate +//{ +// unsigned short DateYYYY; /* gregorian year; range is -4712 <= year <= 9999 */ +// unsigned char DateMM; /* month; range is 1 <= month < 12 */ +// unsigned char DateDD; /* day; range is 1 <= day <= 31 */ +// BindTime DateTime; /* time */ +//}; +//typedef struct BindDate BindDate; + +//namespace SQL_SP_SERVER +//{ +class sql_sp_send_client_base +{ + public: + + sql_sp_send_client_base(); + sql_sp_send_client_base(int port); + sql_sp_send_client_base(int port, int seconds); + ~sql_sp_send_client_base(); + void SetRequestTimeout(int seconds); + + //add jihy for send + short ExecuteSqlForSend(const char* sql_str, + SEQDBErrorStru& out_db_error, + const char * domain_name); + + + short ExecuteBindForSend(const char * sql_str, + SEQBindParaStru &seq_bind_para, char * data_buffer, + char * null_flag_buffer, unsigned int row_num, + SEQDBErrorStru& out_db_error, + const char * domain_name); + + short ExecuteMultiSqlForSend(int sql_num, + const StrSeq& seq_sql_str, + SEQExecMultiResultStru& seq_exec_multi_result, + const char * domain_name); + //add end + + //add new interface + short ExecuteSqlForSend(const char* sql_str, + SEQDBErrorStru& out_db_error, + int app_no, + const char * proc_alias, + const char * domain_name); + + short ExecuteMultiSqlForSend(int sql_num, + const StrSeq& seq_sql_str, + SEQExecMultiResultStru& seq_exec_multi_result, + int app_no, + const char * proc_alias, + const char * domain_name); + //add end + + //add for remote access + int SetDomainInfo(const DomainInfo& domain_info); //ԶϢͨã + int SetDomainInfo(const char* domain_name, const tSecLabel& sec_label, const int app_no = AP_DATA_SRV, const int ctx_no = AC_REALTIME_NO); + int SetDomainName(const char* domain_name); // + int SetSecLabel(tSecLabel& sec_label); //ñǩ + void ClearDomainName(); //m_DomainNameΪlocal_domain + private: + DomainInfo m_DomainInfo; + ServiceInfo m_Serviceinfo; + char m_IpAddress[64]; + int m_Port; + Handle m_Handle; + char m_HostName[64]; + int m_RequestTimeoutSeconds; + + int SetServiceHost(); + int GetHostByAppNo(char* host_name, const int app_no, const short context_no); + int getOperatorType(string sql_str,string & operator_type); +}; +//} + +#endif + + + diff --git a/code/sys_nicmonitor/include/db_com/sql_syntax_anls.h b/code/sys_nicmonitor/include/db_com/sql_syntax_anls.h new file mode 100644 index 0000000..da96448 --- /dev/null +++ b/code/sys_nicmonitor/include/db_com/sql_syntax_anls.h @@ -0,0 +1,179 @@ +//****************************************************************** +// +// AUTHOR : ZhaoTiger +// +// FUNCTION : ͨSQLͷļ﷨ +// +// TIME : 2003.10.21 +// +// HISTORY : ӺĹʽ +// Datetime Action Author Reason +// ----------------------------------------------------------------- +// 2003.10.21 Creation ZhaoTiger +// +//****************************************************************** + +#ifndef __SQL_SYNTAX_ANLS_H__ +#define __SQL_SYNTAX_ANLS_H__ + +#ifdef _WINDOWS32 +#ifdef SQL_ANALYSER_EXPORTS +#define SQL_ANALYSER_API __declspec(dllexport) +#else +#define SQL_ANALYSER_API __declspec(dllimport) +#endif +#else +#define SQL_ANALYSER_API +#endif + +#include "lexical_anls.h" + +using namespace std; + +namespace SQL_ANALYSER +{ + +//sql﷨ +class SQL_ANALYSER_API CSqlSyntaxAnalyser +{ +private : + //ʷ + CLexicalAnalyser m_LxcAnls; + + //ֺϢ + vector m_AnlsColInfo; + + //ƼǷСд + bool m_CaseSensitive; + + //ôʷһεõǰһʵķ + LEXICAL_RET_RES_STRU m_LexicalRetRes; + + //Ϣ + char m_ErrMsg[MAX_ERRMSG_LEN]; + + // ﷨ + TSqlAnlsResult m_SqlAnlsResult; + + void ErrorProcess(); + void FatalProcess(); + + // WHEREӾ֮ǰSQL + bool SqlExpression(); + + // SELECTӾ + bool SelectExpression(); + + // INSERTӾ + bool InsertExpression(); + + // DELETEӾ + bool DeleteExpression(); + + // UPDATEӾ + bool UpdateExpression(); + + // SELECTеORDER BY Ӿ + bool OrderByExpression(); + + // WHEREӾ + bool WhereExpression(); + + //SQLеwhereʽеġor + bool OrExpression(ITEM_STRU *attribute_ptr); + + //ʽе"and" + bool AndExpression(ITEM_STRU *attribute_ptr); + + //ʽе"not" + bool NotExpression(ITEM_STRU *attribute_ptr); + + //SQLеwhereʽеġLike""As + bool FuzzyExpression(ITEM_STRU *attribute_ptr) ; + + //ʽе>>=<<=<>!==ȱȽ + bool CompareExpression(ITEM_STRU *attribute_ptr); + + //ʽе+- + bool SimpleExpression(ITEM_STRU *attribute_ptr); + + //ʽе*/%&|^ + bool Term(ITEM_STRU *attribute_ptr); + + //ʽе! ~- + bool SingleItemExpression(ITEM_STRU *attribute_ptr); + + //ʽ + bool Factor(ITEM_STRU *attribute_ptr); + + //õWHERE֮ǰijϢ + bool GetConstInfo(const LEXICAL_RET_RES_STRU & lexi_ret_res, TConstInfo & const_info); + + //TIMESTR + bool GetConstTimeStr(long & time_long); + + //TIMEINT + bool GetConstTimeInt(long & time_long); + + bool GetConstRtdbKey(_RTDB_KEY_STRU &rtdbkey_value); + + bool GetConstMeasRtdbKey(_RTDB_KEY_STRU &measrtdbkey_value); + + bool GetConstAppRtdbKey(_APP_KEY_STRU &apprtdbkey_value); + + //ŵֵ + bool GetConstSignedNumber(const int sign_symbol, TConstInfo & const_info); + + bool IsNumericalDataType(const short data_type); + bool IsCanAddDataType(const short data_type); + bool IsIntegralDataType(const short data_type); + bool IsCanCompareDataType(const short data_type); + bool IsCanLikeDataType(const short data_type); + bool IsCanCompareTwoType(const short data_type_1, const short data_type_2); + + //ͽиֵԵƥ + bool IsCanEvaluateTwoType(const short data_type_1, const short data_type_2); + + //WHEREӾ沨 + bool EnterWhereCode(const TWhereAntiPorland & one_code); + + //ݱʶϢвѯǷǺϷ + bool IsIdenALegalColumn(const char * iden_name); + + //ݱʶϢвѯǷǺϷҵõԽͼ + bool GetIdenDataType(const char * iden_name, short & data_type); + + //תɴд + void UpperString(char * str); + + //תСд + void LowerString(char * str); + +public: + + // + void GetError(char * err_msg); + + // Ԥ̣SQLıSQLͣӶõ÷֯ñеϢ﷨ͼ + bool SqlPreAnalysProcess(char * table_name, int & sql_type); + + // ʼSQL﷨ + bool SqlAnalysProcess(); + + // ʼ + bool Initialize(const char *source); + + // Ϣ + void PutAnalysColumnInfo(const bool need_transfer, const vector & anls_col_info, const bool case_sensitive = true); + + // + void ExportTable(TSqlAnlsResult &sql_anls_result); + + // ݲõȼ + int GetOperatorClass(const int operator_code); + +}; + +} + +#endif diff --git a/code/sys_nicmonitor/include/db_com/sql_to_cime.h b/code/sys_nicmonitor/include/db_com/sql_to_cime.h new file mode 100644 index 0000000..b978e9e --- /dev/null +++ b/code/sys_nicmonitor/include/db_com/sql_to_cime.h @@ -0,0 +1,170 @@ +#ifndef _SQL_TO_CIME_H +#define _SQL_TO_CIME_H + +#include +#include +#include +#include +#include +#include +//#include +//#include + + +#include "db_com/CFindFile.h" + +#include "db_com/db_error_define.h" +#include "db_com/DBAccess.h" +#include "db_com/sql_syntax_anls.h" +#include "db_com/interpreter_define.h" +#include "db_com/interpreter_struct.h" +#include "db_com/db_extern.h" +#include "db_com/server_define.h" +#include "db_com/sql_sp_client_base.h" +#include "db_com/CSqlResultAlignClient.h" +#include "db_com/CSqlResultAlign.h" +#include "paramanage.h" + +#define ANLS_ERR -1 +#define NO_TABLE 2 +//const int SCAN_DIR_NUM_ONE_TIME = 1; +const int SCAN_FILE_NUM_TIME = 360; + + + + + + +#define uchar unsigned char +using namespace std; +using namespace SQL_ANALYSER; + +typedef vector VECAnalysColumnInfo; + +// ޸ʱϢ +struct TModifiedColumn_str +{ + short column_id; + char column_name[32]; + char column_name_chn[64]; + uchar column_type; + short column_length; + uchar is_key; + uchar allow_null; + int app_type; + uchar reference_mode;//Ƿ zhangkeheng add 2005.08.18 + int column_special;// + int reserved_1;//Ƿģͬ +}; +typedef vector VModifiedColumn_str; +//select a.table_name_eng,b.column_id, b.column_name_eng, b.column_name_chn, b.data_type,b.data_length, b.is_key, b.allow_null, b.app_type, b.reference_mode, b.column_special, b.reserved_1 +// ޸ʱϢ +struct TModifiedColumn_str_ex +{ + char table_name_eng[32]; + short column_id; + char column_name[32]; + char column_name_chn[64]; + uchar column_type; + short column_length; + uchar is_key; + uchar allow_null; + int app_type; + uchar reference_mode;//Ƿ zhangkeheng add 2005.08.18 + int column_special;// + int reserved_1;//Ƿģͬ +}; +typedef vector VModifiedColumn_str_ex; + +// ѯʱҪõĽָṹ +//struct TQueryResultPtr +struct TQueryResultPtr_str +{ + char *result_link_ptr; + char *result_data_ptr; + short *result_indicator_ptr; + TResultHead *result_head_ptr; + TFieldInfo *field_info_ptr; +}; + +//struct TTableColumnStu +struct TTableColumnStu +{ + int table_no; + string table_name; + VModifiedColumn_str all_col_vec; + VECAnalysColumnInfo anls_col_vec; +}; +struct OperaStru +{ + + char sql[512]; //sql + char table_name[512]; // + int operate; // insert update delete + string value; //ֵ + string attribute; // + long index_id; //id + bool disp_flag; //Ƿʾ +}; + +struct TTableInf +{ + int table_no; // + char table_name_eng[32]; + int reserved_4; //Ƿ +}; + + +class analytic +{ +public: + analytic(CDbAccess* db_access); + ~analytic(); + CDbAccess* m_db_access; +protected: + + string area_str ; + string cime_type ; + ofstream m_outFileStream; + ofstream m_outLogStream; + + map m_allSql; //sql sql + map m_out; //תĽṹ + map m_relation; //¼IdͲ磬delete insert update ϲ + vector v_all_Op; //е + map m_all_tableInf; + map m_all_coluInf; + map m_all_coluInf_ex; + + map m_sys_table; + map m_colum; + + vector m_all_sql; + string m_file_path; + string m_file_name; + +// string m_new_file_path="/data/sqltocime"; + +public: + + int WriteToFile(string &filePath); + void setPath(const string &filePath); +protected: + int GetDbConfig(); + string space(); + bool close(); + string eraseNull( string text); + bool open(string &fullFilePath, string &fullLogPath); + string GetTimeStringBySeconds(long seconds); + int sqlAnaly(const char* sql_str); + bool GetTableColInfoByTableName(const char * table_name, TTableColumnStu & table_column_info); + void DeleteQueryResultPtr(TQueryResultPtr_str & query_result_ptr_stru); + void NewQueryResultPtr(TQueryResultPtr_str & query_result_ptr_stru); + bool init(map &all_coluInf_ex); + int GetFilesql(vector& v_all_sql,string & m_new_file_path); + void PrintExportResult(const char * sql_str, const TSqlAnlsResult & sql_anls_result); + void WhiteSpace(string &str); + int readFile(const char* filePath,const char* key,vector& v_all_sql); +}; + +#endif diff --git a/code/sys_nicmonitor/include/db_com/sqlite_access.h b/code/sys_nicmonitor/include/db_com/sqlite_access.h new file mode 100644 index 0000000..93cecd7 --- /dev/null +++ b/code/sys_nicmonitor/include/db_com/sqlite_access.h @@ -0,0 +1,375 @@ +/************************************************* + Copyright (C), 1988-1999, Nari Tech. Co., Ltd. + File name: sqlite_access_interface.h + Author: LH + Version: 1.0 + Date: 2012.6.4 + Description: sqliteװӿ + Function List: + + Datetime Action Author Modify + ------------------------------------------------------------------- + 2012.6.4 Creation LH + +*************************************************/ +#ifndef SQLITE_ACCESS_H_ +#define SQLITE_ACCESS_H_ + +#include "sqlite3.h" +#include +#include +#include +#include + +using namespace std; + +#define DB_SUCCESS 0 +#define DB_FAIL -1 +#define DB_NO_DATA 100 + +#define DB_AUTO_LOGOFF 0 +#define DB_MANUAL_LOGOFF 1 + +#define DB_STATUS_CONNECT 0 +#define DB_STATUS_DISCONNECT 1 + +#define GET_ALL_RESULT -1 + +#define LOGIN_DEFAULT_MODE 0 +#define LOGIN_THREADED_MODE 1 + +//ͳһC +#define DB_DATATYPE_STRING 1 +#define DB_DATATYPE_UCHAR 2 +#define DB_DATATYPE_SHORT 3 +#define DB_DATATYPE_INT 4 +#define DB_DATATYPE_DATETIME 5 +#define DB_DATATYPE_FLOAT 6 +#define DB_DATATYPE_DOUBLE 7 +#define DB_DATATYPE_KEYID 8 +#define DB_DATATYPE_BINARY 9 +#define DB_DATATYPE_TEXT 10 +#define DB_DATATYPE_IMAGE 11 +#define DB_DATATYPE_APPKEYID 12 +#define DB_DATATYPE_APPID 13 + +#define DB_DATATYPE_LONG 15 + +#define MAX_COL_NUMBER 1024 +#define MAX_LOB_NUMBER 1024 +#define MAX_COLNAME_LENGTH 255 +#define MAX_PROCNAME_LENGTH 255 +#define MAX_SQL_LENGTH 10240 +#define QUERY_RECORD_BUF 102400 // ¼Ԥڴ100K + +#ifdef _ALPHA +#define READ_BUFSIZE 204800 // +#endif +#ifdef _IBM +#define READ_BUFSIZE 204800 // +#endif +#ifdef _SUN +#define READ_BUFSIZE 102400 // +#endif +#ifdef _HPUX +#define READ_BUFSIZE 204800 // +#endif +#ifdef _LINUX +#define READ_BUFSIZE 204800 // +#endif + +struct TResultHead +{ + int field_num; + int field_size; + int data_num; + int data_size; + int record_length; + int reach_max; +}; + +struct TFieldInfo +{ + short field_type; + short field_length; +}; + +struct TFieldAttr { + char colName[64]; + unsigned int colNameLen; + unsigned short field_type; + unsigned int field_len; + unsigned char field_precision; + signed char field_scale; + TFieldAttr() + { + memset(this,0,sizeof(TFieldAttr)); + } +}; + +//LOBʹõResultHead +struct TLOBResultHead +{ + int field_num; + int field_size; + int data_num; + int data_size; + vector record_length_vec; //data_num==0record_length_vec + int reach_max; +}; + +//LOBʹõFieldInfo +struct TLOBFieldInfo +{ + short field_type; + vector field_length_vec; //field_length_vec.sizeTLOBResultHeadеdata_num //data_num == 0, field_length_vec.size = 1 +}; + +//Ϣṹ +struct TErrorMsg +{ + int err_no; //DBAccess + string dbaccess_err; //DBAccessϢ + string db_err; //ݿϢ +}; + +// Define the KeyID_Type's Description +struct TKeyidType +{ + int record_id; + short column_id; +}; + +struct TAppKeyidType +{ + long key_id; + int app_id; +}; + +// Define the AppID_Type's Description +struct TAppidType +{ + int app_id; + int record_id; +}; + +// LOBݽṹ +struct TLOBContent +{ + unsigned char *lob_content; + int lob_content_size; +}; + +typedef map UserSpecTypeMap; + +class SqliteAccess +{ +public: + //캯auto_logoff == true ޲ʱҪʾLogoffе + //֮ҪʾLogoffעݿ¼ûͷ + SqliteAccess(bool auto_logoff = true); + ~SqliteAccess(); + +private: + void stripWhiteSpace(string &str); + + int PrintError(string &err_string); + + int PrepareOneSentence(sqlite3_stmt* &stmt, const char *query_string, vector &err_vec); + + int FreeOneStatement(sqlite3_stmt* &stmt, vector &err_vec); + + int ExecuteOneSelectSentence(sqlite3_stmt* &stmt, bool &is_no_record, vector &err_vec); + + int ExecuteOneModifySentence(sqlite3_stmt* &stmt, vector &err_vec); + + void GetSelectColNum(sqlite3_stmt* &stmt, int &num_cols); + + int GetSingleColInfo(sqlite3_stmt *stmt, int col_num, TFieldAttr &field_attr, string &column_decltype, string &field_precision, string &field_scale, string &field_len, vector &err_vec); + + TKeyidType* ConvertKeyidToStruct(char *keyid); + + TAppKeyidType* ConvertAppKeyidToStruct(char *keyid); + + TAppidType* ConvertAppidToStruct(char *keyid); + + int ConvertSQLDateToTimet(char* date_ptr,time_t *osdate); +public: + /*--------------------------------------------------------------------------------- + - : ݿע + - : server: + - : err_vec: 󷵻ؽṹVector + - : DB_SUCCESS: ɹ + DB_FAIL: ʧ + ----------------------------------------------------------------------------------*/ + int Login(char *server, vector &err_vec); + + /*--------------------------------------------------------------------------------- + - : ݿע + - : + - : err_vec: 󷵻ؽṹVector + - : DB_SUCCESS: ɹ + DB_FAIL: ʧ + ----------------------------------------------------------------------------------*/ + int Logoff(vector &err_vec); + + /*--------------------------------------------------------------------------------- + - : ȡSQLѯؽ(LOB) + - : query_string: SQLѯ + max_result: GET_ALL_RESULTʾȡ + user_type_map: ûָͣMAP + - : result_link: ָ + result_indicator ǷΪָ + err_vec: 󷵻ؽṹVector + result_link_length ڴ鳤 + result_indicator_length ڴ鳤 + - : DB_SUCCESS: ɹ + DB_FAIL: ʧ + ----------------------------------------------------------------------------------*/ + + int GetQueryResult(char *query_string, + int max_result, + UserSpecTypeMap user_type_map, + char *&result_link, + signed short *&result_indicator, + vector &err_vec, + int &result_link_length, + int &result_indicator_length + ); + + /*--------------------------------------------------------------------------------- + - : ȡHEADFIELDDATAָ + - : result_link: ָ + - : result_head_ptr: HEADָ + field_info_ptr: FIELDָ + data_ptr: DATAָ + err_vec: 󷵻ؽṹVector + - : DB_SUCCESS: ɹ + DB_FAIL: ʧ + ----------------------------------------------------------------------------------*/ + int GetQueryHead( char *result_link, + TResultHead *&result_head_ptr, + TFieldInfo *&field_info_ptr, + char *&data_ptr, + vector &err_vec); + + /*--------------------------------------------------------------------------------- + - : ִSQLύ + - : cmd_string: SQL + - : err_vec: 󷵻ؽṹVector + - : DB_SUCCESS: ɹ + DB_FAIL: ʧ + ----------------------------------------------------------------------------------*/ + int ExecuteCommandWithCommit(char *cmd_string, vector &err_vec); + + + /*--------------------------------------------------------------------------------- + - : ִаLOBݵINSERTύ + - : insert_string: INSERT(LOB) + select_string: ӵSELECT FOR UPDATE(ֻҪдLOB) + lob_vec: LOBVector + - : err_vec: 󷵻ؽṹVector + - : DB_SUCCESS: ɹ + DB_FAIL: ʧ + + - ˵ + 1insert_string + ORACLE"insert into my_test_lob(id,clob_content,blob_content) + values(1,empty_clob(),empty_blob())" + SYBASE"insert into my_test_lob(id,clob_content,blob_content) + values(1,'','')" + ҪselectиLOBעⲻҪInsertнLOBΪգNULL + ORACLEʹempty_clob()empty_blob()EMPTY + SYBASEʹ''EMPTY + 2select_string + ORACLE"select clob_content,blob_content from my_test_lob where id = 1 for update" + SYBASE"select clob_content,blob_content from my_test_lob where id = 1" + ע⣺whereӾ䲻Ӧinsertе½Ԥ + ORACLE for updateؼDZ + 3lob_vecLOBʵݣlob_vec.size()select_stringLOBĸһ + + ----------------------------------------------------------------------------------*/ + int ExecuteInsertCommandWithLOB(const char *insert_string, const char *select_string, + const vector &lob_vec, vector &err_vec); + + + /*--------------------------------------------------------------------------------- + - : ȡSQLѯؽ(LOB) + - : query_string: SQLѯ + max_result: GET_ALL_RESULTʾȡ + user_type_map: ûָͣMAP + עLOB޷ָ + - : result_link: ָ + result_indicator ǷΪָ + err_vec: 󷵻ؽṹVector + - : DB_SUCCESS: ɹ + DB_FAIL: ʧ + - ˵ + 1SYBASEݿҪLOB򶼱BINDͨ򣩵ĺ + ͳһҪquery_stringеLOB֮ͨ + ----------------------------------------------------------------------------------*/ + int GetQueryResultWithLOB( const char *query_string, + int max_result, + UserSpecTypeMap user_type_map, + char *&result_link, + signed short *&result_indicator, + TLOBResultHead *&result_head_ptr, + TLOBFieldInfo *&field_info_ptr, + vector &err_vec, + int &result_link_length, + int &result_indicator_length + ); + + /*--------------------------------------------------------------------------------- + - : ȡHEADFIELDDATAָ(LOB) + - : result_link: ָ + - : result_head_ptr: HEADָ룬ӦTLOBResultHeadṹ + field_info_ptr: FIELDָ룬ӦTLOBFieldInfoṹ + data_ptr: DATAָ + err_vec: 󷵻ؽṹVector + - : DB_SUCCESS: ɹ + DB_FAIL: ʧ + ----------------------------------------------------------------------------------*/ + int GetQueryHeadWithLOB( char *result_link, + TLOBResultHead *&result_head_ptr, + TLOBFieldInfo *&field_info_ptr, + char *&data_ptr, + vector &err_vec); + + /*--------------------------------------------------------------------------------- + - : ִаLOBݵUPDATEύ + - : update_string: UPDATE(LOB) + select_string: ӵSELECT FOR UPDATE(ֻҪдLOB) + lob_vec: LOBVector + - : err_vec: 󷵻ؽṹVector + - : DB_SUCCESS: ɹ + DB_FAIL: ʧ + - ˵ + 1update_string + ORACLE"update my_test_lob set blob_content = empty_blob() where id = 1" + SYBASE"update my_test_lob set blob_content = '' where id = 1" + ҪselectиLOBעⲻҪUpdateнLOBΪգNULL + ORACLEʹempty_clob()empty_blob()EMPTY + SYBASEʹ''EMPTY + 2select_string + ORACLE"select clob_content,blob_content from my_test_lob where id = 1 for update" + SYBASE"select clob_content,blob_content from my_test_lob where id = 1" + ע⣺whereӾ䲻Ӧupdateе½Ԥ + 2lob_vecLOBʵݣlob_vec.size()select_stringLOBĸһ + ----------------------------------------------------------------------------------*/ + int ExecuteUpdateCommandWithLOB( const char *update_string, + const char *select_string, + const vector &lob_vec, + vector &err_vec + ); +private: + sqlite3 *m_db_handle; + +private: + int m_Status; + int m_LoginMode; + int m_LogoffFlag; +}; + + +#endif /* SQLITE_ACCESS_INTERFACE_H_ */ diff --git a/code/sys_nicmonitor/include/db_com/sqlite_server_client.h b/code/sys_nicmonitor/include/db_com/sqlite_server_client.h new file mode 100644 index 0000000..28c7712 --- /dev/null +++ b/code/sys_nicmonitor/include/db_com/sqlite_server_client.h @@ -0,0 +1,156 @@ +/* + * sqlite_server_client.h + * + * Created on: 2012-6-6 + * Author: LH + */ + +#ifndef SQLITE_SERVER_CLIENT_H_ +#define SQLITE_SERVER_CLIENT_H_ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include "pthread.h" +#include "system.h" +#include "sam_service.h" +#include "servicesclient.h" +#include "pub_ctx.h" + +using namespace std; + +//Ϣṹ +struct TSqliteErrorMsg +{ + int err_no; //DBAccess + string db_err; //ݿϢ +}; + +//LOBʹõResultHead +struct TSqliteLOBResultHead +{ + int field_num; + int field_size; + int data_num; + int data_size; + vector record_length_vec; //data_num==0record_length_vec + int reach_max; +}; + +//LOBʹõFieldInfo +struct TSqliteLOBFieldInfo +{ + short field_type; + vector field_length_vec; //field_length_vec.sizeTLOBResultHeadеdata_num + //data_num == 0, field_length_vec.size = 1 +}; + +struct TSqliteLOBContent +{ + unsigned char *lob_content; + int lob_content_size; +}; + +class SqliteServerClient +{ +public: + SqliteServerClient(char *db_service); + SqliteServerClient(char *db_service, int seconds); + ~SqliteServerClient(); + void SetRequestTimeout(int seconds); + int SetHostName(char * host_name); +public: + /*--------------------------------------------------------------------------------- + - : ȡSQLѯؽ(LOB) + - : query_string: SQLѯ + max_result: GET_ALL_RESULTʾȡ + user_type_map: ûָͣMAP + - : result_link: ָ + result_indicator ǷΪָ + err_vec: 󷵻ؽṹVector + - : DB_SUCCESS: ɹ + DB_FAIL: ʧ + ----------------------------------------------------------------------------------*/ + + int GetQueryResult(char *query_string, + int max_result, + map user_type_map, + char *&result_link, + signed short *&result_indicator, + vector &err_vec + ); // fun_no=1; + + /*--------------------------------------------------------------------------------- + - : data_srvύִSQL + - : cmd_string: SQL + - : err_vec: 󷵻ؽṹVector + - : DB_SUCCESS: ɹ + DB_FAIL: ʧ + ----------------------------------------------------------------------------------*/ + int ExecuteCommandWithCommitToMaster(char *cmd_string, vector &err_vec); // fun_no=2 + + /*--------------------------------------------------------------------------------- + - : data_srvύִSQL + - : cmd_string: SQL + - : err_vec: 󷵻ؽṹVector + - : DB_SUCCESS: ɹ + DB_FAIL: ʧ + ----------------------------------------------------------------------------------*/ + int ExecuteCommandWithCommitToSlave(Handle async_commit_handle, char *cmd_string, vector &err_vec); // fun_no=3; + + int FetchDBFileByHostName(char *host_name, vector &err_vec); // fun_no=4; + + int ExecuteInsertCommandWithLOB(const char *insert_string, const char *select_string, + const vector &lob_vec, vector &err_vec); // fun_no=5 + + int ExecuteInsertCommandWithLOBToSlave(const char *insert_string, const char *select_string, + const vector &lob_vec, vector &err_vec); // fun_no=7 + + int ExecuteUpdateCommandWithLOB( const char *update_string, + const char *select_string, + const vector &lob_vec, + vector &err_vec + ); // fun_no=6 + + int ExecuteUpdateCommandWithLOBToSlave( const char *update_string, + const char *select_string, + const vector &lob_vec, + vector &err_vec + ); // fun_no=8 + + int GetQueryResultWithLOB(const char *query_string, + int max_result, + map user_type_map, + char *&result_link, + signed short *&result_indicator, + TSqliteLOBResultHead &result_head_ptr, + TSqliteLOBFieldInfo &field_info_ptr, + vector &err_vec + ); // fun_no=9 + +private: + int SetServiceHost(int policy); //򱸻 1 2 + int GetHostByAppNo(char* host_name, const int app_no, const short context_no, const int policy); + +private: + ServiceInfo m_Serviceinfo; + char m_IpAddress[64]; + int m_Port; + Handle m_Handle; + char m_HostName[64]; + CServicesManage* m_ServicesManage; + + pthread_mutex_t m_mutex; + bool is_sethostname; + int m_RequestTimeoutSeconds; +}; + + + +#endif /* SQLITE_SERVER_CLIENT_H_ */ diff --git a/code/sys_nicmonitor/include/db_com/sqlite_srv_m.h b/code/sys_nicmonitor/include/db_com/sqlite_srv_m.h new file mode 100644 index 0000000..6b9a3be --- /dev/null +++ b/code/sys_nicmonitor/include/db_com/sqlite_srv_m.h @@ -0,0 +1,90 @@ +//************************************** +// Generated by mcpp translator +// Version 1.2 +//************************************** + +#ifndef __SQLITE_SRV_M_H__ +#define __SQLITE_SRV_M_H__ + +#include"mcode/mvector.h" +#include"mcode/mstring.h" +#include"mcode/mstream.h" +#include"mcode/mclient.h" +#include"public_m.h" + + +const int QUERY_ALL_RESULT = -1; +struct TResultDataValue +{ + bool is_null; + UDataValue data_value; + void __write(MLang::OutputStream&__os)const; + void __read(MLang::InputStream&__is); +}; +typedef MLang::VECTOR SEQResultDataValue; +struct TResultFieldInfo +{ + short data_type; + short data_len; + void __write(MLang::OutputStream&__os)const; + void __read(MLang::InputStream&__is); +}; +typedef MLang::VECTOR SEQResultFieldInfo; +struct TOutDataTypeStru +{ + short out_field_position; + short out_field_datatype; + void __write(MLang::OutputStream&__os)const; + void __read(MLang::InputStream&__is); +}; +typedef MLang::VECTOR SEQOutDataTypeStru; +struct TSelectResultStru +{ + short field_num; + SEQResultFieldInfo field_info; + unsigned int data_num; + SEQResultDataValue data_value_seq; + TSelectResultStru(); + TSelectResultStru(const TSelectResultStru&); + TSelectResultStru&operator=(const TSelectResultStru&); + void __write(MLang::OutputStream&__os)const; + void __read(MLang::InputStream&__is); +}; +struct TExecMultiResultStru +{ + bool is_success; + TDBErrorStru db_error; + TExecMultiResultStru(); + TExecMultiResultStru(const TExecMultiResultStru&); + TExecMultiResultStru&operator=(const TExecMultiResultStru&); + void __write(MLang::OutputStream&__os)const; + void __read(MLang::InputStream&__is); +}; +typedef MLang::VECTOR SEQExecMultiResultStru; +struct TSQLiteLOBResultHeadStru +{ + int field_num; + int field_size; + int data_num; + int data_size; + MLang::VECTOR record_length_vec; + int reach_max; + TSQLiteLOBResultHeadStru(); + TSQLiteLOBResultHeadStru(const TSQLiteLOBResultHeadStru&); + TSQLiteLOBResultHeadStru&operator=(const TSQLiteLOBResultHeadStru&); + void __write(MLang::OutputStream&__os)const; + void __read(MLang::InputStream&__is); +}; +struct TSQLiteLOBFieldInfoStru +{ + short field_type; + MLang::VECTOR field_length_vec; + TSQLiteLOBFieldInfoStru(); + TSQLiteLOBFieldInfoStru(const TSQLiteLOBFieldInfoStru&); + TSQLiteLOBFieldInfoStru&operator=(const TSQLiteLOBFieldInfoStru&); + void __write(MLang::OutputStream&__os)const; + void __read(MLang::InputStream&__is); +}; +typedef CharSeq LOBValueType; +typedef MLang::VECTOR SEQLOBValueType; +#endif diff --git a/code/sys_nicmonitor/include/db_com/store_access_client.h b/code/sys_nicmonitor/include/db_com/store_access_client.h new file mode 100644 index 0000000..63cf88b --- /dev/null +++ b/code/sys_nicmonitor/include/db_com/store_access_client.h @@ -0,0 +1,206 @@ +#ifndef __HBASE_OPERATE_H +#define __HBASE_OPERATE_H + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "paramanage.h" + +#include "Hbase.h" + +#ifndef MAX_PARA_NAME_LEN +#define MAX_PARA_NAME_LEN 255 +#endif +#define RETURN_SUCCESS 0 +#define RETURN_FAIL -1 +#define TABLE_EXIST_FAIL -2 +#define VECTOR_EMPTY_FAIL -3 + +using namespace std; +using namespace apache::thrift; +using namespace apache::thrift::protocol; +using namespace apache::thrift::transport; +using namespace apache::hadoop::hbase::thrift; +namespace +{ + typedef vector StrVec; + //typedef vector ByteVec; + typedef map StrMap; + typedef vector ColVec; + typedef map ColMap; + typedef vector CellVec; + typedef map CellMap; + + static void printRow(const vector &rowResult) + { + for (size_t i = 0; i < rowResult.size(); i++) + { + cout << "row: " << rowResult[i].row << ", cols: "; + for (CellMap::const_iterator it = rowResult[i].columns.begin(); it != rowResult[i].columns.end(); ++it) + { + cout << it->first << " => " << it->second.value << "; "; + } + cout << endl; + } + } + + static void printVersions(const string &row, const CellVec &versions) + { + cout << "row: " << row << ", values: "; + for (CellVec::const_iterator it = versions.begin(); it != versions.end(); ++it) + { + cout << (*it).value << "; "; + } + cout << endl; + } + + static void split(const string& src, const string& separator, vector& dest) { + string str = src; + string substring; + string::size_type start = 0, index; + + do { + index = str.find_first_of(separator, start); + if (index != string::npos) { + substring = str.substr(start, index - start); + dest.push_back(substring); + start = str.find_first_not_of(separator, index); + if (start == string::npos) + return; + } + } while (index != string::npos); + + //the last token + substring = str.substr(start); + dest.push_back(substring); + } +} + +struct ip_port +{ + string ip; + int port; +}; + +class CGetThriftConf +{ +public: + CGetThriftConf(); + virtual ~CGetThriftConf(); + vector get_thift_conf(); +private: + string IntToStr(int nVal) + { + string strRet; + char buff[128]; + + sprintf(buff, "%d", nVal); + strRet = buff; + return strRet; + } +}; + +class CStoreAccessClient +{ +public: + CStoreAccessClient(); + CStoreAccessClient(vector ip_port_vec); + virtual ~CStoreAccessClient(); + +private: + boost::shared_ptr socket; + boost::shared_ptr transport; + boost::shared_ptr protocol; + HbaseClient *client; + + string m_service_host; + int m_service_port; + bool m_is_connected; + vector m_ip_port_vec; + string IntToStr(int nVal) + { + string strRet; + char buff[128]; + + sprintf(buff, "%d", nVal); + strRet = buff; + return strRet; + } +public: + //��HBase�������� + int Connect(); + + //��������HBase + int Connect(const string host, const int port); + + string GetIp(); + int GetPort(); + //�Ͽ���HBase������ + int Close(); + + //�������� + int CreateTable(const string tablename, vector col_vec); + + //ɾ������ + int DeleteTable(const string tablename); + + //�鿴HBase���Ƿ����ij���� + bool IsExist(const string tablename); + + //��ʾ������Ϣ + int ShowColumn(const string tablename); + + //��ʾ�����б�ʶ�� + int ShowQualifier(const string tablename, const string rowkey); + + //��ʾ���洢������Ϣ + int ShowAndStoreColumn(const string tablename, vector &column_name_vec); + + //��HBase�в���һ����¼ + int MutateRow(const string tablename, const string rowkey, vector mutations); + + //��HBase�в����������¼ + int MutateRows(const string tablename, vector BatchMutation); + + //ɾ��ij���е�ijЩ�� + int DeleteAll(const string tablename, const string rowkey, const string column); + + //ɾ���������� + int DeleteAllRow(const string tablename, const string rowkey); + + //ͨ��rowkey��ȡһ���м�¼ + int GetRow(vector &results, const string tablename, const string rowkey); + + // overload, add error_string + int GetRow(vector &results, const string tablename, const string rowkey, string & error_string); + + int GetRows(vector &results, const string tablename, const vector vec_rowkey); + + int GetRowWithColumns(vector &results, const string tablename, const string rowkey, const vector &columns); + + // overload, add error_string + int GetRowWithColumns(vector &results, const string tablename, const string rowkey, const vector &columns, string & error_string); + + int GetRowsWithColumns(vector &results, const string tablename, const vector vec_rowkey, const vector &columns); + + //ͨ��Rowkeyǰ׺Fliter��ȡ���� + int ScanDataByPrefix(vector &finalresults, const string tablename, const string Prefixrowkey, vector col_name_vec, const int one_time_rows = 10); + + //ͨ��RowKey�ķ�Χ��ȡ���� + int ScanDataByRange(vector &finalresults, const string tablename, const string startRowkey, const string endRowkey, vector col_name_vec, const int one_time_rows = 10); + + // overload, add error_string + int ScanDataByRange(vector &finalresults, const string tablename, const string startRowkey, const string endRowkey, vector col_name_vec, string & error_string, const int one_time_rows = 10); + + //ͨ��Filter�������ݵ�Scanner + int ScanDataByFilter(vector &finalresults, const string tablename, const string filterString, vector col_name_vec, const int one_time_rows = 10); +}; + +#endif diff --git a/code/sys_nicmonitor/include/db_com/trigger_sample_m.h b/code/sys_nicmonitor/include/db_com/trigger_sample_m.h new file mode 100644 index 0000000..ac4ebf2 --- /dev/null +++ b/code/sys_nicmonitor/include/db_com/trigger_sample_m.h @@ -0,0 +1,194 @@ +//************************************** +// Generated by mcpp translator +// Version 1.3 +//************************************** + +#ifndef __TRIGGER_SAMPLE_M_H__ +#define __TRIGGER_SAMPLE_M_H__ + +#include"mcode/mvector.h" +#include"mcode/mstring.h" +#include"mcode/mstream.h" +#include"mcode/mclient.h" +#include"public_m.h" + + +const short SAMPLE_DATATYPE_LONG = 0; +const short SAMPLE_DATATYPE_FLOAT = 1; +const short SAMPLE_DATATYPE_STRING = 2; +const short OFFERDATA_SAMPLE_MODE = 0; +const short UNPROMPTED_SAMPLE_MODE = 1; +struct USampleDataValue +{ +private: + union + { + MLang::Long c_long; + float c_float; + char* c_string; + }__u_val; + bool __u_init; + unsigned short __u_index; +public: + USampleDataValue(); + ~USampleDataValue(); + USampleDataValue(const USampleDataValue&); + USampleDataValue&operator=(const USampleDataValue&); + short _d()const; + void __clear(); + void __write(MLang::OutputStream&__os)const; + void __read(MLang::InputStream&__is); + void c_long(const MLang::Long); + const MLang::Long c_long()const; + void c_float(const float); + const float c_float()const; + void c_string(const char*); + void c_string(const MLang::STRING&); + const char*c_string()const; +}; +typedef MLang::VECTOR SEQSampleDataValue; +struct TSampleKeyIDInfo +{ + MLang::STRING keyid; + short keyid_datatype; + unsigned char is_key; + TSampleKeyIDInfo(); + TSampleKeyIDInfo(const TSampleKeyIDInfo&); + TSampleKeyIDInfo&operator=(const TSampleKeyIDInfo&); + void __write(MLang::OutputStream&__os)const; + void __read(MLang::InputStream&__is); +}; +typedef MLang::VECTOR SEQSampleKeyIDInfo; +struct TSampleProcessInfo +{ + MLang::STRING keyid; + short keyid_datatype; + USampleDataValue keyid_value; + bool is_valid; + MLang::STRING invalid_string; + TSampleProcessInfo(); + TSampleProcessInfo(const TSampleProcessInfo&); + TSampleProcessInfo&operator=(const TSampleProcessInfo&); + void __write(MLang::OutputStream&__os)const; + void __read(MLang::InputStream&__is); +}; +typedef MLang::VECTOR SEQSampleProcessInfo; +struct TSampleDefineRequest +{ + int sample_type; + MLang::Long app_no; + void __write(MLang::OutputStream&__os)const; + void __read(MLang::InputStream&__is); +}; +typedef MLang::VECTOR SEQSampleDefineRequest; +struct TSEQSampleDefineRequest +{ + int seq_length; + SEQSampleDefineRequest seq_sample_define_request; + TSEQSampleDefineRequest(); + TSEQSampleDefineRequest(const TSEQSampleDefineRequest&); + TSEQSampleDefineRequest&operator=(const TSEQSampleDefineRequest&); + void __write(MLang::OutputStream&__os)const; + void __read(MLang::InputStream&__is); +}; +struct TSampleDefineAnswer +{ + int sample_type; + MLang::Long app_no; + bool is_success; + TDBErrorStru error_info; + short keyid_num; + SEQSampleKeyIDInfo seq_keyid_info; + TSampleDefineAnswer(); + TSampleDefineAnswer(const TSampleDefineAnswer&); + TSampleDefineAnswer&operator=(const TSampleDefineAnswer&); + void __write(MLang::OutputStream&__os)const; + void __read(MLang::InputStream&__is); +}; +typedef MLang::VECTOR SEQSampleDefineAnswer; +struct TSEQSampleDefineAnswer +{ + int seq_length; + SEQSampleDefineAnswer seq_sample_define_answer; + TSEQSampleDefineAnswer(); + TSEQSampleDefineAnswer(const TSEQSampleDefineAnswer&); + TSEQSampleDefineAnswer&operator=(const TSEQSampleDefineAnswer&); + void __write(MLang::OutputStream&__os)const; + void __read(MLang::InputStream&__is); +}; +struct TSampleKeyIDValue +{ + MLang::STRING keyid; + short keyid_datatype; + USampleDataValue keyid_value; + TSampleKeyIDValue(); + TSampleKeyIDValue(const TSampleKeyIDValue&); + TSampleKeyIDValue&operator=(const TSampleKeyIDValue&); + void __write(MLang::OutputStream&__os)const; + void __read(MLang::InputStream&__is); +}; +typedef MLang::VECTOR SEQSampleKeyIDValue; +struct TSampleProcessRequest +{ + int sample_type; + MLang::STRING scn_name; + int scn_inst; + MLang::STRING sub_scn_name; + int sub_scn_inst; + MLang::Long app_no; + unsigned char sample_mode; + MLang::Long occur_time; + MLang::Long flag; + MLang::Long reserve_1; + MLang::Long reserve_2; + short keyid_num; + SEQSampleKeyIDValue seq_keyid_value; + TSampleProcessRequest(); + TSampleProcessRequest(const TSampleProcessRequest&); + TSampleProcessRequest&operator=(const TSampleProcessRequest&); + void __write(MLang::OutputStream&__os)const; + void __read(MLang::InputStream&__is); +}; +typedef MLang::VECTOR SEQSampleProcessRequest; +struct TSEQSampleProcessRequest +{ + MLang::Long seq_length; + SEQSampleProcessRequest seq_sample_process_request; + TSEQSampleProcessRequest(); + TSEQSampleProcessRequest(const TSEQSampleProcessRequest&); + TSEQSampleProcessRequest&operator=(const TSEQSampleProcessRequest&); + void __write(MLang::OutputStream&__os)const; + void __read(MLang::InputStream&__is); +}; +struct TSampleProcessAnswer +{ + int sample_type; + MLang::STRING scn_name; + int scn_inst; + MLang::STRING sub_scn_name; + int sub_scn_inst; + MLang::Long app_no; + unsigned char sample_mode; + MLang::Long occur_time; + short keyid_num; + SEQSampleProcessInfo seq_process_info; + bool is_success; + TDBErrorStru error_info; + TSampleProcessAnswer(); + TSampleProcessAnswer(const TSampleProcessAnswer&); + TSampleProcessAnswer&operator=(const TSampleProcessAnswer&); + void __write(MLang::OutputStream&__os)const; + void __read(MLang::InputStream&__is); +}; +typedef MLang::VECTOR SEQSampleProcessAnswer; +struct TSEQSampleProcessAnswer +{ + MLang::Long seq_length; + SEQSampleProcessAnswer seq_sample_process_answer; + TSEQSampleProcessAnswer(); + TSEQSampleProcessAnswer(const TSEQSampleProcessAnswer&); + TSEQSampleProcessAnswer&operator=(const TSEQSampleProcessAnswer&); + void __write(MLang::OutputStream&__os)const; + void __read(MLang::InputStream&__is); +}; +#endif diff --git a/code/sys_nicmonitor/include/db_com/trigger_sample_service_interface.h b/code/sys_nicmonitor/include/db_com/trigger_sample_service_interface.h new file mode 100644 index 0000000..938093a --- /dev/null +++ b/code/sys_nicmonitor/include/db_com/trigger_sample_service_interface.h @@ -0,0 +1,70 @@ +//****************************************************************** +// +// AUTHOR : ZhangKeHeng +// +// FUNCTION : TRIGGER_SAMPLE_SERVER ̵Ŀͻ๫ඨ +// +// TIME : 2004.03.23 +// +// HISTORY : +// Datetime Action Author Reason +// ------------------------------------------------------------------- +// 2004.03.23 Creation ZhangKeHeng +// 2012.02.03 Modify WangYuJun OPEN3000-->D5000 +//****************************************************************** + +#ifndef __TRIGGER_SAMPLE_SERVICE_INTERFACE_H__ +#define __TRIGGER_SAMPLE_SERVICE_INTERFACE_H__ + +#include "db_com/trigger_sample_m.h" +#include "servicemanage.h" +// 2018 +// #include "sam_service.h" +#include "sysadm/scn_service.h" +#include "pub_ctx.h" +#include "system.h" + +#include +#include +#include +#include +#include +using namespace NS_SYSADMIN; + +class trigger_sample_service_interface +{ +public: + //캯 + trigger_sample_service_interface(); + trigger_sample_service_interface(int specify_port); + trigger_sample_service_interface(int specify_port, int seconds); + + // + ~trigger_sample_service_interface(); + void SetRequestTimeout(int seconds); + + //õĽӿںӣIDLӳͷļж + short GetTriggerSampleDefine(const SEQSampleDefineRequest &seq_sample_define_request, SEQSampleDefineAnswer &seq_sample_define_answer); //1 + short PutTriggerSample(const SEQSampleProcessRequest &seq_sample_process_request, SEQSampleProcessAnswer &seq_sample_process_answer); //2 + //ONEWAY + short PutTriggerSampleOneWay(const SEQSampleProcessRequest &seq_sample_process_request); //3 + +private: + // ߳ʼServiceInfoϢIP˿ڡIdơ״̬ + ServiceInfo m_Serviceinfo; + DomainInfo m_DomainInfo; + char m_IpAddress[64]; + int m_Port; + Handle m_Handle; + char m_HostName[64]; + // 2018 + // CServicesManage* m_ServicesManage; + CScnService * m_scnsrv; + int m_RequestTimeoutSeconds; + + int GetHostByAppNo(char* host_name, const int app_no, const short context_no); + int SetServiceHost(); +}; + +#endif + diff --git a/code/sys_nicmonitor/include/db_com/wholepubtools.h b/code/sys_nicmonitor/include/db_com/wholepubtools.h new file mode 100644 index 0000000..1c253da --- /dev/null +++ b/code/sys_nicmonitor/include/db_com/wholepubtools.h @@ -0,0 +1,8 @@ +#include "CCharArray.h" +#include "CDataStream.h" +#include "CDbSem.h" +#include "CDbSemUse.h" +#include "CDbShm.h" +#include "CErrorLog.h" +#include "CFindFile.h" +#include "CPrecTime.h" diff --git a/code/sys_nicmonitor/include/db_com/wholesampledata.h b/code/sys_nicmonitor/include/db_com/wholesampledata.h new file mode 100644 index 0000000..68da592 --- /dev/null +++ b/code/sys_nicmonitor/include/db_com/wholesampledata.h @@ -0,0 +1,3 @@ +#include "public_m.h" +#include "sample_data_m.h" +#include "sample_data_client_base.h" diff --git a/code/sys_nicmonitor/include/db_com/wholesqlsp.h b/code/sys_nicmonitor/include/db_com/wholesqlsp.h new file mode 100644 index 0000000..4a85404 --- /dev/null +++ b/code/sys_nicmonitor/include/db_com/wholesqlsp.h @@ -0,0 +1,4 @@ +#include "public_m.h" +#include "sql_sp_m.h" +#include "sql_sp_client_base.h" +#include "CSqlResultAlignClient.h" diff --git a/code/sys_nicmonitor/include/log_api.h b/code/sys_nicmonitor/include/log_api.h new file mode 100644 index 0000000..7b87794 --- /dev/null +++ b/code/sys_nicmonitor/include/log_api.h @@ -0,0 +1,41 @@ +//****************************************************************************** +// ModuleName: Log management system +// FileName: log_api.h +// DESCRIPTION: common data struct definition +// FUNCTION LIST: +// COMMENT: public application +// History: +// Date Version Modifier Activities +// 2002-04-08 1.0 wkm modify +//============================================================================== +// 2002-09-01 1.0 zzs created +//****************************************************************************** + +#ifndef __LOG_API_H__ +#define __LOG_API_H__ + +#ifdef _WINDOWS64 + #ifdef PUB_EXPORTS + #define PUB_LIB_API __declspec(dllexport) + #else + #define PUB_LIB_API __declspec(dllimport) + #pragma comment(lib,"libpub.lib") + #endif +#else + #define PUB_LIB_API +#endif + +#include "log_define.h" + +//============================================================================== +// +// Log Api Functions +// +PUB_LIB_API int LogInit(const char* ProcName, const char* ProcAlias); +PUB_LIB_API int LogPrint(const int MsgLevel, const char* LogMsg); +PUB_LIB_API int LogPrintf(const int MsgLevel, const char* MsgFormat, ...); + +PUB_LIB_API int LogPrint(const char * file_name, const int line_no, const int msg_level, const char* log_msg); +PUB_LIB_API int LogPrintf(const char * file_name, const int line_no, const int msg_level, const char* msg_format, ...); + +#endif \ No newline at end of file diff --git a/code/sys_nicmonitor/include/log_define.h b/code/sys_nicmonitor/include/log_define.h new file mode 100644 index 0000000..f2e64c5 --- /dev/null +++ b/code/sys_nicmonitor/include/log_define.h @@ -0,0 +1,232 @@ +//****************************************************************************** +// ModuleName: Log management system +// FileName: log_define.h +// DESCRIPTION: common data struct definition +// FUNCTION LIST: +// COMMENT: public application +// History: +// Date Version Modifier Activities +// 2003-04-08 1.0 wkm modify +//============================================================================== +// 2002-09-01 1.0 zzs created +//****************************************************************************** + +#ifndef __LOG_DEFINE_H +#define __LOG_DEFINE_H + +#include +#include +#include "port_def.h" +#include + +#ifndef _WINDOWS64 +#include +#include +#ifdef _SUN +#undef TRANSPARENT +#endif +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +//#include +#else +#include +#include +#include +#endif + +#include +#include +#include +#include + +#ifdef _WINDOWS64 +#undef _ALPHA +#endif + +#ifdef _ALPHA +#include +#endif +#include +#include +#include +#include +#include +#include + +#ifdef _WINDOWS64 +#include +#include +#endif + +// +//definition +// + +#ifndef _WINDOWS64 +const int LOG_SHM_KEY = 0x1999; +#else +#define HAVE_WINSOCK_H +#endif + +const int MAX_PROCESS_NUM = 1024; +const int MAX_CLIENT_NUM = 10; //max client to view log +const int MAX_FILTER_PROC_NUM = 50; //max process num to filter for each client +const int MAX_BUFFER_LENGTH = 4096; // max text line length +const int COMMAND_LENGTH = 40; +const int NMAE_LENGTH = 40; +const int MAXNAMELEN = 32; //max txt/app/proc/lib name ref to D5000 -- gs +const int MAX_LOG_FILE_LEN = 200; //max log file length:200MB +const int MAX_LOG_FILE_ACCOUNT = 30; //־ļܸ(Ĭֵ30) +const int LOG_FILE_DEL = 1; // ־ļܸMAX_LOG_FILE_ACCOUNTʱɾLOG_FILE_DELɵ־ļ(Ĭֵ2) +const int MAX_LOG_FILE_ACCOUNT_ONE_DAY = 10; // ÿ־ļ(Ĭֵ10) +const int LOG_FILE_DEL_ONE_DAY = 1; // ij־ļMAX_LOG_FILE_ACCOUNT_ONE_DAYʱɾLOG_FILE_DEL_ONE_DAYɵ־ļ(Ĭֵ2) +// +//following block is event type +// + +//enum WARNING_LEVEL +//{ +// MESSAGE_DEBUG = 0, //Ϣ +// MESSAGE_NORMAL = 1, //Ϣ +// MESSAGE_WARN0 = 2, //һ澯 +// MESSAGE_WARN1 = 3, //ظ澯 +// MESSAGE_ERROR0 = 4, //һ +// MESSAGE_ERROR1 = 5 //ش +//}; + + +const int LOG_EMERG = 0; +const int LOG_ALERT = 1; +const int LOG_CRIT = 2; +const int LOG_ERR = 3; +const int LOG_WARNING = 4; +const int LOG_NOTICE = 5; +const int LOG_INFO = 6; +const int LOG_DEBUG = 7; +const int LOG_REMOTE = 8; //add 20130924 + + +const int MSG_DEBUG = 0; //Ϣ +const int MSG_NORMAL = 1; //Ϣ +const int MSG_WARN0 = 2; //һ澯 +const int MSG_WARN1 = 3; //ظ澯 +const int MSG_ERROR0 = 4; //һ +const int MSG_ERROR1 = 5; //ش + +const int STA_ACTIVE = 0; // +const int STA_ABNORMAL = 1; //쳣 +const int STA_DEBUG = 2; //̵ + + +//const int SERV_UDP_PORT = 9877; +//const int SERV_UDP_PORT = 98770; +const int SERV_UDP_PORT = 19801; +#ifdef _WINDOWS64 +const int SERV_TCP_PORT = 32352; +#else +//const int SERV_TCP_PORT = 97888; +//const int SERV_TCP_PORT = 98771; +const int SERV_TCP_PORT = 19802; +#endif + +const int MAX_BTYES_ONE_TIME_SEND = 2000; + +//#define HOST_NAME_LEN 40 +//following block is system flag' value +//#define SYS_YES 1 +//#define SYS_NO 0 + +//following block is +//#define CONNECT_TIME_MSECOND 200 +//#define MAX_BTYES_ONE_TIME_SEND 2000 + +struct SYS_MSG //for log_view +{ + char log_date[60]; + char log_time[60]; + char ctx_name[MAXNAMELEN]; + char app_name[MAXNAMELEN]; + char proc_name[MAXNAMELEN]; + char lib_name[MAXNAMELEN]; + char proc_id[60]; + char msg_level[60]; + char msg[260]; +}; + +// +// process info for logd and api +// +struct PROCESS_INFO +{ + int proc_pid; + int start_time; + char ctx_name[MAXNAMELEN]; + char app_name[MAXNAMELEN]; + char proc_name[MAXNAMELEN]; + char lib_name[MAXNAMELEN]; + unsigned char proc_status; //active, dead etc + unsigned char msg_level; //set by logd, read by each process + + struct PROCESS_INFO& operator= (const struct PROCESS_INFO& proc_info) + { + if( this == &proc_info) + { + return *this; + } + + proc_pid = proc_info.proc_pid; + start_time = proc_info.start_time; + strcpy(ctx_name, proc_info.ctx_name); + strcpy(app_name, proc_info.app_name); + strcpy(proc_name, proc_info.proc_name); + strcpy(lib_name, proc_info.lib_name); + proc_status = proc_info.proc_status; + msg_level = proc_info.msg_level; + + return *this; + } +}; + +struct PROCESS_BASE_INFO +{ + char ctx_name[MAXNAMELEN]; + char app_name[MAXNAMELEN]; + char proc_name[MAXNAMELEN]; + char lib_name[MAXNAMELEN]; + unsigned char msg_level; + + struct PROCESS_BASE_INFO& operator= (const struct PROCESS_INFO& proc_info) + { + strcpy(ctx_name, proc_info.ctx_name); + strcpy(app_name, proc_info.app_name); + strcpy(proc_name, proc_info.proc_name); + strcpy(lib_name, proc_info.lib_name); + msg_level = proc_info.msg_level; + + return *this; + } +}; + +// +// client info for log view +// +struct CLIENT_INFO +{ + int sockfd; //connection id in TCP + int filter_num; //real process num that need filter + unsigned char chief_msg_level; + PROCESS_BASE_INFO filter[MAX_FILTER_PROC_NUM]; //max process to filter for each client +}; + + + +#endif diff --git a/code/sys_nicmonitor/include/logclient.h b/code/sys_nicmonitor/include/logclient.h new file mode 100644 index 0000000..f619a28 --- /dev/null +++ b/code/sys_nicmonitor/include/logclient.h @@ -0,0 +1,75 @@ +/* + * File : logclient.h + * Author : mzhb + * Version : v1.0 + * Description + * Ҫܣsgd-5000ϵͳ־ͻ˽ӿļ; + * 1ڲϵͳsyslogӿд־ļ + * 2־ӿֽ̺Ͷ̬־ļ + * History + * ====================================================== + * 10-05-02 mzhb created + * 10-07-16 mzhb modified ɾͷļжĺϢ + * ====================================================== +*/ + +#ifndef _LOGCLIENT_H +#define _LOGCLIENT_H + +//#include +#ifndef _WINDOWS64 +#include +#include +#endif +#include "log_define.h" +#include + +#ifdef _WINDOWS64 + #ifdef LOGCLIENT_EXPORTS + #define LOGCLIENT_API __declspec(dllexport) + #else + #define LOGCLIENT_API __declspec(dllimport) + #pragma comment(lib,"liblogclient.lib") + #endif +#else + #define LOGCLIENT_API +#endif + + +const int PROLOG = 0; /* the process write log */ +const int LIBLOG = 1; /* the library write log */ + +struct LogInfo +{ + int flag; /* 0 - process; 1 - library; */ + char ctx_name[MAXNAMELEN]; + char app_name[MAXNAMELEN]; + char pro_name[MAXNAMELEN]; + char lib_name[MAXNAMELEN]; +}; + +struct LogRecord +{ +public: + LogRecord(); + ~LogRecord(); + LogRecord&operator=(const LogRecord&); + int flag; /* 0 - process; 1 - library; */ + char scn[MAXNAMELEN]; + int scnInst; + char subScn[MAXNAMELEN]; + int subScnInst; + char pro_name[MAXNAMELEN]; + char lib_name[MAXNAMELEN]; +}; + +#ifdef _WINDOWS64 +extern "C" LOGCLIENT_API int LogWrite(int level, LogInfo *log_info,const char *format, ...); +#else +extern int LogWrite(int level, LogInfo *log_info,const char *format, ...); +extern int LogWrite (int level, LogRecord *log_info, const char *format, ...); +extern int LogWrite (int level, const char *format, ...); +#endif + +#endif // end logclient.h + diff --git a/code/sys_nicmonitor/include/port_def.h b/code/sys_nicmonitor/include/port_def.h new file mode 100644 index 0000000..aaf0ffa --- /dev/null +++ b/code/sys_nicmonitor/include/port_def.h @@ -0,0 +1,222 @@ +/******************************************************************************* +FileName: port_def.h +DESCRIPTION: port definitions +COMMENT: +History: +Date Version Modifier Activities +================================================================================ +2004-07-09 1.0 YZH created +2004-07-19 1.0 YZH modify +*******************************************************************************/ + +#ifndef __PORT_DEF_h__ +#define __PORT_DEF_h__ + +// 10000 - 10999 : ports not relative to context +// 11000 - 11999 : ports assigned to context01 ( for real-time ) +// 12000 - 12999 : ports assigned to context02 ( for training ) +// 13000 - 13999 : ports assigned to context04 ( for research1 ) +// 14000 - 14999 : ports assigned to context08 ( for research2 ) + +// real-time +// 11000 - 11099 : platform - public +// 11100 - 11199 : platform - db_service +// 11200 - 11299 : scada/agc +// 11300 - 11399 : pas +// 11400 - 11499 : dts +// 11500 - 11699 : fes +// 11700 - 11999 : reserved + +//sys_admin +const int MNG_SERV_UDP_PORT = 8001; +const int MNG_SERV_TCP_PORT = 8003; +const int MNG_SERV_TCPREXEC_PORT = 8005; +const int MNG_SERV_COLD_PORT = 8007; +const int MNG_SENDRECV_PORT = 28001; +const int MNG_UNISEND_PORT = 28002; +const int MNG_NODENET_PORT = 28008; //copy from jsems08-1 by jxc. +const int MC_SCN_RECV_PORT = 18501; +const int MC_SCN_TRANS_LISTEN_PORT = 28009; + +// web sync +#define PORT_WEB_SYNC_RT 9001 +#define PORT_WEB_SYNC_MODIFY 9002 +#define PORT_WEB_SYNC_RDB 9003 +#define PORT_WEB_SYNC_RDB_LOB 9004 +#define PORT_WEB_SYNC_RDB_BIND 9005 +#define PORT_MSG_FWD_RECV 8801 +// 13001 to 13003 for pgm +// 12050 to 12055 for msgbus +#define PORT_QUERY_SCN 12167 +#define PORT_CENTER_HEART 12168 //udp +#define PORT_DUTY_CHECK 12169 +#define PORT_MC_HEART 12170 +#define PORT_MC_QUERY 12171 +#define PORT_GW_SERVER 12172 + +#define PORT_MIDMMI_SERVER 10001 +#define PORT_FILE_SYNC 10011 +#define PORT_FILE_SERVER 10012 //10010 +#define PORT_PUBLIC_CHAT 10014 +#define PORT_PROXY_SERVER 30009 +#define PORT_EVENT_SERVER 10027 + +//case_mange(model\mode\msg) +#define PORT_CASE_MODEL 10888 + +#define PORT_RTDB 11000 +#define PORT_SYNC_RT 11006 //sync_rt_recv -> sync_rt_write +#define PORT_RTDB_DOWN 11009 //rtdb_down_server +#define PORT_CACHED_HIS 11010 //cached_his_server +#define PORT_FILE_RECV 11105 + +//for hiscache sync +#define PORT_HC_SYNC_SEND 12901 + +#define PORT_DB_MONITOR 11100 + +#define PORT_DB_COMMIT_NUSP 11101 +#define PORT_DB_COMMIT_HISDB 11102 +#define PORT_DB_COMMIT_ALARM 11103 +#define PORT_DB_COMMIT_STATICS 11104 +#define PORT_DB_COMMIT_SCHEDULE 11106 + +#define PORT_DY_COMMIT_SCADA 11140 +#define PORT_DY_COMMIT_WAMS 11150 +#define PORT_DB_MODEL_ADMIN 11160 //model admin +#define PORT_DB_DOWNLOAD 11110 // download_server +#define PORT_DB_MODIFY 11111 // db_modify_server +#define PORT_DB_SQL_SP 11112 // sql_sp_server +#define PORT_DB_SQL_SP_MSG 11113 // sql_sp_server for msg save +#define PORT_DB_CASE_GRAPH 11114 // case_graph_server +#define PORT_DB_SQL_SP_QUERY 11115 // sql_sp_server for query +#define PORT_DB_MODEL_MODIFY 11116 // model_modify +#define PORT_DB_MODEL_QUERY 11117 // model_query +#define PORT_DB_DOWNLOAD_DAEMON 11118 // download daemon +#define PORT_DB_DATA_MODIFY 11119 // data_modify + +#define PORT_DB_SAMPLE_DEFINE 11120 // sample_define_server +#define PORT_DB_SAMPLE_DATA 11121 // sample_data_server +#define PORT_DB_TRIGGER_SAMPLE 11122 // trigger_sample_server +#define PORT_DB_TRIGGER_SAMPLE_DEFINE 20022 // trigger_sample_define_server +#define PORT_DB_STAT_SERVER 11123 // sample_day_statics_server +#define PORT_DB_TRIGGER_SAMPLE 11122 // trigger_sample_server +#define PORT_DB_QUERY_SAMPLE_PI 11124 // query_sample_server_pi for PI only +#define PORT_DB_QUERY_SAMPLE 11125 // query_sample_server +#define PORT_DB_QUERY_REPORT 11126 // query_report_server +#define PORT_DB_SAMPLE_MODIFY 11127 // sample_modify_server +#define PORT_DB_QUERY_STAT 11128 // query_stat_server +#define PORT_TAG_DEFINE_PROCESS 11129 // tag_define_process +#define PORT_DY_SAMPLE_DEFINE 11130 // dy_sample_define_server +#define PORT_DY_STAT_SERVER 11131 // dy_stat_server +#define PORT_DB_SQL_SP_HISDB 11132 // sql_sp_server for msg save hisdb +#define PORT_DB_SQL_SP_SCHEDULE 11133 // sql_sp_server for msg save schedule +#define PORT_DB_QUERY_SAMPLE_STAT 11134 // query_sample_server for statistics +#define PORT_DB_SQL_SP_SCHEDULE2 11135 // sql_sp_server for msg save schedule2 +#define PORT_DY_COMMIT_SCADA 11140 // dy_commit scada can use 11140~11149 +#define PORT_DB_SQL_SP_ALARM 11141 +#define PORT_DY_COMMIT_WAMS 11150 // dy_commit wams can use 11150~11159 + +#define PORT_DB_SQLITE_SERVER 11151 // sqlite_server +#define PORT_DB_SQLITE_SERVER_MDB 11152 // sqlite_server for mdb +#define PORT_DB_SQLITE_SERVER_HIS 11153 // sqlite_server for his +#define PORT_DB_SQLITE_SERVER_ALARM 11154 // sqlite_server fro alarm +#define PORT_DB_SCD_MODEL_SYNCH_SERVER 11155 // scd_model_synch_server +#define PORT_DB_MODEL_TRANSPORT_SERVER 11156 //transport_model_server +#define PORT_DB_TO_RTDB_SERVER 11157 //db_to_rtdb_server +#define PORT_MODEL_COMPARE_SERVER 11158 //model_compare_server +#define PORT_EXPORT_MODEL_DMP 11159 //model_dmp_server + +#define PORT_DATABASE_REP_REMOTE 11161 //database_replicate remote +#define PORT_MG_METADATA_SERVER 11166 //mg_metadata_server +#define PORT_MG_OFFLINE_SERVER 11167 //mg_offline_server +#define PORT_MG_HISTORY_SERVER 11168 //mg_history_server +#define PORT_MG_FUTURE_SERVER 11169 //mg_future_server + + +#define PORT_MG_VERSION_PROXY 11162 +#define PORT_DATA_JDBC_RPOXY 11164 +#define PORT_DB_SG_DATA_SERVER 11172 +#define PORT_ID_CREATER_SERVER 11173 +#define PORT_MG_VERSION_SERVER 11174 +#define PORT_GRID_MODEL_SERVER 11175 //grid_model_server +#define PORT_MODEL_DATACHECK_SERVER 11177 //model_datacheck_server +#define PORT_ID_SERVICE 11180 +#define PORT_MODEL_PUB 11181 + +//add midhs port +#define PORT_DB_MIDHS_SERVER 20009 // midhs + + +#define PORT_MEA_HIS 11165 + +#define PORT_WARN_SERVICE 11170 // for receiving local warn message. copy from jsems08-1 by jxc. + +//#define PORT_ES_SEARCH_SERVER 11176 //trace_search_server +//#define PORT_TRACE_ANALYSE_SERVER 11177 //trace_analyse_server +//#define PORT_PRIV_MANAGER_SERVER 11178 //priv_manager_server +//#define PORT_PRIV_SERVER 11179 // priv_server + +//scada +#define PORT_SCADA_STATISTICS 11200 //scada_statistics_server +#define PORT_SCADA_CTRL 11202 //sca_ctrl_server + +// pas +#define PORT_LF_SERVER 11300 // lf_server + +//reserved +#define PORT_HDAI_NARI 11701 //hdai_nari_server + + +#define MSG_PROXY_PORT 12063 //message bus proxy for web +#define MSG_PROXY_BROAD_PORT 12064 +#define MSG_PROXY_WEB_PORT 12065 //for web client +#define MSG_PROXY_WEB_SERVER_PORT 12066 +#define MSG_TEST_PORT 12068 //for test mulitple connections + +#define PORT_WEB_UNIQUE 12069 +#define PORT_SVG_PRIV_SERVER 12071 +#define PORT_WEB_HOST_SERVER 12075 +#define PORT_WEB_WARN_SERVER 12076 +#define PORT_WEB_REPORT_SERVER 12077 + +#define PORT_TOMCAT1 8000 +#define PORT_TOMCAT2 8080 +#define PORT_TOMCAT3 8009 +#define PORT_TOMCAT4 8443 +#define PORT_WEBLOGIC1 7001 + +#define PORT_OP_TICKET_SIMU 20000 +#define PORT_FLOW_INTERFACE 22222 + + +// fes +//#define PORT_FES_READ_VAR from 11500 to 15100 +#define PORT_FES_READ_VAR 11500 +#define FES_DB_SEND_PORT 11590 +#define FES_DB_RECV_PORT 11691 +//#define MOXA_PORT from 950 to 981 +//#define CISCO_PORT from 4033 to 4048 +//#define CHASE_PORT from 10001 to 10016 +//#define NET104_PORT from 2400 to 2599 +#define DMS_FES_REAL_DATA_QUERY 11800 + +//121** reserved for sync_rt +#define PORT_SYNC_RT_CTX_1 12100 +#define PORT_SYNC_RT_CTX_2 12101 +#define PORT_SYNC_RT_CTX_4 12102 +#define PORT_SYNC_RT_CTX_8 12103 +#define PORT_SYNC_RT_CTX_16 12104 +// +//port 18000-18999 reserved for Dynamic DB +#define PORT_DY_MONITOR_BASE 18100 //probably up to 18199 +#define PORT_DY_COMMIT_SCADA_BASE 18200 //probably up to 18299 +#define PORT_DY_COMMIT_WAMS_BASE 18300 //probably up to 18799 +#define PORT_DY_QUERY_SCADA_BASE 18800 //probably up to 18899 +#define PORT_DY_QUERY_WAMS_BASE 18900 //probably up to 18999 + +#define PORT_FILE_MONITOR 16100 +//switch +#define PORT_OPTICKET_TOPO_SERVER 30000 +#endif + diff --git a/code/sys_nicmonitor/include/proc_common.h b/code/sys_nicmonitor/include/proc_common.h new file mode 100644 index 0000000..ca82943 --- /dev/null +++ b/code/sys_nicmonitor/include/proc_common.h @@ -0,0 +1,151 @@ +/********************************************************************* +*Copyright(c) 2018,Ƽɷݹ˾ +*All rights reserved. +* +*Filename + proc_common.h +*Modulename: + libproc_common.so +*Description: + proc manager +*Author: + chenboyu guwenjie +*Date Version Description of modification +==================================================================== +*2018/08/20 1.0 Create +*2018/11/12 1.1 modify +********************************************************************/ + +#ifndef _PROC_COMMON_H_ +#define _PROC_COMMON_H_ + +#ifndef _WINDOWS64 +#include "sysadm/proc_define.h" +#endif + +#include +using std::vector; + +namespace NS_SYSADMIN +{ + +#ifndef _WINDOWS64 +struct ProcAdmInfo +{ + char scn_name[SCN_MAX_NAME_LEN];// + char subscn_name[SCN_MAX_NAME_LEN];//ӳ + char label[Length::StringLen];//ʶ + int scn_id;// + int subscn_id;//ӳ + int scn_inst;//ʵ + int subscn_inst;//ӳʵ + char subscn_label[Length::StringLen];//ӳʶΪչ + char proc_name[Length:: NameLen];// + pid_t proc_pid;//̺ + char cmd[Length::SentenceLen]; + +public: + int copyFrom(ProcessInfo proc) + { + strcpy(scn_name,proc.m_scn_name); + strcpy(subscn_name,proc.m_subscn_name); + strcpy(label,proc.m_scn_label); + scn_id=proc.m_scn_id; + subscn_id=proc.m_subscn_id; + scn_inst=proc.m_scn_inst; + subscn_inst=proc.m_subscn_inst; + strcpy(subscn_label,proc.m_scn_label); + strcpy(proc_name,proc.m_process_name); + proc_pid=proc.m_process_id; + strcpy(cmd,proc.m_cmd); + return 1; + } + bool scn_match(int tmp_scn_id,int tmp_subscn_id,int tmp_scn_inst,int tmp_subscn_inst) + { + return ((tmp_scn_id == scn_id) && (tmp_subscn_id == subscn_id) && (tmp_scn_inst == scn_inst) && (tmp_subscn_inst== subscn_inst)); + + } + +}; +#endif + +class CProcCommonImpl; + + +#ifdef _WINDOWS64 +#ifdef PROC_COMMON_EXPORTS +#define PROC_COMMON_API __declspec(dllexport) +#else +#define PROC_COMMON_API __declspec(dllimport) +#endif +#else +#define PROC_COMMON_API +#endif + +class PROC_COMMON_API CProcCommon +{ +public: + CProcCommon (int rw = 1); + ~CProcCommon(); +#ifndef _WINDOWS64 + //һ4runningӿ -1not running, 1running + int is_proc_running(const int proc_id); + int is_proc_running(const char* cmd);//صǴcmdеĸҪע + int is_proc_running(ProcessInfo& proc_info); + int is_proc_running(int scn_id, int scn_inst,int subscn_id,int subscn_inst, char* process_name,pid_t & proc_id); + int proc_init (int scn_id, int subscn_id, char* process_name, int scn_inst = 1,int subscn_inst = 1); + int proc_init (const char* scn_name, const char* subscn_name, + char* process_name, const char* label = NULL, const char* subscn_lable = NULL); + int proc_init (const char* scn_name, const char* subscn_name, + char* process_name, int subscn_inst, int scn_inst = 1, const char* label = NULL, + const char* subscn_lable = NULL); + + int proc_init (long cluster_id, int task_id, int number_no, char* process_name,long container_id = 0); + int proc_init (char* process_name,long container_id); //нʹãcontainer_idΪ0 + int proc_insert (ProcessInfo& proc_info); + int proc_insert (char* process_name, long container_id); + int proc_insert (int info_nums,vector& proc_infos); + int proc_get (vector& proc_info); + int proc_get (vector& proc_info); + int proc_get (long container_id, vector& proc_info); + int proc_get(char *process_name,long container_id,ProcessInfo& proc_info); + int proc_get(int scn_id, int scn_inst,int subscn_id,int subscn_inst,vector& proc_info); + int proc_get(int scn_id, int scn_inst,int subscn_id,int subscn_inst,char* process_name, long container_id,ProcessInfo& proc_info); + int proc_get(int position,ProcAdmInfo& proc_info); + int proc_get(int position,struct ProcessInfo& proc_info); + int proc_update (char* process_name, long container_id,unsigned char run_status); + int proc_update (char* process_name, long container_id, ProcessInfo& proc_info); + int proc_update(int scn_id, int scn_inst,int subscn_id,int subscn_inst,char* process_name,long container_id,ProcessInfo& proc_info); + int proc_update(int scn_id, int scn_inst,int subscn_id,int subscn_inst,char* process_name,unsigned char run_status); + int proc_update(ProcessInfo& proc_info,float cpu_occupy,int mem_occupy); + int proc_update(ProcessInfo& proc_info,time_t start_time); + int proc_update(ProcessInfo& proc_info,int value,int location); + int proc_shut (char* process_name, long container_id); + int proc_shut(int scn_id, int scn_inst,int subscn_id,int subscn_inst, char* process_name); + int proc_shut(int pid); + int proc_exit(int position); + int proc_report (int position,unsigned char run_status, int period); + int proc_clear_all(); + int proc_show_mem(); + int get_active_pid(int &num, int *pid_list); + int clear_exit_proc_info(int position); + int clear_oneproc_shm(int scn_id, int scn_inst,int subscn_id,int subscn_inst, char* process_name); + int set_procshm_check(int check_value); + int proc_add(struct ProcessInfo& proc_info); +#endif + +private: + CProcCommonImpl *m_impl; + +public: + //windows or linux,cmdǽ cmdline + int is_proc_running(const char *cmd,vector &pid_vec); +}; + +} + + + + +#endif + diff --git a/code/sys_nicmonitor/include/scn_common.h b/code/sys_nicmonitor/include/scn_common.h new file mode 100644 index 0000000..884c02b --- /dev/null +++ b/code/sys_nicmonitor/include/scn_common.h @@ -0,0 +1,118 @@ +/******************************************************************* +ModuleName: scn_common +FileName: scn_common.h +DESCRIPTION:common data struct define +AUTHOR: gaoyuan +History: +Date Version +========================== +13/05/2004 1.3 +07/22/2003 1.2 +04/16/2003 1.1 +11/20/2002 1.0 +********************************************************************/ + +#ifndef SCN_COMMON_H__ +#define SCN_COMMON_H__ + + +#include + +using namespace std; + + +#ifndef SAM_PRIVATE_EXPORTS +#ifdef _WINDOWS64 +#ifdef SAM_COMMON_EXPORTS +#define SAM_COMMON_API __declspec(dllexport) +#else +#define SAM_COMMON_API __declspec(dllimport) +#pragma comment(lib,"libscn_common.lib") +#endif +#else +#include +#endif +#else +#ifdef _WINDOWS64 +#ifdef SAM_PRIVATE_EXPORTS +#define SAM_PRIVATE_API __declspec(dllexport) +#else +#define SAM_PRIVATE_API __declspec(dllimport) +#endif +#endif +#endif +namespace NS_SYSADMIN +{ +#ifndef SAM_PRIVATE_EXPORTS +#ifdef _WINDOWS64 +class SAM_COMMON_API CScnPub +#else +class CScnPub +#endif +#else +class SAM_PRIVATE_API CScnPub +#endif +{ +public: + CScnPub(); + explicit CScnPub(int is_readwrite); + ~CScnPub(); + + int SetNetCardStatus(char *card_id,unsigned char card_status); + //int IsProcRun(const int proc_id); + //int IsProcRun(const int scn_id, const int scn_inst,const int subscn_id, const int subscn_inst,const char *proc_alias, int &proc_id ); + /* + int Name_to_ID(const char *app_name, const char *ctx_name, const char *node_name, + int &app_id, int &ctx_no, int &node_id ); + */ + int Name_to_ID(const char * subscn_name, const char * scn_name, const char *node_name, + int &subscn_id, int &scn_id, int &node_id ); + /* + int ID_to_Name(const int app_id, const int ctx_no, const int node_id, + char *app_name, char *ctx_name, char *node_name); + */ + int ID_to_Name(const int subscn_id, const int scn_id, const int node_id, + char *subscn_name, char *scn_name, char *node_name); + int scnlabel_name2id (int scn_id, const char* scn_label, int& scn_inst); + int scnlabel_id2name (int scn_id, int scn_inst, char* scn_label); + int subscnlabel_id2name (int scn_id, int scn_inst, int subscn_id, + int subscn_inst, char* subscn_label); + int subscnlabel_name2id (int scn_id, const char* scn_label, int subscn_id, + const char* subscn_label, int& subscn_inst); + int scn_id_name (int &scn_id, char* scn_name); + int subscn_id_name (int &subscn_id, char* subscn_name); +protected: + int SetSystemInfo(); + int SetSystemInfo(int is_readwrite); + + static char* MapFile(const char* file_name, const int stab_total_size); + static int UMapFile(char* addr_t, const int size); +#ifndef _WINDOWS64 + //semaphore operations + static int InitSem(const key_t key,const int nsems = 1); //initial semaphore + static int p(const int sem_id, const int sem_num = 0); + static int v(const int sem_id, const int set_num = 0); +#else + //semaphore operations + static int p(const char* sem_name, const int sem_num); + static int v(const char* sem_name, const int sem_num = 1, const int release_num = 1); +#endif + +public: + int m_ProcReportSemid; + int m_NetStatusSemid; + int m_AppStatusSemid; + struct PROC_REPORT_INFO *m_ProcReportInfo; + struct NET_CARD_STATUS *m_NetStatusInfo; + struct SUBSCN_STATUS_INFO *m_ScnStatusInfo; +protected: + int m_ProcessNo; + int m_TotalBufSize; +public: + static const char PATH_VIRGULE = '/'; + +}; +} +#endif + + diff --git a/code/sys_nicmonitor/include/sysadm/proc_define.h b/code/sys_nicmonitor/include/sysadm/proc_define.h new file mode 100644 index 0000000..e4e1291 --- /dev/null +++ b/code/sys_nicmonitor/include/sysadm/proc_define.h @@ -0,0 +1,190 @@ +/********************************************************************* +*Copyright(c) 2018,Ƽɷݹ˾ +*All rights reserved. +* +*Filename + proc_define.h +*Modulename: + libproc_common.so +*Description: + صijͽṹ +*Author: + guwenjie +*Date Version Description of modification +==================================================================== +*2018/11/12 1.0 Create +********************************************************************/ +#ifndef _PROCESS_DEFINE_H_ +#define _PROCESS_DEFINE_H_ + +#include "scn_define.h" +#include +namespace NS_SYSADMIN +{ + +const int c_max_proc_num=2048; +#ifndef _WINDOWS64 +const int c_proc_sem_key=0x1050; +const int c_proc_shm_key=0x1050; +#else +const char c_proc_shm_key[]="PROCESS_MAN_SHM"; +const char c_proc_sem_key[]="PROCESS_MAN_SEM"; +#endif + + +struct ProcRegisterType +{ + enum + { + ShmType=1, + ServerType=2 + }; +}; + +struct ProcStatusType +{ + enum + { + Offline=0, + Starting=1, + Running=2, + Hangup=3, + Stopping=4, + Failure=5, + Stopped=6, + Killed=7, + Exited=8 + }; +}; + +struct ProcMonitorType +{ + enum + { + PROC_TYPE_UNRPT = 0, + PROC_TYPE_RPT =1 + }; +}; + +struct ProcManLimit +{ + enum + { + COUNT_LIMIT = 2, + DEFAULT_PERIOD = 3, + START_DEFAULT_PERIOD = 5, + START_COUNT_LIMIT = 5, + FAILOVER_INTERVAL = 300, + APP_COUNT_LIMIT = 1 + }; +}; + +struct CriticalType +{ + enum + { + General=0, + Crucial=1 + }; +}; + +struct ProcType +{ + enum + { + HostProc=0, + ConProc=1, + ScnConProc=2 + }; +}; + +struct OS_TYPE +{ + enum + { + ROCKY = 0, + CENTOS = 1 + }; +}; + +struct CRUCIAL_TYPE +{ + + enum + { + GENERAL = 0, + CRUCIAL = 1 + }; +}; +struct ProcessInfo +{ + int m_process_id; + char m_process_name[Length:: NameLen]; + char m_cmd[Length::SentenceLen]; + char m_script[Length::SentenceLen]; + char m_namespace[Length::StringLen]; + int m_scn_id; + char m_scn_name[SCN_MAX_NAME_LEN]; + int m_scn_inst; + char m_scn_label[Length::StringLen]; + int m_subscn_id; + char m_subscn_name[SCN_MAX_NAME_LEN]; + int m_subscn_inst; + char m_subscn_label[Length::StringLen]; + char m_owner[Length:: NameLen]; + long m_container_id; + long m_cluster_id; + int m_task_id; + int m_member_no; + int m_context_id; + int m_app_id; + char m_node_name[Length::NameLen]; + int m_system_id; + long m_resUnitId; + unsigned char m_critical_type; + unsigned char m_run_status; + float m_cpu_occupy; + int m_mem_occupy; + time_t m_init_time; + time_t m_start_time; + time_t m_refresh_time; + time_t m_change_time; + time_t m_end_time; + unsigned char m_monitor_type; + int m_start_num; + int m_noactive_num; + int m_pos; + int m_check; + //long m_reserve; + int m_refresh_period; + int m_reserve; + +public: + bool scn_match(int scn_id,int scn_inst,int subscn_id,int subscn_inst) + { + if(m_scn_id == scn_id && + m_scn_inst == scn_inst && + m_subscn_id == subscn_id && + m_subscn_inst == subscn_inst) + { + return true; + } + return false; + } + + bool scn_match(const char* scn_name,int scn_inst,const char* subscn_name,int subscn_inst) + { + if((strcmp(m_scn_name,scn_name) == 0) && + m_scn_inst == scn_inst && + (strcmp(m_subscn_name,subscn_name)==0) && + m_subscn_inst == subscn_inst) + { + return true; + } + return false; + } +}; + +} + +#endif diff --git a/code/sys_nicmonitor/include/sysadm/scn_define.h b/code/sys_nicmonitor/include/sysadm/scn_define.h new file mode 100644 index 0000000..28f7365 --- /dev/null +++ b/code/sys_nicmonitor/include/sysadm/scn_define.h @@ -0,0 +1,436 @@ +#ifndef _SCN_DEFINE_H_ +#define _SCN_DEFINE_H_ + +#include +#ifndef _HPUX +#include +#endif +using namespace std; +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include "common_types.h" +#include "db_api/odb_struct.h" +namespace NS_SYSADMIN +{ +//#define hton64(i) (1 == htonl(1)) ? i : (((long)(htonl((i) & 0xffffffff)) << 32) | htonl(((i) >> 32) & 0xffffffff )) +#define hton64(i) (1 == htonl(1)) ? i : (((cmnInt64)(htonl((i) & 0xffffffff)) << 32) | htonl(((i) >> 32) & 0xffffffff )) +#define ntoh64 hton64 + +#define RED "\033[1;31m" +#define GREEN "\033[1;32m" +#define NONE "\033[0m" +#define BOLD "\033[1m" + +//port define. +const int c_scn_query_port = 18421; +const int c_scn_label_serv_port = 18422; + + +//SCN define +const int SCN_MAX_NAME_LEN = 40; +const int SCN_MAX_STR_LEN = 256; +const int SCN_MAX_SEND_LEN = 40960; +const int SCN_MAX_RECV_LEN = 40960; +const int MNG_MAX_CMD_STR_LEN = 512; +//MNG define +const int MNG_MAX_PROCESS_NUM = 600; +const int MNG_MAX_STR_LEN = 256; +const int MNG_MAX_NET_CARD_NUM = 2; +const int MNG_MAX_APP_NUM = 1024; +const int MNG_COMMAND_LENGTH = 80; +const int PARA_LENGTH = /*32*/128; +const int MNG_MAX_PATH_STR_LEN =1024; + +//app report type +const int SAM_APP_START = 1001; +const int SAM_APP_STATUS_CHANGE = 1002; +const int SAM_APP_STATUS_REPORT = 1003; +const int SAM_APP_SWITCH = 1005; +const int SAM_APP_SWITCH_RPS = 1006; +const int SAM_APP_EXIT = 1007; +//cold app report type +const int SAM_COLD_STATUS_CHANGE = 1008; +const int SAM_COLD_STATUS_REPORT = 1009; +const int SAM_CONTAINER_STATUS_REPORT = 1010; +const int SAM_CONTAINER_APP_STATUS_REPORT = 1011; + +//mc reprot type +const int SCN_TRANS_INFO_REPORT =2001; + +//share memory key & sem key +const int SAM_SHM_KEY = 0x1060; +const int NET_STATUS_SEM_KEY = 0x1011; +const int PROC_REPORT_SEM_KEY = 0x1013; +const int MC_STAGE_SEM_KEY = 0x1039; +const int MC_STAGE_SHM_KEY = 0x1039; +const int APP_STATUS_SEM_KEY = 0x1060; + +//service type +const int BASE_SERVICE = 3400000; +const int EMS_SERVER = 1; +const int EMS_CLIENT = 2; +const int EMS_WEBCLIENT = 4; +const int WEB_SERVER = 1024; + +//error definition +const int OPEN_PARA_FILE_FAIL = -1001; +const int GET_PARA_FAIL = -1002; +const int GET_NETMASK_FAIL = -1003; +const int INPUT_IP_ADDRESS_ERROR = -1004; +const int CONVERT_IP_ERROR = -1005; +const int PROC_DO_NOT_EXIST = -1006; +const int KILL_PROC_FAIL = -1007; +const int CLEAR_PROC_STATUS_FAIL = -1008; +const int CLEAR_NET_STATUS_FAIL = -1009; +const int CLEAR_APP_STATUS_FAIL = -1010; +const int P_SEM_ERROR = -1011; +const int V_SEM_ERROR = -1012; +const int APP_NUM_ERROR = -1013; + +const int MNG_TIME_UDP_PORT = 2345; +const int MASK_REAL = 1; +const int MASK_REAL_WEB = 65536; +const short MNG_NET_INFO_NO = 171; + +//sys_info +const int MAX_DISK_NUM = 100; +const int MAX_NODE_NUM = 512;//50; +const int MNG_MAX_NODE_NUM = 512; + +const int MAX_DISTANCE_READ_STATIC = 1; +const int MAX_DISTANCE_READ_DYNAMIC = 2; //5; modify 20090901 +const int MAX_DISTANCE_READ_DISK = 10; //600; modify 20090623 +const int REPORT_DISK_USAGES_DISTANCE = 512; + +const int PARA_NUM = 6; +const int PATH_LENGTH = 80; +const int APP_DO_NOT_EXIST = -1014; +const int PROC_STATUS_INPUT_ERROR = -1015; +const int UPDATE_APP_STATUS_FAIL = -1016; +const int SWITCH_FLAG_INPUT_ERROR = -1017; +const int GET_HOSTNAME_ERROR = -1018; +const int GET_BASE_INFO_FAIL = -1019; +const int PROCESS_INFO_NOT_SET = -1020; +const int GET_PROCESS_INFO_FAIL = -1021; +const int RUN_STATUS_INPUT_ERROR = -1022; +const int MAP_FILE_FAIL = -1023; +const int SHMGET_FAIL = -1024; +const int SHMMAT_FAIL = -1025; +const int INIT_SEM_FAIL = -1026; +const int IS_NOT_SERVER = -1027; +const int NAMETOID_FAIL = -1028; +const int IDTONAME_FAIL = -1029; +const int PARA_INPUT_ERROR = -1030; +const int INIT_NETINFO_ERROR = -1031; +const int GET_NETINFO_ERROR = -1032; +const int SET_PROCOK_FAIL = -1033; +const int INIT_NIC_FAIL = -1034; +const int GET_NIC_FAIL = -1035; +const int APP_DO_NOT_RUN = -1036; + + +////////////////////////////////////////////////////////// add 20090415 + + +const int APP_DONT_DUTY = -1910; +const int APP_DONT_STANDBY = -1911; +const int APP_DONT_EXT = -1912; +const int ERR_INPUT_PARA = -1913; +const int NO_OTHER_APP_STANDBY = -1914; +const int NO_OTHER_APP_DUTY = -1915; +const int CAN_NOT_SWITCH_TO_STANDBY = -1916; +const int CAN_NOT_SWITCH_TO_DUTY = -1917; +const int APP_LOCKED = -1918; //add 20090414 +//max socket address struct size +//const int MAXSOCKADDR = 128; +const int MNG_PLOT_SIZE = 101; + +//proc type +const int START_RESPAWN_OPTION = 0; +const int START_RESPAWN_KEY = 1; +const int START_ONCE = 2; +const int START_WAIT = 3; +const int STOP_WAIT = 4; + +//network status +const unsigned char OFFLINE = 0; +const unsigned char ONLINE = 1; +//run status +const unsigned char IS_EXIT = 0; +const unsigned char IS_RUNNING = 1; +const unsigned char IS_START = 2; +const unsigned char IS_RECOVER = 3; +//app monitor +const int DIS_BETWEEN_APP_REPORT = 1; +const int DIS_COLD_TIME = 1; +const int DIS_COLD_UNIT = 10; + +//app status +const unsigned char APP_START = 1; +const unsigned char APP_STANDBY = 2; +const unsigned char APP_DUTY = 3; +const unsigned char APP_FORCESTANDBY = 4; +const unsigned char APP_FORCEDUTY = 5; +const unsigned char APP_OFFLINE = 6; +const unsigned char APP_BAD = 7; +const unsigned char APP_EXIT = 8; +const unsigned char APP_NON = 13; +const unsigned char APP_INIT = 14; +const unsigned char SYSCTL_START = 9; +const unsigned char SYSCTL_STOP = 10; +const unsigned char NODE_OFFLINE = 11; +const unsigned char NODE_ONLINE = 12; +const unsigned char TASK_INIT_MENU = 21;//������ +const unsigned char TASK_RUN_MENU = 22;//�����л� +const unsigned char TASK_OFFLINE_MENU = 23;//������? +const unsigned char TASK_BAD_MENU = 24;//������? +const unsigned char TASK_EXIT_MENU = 25;//�����˳� + +//other definition +const int SCN_YES = 1; +const int SCN_NO = 0; + +// Ӧȼ +//PUBLICӦδõ,PUBLICȼ256ʼ +const int PRI_BASE_NO_DEFINED = 256; +const int PRI_BASE_COLD_NODE = 1024; //䱸ڵ㣬Ӧȼ65536ʼ +const int PRI_BASE_32_PUBLIC = 1; //32̬Ӧȼ + +//other definition +const int SAM_YES = 1; +const int SAM_NO = 0; + +//SAM TRANS ERROR DEFINE +const int ECLIENT_CLOSE = -2; +const int ESERVER_CLOSE = -3; +const int ERECV_ZERO = 0; + +#ifdef _HPUX +const int MAX_START_TIME = 6;//10; modify 20090428 +#else +const int MAX_START_TIME = 3;//10; modify 20090428 +#endif + +//struct SCN_STATUS_INFO //from APP_STATUS_INFO, 20181106 modify by gaoyuan +struct SUBSCN_STATUS_INFO +{ + int scn_id; + int scn_inst; + //char scn_name[SCN_MAX_NAME_LEN]; + char scn_label[SCN_MAX_NAME_LEN]; + int subscn_id; + int subscn_inst; + //char subscn_name[SCN_MAX_NAME_LEN]; + char subscn_label[SCN_MAX_NAME_LEN]; + int node_id; + char node_name[SCN_MAX_NAME_LEN]; + short subscn_priority; + unsigned char cur_status; + unsigned char net_status; + unsigned char all_proc_ok; + int normal_key_proc_num; + int bad_key_proc_num; + time_t last_active_time; + unsigned char run_status; + short switch_flag; //add 20090414 + char reserve[20]; //add 20090414 +}; + +struct SCN_STATUS_CHANGE +{ + char project_name[SCN_MAX_NAME_LEN]; + int node_id; + char node_name[SCN_MAX_NAME_LEN]; + time_t report_time; + int scn_id; + int scn_inst; + char scn_label[SCN_MAX_NAME_LEN]; + int subscn_id; + int subscn_inst; + char subscn_label[SCN_MAX_NAME_LEN]; + short subscn_priority; + unsigned char cur_status; + unsigned char all_process_ok; +}; + +struct SCN_STATUS_REPORT_INFO +{ + int scn_id; + int scn_inst; + char scn_label[SCN_MAX_NAME_LEN]; + int subscn_id; + int subscn_inst; + char subscn_label[SCN_MAX_NAME_LEN]; + + int node_id; + char node_name[SCN_MAX_NAME_LEN]; + short subscn_priority; + unsigned char net_status; + unsigned char cur_status; + unsigned char all_process_ok; + time_t last_receive_info_time; + time_t report_time; + int run_status; + short switch_flag; +}; + +struct SCN_STATUS_TABLE_INFO +{ + int scn_id; + int scn_inst; + char scn_label[SCN_MAX_NAME_LEN]; + int subscn_id; + int subscn_inst; + char subscn_label[SCN_MAX_NAME_LEN]; + int node_id; + char node_name[SCN_MAX_NAME_LEN]; + + short subscn_priority; + unsigned char net_status; + unsigned char cur_status; + unsigned char all_process_ok; + time_t last_receive_info_time; +}; + +//struct SCN_PROC_STATIC_INFO +struct SUBSCN_PROC_STATIC_INFO +{ + int scn_id; + int scn_inst; + int subscn_id; + int subscn_inst; + + int proc_num; + std::vectorproc_info_stru; +}; + +struct SUBSCN_PROC_INFO +{ + //int process_id; for d5000 + //cmnInt64 process_id; //20180810 boyu +/* +#ifndef _VERSION_5000_ + RTDB_KEY_STRU process_id; +#else + cmnInt64 process_id; +#endif +*/ + cmnInt64 process_id; + char proc_name[SCN_MAX_NAME_LEN]; + char proc_alias[SCN_MAX_NAME_LEN]; + int instance_num; + unsigned char is_used; + // unsigned char key_proc; + unsigned char start_type; + unsigned char auto_run; + int run_order; + unsigned char cycle_start; + int cycle_period; + unsigned char offline_run; + unsigned char duty_run; + unsigned char standby_run; + int occupy_context; + char file_path[MNG_COMMAND_LENGTH]; + char proc_para[SCN_MAX_STR_LEN]; + unsigned char run_style; + //char proc_para[PARA_NUM][PARA_LENGTH]; + //int para_num; +}; + +// +//struct for process report +// +struct PROC_REPORT_INFO +{ + int scn_id; + int scn_inst; + int subscn_id; + int subscn_inst; + char proc_alias[SCN_MAX_NAME_LEN]; + pid_t proc_id; + time_t mon_time; + time_t start_time; + int proc_run_port; + int report_moncycle; + int msg_level; + int status_change; + char proc_msg[MNG_MAX_STR_LEN]; + int proc_beat; +}; + + +// +//struct of net card status +// +struct NET_CARD_STATUS +{ + unsigned char use_flag; + char net_card_id[SCN_MAX_NAME_LEN]; + unsigned char net_card_ok; +}; + + +// +//union for scn_common +// +union SEMUN +{ + int val; + struct semid_ds *buf; + unsigned short *array; +}; + +struct Length //2.ַ +{ + enum + { + WordLen=32, + NameLen=64, + StringLen=128, + SentenceLen=256, + ParagraphLen=512, + PageLen=1024 + }; +}; + +enum SCN_QUERY_CODE +{ + GetAllScn_CODE, + GetSubscnByScn_CODE, + GetScnInstByScn_CODE, + GetSubscnInst_CODE, + RequestSubscn_label_CODE, + RequestSubscn_inst_CODE, + RequestSubscn_label_CODE2, + RequestSubscn_inst_CODE2, + Scn_ID_Name_CODE, + Subscn_ID_Name_CODE, + CreateObj_CODE, + GetKey_int_CODE, + GetKey_str_CODE, + File_Exist_CODE, + GetKeys_CODE, +}; + + +} + +#endif diff --git a/code/sys_nicmonitor/include/system.h b/code/sys_nicmonitor/include/system.h new file mode 100644 index 0000000..08f9d36 --- /dev/null +++ b/code/sys_nicmonitor/include/system.h @@ -0,0 +1,313 @@ +/******************************************************************************* +FileName: system.h +DESCRIPTION: system constants definitions +COMMENT: +History: +Date Version Modifier Activities +================================================================================ +2009-06-01 1.0 ZMY modify +2009-04-09 1.0 GY created +*******************************************************************************/ + +#ifndef __SYSTEM_h__ +#define __SYSTEM_h__ + +#include "port_def.h" + +//ӦSCADAָһ̣϶Ӧʵʱʵ +//DATA_SRVָһ̣ûжӦʵʱʵ +//PUBLICӦµḶ̌ṩз +//BASE_SERVICEḶ̌ṩڷ͹վ +//վûʵʱ + + +//hpux FALSE AND TRUE definition +#ifdef _HPUX +#ifndef TRUE +#define TRUE 1 +#endif +#ifndef FALSE +#define FALSE 0 +#endif +#endif + +#ifdef _SUN +#ifndef FALSE +#define FALSE 0 +#endif +#ifndef TRUE +#define TRUE 1 +#endif +#endif + +#ifdef _LINUX +#ifndef TRUE +#define TRUE 1 +#endif +#ifndef FALSE +#define FALSE 0 +#endif +#ifndef NULL +#define NULL 0 +#endif +#endif + +#define GET_RECORD_ID(a) ((struct COMM_KEY_STRU*)(&a))->record_id +#define GET_TABLE_NO(a) ((struct COMM_KEY_STRU*)(&a))->table_no +#define GET_COLUMN_ID(a) ((struct COMM_KEY_STRU*)(&a))->column_id +#define GET_AREA_ID(a) ((struct KEY_STRU_AREA*)(&a))->area +#define GET_RECORD_ID_IN_AREA(a) ((struct KEY_STRU_AREA*)(&a))->key + +#define SET_RECORD_ID(a,b) ((struct COMM_KEY_STRU*)(&a))->record_id=b +#define SET_TABLE_NO(a,b) ((struct COMM_KEY_STRU*)(&a))->table_no=b +#define SET_COLUMN_ID(a,b) ((struct COMM_KEY_STRU*)(&a))->column_id=b +#define SET_AREA_ID(a,b) ((struct KEY_STRU_AREA*)(&a))->area=b +#define SET_RECORD_ID_IN_AREA(a,b) ((struct KEY_STRU_AREA*)(&a))->key=b + +// language definition +//#define LOCAL_LANGUAGE "gbk" + #define LOCAL_LANGUAGE (getenv("LANGUAGE_CODE")==NULL?"GBK":getenv("LANGUAGE_CODE")) + + +// context definitions + +//#define AC_MAX_NUM 5 //del by tcr 2007/03/16 +#define AC_MAX_NUM 32768 + +#define AC_DEFAULT_NO 0 + +#define AC_REALTIME_NO 1 +#define AC_STUDY_NO 2 +#define AC_RESEARCH_NO 2 +#define AC_PLAN_NO 3 +#define AC_FUTURE_NO 3 +#define AC_TEST_NO 4 +#define AC_PDR_NO 5 +#define AC_DTS_NO 6 +#define AC_TRAINING_NO 6 +#define AC_SYS_NO 15 + +#define AC_REALTIME_NAME "realtime" +#define AC_RESEARCH_NAME "study" +#define AC_STUDY_NAME "study" +#define AC_TRAINING_NAME "training" +#define AC_PLAN_NAME "plan" +#define AC_TEST_NAME "test" +#define AC_PDR_NAME "pdr" +#define AC_DTS_NAME "dts" +#define AC_SYS_NAME "sys" +#define AC_FUTURE_NAME "plan" + +#define AC_REALTIME_MSG "realtime" +#define AC_TRAINING_MSG "training" +#define AC_PLAN_MSG "plan" +#define AC_TEST_MSG "test" +#define AC_PDR_MSG "pdr" +#define AC_DTS_MSG "dts" + +// application definitions + +#define MAX_AF_NUM 64 /* 1 ~ 32768 */ + +#define AF_SCADA 1 +#define AF_PAS 2 +#define AF_DTS 3 +#define AF_FES 4 +#define AF_AGC 5 +#define AF_AVC 6 +#define AF_WAMS 7 +#define AF_CIM 8 +#define AF_WDM 9 +#define AF_TMR 10 +#define AF_DESUFS 11 +#define AF_SCHEDULE 12 +#define AF_DSA 13 + +#ifdef _APP_SYS_SUBSTATION +#define AF_WF 14 +#else +#define AF_LLS 14 +#endif + +#define AF_OMS 15 +#define AF_PUBLIC 16 + +#define AF_DATA_SRV 33 +#define AF_BASE_SRV 34 +#define AF_REPORT_SRV 35 +#define AF_DMS_SCADA 65 +#define AF_DMS_FES 66 +#define AF_DMS_PAS 67 + + +#define AP_SCADA 100000 +#define AP_PAS 200000 +#define AP_DTS 300000 +#define AP_FES 400000 +#define AP_FES_GPS 410000 +#define AP_AGC 500000 +#define AP_AVC 600000 +#define AP_WAMS 700000 +#define AP_CIM 800000 +#define AP_WDM 900000 +#define AP_TMR 1000000 +#define AP_DESUFS 1100000 +#define AP_SCHEDULE 1200000 +#define AP_DSA 1300000 + +#ifdef _APP_SYS_SUBSTATION +#define AP_WF 1400000 +#else +#define AP_LLS 1400000 +#endif + +#define AP_OMS 1500000 +#define AP_PUBLIC 1600000 +#define AP_PUBLIC_RESRC 1610000 +#define AP_PUBLIC_CLUSTER 1601000 +#define AP_PUBLIC_PROXY 1600200 +#define AP_PUBLIC_DIVISION 1600300 +#define AP_PUBLIC_CHAT 1651000 + +//add by zhaohaifeng +#define AP_DMS_SCADA 6500000 +#define AP_DMS_FES 6600000 +#define AP_DSCADA_AREA 6500000 +#define AP_DMS_SCADA_RED 6510000 //add by xtp +//add end +#define AP_DPAS_MODEL 6700000 +#define AP_DPAS_RTNET 6701100 +#define AP_DPAS_DPF 6701200 +#define AP_DPAS_DPF1 6701201 +#define AP_DPAS_DPF2 6701202 +#define AP_DPAS_DPF3 6701203 +#define AP_DPAS_LF 6701300 + +#define AP_FES_RELAY 402000 //ddx +#define AP_DATA_SRV 3300000 +#define AP_DATA_SRV_DMS 3301000 +#define AP_GIS_SRV 3310000 +#define AP_DATA_SRV_DY 3310100 +#define AP_FILE_SERV 3320000 +#define AP_DATA_MODEL 3330000 +#define AP_BASE_SRV 3400000 +#define AP_REPORT_SRV 3500000 + +#define AP_DEFAULT -999 + +#define AF_SCADA_NAME "scada" +#define AF_PAS_NAME "pas" +#define AF_DTS_NAME "dts" +#define AF_FES_NAME "fes" +#define AF_AGC_NAME "agc" +#define AF_AVC_NAME "avc" +#define AF_WAMS_NAME "wams" +#define AF_CIM_NAME "cim" +#define AF_WDM_NAME "wdm" +#define AF_TMR_NAME "tmr" +#define AF_DESUFS_NAME "desufs" +#define AF_SCHEDULE_NAME "schedule" +#define AF_DSA_NAME "dsa" +#define AF_LLS_NAME "lls" +#define AF_WF_NAME "wf" +#define AF_OMS_NAME "oms" +#define AF_PUBLIC_NAME "public" +#define AF_OSM_NAME "osm" + +#define AF_DATA_SRV_NAME "data_srv" +#define AF_DATA_SRV_DMS_NAME "data_srv_dms" +#define AF_BASE_SRV_NAME "base_srv" +#define AF_REPORT_SRV_NAME "report_srv" + +//add for dms +#define AF_DMS_SCADA_NAME "dscada" //add by slong +#define AF_DMS_FES_NAME "dfes"//add by wuhuichao +#define AF_DMS_SCADA_RED_NAME "dscada_red" //add by xtp +//add end +#define AF_FES_RELAY_NAME "fes_relay"//ddx +#define AF_AP_MOD 100000 +#define AP_RESEARCH_MOD 100 + +#define AP_PAS_MODEL 200000 +#define AP_PAS_RTNET 201100 +#define AP_PAS_DPF 201200 +#define AP_PAS_LF 201300 +#define AP_PAS_NETCA 201400 +#define AP_PAS_FAULT 201500 +#define AP_PAS_BUSLF 201600 +#define AP_PAS_SENS 201700 +#define AP_PAS_OPF 201800 +#define AP_PAS_NETEQ 201900 +#define AP_PAS_SCD 202000 +#define AP_PAS_RTS 202100 +#define AP_PAS_SCED 202200 +#define AP_PAS_AVC 202500 +#define AP_PAS_PLAN 202600 +#define AP_PAS_AVCDF 202700 +#define AP_PAS_GENSK 202800 +#define AP_PAS_STUSQA 202900 +#define AP_PAS_STUSQB 203000 +#define AP_PAS_ATC 203100 +#define AP_PAS_AZP 203200 +#define AP_PAS_RISK 203300//xux +#define AP_PAS_NODE 203500 +#define AP_PAS_LDADS 203600 + +#define AP_WAMS_FES 702100 +#define AP_WAMS_HIS 703100 + +#define AP_PAS_RESEARCH_1 202900 +#define AP_PAS_RESEARCH_2 203000 + +#define AP_SCADA_SIM 101000 +#define AP_SCADA_RED 1110 +#define AP_SCADA_RELAY 102000 +#define AP_SCADA_ADM 103000 +#define AP_SCADA_IFA 104000 +#define AP_SCADA_ISW 105000 +#define AP_SCADA_OAA 106000 +#define AP_SCADA_LTA 107000 +#define AP_SCADA_OSM 108000 +#define AP_OSM 108000 +#define AP_SCADA_AREA 131000 + +#define AP_AVC_CTLNS 601000 +#define AP_AVC_ROPF 602000 +#define AP_AVC_SVC 604000 +#define AP_AVC_DVC 603000 +#define AP_AVC_EVA 605000 + +//SCHEDULE +#define AP_SCHEDULE_LF 1200100 +#define AP_SCHEDULE_BUSLF 1200200 +#define AP_SCHEDULE_RPP 1210100 +#define AP_SCHEDULE_IPP 1210200 +#define AP_SCHEDULE_SPP 1210300 +#define AP_SCHEDULE_MPP 1210400 +#define AP_SCHEDULE_LPP 1210500 +#define AP_SCHEDULE_ROP 1220100 +#define AP_SCHEDULE_SOP 1220200 +#define AP_SCHEDULE_WOP 1220300 +#define AP_SCHEDULE_MOP 1220400 +#define AP_SCHEDULE_LOP 1220500 + +// + +#define HOME_ENV_NAME "D5000_HOME" + +// column IDs + +#define COLID_T0002_COLUMN_SPECIAL 31 + +//DB FAULT STATUS (1+N) +#define DB_FAULT_STATUS -201 + + +#define SET_DATA 4508 +#define CONF_DIR "conf" +#define MAX_MSG_PACKET_SIZE 32767 + +#define SLICE_MAX_NUM 255 + +#endif + diff --git a/code/sys_nicmonitor/mnic.c b/code/sys_nicmonitor/mnic.c index e6aec95..4a9a605 100644 --- a/code/sys_nicmonitor/mnic.c +++ b/code/sys_nicmonitor/mnic.c @@ -6,7 +6,8 @@ #include #include #include -#include "proc_inv.h" +#include "proc_common.h" +#include "scn_common.h" #include "version.h" #define THRNR 10 @@ -1505,7 +1506,7 @@ int main(int argc, char ** argv) shmctl(id,IPC_RMID,0); id = -1; if((id = shmget(0x1d6010, 128, 0666)) != -1) - shmctl(id,IPC_RMID,0); + shmctl(id,IPC_RMID,0); int ret = 0, proc_stat = 0; unsigned int i = 0; @@ -1534,7 +1535,7 @@ int main(int argc, char ** argv) //#define TESTINTERVAL #ifndef TESTINTERVAL - proc_invocation prcm; + NS_SYSADMIN::CProcCommon prcm; #endif char log_record[125]={0}; char *dir_memory; @@ -1556,7 +1557,6 @@ int main(int argc, char ** argv) exit(-1); } #endif - sig.sa_handler = sig_handler; sigemptyset(&sig.sa_mask); sigaddset(&sig.sa_mask, SIGINT); @@ -1567,7 +1567,11 @@ int main(int argc, char ** argv) sigaction(SIGSEGV, &sig, NULL); /* create dir file path */ +#ifdef USER_NUSP + if((user = getpwnam("nusp")) != NULL){ +#else if((user = getpwnam("d5000")) != NULL){ +#endif sprintf(log_path,"%s",user->pw_dir); sprintf(shm_path,"%s",user->pw_dir); sprintf(sem_path,"%s",user->pw_dir); diff --git a/code/sys_nicmonitor/nicinfo_shm.c b/code/sys_nicmonitor/nicinfo_shm.c index 1c046bf..e538468 100644 --- a/code/sys_nicmonitor/nicinfo_shm.c +++ b/code/sys_nicmonitor/nicinfo_shm.c @@ -15,7 +15,10 @@ #include #include +//#define _WINDOWS64 0 #include "nicinfo_shm.h" +//#include "scn_common.h" +//#include "proc_common.h" #define SHM_PATH "/share/sys_netcard_shm_path" #define SEM_PATH "/share/sys_netcard_sem_path" @@ -154,7 +157,7 @@ void get_sem(int semid) if (errno == EINTR) { continue; } - snprintf(err_str, sizeof(err_str), "EMERG: semop():\n", strerror(errno)); + snprintf(err_str, sizeof(err_str), "EMERG: get_sem semop():%s\n", strerror(errno)); record_log(err_str); return; } @@ -171,7 +174,7 @@ void release_sem(int semid) unlock.sem_flg = SEM_UNDO; if((ret = semop(semid, &unlock, 1)) == -1){ - snprintf(err_str, sizeof(err_str), "EMERG: semop():\n", strerror(errno)); + snprintf(err_str, sizeof(err_str), "EMERG: release_sem semop():%s\n", strerror(errno)); record_log(err_str); return; } @@ -333,12 +336,20 @@ int get_nic_info(char *nic_name, NETCARD_INFO *net_info) strcat(log_path, buf); LOGPATH_UNLOCK; - if (nic_init_flag != 1){ - ret = init_nic_info(); - if (ret != 0){ - return -1; + shm_id = shmget(shm_key,128,0666); + if(shm_id < 0){ + nic_init_flag = 0; + snprintf(err_str, sizeof(err_str), "EMERG: The sys_nicmonitor process status is abnormal !\n"); + record_log(err_str); + return 1; + }else{ + if (nic_init_flag != 1){ + ret = init_nic_info(); + if (ret != 0){ + return -1; + } + nic_init_flag = 1; } - nic_init_flag = 1; } get_sem(semid); // ret = init_nic_info() diff --git a/code/sys_nicmonitor/test.c b/code/sys_nicmonitor/test.c index e9e27f3..6f78753 100644 --- a/code/sys_nicmonitor/test.c +++ b/code/sys_nicmonitor/test.c @@ -12,7 +12,7 @@ int main(int argc, char *argv[]) struct timeval st,et; unsigned long uset, stl, etl, to; if( argc >=2 ) strncpy(dev,argv[1],9); - else strcpy(dev, "eth0"); + else strcpy(dev, "bond0"); if( argc >=3 ) to = strtol(argv[2], NULL, 10 ); else to= 500000ull; @@ -26,17 +26,18 @@ int main(int argc, char *argv[]) etl = et.tv_sec; etl = etl*1000000 + et.tv_usec; uset = etl - stl; -// printf("%d, %x, %x\n", ret, uset, to); + printf("%d, %x, %x\n", ret, uset, to); + printf("KEY= %ld %s\n", ni.ID, ni.charname); if( ret != 0 || uset > to) { ///home/d5000/var/log/netcard/testnic.log char buf[120]; - int log = open("/home/d5000/var/log/netcard/testnic.log", O_CREAT|O_RDWR|O_APPEND, 0666); + int log = open("/home/nusp/var/log/netcard/testnic.log", O_CREAT|O_RDWR|O_APPEND, 0666); snprintf(buf,sizeof(buf),"ret:%d, %lld-%lld=%lld\n", ret, etl, stl, uset); write(log, buf, strlen(buf)); close(log); } -// sleep(1); + sleep(1); } diff --git a/code/sys_nicmonitor/version.h b/code/sys_nicmonitor/version.h index 256feb1..2b87fb3 100644 --- a/code/sys_nicmonitor/version.h +++ b/code/sys_nicmonitor/version.h @@ -1,5 +1,5 @@ -// version=1.20 +// version=2.0 #ifndef MNIC_VERSION - #define MNIC_VERSION "1.21" + #define MNIC_VERSION "2.0" #endif diff --git a/code/test/test_nic b/code/test/test_nic new file mode 100755 index 0000000..11aeccb Binary files /dev/null and b/code/test/test_nic differ diff --git a/code/test/test_nic.cpp b/code/test/test_nic.cpp new file mode 100644 index 0000000..91801ef --- /dev/null +++ b/code/test/test_nic.cpp @@ -0,0 +1,39 @@ +#include "nicinfo_shm.h" +#include +#include +#include +#include +#include +#define IFF_LINKOK ((IFF_UP)|(IFF_RUNNING)) + +int main(int argc,char ** argv) +{ + if(argc!=2) + { + printf("Usage:%s nic_name\n",argv[0]); + exit(0); + } + + int ret_val; + NETCARD_INFO cur_net_info; + while (1) + { + memset(&cur_net_info,0,sizeof(cur_net_info)); + ret_val = get_nic_info(argv[1],&cur_net_info); + if(ret_val == 0) + { + printf("flag:%d\n",cur_net_info.flags); + if ((cur_net_info.flags & IFF_LINKOK) == IFF_LINKOK ) + { + printf("net card %s status OK\n",argv[1]); + } + else + { + printf("net card %s status BAD\n",argv[1]); + } + } + sleep(1); + } + return 1; + +} diff --git a/packages/sys_nicmonitor-2.0-linx90-aarch64-bin-d5000.tar.gz b/packages/sys_nicmonitor-2.0-linx90-aarch64-bin-d5000.tar.gz new file mode 100644 index 0000000..bb53754 Binary files /dev/null and b/packages/sys_nicmonitor-2.0-linx90-aarch64-bin-d5000.tar.gz differ diff --git a/packages/sys_nicmonitor-2.0-linx90-aarch64-bin-nusp.tar.gz b/packages/sys_nicmonitor-2.0-linx90-aarch64-bin-nusp.tar.gz new file mode 100644 index 0000000..caab961 Binary files /dev/null and b/packages/sys_nicmonitor-2.0-linx90-aarch64-bin-nusp.tar.gz differ diff --git a/packages/sys_nicmonitor-2.0-linx90-x86_64-bin-d5000.tar.gz b/packages/sys_nicmonitor-2.0-linx90-x86_64-bin-d5000.tar.gz new file mode 100644 index 0000000..f15854c Binary files /dev/null and b/packages/sys_nicmonitor-2.0-linx90-x86_64-bin-d5000.tar.gz differ diff --git a/packages/sys_nicmonitor-2.0-linx90-x86_64-bin-nusp.tar.gz b/packages/sys_nicmonitor-2.0-linx90-x86_64-bin-nusp.tar.gz new file mode 100644 index 0000000..0caa177 Binary files /dev/null and b/packages/sys_nicmonitor-2.0-linx90-x86_64-bin-nusp.tar.gz differ diff --git a/sys_nicmonitor-arm-bin.tar.gz b/packages/sys_nicmonitor-arm-bin.tar.gz similarity index 100% rename from sys_nicmonitor-arm-bin.tar.gz rename to packages/sys_nicmonitor-arm-bin.tar.gz diff --git a/sys_nicmonitor-arm.tar.gz b/packages/sys_nicmonitor-arm.tar.gz similarity index 100% rename from sys_nicmonitor-arm.tar.gz rename to packages/sys_nicmonitor-arm.tar.gz diff --git a/packages/sys_nicmonitor-mips64-bin.tar.gz b/packages/sys_nicmonitor-mips64-bin.tar.gz new file mode 100644 index 0000000..e303c1b Binary files /dev/null and b/packages/sys_nicmonitor-mips64-bin.tar.gz differ diff --git a/packages/sys_nicmonitor-mips64.tar.gz b/packages/sys_nicmonitor-mips64.tar.gz new file mode 100644 index 0000000..0baf73f Binary files /dev/null and b/packages/sys_nicmonitor-mips64.tar.gz differ