- 浏览: 271331 次
- 性别:
- 来自: 杭州
文章分类
最新评论
-
sunlin:
水文 其他erp就没这样的问题? 不能单方面拿sap说 ...
【转】揭秘SAP在华真相:天价收费与用户之灾 -
zjut_xiongfeng:
用当前日期所在月的第一天,比如2010-7-30的当前月第一天 ...
pb函数库之日期、时间函数 -
550627069:
你好!问下 在PB中显示当前日期的前一个月 应该怎么做?求教
pb函数库之日期、时间函数
--------------of_buildselectexpression-------------------------------
string ls_value = '', ls_expression, ls_tmp, ls_column, ls_coltype
long ll_row, ll_rowcount
ll_rowcount = ids_cond.rowcount()
ls_column = adwc.describe(as_col + '.dbname')
if ls_column = '!' or ls_column = '?' or ls_column = '' then return '!'
ls_coltype = adwc.describe(as_col + '.coltype')
If ls_coltype='!' or ls_coltype='?' Then Return '!'
ls_coltype = Lower ( Left (ls_coltype, 5 ) )
ls_expression = ls_column + ' ' + as_opr + ' '
choose case as_opr
case '= any'
ls_expression = ''
case 'is null', 'is not null'
//do nothing
case 'in', 'not in'
if ll_rowcount < 2 then return '!'
ls_value = "("
for ll_row = 1 to ll_rowcount
ls_tmp = ids_cond.getitemstring(ll_row, 'value')
if len(trim(ls_tmp)) = 0 or isnull(ls_tmp) then return '!'
Choose Case ls_coltype
Case "char(", "char", "date", "datet", "time", "times"
ls_value += "'" + ls_tmp + "', "
Case Else
ls_value += ls_tmp + ", "
end choose
next
ls_value = left(ls_value, len(ls_value) - 2) + ')'
ls_expression += ls_value
case 'like', 'not like'
if ll_rowcount <> 1 then return '!'
ls_tmp = ids_cond.getitemstring(1, 'value')
if len(trim(ls_tmp)) = 0 or isnull(ls_tmp) then return '!'
Choose Case ls_coltype
Case "char(", "char"
ls_expression += "'%" + ls_tmp + "%'"
case else
ls_expression = '!'
end choose
case else
if ll_rowcount <> 1 then return '!'
ls_tmp = ids_cond.getitemstring(1, 'value')
if len(trim(ls_tmp)) = 0 or isnull(ls_tmp) then return '!'
Choose Case ls_coltype
Case "char(", "char", "date", "datet", "time", "times"
ls_expression += "'" + ls_tmp + "'"
case else
ls_expression += ls_tmp
end choose
end choose
return ls_expression
------------------------of_buildselectexpression------------------------------
string ls_value = '', ls_expression, ls_tmp, ls_column, ls_coltype
long ll_row, ll_rowcount
ll_rowcount = ids_cond.rowcount()
ls_column = adw.describe(as_col + '.dbname')
if ls_column = '!' or ls_column = '?' or ls_column = '' then return '!'
ls_coltype = adw.describe(as_col + '.coltype')
If ls_coltype='!' or ls_coltype='?' Then Return '!'
ls_coltype = Lower ( Left (ls_coltype, 5 ) )
ls_expression = ls_column + ' ' + as_opr + ' '
choose case as_opr
case '= any'
ls_expression = ''
case 'is null', 'is not null'
ls_expression += ls_column + ' ' + as_opr
case 'in', 'not in'
if ll_rowcount < 2 then return '!'
ls_value = "("
for ll_row = 1 to ll_rowcount
ls_tmp = ids_cond.getitemstring(ll_row, 'value')
if len(trim(ls_tmp)) = 0 or isnull(ls_tmp) then return '!'
Choose Case ls_coltype
Case "char(", "char", "date", "datet", "time", "times"
ls_value += "'" + ls_tmp + "', "
Case Else
//weng
//old ls_value += "'" + ls_tmp + ", "
ls_value += ls_tmp + ", "
//weng
end choose
next
ls_value = left(ls_value, len(ls_value) - 2) + ')'
ls_expression += ls_value
case 'like', 'not like'
if ll_rowcount <> 1 then return '!'
ls_tmp = ids_cond.getitemstring(1, 'value')
if len(trim(ls_tmp)) = 0 or isnull(ls_tmp) then return '!'
Choose Case ls_coltype
Case "char(", "char"
ls_expression += "'%" + ls_tmp + "%'"
case else
ls_expression = '!'
end choose
case else
if ll_rowcount <> 1 then return '!'
ls_tmp = ids_cond.getitemstring(1, 'value')
if len(trim(ls_tmp)) = 0 or isnull(ls_tmp) then return '!'
Choose Case ls_coltype
Case "char(", "char", "date", "datet", "time", "times"
ls_expression += "'" + ls_tmp + "'"
case else
ls_expression += ls_tmp
end choose
end choose
return ls_expression
--------------------of_buildselectimpossible---------------------------------------
string ls_column
If Len(Trim(as_col))=0 or IsNull(as_col) Then Return '!'
ls_column = adw.describe(ls_column + '.dbname')
if ls_column = '!' or ls_column = '?' or ls_column = '' then return '!'
return ls_column + ' is null and ' + ls_column + ' is not null '
-----------------------------of_buildselectimpossible--------------------------------------
string ls_column
If Len(Trim(as_col))=0 or IsNull(as_col) Then Return '!'
ls_column = adwc.describe(as_col + '.dbname')
if ls_column = '!' or ls_column = '?' or ls_column = '' then return '!'
return ls_column + ' is null and ' + ls_column + ' is not null '
---------------------------of_findcontrolcolumn-----------------------------------------
string ls_r
long ll_row
if isnull(as_dw) or len(trim(as_dw)) = 0 then return '!'
if not isvalid(ids_template) then return '!'
if ids_template.rowcount() < 1 then return '!'
ll_row = ids_template.find('datawindow = "' + as_dw + '"', 1, ids_template.rowcount())
if ll_row <= 0 then return '!'
ls_r = ids_template.getitemstring(ll_row, 'columnname')
if isnull(ls_r) or trim(ls_r) = '' then return '!'
return ls_r
-----------------------------of_finddw----------------------------------------------------
long ll_row
if isnull(as_dw) or len(trim(as_dw)) = 0 then return false
if not isvalid(ids_template) then return false
if ids_template.rowcount() < 1 then return false
ll_row = ids_template.find('datawindow = "' + as_dw + '"', 1, ids_template.rowcount())
if ll_row <= 0 then return false
return true
--------------------------------of_protect-------------------------------
string ls_cols[], ls_modify, ls_tmp
long ll_column, ll_tmp
of_getobjects(ls_cols, 'column', '*', false)
ll_column = upperbound(ls_cols)
for ll_tmp = 1 to ll_column
ls_modify = ls_cols[ll_tmp] + ".Protect=1"
ls_tmp = idw_requestor.describe(ls_cols[ll_tmp] + ".band")
if ls_tmp <> '?' then
ls_modify = idw_requestor.modify(ls_modify)
if ls_modify <> '' then return FAILURE
end if
next
return SUCCESS
-----------------------------------of_register-----------------------------
string ls_dw, ls_col, ls_opr, ls_user
integer li_rc
application app
app = GetApplication()
is_app = app.appname
is_user = as_user
ls_dw = idw_requestor.dataobject
idw_requestor.settransobject(atr)
itr = atr
if isnull(atr) or not isvalid(atr) then return FAILURE
if isnull(is_app) or isnull(as_user) or isnull(ls_dw) or trim(is_user) = '' then return FAILURE
//初始化数据窗口
ids_info = create n_ds
ids_info.dataobject = 'd_datasecurity_info'
ids_info.settransobject(atr)
ids_cond = create n_ds
ids_cond.dataobject = 'd_datasecurity_condition'
ids_cond.settransobject(atr)
ids_template = create n_ds
ids_template.dataobject = 'd_datasecurity_template'
ids_template.settransobject(atr)
//取出模板
if ids_template.retrieve(is_app) < 0 then return FAILURE
//如果在安全模板中就处理,否则就处理CHILDDATAWINDOW,然后返回,对本窗口不作任何控制
if not of_finddw(ls_dw) then
is_act = ''
return of_securechild()
end if
//取出控制列
ls_col= of_findcontrolcolumn(ls_dw)
//取控制列出错
if ls_col= '!' then
return FAILURE
end if
//模板中有,信息中没有,认为不可见,则只需将is_act置为'不可见',DATAWINDOW也不可见
if ids_info.retrieve(is_app, ls_dw, is_user) < 0 then return FAILURE
if ids_info.rowcount() = 0 then
is_act = '不可见'
else //取出用户信息
is_act = trim(ids_info.getitemstring(1, 'allowedaction'))
ls_opr = trim(ids_info.getitemstring(1, 'operator'))
ls_user = trim(ids_info.getitemstring(1, 'username'))
if isnull(ls_user) or len(trim(ls_user) ) = 0 then return FAILURE
if isnull(ls_col) or isnull(is_act) or trim(ls_opr) = '' or trim(is_act) = '' then return FAILURE
end if
//明确不可见
if is_act = '不可见' then
if of_setinvisible(idw_requestor, ls_col) = FAILURE then return FAILURE
if of_protect() = FAILURE then return FAILURE
return SUCCESS
end if
//如果是可见先保护再说
if is_act = '可见' then
if of_protect() = FAILURE then return FAILURE
end if
//再往下就只有'可见'和'可改'了, 不论'可见'或'可改', 均应先改sql
//先把条件取出来
if ids_cond.retrieve(is_app, ls_dw, ls_user, ls_col) < 0 then return FAILURE
//在本函数中处理中DATAWINDOW,如果成功则继续处理CHILDDATAWINDOW
li_rc = of_beforeretrieve(idw_requestor, ls_col, ls_opr)
if li_rc = FAILURE then return FAILURE
li_rc = of_securechild()
return li_rc
--------------------------------------------of_securechild--------------------------------
//以下处理CHILDDATAWINDOW
string ls_cols[], ls_dddw, ls_act, ls_opr, ls_col, ls_user
long ll_column, ll_tmp
integer li_rc
datawindowchild ldwc
of_getobjects(ls_cols, 'column', '*', false)
ll_column = upperbound(ls_cols)
for ll_tmp = 1 to ll_column
//先判断是否DDDW
ls_dddw = idw_requestor.describe(ls_cols[ll_tmp] + ".dddw.name")
if ls_dddw = '!' or ls_dddw = '?' or ls_dddw = '' then continue
//是否在模板中
if not of_finddw(ls_dddw) then continue
//取出列名信息
ls_col = of_findcontrolcolumn(ls_dddw)
if ls_col = '!' then return FAILURE
//如果在模板中,应该能取出来
if idw_requestor.getchild(ls_cols[ll_tmp], ldwc) = -1 then return FAILURE
//SETTRANSOBJECT
if ldwc.settransobject(itr) = -1 then return FAILURE
//取出用户信息
if ids_info.retrieve(is_app, ls_dddw, is_user) < 0 then return FAILURE
if ids_info.rowcount() = 0 then
ls_act = '不可见'
else //取出用户信息
ls_act = trim(ids_info.getitemstring(1, 'allowedaction'))
ls_opr = trim(ids_info.getitemstring(1, 'operator'))
ls_user = trim(ids_info.getitemstring(1, 'username'))
if isnull(ls_col) or isnull(ls_act) or trim(ls_opr) = '' or trim(ls_act) = '' then return FAILURE
end if
//明确不可见
if ls_act = '不可见' then
if of_setinvisible(ldwc, ls_col) = FAILURE then return FAILURE
continue
end if
if ids_cond.retrieve(is_app, ls_dddw, ls_user, ls_col) < 0 then return FAILURE
if of_securechild(ldwc, ls_col, ls_opr) = FAILURE then return FAILURE
next
return SUCCESS
//结束
-----------------------------------------------of_securechild----------------------------------
string ls_select, ls_expression, ls_colexp, ls_oldfilter
long ll_row
//先构造过滤用的EXPRESSION
ls_expression = of_builddwexpression(adwc, as_col, as_opr)
if ls_expression = '!' then
return FAILURE
else
ls_oldfilter = adwc.describe('datawindow.table.filter')
if not (isnull(ls_oldfilter) or ls_oldfilter = '' or ls_oldfilter = '?' or ls_oldfilter = '!') then
ls_expression = '(' + ls_oldfilter + ') and (' + ls_expression + ')'
end if
if adwc.setfilter(ls_expression) <> 1 then
return FAILURE
else
adwc.filter()
is_filter = ls_expression
end if
end if
//对于可取到SQL并且非数据窗口计算字段的,还要修改SQL,修改成功当然好,不成功也没有关系因为FILTER成功了
ls_select = adwc.describe('datawindow.table.select')
ls_colexp = adwc.describe(as_col + '.expression')
if ls_select <> '!' and ls_select <> '?' and ls_select <> '' and ls_colexp = '!' then //可以修改select
ls_expression = of_buildselectexpression(adwc, as_col, as_opr)
if ls_expression <> '!' and ls_expression <> '' then
ls_select = lower(ls_select)
if pos(ls_select, 'where') > 0 then
ls_select = ls_select + ' and ' + ls_expression
else
ls_select = ls_select + ' where ' + ls_expression
end if
end if
// if of_testsqlselect() then
if adwc.modify('datawindow.table.select="' + ls_select + '"') <> '' then return FAILURE
// end if
end if
return SUCCESS
----------------------------------------of_setinvisible-----------------------------------------------------
string ls_expression, ls_select, ls_colexp
if isnull(as_col) or trim(as_col) = '' then return FAILURE
if not isvalid(adw) then return FAILURE
ls_expression = 'isnull(' + as_col + ') and not isnull(' +as_col + ')'
if adw.setfilter(ls_expression) <> 1 then
return FAILURE
else
adw.filter()
end if
//处理SQL,对于可取到SQL并且非数据窗口计算字段的,还要修改SQL,修改成功当然好,不成功也没有关系因为FILTER成功了
ls_select = adw.describe('datawindow.table.select')
ls_colexp = adw.describe(as_col + '.expression')
if ls_select <> '!' and ls_select <> '?' and ls_select <> '' and ls_colexp = '!' then //可以修改select
ls_expression = of_buildselectimpossible(adw, as_col)
ls_select = lower(ls_select)
if pos(ls_select, 'where') > 0 then
ls_expression = ls_select + ' and ' + ls_expression
else
ls_expression = ls_select + ' where ' + ls_expression
end if
adw.modify('datawindow.table.select="' + ls_expression + '"')
end if
return SUCCESS
-------------------------------------of_setinvisible-----------------------------------
string ls_expression, ls_select, ls_colexp
if isnull(as_col) or trim(as_col) = '' then return FAILURE
if not isvalid(adwc) then return FAILURE
ls_expression = 'isnull(' + as_col + ') and not isnull(' +as_col + ')'
if adwc.setfilter(ls_expression) <> 1 then
return FAILURE
else
adwc.filter()
end if
//处理SQL,对于可取到SQL并且非数据窗口计算字段的,还要修改SQL,修改成功当然好,不成功也没有关系因为FILTER成功了
ls_select = adwc.describe('datawindow.table.select')
ls_colexp = adwc.describe(as_col + '.expression')
if ls_select <> '!' and ls_select <> '?' and ls_select <> '' and (ls_colexp = '!' or ls_colexp = '?') then //可以修改select
ls_expression = of_buildselectimpossible(adwc, as_col)
ls_select = lower(ls_select)
if pos(ls_select, 'where') > 0 then
ls_expression = ls_select + ' and ' + ls_expression
else
ls_expression = ls_select + ' where ' + ls_expression
end if
adwc.modify('datawindow.table.select="' + ls_expression + '"')
end if
return SUCCESS
发表评论
-
关于pb游标的使用
2010-08-19 09:58 8890提到游标这个词,人们 ... -
如何将COLUMN的显示风格在EDIT、DDDW、DDLB之间相互切换:
2010-08-19 08:45 1562//如何将COLUMN的显示风格在EDIT、DDDW、DDLB ... -
pb从数据窗口获得数据的方法总结
2010-08-19 08:40 1872通过PowerBuilder的数据窗 ... -
在PB中如何动态注册ACCESS的ODBC数据库连接
2010-08-18 09:28 2958在PB中如何动态注册ACCESS的ODBC数据库连接 //获 ... -
在PB中快速实现数据库树形结构
2010-08-18 08:47 1854树形结构在Windows环境中被普遍应用,它以简捷的界面深受用 ... -
datawindow的参考手册
2010-08-18 08:24 850http://www.docin.com/p-63792034 ... -
sap powerbuilder 接口
2010-08-10 13:40 1594//Declaration String ls_app_se ... -
权限设计的探讨
2010-08-06 16:13 1326但凡涉及多用户不同权限的网络或者单机程序,都会有权限管理的问题 ... -
数据管道的用法
2010-04-22 08:58 1434我们首先看看数据管道 ... -
使用PowerBuilder同时访问多个数据库
2010-04-21 16:00 1289某个客户应用可能需要在同一窗口同时访问两个服务器上的两个不同种 ... -
优化你的PowerBuilder程序
2010-04-21 15:50 965一段程序,完成了所需要的功能固然重要,但是提高执行效率,提高代 ... -
Power Builder 中动态SQL语句的写法
2010-04-16 10:49 1545PowerBuilder是目前最流行的数据库开发工具之一。Po ... -
Datawindow每页显示固定行
2010-04-14 18:52 945使Datawindow每页显示固定行 ---- 第一步:增加 ... -
日期计算函数
2010-04-11 14:00 900Day() 功能得到日期型 ... -
最小化,最大化,正常化窗口
2010-04-01 10:46 905This statement minimizes the Da ... -
datawindow 技巧
2010-04-01 09:08 6063网上看了很多datawindow的技巧,找了很多的例子,发现网 ... -
PowerScript – 常用函数和语句 -文件操作
2010-04-01 08:51 1060文件操作在程序设计中是不可缺少的。可以用文件函数来打开一 ... -
sqlca.sqlcode的数值含义
2010-03-29 16:23 1668如果一个 SQL 语句发生了错误,那么 sqlca.sq ... -
pb函数库之日期、时间函数
2010-03-25 09:59 2659Day()功能得到日期型数据中的号数(1到31之间的整数值 ... -
MESSAGE传递的机制及实例
2010-03-23 09:19 671MESSAGE是PFC消息传递的一个全局变量,是一个通用的数据 ...
相关推荐
The security vulns detector for Hadoop and Spark(大数据安全检测工具)
基于Android平台的数据安全检测研究.pdf
The security vulns detector for Hadoop and Spark(大数据安全检测工具).zip
汽车企业数据安全年报模板.
金融数据安全 数据安全分级指南;本标准起草单位:中国人民银行科技司、中国银行保险监督管理委员会统计信息与风险监测部、国 家金融IC卡安全检测中心(银行卡检测中心)、深圳市长亮科技股份有限公司、中国银行保险...
这个议题来自于携程资深数据安全工程师挖土。数据安全是当前安全领域最为火热的话题之一,很多企业受困于敏感信息访问监控、预警、追溯能力的不足,在信息泄露事件发生时往往束手无策。 针对企业内部的后台系统的...
本文以企业入侵检测日志分析为场景来谈谈大数据安全。
安全管理标准从数据安全保护的管理视角出发,指导行业有效落实法律法规关于数据安全管理的要求,包括数据安全规范、数据安全评估、监测预警与处置、应急响应与灾难备份、安全能力认证等。 内容包含数据安全标准体系...
基于《数据安全法》---企业如何做好数据安全防护 1.企业应设立数据安全负责人和管理机构,落实数据安全保护责任,尤其是重要数据所在企事业单位。...4.企业应建立健全数据安全风险监测和应急处置机制(第二十九条)。
阿里云作为领先的云计算服务提供商,致力于数据安全治理实践,以确保客户数据的安全和隐私。其数据安全治理实践主要包括以下几个方面: 数据加密:阿里云通过提供多层次的数据加密解决方案,包括数据传输加密、数据...
基于Python的加密恶意流量检测源码(AI大数据安全分析赛).zip基于Python的加密恶意流量检测源码(AI大数据安全分析赛).zip基于Python的加密恶意流量检测源码(AI大数据安全分析赛).zip基于Python的加密恶意流量检测源码...
网络安全,风险评估方法,策略,以及欧美建立此规则的经验
目前,部分省级煤矿监管监察...实际应用实践表明,该系统能够根据煤矿监管监察部门的需要对煤矿安全监测监控系统数据进行联网采集,该系统运行稳定,其成功应用为下一步开展煤矿风险研判及大数据分析提供了技术和数据支撑。
工地上工人佩戴安全帽检测数据集,里面是一些佩戴了安全帽的工人图片数据集和未佩戴安全帽的员工数据集。 1、7000多张标注好的数据图片, 2、类别:person、hat, 3、标签格式分别为txt和xml格式两种, 4、直接用于...
1、YOLO安全帽检测数据集,3500张使用lableimg标注软件,标注好的真实场景的高质量图片数据,图片格式为jpg,标签有两种,分别为VOC格式和yolo格式,分别保存在两个文件夹中,可以直接用于YOLO安全帽检检测;数据...
安全帽检测数据集 (Helmet Detection).zip
适用于任意场景,可作为安全帽,反光衣检测+工作服检测的模板数据集. 应用特定场景时,只需加入部分特定场景数据,即可满足对特定场景的检测. 免去了收集,挑选,标注抽烟图片的时间,可直接进行工程化应用.
⼤数据安全核⼼技术 ⼤数据安全核⼼技术 01 数据采集安全技术 数据采集安全技术 01.01 传输安全 传输安全 虚拟专⽤⽹络将隧道技术、协议封装技术、密码技术和配置管理技术结合在⼀起,采⽤安全通道技术在源端和⽬的...
安全帽检测数据集.zip 一共1000多张安全帽佩戴图片,可供安全帽模型检测的数据集。