面向对象的数据建模数据筛选接口的设计毕业设计论文

上传人:1666****666 文档编号:39979037 上传时间:2021-11-13 格式:DOC 页数:66 大小:924KB
返回 下载 相关 举报
面向对象的数据建模数据筛选接口的设计毕业设计论文_第1页
第1页 / 共66页
面向对象的数据建模数据筛选接口的设计毕业设计论文_第2页
第2页 / 共66页
面向对象的数据建模数据筛选接口的设计毕业设计论文_第3页
第3页 / 共66页
点击查看更多>>
资源描述
成成 都都 信信 息息 工工 程程 学学 院院学学 位位 论论 文文面向对象的数据建模面向对象的数据建模数据筛选接口的设计数据筛选接口的设计论文作者姓名:论文作者姓名:申请学位专业:申请学位专业:申请学位类别:申请学位类别:指指导导教教师师姓姓名名(职职称称):论文提交日期:论文提交日期: 面向对象的数据建模面向对象的数据建模数据筛选接口的设计数据筛选接口的设计摘摘 要要WISE 系统是一个功能强大的数据处理系统。它应用于某公司,此公司由于行业的关系需要它去处理庞大的数据,这些数据每天都在以上百万条甚至上亿条的数量在增加。因此它需要处理海量的数据,它的其中一个比较重要的功能是根据复杂并且灵活的条件筛选出适当的数据返回给客户。本论文主要讲述了如何针对数据筛选条件比较复杂并且比较灵活这一需求,在做了详尽的需求分析之后,进行了一系列的设计,包括解决方案的设计,数据建模,PL/SQL 程序设计,最终完成整个数据筛选接口的设计。在整个数据筛选接口的设计中,在传统的关系性数据库的基础上,会尝试着应用一些面向对象的思想去设计。尤其在数据建模阶段,通过传统的数据模型之间的关系,例如主外键关系,实现了一些重要的面向对象的思想。关键字关键字:数据筛选;面向对象;数据建模;PL/SQLImplement the Object Oriented thinking in the project to data modelingthe design about the API to filter dataAbstractThe 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 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 complex 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 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 filtration;object oriented;data modeling;PL/SQL目目 录录论文总页数:24 页1 引 言.12 开发概述.13 需求分析.131 需求调研.132 开发运行环境.34 解决方案的设计.35 数据建模.85.1 数据模型的建立.85.2 数据库表结构的设计.95.3 数据库基础视图的设计.116 PL/SQL 程序设计.12结 论.22参考文献.22致 谢.23声 明.241 1 引引 言言当今社会,某些行业的数据量越来越庞大,每天都在以上百万条甚至上亿条的数量在增加,因此对这些行业的数据处理系统的性能要求也越来越高。这些要求不但包括处理速度尽可能快,系统可维护性尽可能高等传统需求,而且增加了对数据的处理尽可能的灵活等一些新的需求。要满足这些新的需求,我们需要研究这些新需求的特性,挖掘一些解决办法。面向对象的数据建模是我们研究的一个重要方向。引用言论:Steve Hoberman 所提出的“抽象组件”的概念和面向对象设计中的“设计模式”非常类似。即数据库专家在多次的数据建模后,将各个项目中的类似部分抽象化,提取出特定的建模模型片段,以后只需在新的项目中对这些模型片段细化派生,即可快速构建出适合于该项目的数据库架构。2 2 开发概述开发概述WISE 系统是一个功能强大的数据处理系统。由于业务的关系,它需要处理海量的数据,它的比较重要的一个功能是根据复杂并且灵活的条件筛选出适当的数据返回给客户。针对这一数据筛选功能,开发的目标是设计一个合理的数据筛选接口。接口能做到便于动态控制,便于动态修改,以及便于维护。开发的过程包括需求分析,解决方案的设计,数据建模,PL/SQL 程序设计,最终完成整个数据筛选接口的设计。3 3 需求分析需求分析3 31 1 需求调研需求调研WISE 系统是某公司的数据处理系统,它的一个主要功能是每天根据复杂并且灵活的条件筛选出适当的数据返回给客户。所筛选的数据都来自于一张表,这张表的字段有 260 个,这些字段中有超过 250 个字段需要作为筛选字段,它们通常互为组合去筛选出客户需要的数据,根据客户的需要它们的组合又是多变的。这张表的数据量通常在一千万到一亿条记录之间。值得注意的是,筛选条件需要去匹配的值是具有特定意义的,尽管这些值数目众多,但它们的数量不是随意增长的。而且这些值是根据客户的需求可以去定制的。表 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_U14日期/时间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 开发运行环境开发运行环境开发所需的基本软、硬件环境为:Windows 2003 或者 Windows XP。Oracle 10 g R2。CPU 2.40GHz1G 以上内存。2G 以上可用硬盘空间。在 Windows 2003 操作系统下,以 Toad for Oracle Xpert v9.0.1.8 为开发工具,用 Oracle 10 g R2 为后台数据库。4 4 解决方案的设计解决方案的设计在这里来逐步分析需求应该通过怎样的方式来实现,进行一些解决方案的设计。方案方案 1 1 :直接写过程来实现。根据不同的筛选条件,写不同的过程来实现数据筛选。问题:很显然,这种方案是行不通的。由于筛选字段数量达两百多个,而且相互之间可以互为组合,所以是不应该写过程来实现的。即便把目前需求要求的筛选条件通过写过程来实现了(暂不考虑开发人员的头疼) ,如果需要添加一些新的筛选,那将是非常麻烦的。再则,如果所写过程中出现一些问题,也是难以维护的。所以考虑到开发的质量与代码的可维护性,是不可能采用此方案的。方案方案 2 2:结合数据建模与程序设计来实现。由于筛选条件数量众多,但是条件之间的很多部分相互重合,从面向对象的角度出发,这些条件间存在继承的关系,如果能采用面向对象的方法,或许能做到重用条件。假设一共有 250 个独立的筛选条件,也即表中的 250 个字段单独作为条件时的情况。这些条件能相互组合,组合后的条件越发复杂,写程序时如果按照方案 1 要想做到很好的代码重用是不可能实现的。所以根据方案 1 的失败,要想很好的做到代码重用,就很有必要引入面向对象的思想,采用继承的方法,做到条件组合,就好像类与类之间的继承。作为表中列名出现的字段,是不可能相互组合的。但是换个角度,大胆的设想,如果把这些字段不作为列名,能不能做到相互组合呢?如果把这些字段转换成变量,对变量一一赋值,和作为字段相比并没有做到很大的改善。如果把这些字段转换成表中的记录值呢?试想一下,似乎看到一线光明,因为在 PL/SQL 里,可以用到动态 SQL 的方法,这样可以所需要的条件动态的组合了。但是能不能真正达到便于动态控制,便于动态修改,以及便于维护呢?我们需要一步一步去研究,以及测试。根据目前得出的结论,我们现在需要一个表,表中的某一列的记录值为Complexity 表中作为筛选条件的列名,如下表 2 所示:表 2 FIELD字段名数据类型说明ID数字主键NAME文本COLUMN_NAME文本列名FIELD 表中的 COLUMN_NAME 列存放 Complexity 表中作为筛选条件的列名。这样就可以做到把条件一步一步拼起来了。接着往下分析。需要选取出可能作为筛选条件的列名C_U1、C_U2、C_U3、C_U4 四个字段,以后的分析将会以它们作为例子。这里把每个单独的列名作为筛选条件的条件叫做简单条件,而多个简单条件组合而成的条件叫做复杂条件。值得注意的是,筛选条件中有相当一部分是类似于C_U1 IN (A, B, C, D)的,它也是简单条件,但是比较特殊一点,这样的条件把它叫做简单序列条件。假设现在客户 Ted 需要的数据是以 C_U1A 和 C_U2A和 C_U2 A 或者C_U2=B ,筛选列和匹配的数值我们都可以在相关表中取到,而筛选列和匹配的数值之间的关系,例如大于,小于,等于,时间从某时间开始,这些关系是我们在写代码的时候一直在重复的写的。而正是因为这个原因,代码不能做到代码间的继承和重用,这是一个失败指出。要是通过接口设计能把这些关系像处理筛选列与匹配的数值一样处理,这个问题也就解决了。能做到么?答案是肯定的。因为这些关系也就只有数种,例如数字间的比较,时间数值之间的比较,诸如此类的关系是可以得到有效控制的。对于序列条件,只有两种关系,即是否IN ,很显然也可以得到有效的控制。通过以上的分析,现在只需要再加一个表就可以了,这张表用来存放简单条件的筛选列与匹配的数值之间的关系种类,而对于序列条件,就不用,在程序里很容易做到动态处理。为了不占据篇幅,数据筛选接口的完整数据库架构会在后面的数据建模部分中一并出现。5 5 数据建模数据建模5.15.1 数据模型的建立数据模型的建立根据解决方案的设计,画出数据筛选接口的完整数据库架构,如后页图所示:CONDITIONPKID NAME NEGATED CONTAINER_IDCOMPOUND_CONDITIONPKID CONJUNCTION_IDSIMPLE_CONDITIONPKID NAME VALUE OPERATOR_ID FIELD_IDLIST_CONDITIONPKID FIELD_IDCONJUNCTIONPKID NAME CODECONDITION_OPERATORPKID CODE NAMEFIELD PKID NAME COLUMN_NAMELIST_CONDITION_MATCH_VALUEPKID LIST_CONDITION_ID MATCH_VALUE图 5 数据库架构图5.25.2 数据库表结构的设计数据库表结构的设计根据前面完成的解决方案的设计以及数据模型的建立,可以设计出完整的数据库表结构。具体设计如下:用于存放筛选条件,具体设计如表 3 所示:表 3 条件表 CONDITION字段名数据类型说明ID数字编号字段 主键NAME文本条件名字NEGATED数字判断是否为否定字段CONTAINER_ID数字判断是否属于复合条件字段用于存放条件联接符,具体设计如表 4 所示:表 4 条件联接符表 CONJUNCTION字段名数据类型说明ID数字编号字段 主键NAME文本名字CODE文本联接符编码用于存放复合条件,具体设计如表 5 所示:表 5 复合条件表 COMPOUND_CONDITION字段名数据类型说明ID数字编号字段 主键CONJUNCTION_ID数字联接符编号用于存放简单条件信息,具体设计如表 6 所示:表 6 简单条件表 SIMPLE_CONDITION字段名数据类型说明ID数字编号字段 主键NAME文本简单条件名字VALUE文本简单条件数值OPERATOR_ID数字条件运算符编号FIELD_ID数字筛选列编号用于存放条件运算符信息,具体设计如表 7 所示:表 7 条件运算符表 CONDITION_OPERATOR字段名数据类型说明ID数字编号字段 主键NAME文本条件运算符名字CODE文本条件运算符编码用于存放序列条件信息,具体设计如表 8 所示:表 8 序列条件表 LIST_CONDITION字段名数据类型说明ID数字编号字段 主键FIELD_ID数字筛选列编号用于存放序列条件需要去匹配的数值信息,具体设计如表 9 所示:表 9 序列条件匹配数值表 LIST_CONDITION_MATCH_VALUE字段名数据类型说明ID数字编号字段 主键LIST_CONDITION_ID数字序列条件编号MATCH_VALUE文本序列条件匹配值用于存放筛选列信息,具体设计如表 10 所示:表 10 筛选列信息表 FIELD字段名数据类型说明ID数字编号字段 主键NAME文本筛选列名字(可作标记)COLUMN_NAME文本实际筛选列名5.35.3 数据库基础视图的设计数据库基础视图的设计通过之前的分析,我发现数据库中的八个表之间关联比较多,应该把通常发生关联的表封装起来,视图正是实现这个封装的最佳选择。需要创建四个视图,分别为简单条件视图,序列条件视图,组合条件视图,以及条件视图。通过这四个视图可以把简单条件,序列条件,以及组合条件和FIELD 表很好的封装起来。为了避免占据过多篇幅,这里只以序列条件视图和组合条件视图为例。序列条件视图: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 selectF.Name as Field_Name,F.Column_Name,IC.Negated, ( select count( * )from List_Cond_Match_Value LCMVwhere ( 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_IDfrom List_Condition LCleft outer join Condition Con( C.ID = LC.ID )left outer join Field Fon ( F.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 where ( 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 表很好的封装起来了。到此,数据建模完成。6 6 PL/SQLPL/SQL 程序设计程序设计现在进行本接口设计的 PL/SQL 程序设计部分。从客户出发,这里来整理一下思路。当客户提出一系列筛选条件的要求时,开发人员首先需要把这些基本的简单条件和匹配的数值,以及相关的记录值,一一插入相关的表中。开发人员可以用写一系列的过程来实现,通过传入必需的参数来调用相关的过程,插入一些数值。从下到上,首先要对表直接进行操作,需要一系列最基本的用来实现把数值插入表的过程。以简单条件为例:procedure Ins_Simple_Condition (p_calling_user_id integer, - Requiredp_name varchar2 := null,p_negated number := 0, - Requiredp_container_id integer := null,p_field_id integer, - Requiredp_value varchar2 := null,p_enum_value_id integer := null,p_comparison_field_id integer := null,p_operator_id integer, - Requiredp_new_row_id out integer ) isbegin-省略部分代码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 );-省略部分代码end;然后,需要在这些基础过程之上,写一些调用这些基础过程的过程,也以简单条件为例:procedure Add_Simple_Condition (p_calling_user_id integer, - Requiredp_app_id integer,p_table_type_code varchar2, - Requiredp_name varchar2 := null,p_negated number := 0,p_container_id integer := null,p_field_name varchar2, - Requiredp_value varchar2 := null,p_value_date date := null,p_comparison_field_name varchar2 := null,p_operator_code varchar2, - Requiredp_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 varchar2( 100 );l_operator_id integer;l_value varchar2( 1000 );begin-省略部分代码select ID, Codeinto l_operator_id, l_operator_codefrom Condition_Operatorwhere ( lower( Code ) = lower( p_operator_code ) );-省略部分代码Ins_Simple_Condition (p_calling_user_id = p_calling_user_id,p_name = p_name,p_negated = 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(B,C,D) AND MSG_DELINQ_DAYS90 AND DO_NOT_PROCESS=9 AND CLIENT_ID=116) declarel_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_rule_id integer;l_list_id integer;l_state_4_ted1 varchar2( 4000 ) := B,C,D;begin-省略部分代码-add conditionAdd_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 idinto l_field_idfrom field_where name = NO_NOTICEand ( 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 ),num as ( select rownum I from dualconnect by rownum 0order by r ) loopAdd_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 idinto l_field_idfrom field_where name = MSG_DELINQ_DAYSand ( 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 = 90, p_comparison_field_name = null, p_operator = Greater, p_new_row_id = l_simple_id);select idinto l_field_idfrom field_where name = DO_NOT_PROCESSand ( 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 idinto l_field_idfrom field_where name = CLIENT_IDand ( 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_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 varchar2 isl_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( | p_comparison_field_ref| , dd );l_value_next_day_string := trunc( | p_comparison_field_ref| + 1, dd );elseif ( p_row.Value is not null ) thenl_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_day := 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_Codewhen Equals thenif( p_comparison_field_ref is not null ) thenif( p_row.Negated = 0 ) thenl_comparison :=( ( | p_field_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 | ) );elsel_comparison :=( ( | p_field_ref | is null ) and | ( | p_comparison_field_ref | is not null ) ) or | ( ( | p_field_ref | is not null ) and | ( | p_comparison_field_ref | is null ) ) or | ( | p_field_ref | = | l_value_next_day_string | );end if;elseif( p_row.Value is null ) thenif( p_row.Negated = 0 ) thenl_comparison := p_field_ref | is null;elsel_comparison := p_field_ref | is not null;end if;elseif( p_row.Negated = 0 ) thenl_comparison :=( | p_field_ref | = | l_value_this_day_string | )| and | ( | p_field_ref | | l_value_next_day_string | );elsel_comparison :=( | p_field_ref | is null )| or | ( | p_field_ref | = | l_value_next_day_string | );end if;end if;end if;when Greater thennull;if( ( p_comparison_field_ref is not null ) or ( p_row.Value is not null ) ) thenif( p_row.Negated = 0 ) thenl_operator := =;elsel_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 matches.l_comparison := g_false_condition;end if;when Less thenif( ( p_comparison_field_ref is not null ) or ( p_row.Value is not null ) ) thenif( p_row.Negated = 0 ) thenl_operator := =;end if;l_comparison := p_field_ref | | l_operator | | l_value_this_day_string;else- The value were checking against is null, so we should have no matches.l_comparison := g_false_condition;end if;elseraise_application_error ( g_error_number,Unexpected operator: | p_row.Operator_Code );end case;-省略部分代码return l_comparison;end;总结一下,本接口设计的 PL/SQL 程序设计部分是通过如下过程实现了灵活控制筛选条件,并完成了数据筛选接口的基本部分的。被调用被调用图 6 创造数据筛选条件程序设计图现在筛选列和需要匹配的数值以及筛选列和需要匹配的数值之间的关系都可以得到灵活控制了,只需要根据不同的参数调用公共的PL/SQL接口,一一拼装起来即可。现在还需要通过写过程来实现把这些复杂筛选条件拼装起来,最终筛选出客户需要的数据,这样一个功能。以简单条件为例。function Cond_Where_Simple (p_item_condition_id integer,p_index_field_prefix varchar2 ) return varchar2 is - Requiredl_where_clause varchar2( 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 ) thenl_effective_prefix := p_index_field_prefix | .;基础操作条件过程1 对数据库的相关条件表进行操作,包括插入,更新等基础操作条件过程2 动态处理记录筛选列和需要匹配的数值之间的关系的数值调用基础条件过程用于创造一些复杂的组合条件end if;l_where_clause := ;select *into l_rowfrom V_SimpleConditionwhere( ID = p_item_condition_id );l_field_ref := l_effective_prefix | l_row.Column_Name;if( l_row.Comparison_Column_Name is not null ) thenl_comparison_field_ref := l_effective_prefix | l_row.Comparison_Column_Name;end if;case l_row.Field_Type_Namewhen Boolean thenl_where_clause := l_where_clause | Comparison_Boolean( l_row,l_field_ref, l_comparison_field_ref );when Date thenl_where_clause := l_where_clause | Comparison_Date( l_row,l_field_ref, l_comparison_field_ref );when List thenl_where_clause := l_where_clause | Comparison_String( l_row,l_field_ref, l_comparison_field_ref );when Number thenl_where_clause := l_where_clause | Comparison_Number( l_row,l_field_ref, l_comparison_field_ref );when String thenl_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, - Requiredp_index_field_prefix varchar2 := null ) return varchar2 is - Requiredl_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_typewhen simple thenl_where_clause := l_where_clause | Cond_Where_Simple(p_condition_id, p_index_field_prefix );when list thennull;l_where_clause := l_where_clause | Cond_Where_List(p_condition_id, p_index_field_prefix );when compound thenl_where_clause := l_where_clause | Cond_Where_Compound(p_condition_id, p_index_field_prefix );elseraise_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 的方法, 拼在筛选条件的地方就可以了。结结 论论所设计与开发的数据筛选接口会对系统的数据筛选部分起到便于灵活控制,便于修改,便于维护的作用。融合了面向对象的思想后的数据库在开发阶段会发生了一些改善,例如提高代码的可重用性,这就很大程度上减少了开发阶段在代码编写上所花费的资源,可以很好的提高软件的开发质量,并且易于维护。参考文献参考文献1 Johanna Wenny Rahayu,David Taniar,Eric Pardede.Object-Oriented OracleM.IRM Press,2005。2 Steven Feuerstein,Bill Pribyl.Oracle PL/SQL Programming 4th EdtionM.OReilly Media,2005。3 Steven Feuerstein.Oracle PL/SQL Best PracticesM.OReilly Media,2001。4 Arup Nanda,Steven Feuerstein.Oracle PL/SQL for DBAsM.OReilly Media,2005。5 Bulusu Lakshman.Oracle9i PL/SQL: A Developers Guide M. Apress,2002。6 张海藩.软件工程导论M.北京清华大学出版社,1999。7 任树华.Oracle 10g 应用指导与案例精讲M.北京机械工业出版社,2007。致致 谢谢感谢李中志老师耐心的指导。在完成毕业设计的过程中,有时会遇到一些意想不到的问题和疑惑,在李中志老师的点拨和启发下,这些问题以及疑惑一一得到解决,并使论文最终得以顺利地完成。作者简介:姓 名:叶凯 性别:男 出生年月:1984 年 02 月 12 日 民族:汉 E-mail: 声声 明明本论文的工作是 2007 年 2 月至 2007 年 6 月在成都信息工程学院网络工程系完成的。文中除了特别加以标注地方外,不包含他人已经发表或撰写过的研究成果,也不包含为获得成都信息工程学院或其他教学机构的学位或证书而使用过的材料。除非另有说明,本文的工作是原始性工作。关于学位论文使用权和研究成果知识产权的说明本人完全了解成都信息工程学院有关保管使用学位论文的规定,其中包括:(1)学校有权保管并向有关部门递交学位论文的原件与复印件。(2)学校可以采用影印、缩印或其他复制方式保存学位论文。(3)学校可以学术交流为目的复制、赠送和交换学位论文。(4)学校可允许学位论文被查阅或借阅。(5)学校可以公布学位论文的全部或部分内容(保密学位论文在解密后遵守此规定) 。除非另有科研合同和其他法律文书的制约,本论文的科研成果属于成都信息工程学院。特此声明!成成 都都 信信 息息 工工 程程 学学 院院学学 位位 论论 文文面向对象的数据建模面向对象的数据建模数据筛选接口的设计数据筛选接口的设计论文作者姓名:论文作者姓名:申请学位专业:申请学位专业:申请学位类别:申请学位类别:指指导导教教师师姓姓名名(职职称称):论文提交日期:论文提交日期: 面向对象的数据建模面向对象的数据建模数据筛选接口的设计数据筛选接口的设计摘摘 要要WISE 系统是一个功能强大的数据处理系统。它应用于某公司,此公司由于行业的关系需要它去处理庞大的数据,这些数据每天都在以上百万条甚至上亿条的数量在增加。因此它需要处理海量的数据,它的其中一个比较重要的功能是根据复杂并且灵活的条件筛选出适当的数据返回给客户。本论文主要讲述了如何针对数据筛选条件比较复杂并且比较灵活这一需求,在做了详尽的需求分析之后,进行了一系列的设计,包括解决方案的设计,数据建模,PL/SQL 程序设计,最终完成整个数据筛选接口的设计。在整个数据筛选接口的设计中,在传统的关系性数据库的基础上,会尝试着应用一些面向对象的思想去设计。尤其在数据建模阶段,通过传统的数据模型之间的关系,例如主外键关系,实现了一些重要的面向对象的思想。关键字关键字:数据筛选;面向对象;数据建模;PL/SQLImplement the Object Oriented thinking in the project to data modelingthe design about the API to filter dataAbstractThe 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 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 complex 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 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 filtration;object oriented;data modeling;PL/SQL目目 录录论文总页数:24 页1 引 言.12 开发
展开阅读全文
相关资源
正为您匹配相似的精品文档
相关搜索

最新文档


当前位置:首页 > 其他分类


copyright@ 2023-2025  zhuangpeitu.com 装配图网版权所有   联系电话:18123376007

备案号:ICP2024067431-1 川公网安备51140202000466号


本站为文档C2C交易模式,即用户上传的文档直接被用户下载,本站只是中间服务平台,本站所有文档下载所得的收益归上传人(含作者)所有。装配图网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对上载内容本身不做任何修改或编辑。若文档所含内容侵犯了您的版权或隐私,请立即通知装配图网,我们立即给予删除!