sqlstr.h
上传用户:maryhy001
上传日期:2007-05-02
资源大小:2317k
文件大小:7k
- #ifndef _TRF_SQLSTR_H
- #define _TRF_SQLSTR_H
- namespace SQL{
- ///服务端数据库操作SQL语句
- /************************ 服务器信息表操作 ************************/
- //判断指定服务器是否已经在数据库中注册
- const char SERVER_REG_EXISTS[] = "select count(*) as SVRCOUNT from servers where ip like '%s'";
- //获取当前服务器表的记录数
- const char SERVER_REG_GETSVRCNT[] = "select count(*) as SVRCOUNT from servers where 1=1";
- //获取当前最大服务器ID号
- const char SERVER_REG_GETMAXID[] = "select max(id) as MAXSVRID from servers where 1=1";
- //在数据库中注册某服务器信息
- const char SERVER_REG_REGISTER[] = "insert into servers(id, ip, agcounts) values(%d, '%s', %d)";
- //反注册某服务器信息
- const char SERVER_REG_UNREGISTER[] = "delete from servers where id = %d";
- //获取某服务详细信息
- const char SERVER_GETINFO[] = "select * from servers where id=%d";
- /************************ 客户端信息表操作 ************************/
- //获取所有的部门和终端信息
- const char SERVER_AGENT_GETALL[] = "SELECT * FROM agents WHERE 1=1";
- const char SERVER_DEPART_GETALL[] = "SELECT * FROM depart WHERE id <> parentid";
- //注册客户端信息
- const char SERVER_AGENT_REGISTER[] = "insert into agents(hostname, ipaddr, hdid, departid, state, name) values('%s', '%s', '%s', %d, %d, '%s')";
- //检查某客户端是否已经在数据库中注册
- const char SERVER_GET_AGENTISREG[] = "select count(*) as CLTCOUNT from agents where hdid like '%s'";
- //根据客户端硬件标识来获取客户端详细信息.
- const char SERVER_GET_AGENTINFO[] = "select * from agents where hdid like '%s'";
- //根据客户端ID来获取客户端详细信息.
- const char SERVER_GET_AGENTINFO_FRMID[] = "select * from agents where id = %d";
-
- //更新客户端信息
- const char SERVER_UPDATE_AGINFO[] = "update agents set hostname = '%s', ipaddr = '%s', state = %d where hdid like '%s'";
- //更新客户端状态信息
- const char SERVER_UPDATE_AGSTATE[] = "update agents set state = %d where hdid like '%s'";
- /*********************** 系统用户信息表操作 ***********************/
-
- //获取某系统用户的详细信息
- const char SERVER_GET_SYSUSRINFO[] = "select * from sysuser where id = %d";
- //核对某系统用户的身份
- const char SERVER_VERIFY_SYSUSR[] = "select count(*) as SYSUSRCNT from sysuser where name like '%s' and passwrd like password('%s')";
-
- //更改数据库中客户端显示名称
- const char SERVER_UPDATE_AGENTNAME[]= "update agents set name = '%s' where id = %d";
-
- //更改数据库中部门名称
- const char SERVER_UPDATE_DEPARTNAME[]= "update depart set name = '%s' where id = %d";
- //更改数据库中某客户端所属部门
- const char SERVER_UPDATE_AGFORDEPART[]= "update agents set departid = %d where id = %d";
-
- ///客户端数据库操作SQL语句
- /*********************** 客户端信息表操作 ***********************/
- //删除Agents表内所有记录
- const char CLIENT_CLEAR_AGSTAB[] = "delete from agents where 1=1";
- //删除Departs表内所有记录
- const char CLIENT_CLEAR_DEPARTSTAB[] = "delete from departs where 1=1";
- //新增Agent信息
- const char CLIENT_INSERT_AGINFO[]= "insert into agents (id, hostname, ipaddr, hdid, departid, state, name) values(%d, '%s', '%s', '%s', %d, %d, '%s')";
-
- //新增Depart信息
- const char CLIENT_INSERT_DEPARTINFO[]= "insert into departs (id, name, parentid) values(%d, '%s', %d)";
-
- //更改本地客户端显示名称
- const char CLIENT_UPDATE_AGENTNAME[]= "update agents set name = '%s' where id = %d";
- //更改本地部门名称
- const char CLIENT_UPDATE_DEPARTNAME[]= "update departs set name = '%s' where id = %d";
- //更改本地某客户端所属部门
- const char CLIENT_UPDATE_AGFORDEPART[]= "update agents set departid = %d where id = %d";
- //=============================更新用户列表===============================
-
- //获取数据库中客户端数量
- const char CLIENT_GETALLAGCOUNTS[] = "select count(*) as COUNTS from agents";
-
- //获取指定父结点ID下所有部门信息
- const char CLIENT_GETSUBDEPARTS[] = "select * from departs where id <> parentid and parentid = %d order by name asc";
- //获取指定部门ID下所有用户信息
- const char CLIENT_GETUSRS_FORSPDEPART[] = "select * from agents where departid = %d order by name asc";
- //获取指定部门的详细信息
- const char CLIENT_GETSPECEDEPART_INFO[] = "select * from departs where id = %d";
- //根据客户ID来获取其详细信息
- const char CLIENT_GETSPECEAGENT_FROM_ID[] = "select * from agents where id = %d";
- //根据客户端主机名称来获取其详细信息
- const char CLIENT_GETSPECEAGENT_FROM_HOST[] = "select * from agents where hostname = '%s'";
- //根据客户端主机IP来获取其详细信息
- const char CLIENT_GETSPECEAGENT_FROM_IP[] = "select * from agents where ipaddr = '%s'";
- //=============================操作文件传输表===============================
- /*
- * transtype: 1: 发送方标志
- * 2: 接收方标志
- * 4: 发送成功标志
- * 8: 接收成功标志
- */
- enum {TRANSTYP_SNDER = 1, TRANSTYP_RECOR = 2, TRANSTYP_SNDOK = 4, TRANSTYP_RECVOK = 8};
- //获取当前发送或接收记录数量
- const char CLIENT_TRANS_COUNT[] = "select count(*) as RECCNTS from transrecs where 1=1";
- //获取当前发送或接收记录的最大ID号
- const char CLIENT_TRANS_MAXID[] = "select max(id)+1 as MAXID from transrecs";
- //获取某段时间内发送或接收的历史记录
- const char CLIENT_TRANS_TRANSHISTORY[] = "select * from transrecs where transtype = %d and (transtime >= '%s' and transtime <= '%s') order by transtime desc";
-
- //新增发送或接收记录
- const char CLIENT_TRANS_ADDLOG[] = "insert into transrecs(id, filename, srcfilename, peername, transtime, transtype) values(%d, '%s', '%s', '%s', '%s', %d)";
- //删除发送或接收记录
- const char CLIENT_TRANS_DELLOG[] = "delete from transrecs where filename = '%s' and srcfilename = '%s' and peername = '%s' and transtime = '%s'";
-
- //修改发送或接收记录
- const char CLIENT_TRANS_MODIFYLOG[] = "update transrecs set filename = '%s' where filename = '%s' and srcfilename = '%s' and peername = '%s' and transtime = '%s'";
- //===========================================群发组管理表================================================
-
- //获取所有群发组信息
- const char CLIENT_GRPSND_GETALLSNDGRPS[] = "select * from grpsndgrps order by departname asc";
- //获取所有群发组下的所有用户信息
- const char CLIENT_GRPSND_GETUSRSOFSNDGRP[] = "select b.id, b.name from grpsndusers a, agents b where a.id = b.id and a.departid = %d order by b.name asc";
- //获取当前群发组记录数
- const char CLIENT_GRPSND_GETCNTOFSNDGRP[] = "select count(*) as SNDGRPCNT from grpsndgrps";
- //获取下一个群发组ID号
- const char CLIENT_GRPSND_GETNEXTSNDGRPID[] = "select max(departid)+1 as NEXTID from grpsndgrps";
- //添加群发组信息
- const char CLIENT_GRPSND_ADDSNDGRP[] = "insert into grpsndgrps(departid, departname) values(%d, '%s')";
- //修改群发组名称信息
- const char CLIENT_GRPSND_EDTSNDGRPNAME[] = "update grpsndgrps set departname = '%s' where departid = %d";
- //删除群发组信息
- const char CLIENT_GRPSND_DELSNDGRP[] = "delete from grpsndgrps where departid = %d";
- //=========================================群发组用户管理表================================================
- //添加群发组用户信息
- const char CLIENT_GRPSNDUSR_ADDSNDGRPUSR[] = "insert into grpsndusers(id, departid) values(%d, %d)";
-
- //删除群发组信息
- const char CLIENT_GRPSNDUSR_DELSNDGRPUSR[] = "delete from grpsndusers where id = %d and departid = %d";
- }
- #endif //_TRF_SQLSTR_H