




版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
1、成成 都都 信信 息息 工工 程程 学学 院院 学学 位位 论论 文文 面向对象的数据建模面向对象的数据建模 数据筛选接口的设计数据筛选接口的设计 论文作者姓名:论文作者姓名: 申请学位专业:申请学位专业: 申请学位类别:申请学位类别: 指指导导教教师师姓姓名名(职职称称) : 论文提交日期:论文提交日期: 面向对象的数据建模面向对象的数据建模 数据筛选接口的设计数据筛选接口的设计 摘摘 要要 wise 系统是一个功能强大的数据处理系统。它应用于某公司,此公 司由于行业的关系需要它去处理庞大的数据,这些数据每天都在以上百万条甚 至上亿条的数量在增加。因此它需要处理海量的数据,它的其中一个比较重
2、要 的功能是根据复杂并且灵活的条件筛选出适当的数据返回给客户。本论文主要 讲述了如何针对数据筛选条件比较复杂并且比较灵活这一需求,在做了详尽的 需求分析之后,进行了一系列的设计,包括解决方案的设计,数据建模, pl/sql 程序设计,最终完成整个数据筛选接口的设计。在整个数据筛选接口的 设计中,在传统的关系性数据库的基础上,会尝试着应用一些面向对象的思想 去设计。尤其在数据建模阶段,通过传统的数据模型之间的关系,例如主外键关系,实 现了一些重要的面向对象的思想。 关键字关键字:数据筛选;面向对象;数据建模;pl/sql implement the object oriented thinkin
3、g in the project to data modeling the design about the api to filter data abstract the wise system is a powerful system for data processing .it is applied in a company which needs to use this system to process huge amount data. and these data will be increased by millions or hundreds millions. so it
4、 needs to process the huge amount data .one of its important function is return the right data to client filtered by some complex and flexible conditions. the most content of the paper talks about how to finish the total design for the requirement which is the conditions to filter data can be comple
5、x and flexible. the entire design will include the design of project to solve problem, the design about data modeling, and the design about pl/sql program. finally the all designs to implement the interface for filtering the data are finished .we will try implementing the object oriented thinking to
6、 design on the base of the relational database in the process to finish all the design. especially in the process to implement data modeling, we will implement some important object oriented thinking by some relations among traditional data models, such as pk or fk relationship. key words: data filt
7、ration;object oriented;data modeling;pl/sql 目目 录录 论文总页数:24 页 1 引 言.1 2 开发概述.1 3 需求分析.1 31 需求调研.1 32 开发运行环境.3 4 解决方案的设计.3 5 数据建模.8 5.1 数据模型的建立.8 5.2 数据库表结构的设计.9 5.3 数据库基础视图的设计.11 6 pl/sql 程序设计.12 结 论.22 参考文献.22 致 谢.23 声 明.24 1 1 引引 言言 当今社会,某些行业的数据量越来越庞大,每天都在以上百万条甚至上亿 条的数量在增加,因此对这些行业的数据处理系统的性能要求也越来越高。
8、这 些要求不但包括处理速度尽可能快,系统可维护性尽可能高等传统需求,而且 增加了对数据的处理尽可能的灵活等一些新的需求。要满足这些新的需求,我 们需要研究这些新需求的特性,挖掘一些解决办法。面向对象的数据建模是我 们研究的一个重要方向。 引用言论:steve hoberman 所提出的“抽象组件”的概念和面向对象设计 中的“设计模式”非常类似。即数据库专家在多次的数据建模后,将各个项目 中的类似部分抽象化,提取出特定的建模模型片段,以后只需在新的项目中对 这些模型片段细化派生,即可快速构建出适合于该项目的数据库架构。 2 2 开发概述开发概述 wise 系统是一个功能强大的数据处理系统。由于业
9、务的关系,它需要 处理海量的数据,它的比较重要的一个功能是根据复杂并且灵活的条件筛选出 适当的数据返回给客户。 针对这一数据筛选功能,开发的目标是设计一个合理的数据筛选接口。接 口能做到便于动态控制,便于动态修改,以及便于维护。 开发的过程包括需求分析,解决方案的设计,数据建模,pl/sql 程序设计, 最终完成整个数据筛选接口的设计。 3 3 需求分析需求分析 3 31 1 需求调研需求调研 wise 系统是某公司的数据处理系统,它的一个主要功能是每天根据复杂并 且灵活的条件筛选出适当的数据返回给客户。所筛选的数据都来自于一张表, 这张表的字段有 260 个,这些字段中有超过 250 个字段
10、需要作为筛选字段,它 们通常互为组合去筛选出客户需要的数据,根据客户的需要它们的组合又是多 变的。这张表的数据量通常在一千万到一亿条记录之间。值得注意的是,筛选 条件需要去匹配的值是具有特定意义的,尽管这些值数目众多,但它们的数量 不是随意增长的。而且这些值是根据客户的需求可以去定制的。 表 1 复杂表 complexity 字段名数据类型说明 c_id 数字主键 c_u1 文本 c_u2 文本 c_u13 文本 c_u4 货币 c_u5 数字 c_u6 货币 c_u7 文本 c_u8 货币 c_u9 文本 c_u10 货币 c_u11 文本 c_u12 文本 c_u13 日期/时间 c_u1
11、4 日期/时间 c_u15 数字 c_u16 数字 c_u17 文本 c_u18 文本 c_u19 文本 c_u20 货币 c_u21 数字 c_u22 货币 c_u23 文本 c_u24 货币 c_u25 文本 等等一共 260 个字段 因此对数据筛选的需求特点主要有: 数据筛选需求特点 数据量庞大 来自于一张表,表的字段较多,大多 数为筛选字段 筛选字段通常组合,组合较为灵活 筛选列去需要去匹配的值,有特定 意义,客户可以定制 图 1 需求特点分析图 数据量庞大在这里不是本次设计的研究重点,后三个特点是本次设计要解 决好的需求。 3 32 2 开发运行环境开发运行环境 开发所需的基本软、硬
12、件环境为: windows 2003 或者 windows xp。 oracle 10 g r2。 cpu 2.40ghz 1g 以上内存。 2g 以上可用硬盘空间。 在 windows 2003 操作系统下,以 toad for oracle xpert v 为开 发工具,用 oracle 10 g r2 为后台数据库。 4 4 解决方案的设计解决方案的设计 在这里来逐步分析需求应该通过怎样的方式来实现,进行一些解决方案的 设计。 方案方案 1 1 :直接写过程来实现。 根据不同的筛选条件,写不同的过程来实现数据筛选。 问题:很显然,这种方案是行不通的。由于筛选字段数量达两百多
13、个,而 且相互之间可以互为组合,所以是不应该写过程来实现的。即便把目前需求要 求的筛选条件通过写过程来实现了(暂不考虑开发人员的头疼) ,如果需要添加 一些新的筛选,那将是非常麻烦的。再则,如果所写过程中出现一些问题,也 是难以维护的。 所以考虑到开发的质量与代码的可维护性,是不可能采用此方案的。 方案方案 2 2:结合数据建模与程序设计来实现。 由于筛选条件数量众多,但是条件之间的很多部分相互重合,从面向对象 的角度出发,这些条件间存在继承的关系,如果能采用面向对象的方法,或许 能做到重用条件。 假设一共有 250 个独立的筛选条件,也即表中的 250 个字段单独作为条件 时的情况。这些条件
14、能相互组合,组合后的条件越发复杂,写程序时如果按照 方案 1 要想做到很好的代码重用是不可能实现的。 所以根据方案 1 的失败,要想很好的做到代码重用,就很有必要引入面向 对象的思想,采用继承的方法,做到条件组合,就好像类与类之间的继承。作 为表中列名出现的字段,是不可能相互组合的。但是换个角度,大胆的设想, 如果把这些字段不作为列名,能不能做到相互组合呢?如果把这些字段转换成 变量,对变量一一赋值,和作为字段相比并没有做到很大的改善。 如果把这些字段转换成表中的记录值呢?试想一下,似乎看到一线光明, 因为在 pl/sql 里,可以用到动态 sql 的方法,这样可以所需要的条件动态的组 合了。
15、 但是能不能真正达到便于动态控制,便于动态修改,以及便于维护呢?我 们需要一步一步去研究,以及测试。 根据目前得出的结论,我们现在需要一个表,表中的某一列的记录值为 complexity 表中作为筛选条件的列名,如下表 2 所示: 表 2 field 字段名数据类型说明 id 数字主键 name 文本 column_name 文本列名 field 表中的 column_name 列存放 complexity 表中作为筛选条件的列名。 这样就可以做到把条件一步一步拼起来了。 接着往下分析。需要选取出可能作为筛选条件的列名 c_u1、c_u2、c_u3、c_u4 四个字段,以后的分析将会以它们作为
16、例子。这里把 每个单独的列名作为筛选条件的条件叫做简单条件,而多个简单条件组合而成 的条件叫做复杂条件。值得注意的是,筛选条件中有相当一部分是类似于 c_u1 in (a, b, c, d)的,它也是简单条件,但是比较特殊一点,这样的 条件把它叫做简单序列条件。 假设现在客户 ted 需要的数据是以 c_u1a 和 c_u2a 和 c_u2 a 或者c_u2=b ,筛选列和匹配的数值我们都可以 在相关表中取到,而筛选列和匹配的数值之间的关系,例如大于,小于,等于, 时间从某时间开始,这些关系是我们在写代码的时候一直在重复的写的。而正 是因为这个原因,代码不能做到代码间的继承和重用,这是一个失败
17、指出。 要是通过接口设计能把这些关系像处理筛选列与匹配的数值一样处理,这 个问题也就解决了。能做到么?答案是肯定的。因为这些关系也就只有数种, 例如数字间的比较,时间数值之间的比较,诸如此类的关系是可以得到有效控 制的。 对于序列条件,只有两种关系,即是否in ,很显然也可以得到有效的控 制。 通过以上的分析,现在只需要再加一个表就可以了,这张表用来存放简单 条件的筛选列与匹配的数值之间的关系种类,而对于序列条件,就不用,在程 序里很容易做到动态处理。为了不占据篇幅,数据筛选接口的完整数据库架构 会在后面的数据建模部分中一并出现。 5 5 数据建模数据建模 5.15.1 数据模型的建立数据模型
18、的建立 根据解决方案的设计,画出数据筛选接口的完整数据库架构,如后页图所 示: condition pkid name negated container_id compound_condition pkid conjunction_id simple_condition pkid name value operator_id field_id list_condition pkid field_id conjunction pkid name code condition_operator pkid code name field pkid name column_name list_con
19、dition_match_value pkid list_condition_id match_value 图 5 数据库架构图 5.25.2 数据库表结构的设计数据库表结构的设计 根据前面完成的解决方案的设计以及数据模型的建立,可以设计出完整的 数据库表结构。具体设计如下: 用于存放筛选条件,具体设计如表 3 所示: 表 3 条件表 condition 字段名数据类型说明 id 数字编号字段 主键 name 文本条件名字 negated 数字判断是否为否定字段 container_id 数字判断是否属于复合条件字段 用于存放条件联接符,具体设计如表 4 所示: 表 4 条件联接符表 conj
20、unction 字段名数据类型说明 id 数字编号字段 主键 name 文本名字 code 文本联接符编码 用于存放复合条件,具体设计如表 5 所示: 表 5 复合条件表 compound_condition 字段名数据类型说明 id 数字编号字段 主键 conjunction_id 数字联接符编号 用于存放简单条件信息,具体设计如表 6 所示: 表 6 简单条件表 simple_condition 字段名数据类型说明 id 数字编号字段 主键 name 文本简单条件名字 value 文本简单条件数值 operator_id 数字条件运算符编号 field_id 数字筛选列编号 用于存放条件运
21、算符信息,具体设计如表 7 所示: 表 7 条件运算符表 condition_operator 字段名数据类型说明 id 数字编号字段 主键 name 文本条件运算符名字 code 文本条件运算符编码 用于存放序列条件信息,具体设计如表 8 所示: 表 8 序列条件表 list_condition 字段名数据类型说明 id 数字编号字段 主键 field_id 数字筛选列编号 用于存放序列条件需要去匹配的数值信息,具体设计如表 9 所示: 表 9 序列条件匹配数值表 list_condition_match_value 字段名数据类型说明 id 数字编号字段 主键 list_condition
22、_id 数字序列条件编号 match_value 文本序列条件匹配值 用于存放筛选列信息,具体设计如表 10 所示: 表 10 筛选列信息表 field 字段名数据类型说明 id 数字编号字段 主键 name 文本筛选列名字(可作标记) column_name 文本实际筛选列名 5.35.3 数据库基础视图的设计数据库基础视图的设计 通过之前的分析,我发现数据库中的八个表之间关联比较多,应该把通常 发生关联的表封装起来,视图正是实现这个封装的最佳选择。 需要创建四个视图,分别为简单条件视图,序列条件视图,组合条件视图, 以及条件视图。通过这四个视图可以把简单条件,序列条件,以及组合条件和 fi
23、eld 表很好的封装起来。为了避免占据过多篇幅,这里只以序列条件视图和 组合条件视图为例。 序列条件视图: create or replace view v_list_condition (field_name, column_name, field_type_name, field_type_code, field_table_type_name, field_table_type_code, negated, item_count, id, field_id, field_type_id, container_id) as select f.name as field_name, f.co
24、lumn_name, ic.negated, ( select count( * ) from list_cond_match_value lcmv where ( lcmv.list_condition_id = lc.id ) ) as i_count, lc.id, f.id as field_id, f.type_id as field_type_id, ic.container_id from list_condition lc left outer join condition c on( c.id = lc.id ) left outer join field f on ( f.
25、id = lc.field_id ) / 组合条件视图: create or replace view v_compound_condition (negated, conjunction_name, conjunction_code, condition_count, id, container_id, conjunction_id) as select ic.negated, c.name as conjunction_name, c.code as conjunction_code, ( select count( * ) from condition childcondition wh
26、ere ( childcondition.container_id = cic.id ) ) as condition_count, cc.id, ic.container_id, cc.conjunction_id from compound_condition cc left outer join condition ic on( ic.id = cc.id ) left outer join conjunction c on( c.id = cc.conjunction_id ) / 这样就通过创建视图,把简单条件,序列条件,以及组合条件和 field 表 很好的封装起来了。 到此,数据
27、建模完成。 6 6 pl/sqlpl/sql 程序设计程序设计 现在进行本接口设计的 pl/sql 程序设计部分。 从客户出发,这里来整理一下思路。当客户提出一系列筛选条件的要求时, 开发人员首先需要把这些基本的简单条件和匹配的数值,以及相关的记录值, 一一插入相关的表中。开发人员可以用写一系列的过程来实现,通过传入必需 的参数来调用相关的过程,插入一些数值。 从下到上,首先要对表直接进行操作,需要一系列最基本的用来实现把数 值插入表的过程。 以简单条件为例: procedure ins_simple_condition ( p_calling_user_id integer, - requi
28、red p_name varchar2 := null, p_negated number := 0, - required p_container_id integer := null, p_field_id integer, - required p_value varchar2 := null, p_enum_value_id integer := null, p_comparison_field_id integer := null, p_operator_id integer, - required p_new_row_id out integer ) is begin -省略部分代
29、码 ins_condition ( p_calling_user_id, p_name, p_negated, p_container_id, p_new_row_id ); insert into simple_condition ( id, field_id, value, enum_value_id, comparison_field_id, operator_id ) values( p_new_row_id, p_field_id, p_value, p_enum_value_id, p_comparison_field_id, p_operator_id ); -省略部分代码 en
30、d; 然后,需要在这些基础过程之上,写一些调用这些基础过程的过程,也以 简单条件为例: procedure add_simple_condition ( p_calling_user_id integer, - required p_app_id integer, p_table_type_code varchar2, - required p_name varchar2 := null, p_negated number := 0, p_container_id integer := null, p_field_name varchar2, - required p_value varcha
31、r2 := null, p_value_date date := null, p_comparison_field_name varchar2 := null, p_operator_code varchar2, - required p_new_row_id out integer ) is - l_field_id integer; l_field_type_code varchar2( 100 ); l_comparison_field_id integer; l_comparison_field_type_code varchar2( 100 ); l_operator_code va
32、rchar2( 100 ); l_operator_id integer; l_value varchar2( 1000 ); begin -省略部分代码 select id, code into l_operator_id, l_operator_code from condition_operator where ( lower( code ) = lower( p_operator_code ) ); -省略部分代码 ins_simple_condition ( p_calling_user_id = p_calling_user_id, p_name = p_name, p_negat
33、ed = p_negated, p_container_id = p_container_id, p_field_id = l_field_id, p_value = l_value, p_comparison_field_id = l_comparison_field_id, p_operator_id = l_operator_id, p_new_row_id = p_new_row_id ); -省略部分代码 end; 现在就可以创建一些比较复杂的组合条件了。为了不占据篇幅,这里只以 一个简单的复合条件为例: -first compound condition (no_notice in
34、(b,c,d) and msg_delinq_days90 and do_not_process=9 and client_id=116) declare l_calling_user_id integer; l_dps_appl_id integer; l_count integer; l_spec_id integer; l_item_id integer; l_simple_id integer; l_inventory_item_id integer; l_temp_id integer; l_compound_id integer; l_field_id integer; l_rul
35、e_id integer; l_list_id integer; l_state_4_ted1 varchar2( 4000 ) := b,c,d; begin -省略部分代码 -add condition add_compound_item_condition ( p_name = the fourth compoud condition, p_negated = 0, p_conjunction = and, p_container_id = null, p_new_row_id = l_rule_id); select id into l_field_id from field_ whe
36、re name = no_notice and ( application_id = l_dps_appl_id or application_id is null ); add_list_item_condition ( p_name = no_notice in(b,c,d), p_negated = 1, p_field_id = l_field_id, p_container_id = l_rule_id, p_new_row_id = l_list_id); for x in ( with src as ( select l_state_4_ted1 exp from dual ),
37、 num as ( select rownum i from dual connect by rownum 0 order by r ) loop add_list_item_condition_mv ( p_list_item_condition_id = l_list_id, p_match_value = x.r, p_new_row_id = l_temp_id); end loop; select id into l_field_id from field_ where name = msg_delinq_days and ( application_id = l_dps_appl_
38、id or application_id is null ); add_simple_item_condition ( p_name = null, p_negated = 0, p_container_id = l_rule_id, p_field_id = l_field_id, p_value = 90, p_comparison_field_name = null, p_operator = greater, p_new_row_id = l_simple_id); select id into l_field_id from field_ where name = do_not_pr
39、ocess and ( application_id = l_dps_appl_id or application_id is null ); add_simple_item_condition ( p_name = null, p_negated = 0, p_container_id = l_rule_id, p_field_id = l_field_id, p_value = 9, p_comparison_field_name = null, p_operator = equals, p_new_row_id = l_simple_id); select id into l_field
40、_id from field_ where name = client_id and ( application_id = l_dps_appl_id or application_id is null ); add_simple_item_condition ( p_name = null, p_negated = 0, p_container_id = l_rule_id, p_field_id = l_field_id, p_value = 116, p_comparison_field_name = null, p_operator = equals, p_new_row_id= l_
41、simple_id); commit; end; 到此筛选列和需要匹配的数值,就可以得到灵活控制了。还需要对存储在 表condition_operator中的数值,也就是记录筛选列和需要匹配的数值之间的 关系的数值进行处理,以便能动态处理。下面只以需要匹配的数值的数据类型 为日期类型的情况为例。 当需要匹配的数值的数据类型为日期类型时,如下: function comparison_date ( p_row v_simple_condition%rowtype, p_field_ref varchar2, p_comparison_field_ref varchar2 ) return var
42、char2 is l_comparison varchar2( 4000 ); l_operator varchar2( 2 ); l_value_this_day date; l_value_this_day_string varchar2( 1000 ); l_value_next_day date; l_value_next_day_string varchar2( 1000 ); begin -省略部分代码 if( p_comparison_field_ref is not null ) then -省略部分代码 l_value_this_day_string := trunc( |
43、p_comparison_field_ref | , dd ); l_value_next_day_string := trunc( | p_comparison_field_ref | + 1, dd ); else if ( p_row.value is not null ) then l_value_this_day := to_date( p_row.value, g_date_format ); l_value_this_day_string := to_date( | | p_row.value | , | | g_date_format | ) ; l_value_next_da
44、y := l_value_this_day + 1; l_value_next_day_string := to_date( | | to_char( l_value_next_day, g_date_format ) | , | | g_date_format | ) ; end if; end if; case p_row.operator_code when equals then if( p_comparison_field_ref is not null ) then if( p_row.negated = 0 ) then l_comparison := ( ( | p_field
45、_ref | is null ) and | ( | p_comparison_field_ref | is null ) ) or | ( ( | p_field_ref | = | l_value_this_day_string | ) | and | ( | p_field_ref | | l_value_next_day_string | ) ); else l_comparison := ( ( | p_field_ref | is null ) and | ( | p_comparison_field_ref | is not null ) ) or | ( ( | p_field
46、_ref | is not null ) and | ( | p_comparison_field_ref | is null ) ) or | ( | p_field_ref | = | l_value_next_day_string | ); end if; else if( p_row.value is null ) then if( p_row.negated = 0 ) then l_comparison := p_field_ref | is null; else l_comparison := p_field_ref | is not null; end if; else if(
47、 p_row.negated = 0 ) then l_comparison := ( | p_field_ref | = | l_value_this_day_string | ) | and | ( | p_field_ref | | l_value_next_day_string | ); else l_comparison := ( | p_field_ref | is null ) | or | ( | p_field_ref | = | l_value_next_day_string | ); end if; end if; end if; when greater then nu
48、ll; if( ( p_comparison_field_ref is not null ) or ( p_row.value is not null ) ) then if( p_row.negated = 0 ) then l_operator := =; else l_operator := ; end if; l_comparison := p_field_ref | | l_operator | | l_value_next_day_string; else - the value were checking against is null, so we should have no
49、 matches. l_comparison := g_false_condition; end if; when less then if( ( p_comparison_field_ref is not null ) or ( p_row.value is not null ) ) then if( p_row.negated = 0 ) then l_operator := =; end if; l_comparison := p_field_ref | | l_operator | | l_value_this_day_string; else - the value were che
50、cking against is null, so we should have no matches. l_comparison := g_false_condition; end if; else raise_application_error ( g_error_number, unexpected operator: | p_row.operator_code ); end case; -省略部分代码 return l_comparison; end; 总结一下,本接口设计的 pl/sql 程序设计部分是通过如下过程实现了灵活 控制筛选条件,并完成了数据筛选接口的基本部分的。 被 调
51、用 被 调 用 图 6 创造数据筛选条件程序设计图 现在筛选列和需要匹配的数值以及筛选列和需要匹配的数值之间的关系都 可以得到灵活控制了,只需要根据不同的参数调用公共的pl/sql接口,一一 拼装起来即可。 现在还需要通过写过程来实现把这些复杂筛选条件拼装起来,最终筛 选出客户需要的数据,这样一个功能。 以简单条件为例。 function cond_where_simple ( p_item_condition_id integer, p_index_field_prefix varchar2 ) return varchar2 is - required l_where_clause var
52、char2( 4000 ); l_row v_simple_item_condition%rowtype; l_effective_prefix varchar2( 100 ); l_field_ref varchar2( 1000 ); l_comparison_field_ref varchar2( 1000 ) := null; begin -省略部分代码 l_effective_prefix := ; if( p_index_field_prefix is not null ) then l_effective_prefix := p_index_field_prefix | .; 基
53、础操作条件过程1 对数据库的相关条件表进行 操作,包括插入,更新等 基础操作条件过程2 动态处理记录筛选列和需 要匹配的数值之间的关系 的数值 调用基础条件过程 用于创造一些复杂的组 合条件 end if; l_where_clause := ; select * into l_row from v_simplecondition where( id = p_item_condition_id ); l_field_ref := l_effective_prefix | l_row.column_name; if( l_row.comparison_column_name is not nul
54、l ) then l_comparison_field_ref := l_effective_prefix | l_row.comparison_column_name; end if; case l_row.field_type_name when boolean then l_where_clause := l_where_clause | comparison_boolean( l_row, l_field_ref, l_comparison_field_ref ); when date then l_where_clause := l_where_clause | comparison
55、_date( l_row, l_field_ref, l_comparison_field_ref ); when list then l_where_clause := l_where_clause | comparison_string( l_row, l_field_ref, l_comparison_field_ref ); when number then l_where_clause := l_where_clause | comparison_number( l_row, l_field_ref, l_comparison_field_ref ); when string the
56、n l_where_clause := l_where_clause | comparison_string( l_row, l_field_ref, l_comparison_field_ref ); else -省略部分代码 end case; return l_where_clause; end; 现在还需要再完成一个对简单条件,序列条件,以及组合条件都开放的公 共调用接口。 function condition_where_clause_r ( p_condition_id integer, - required p_index_field_prefix varchar2 := nul
57、l ) return varchar2 is - required l_where_clause varchar2( 10000 ) := null; l_condition_type varchar2( 100 ); begin -省略部分代码 l_where_clause := ( ; - its either a simple, compound, or list condition. l_condition_type := condition_type( p_condition_id ); case l_condition_type when simple then l_where_c
58、lause := l_where_clause | cond_where_simple( p_condition_id, p_index_field_prefix ); when list then null; l_where_clause := l_where_clause | cond_where_list( p_condition_id, p_index_field_prefix ); when compound then l_where_clause := l_where_clause | cond_where_compound( p_condition_id, p_index_fie
59、ld_prefix ); else raise_application_error ( g_error_number, unknown type for item condition | p_condition_id ); end case; l_where_clause := l_where_clause | ); -省略部分代码 return l_where_clause; end; 到此,数据筛选接口的设计就基本完成了。需要什么样的条件,无论复杂 与否,都只需要根据需求,通过传入相关参数调用产生条件的公共接口,然后 用动态 sql 的方法, 拼在筛选条件的地方就可以了。 结结 论论 所设
60、计与开发的数据筛选接口会对系统的数据筛选部分起到便于灵活控制, 便于修改,便于维护的作用。 融合了面向对象的思想后的数据库在开发阶段会发生了一些改善,例如提 高代码的可重用性,这就很大程度上减少了开发阶段在代码编写上所花费的资 源,可以很好的提高软件的开发质量,并且易于维护。 参考文献参考文献 1 johanna wenny rahayu,david taniar,eric pardede.object-oriented oraclem.irm press,2005。 2 steven feuerstein,bill pribyl.oracle pl/sql programming 4th e
温馨提示
- 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
- 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
- 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
- 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
- 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
- 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
- 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- CPMM最常被忽视的内容试题及答案
- 安全员C证考试知识竞赛检测模拟题带答案
- 从容应对CPMM的试题及答案
- 生态位与种群动态关系试题
- 餐饮美学基础 课件 1.2餐饮审美分析
- 2024年电商设计中的用户细分策略试题及答案
- 保健员专业知识培训课件
- 解析2024年CPMM考试试题及答案
- CPSM考试前的心理准备试题及答案
- 《家书》阅读答案
- 2025年云南省高职单招《职测》高频必练考试题库400题(含答案)
- 新教科版一年级科学下册第一单元第6课《哪个流动得快》课件
- 2025年新人教PEP版英语三年级下册全册课时练习
- 2025年广西旅发置业集团有限公司招聘笔试参考题库含答案解析
- 全国职业院校技能大赛高职组(商务数据分析赛项)备赛试题及答案
- 《针对内容安全的人工智能数据标注指南》
- GB/T 45107-2024表土剥离及其再利用技术要求
- 变电站道路施工方案
- 海关基础知识培训课件
- 铸造车间安全培训课件
- 2024年机动车检测站质量手册程序文件记录表格合集(根据补充要求编制)
评论
0/150
提交评论