• 软件测试技术
  • 软件测试博客
  • 软件测试视频
  • 开源软件测试技术
  • 软件测试论坛
  • 软件测试沙龙
  • 软件测试资料下载
  • 软件测试杂志
  • 软件测试人才招聘
    暂时没有公告

字号: | 推荐给好友 上一篇 | 下一篇

详解Enterprise JavaBeans查询语言之一

发布: 2008-5-06 11:30 | 作者: 不详 | 来源: www.linuxaid.com.cn | 查看: 26次 | 进入软件测试论坛讨论

领测软件测试网

在这一部分我们讨论Enterprise JavaBean规范中定义的EJB QL语法。下面的素材中的大多数直接取自Enterprise JavaBean规范或是对规范的解释。 

EJB QL的BNF语法 

这里是EJB QL的全部BNF语法解释: 


EJB QL ::= select_clause 
from_clause [where_clause] 

from_clause ::= FROM 
identification_variable_declaration 
    [, identification_variable_declaration]* 

identification_variable_declaration 
::= 
    collection_member_declaration | 
    range_variable_declaration 

collection_member_declaration 
::= 
    IN (collection_valued_path_expression) 
	[AS] identifier 
  
range_variable_declaration
::= 
    abstract_schema_name 
	[AS] identifier 

single_valued_path_expression 
::= 
    {single_valued_navigation | 
    identification_variable}.cmp_field | 
    single_valued_navigation 

single_valued_navigation 
::= 
    identification_variable.
	[single_valued_cmr_field.]* 
    single_valued_cmr_field 

collection_valued_path_expression 
::= 
    identification_variable.
	[single_valued_cmr_field.]* 
    collection_valued_cmr_field 

select_clause ::= SELECT [DISTINCT] 
    {single_valued_path_expression | 
    OBJECT(identification_variable)} 

where_clause 
::= WHERE conditional_expression 

conditional_expression 
::= conditional_term | 
    conditional_expression OR conditional_term 

conditional_term
::= conditional_factor | 
    conditional_term AND conditional_factor 

conditional_factor
::= [ NOT ] conditional_test 

conditional_test
:: = conditional_primary 

conditional_primary
::= 
    simple_cond_expression | (conditional_expression) 

simple_cond_expression
::= 
    comparison_expression | 
    between_expression | 
    like_expression | 
    in_expression | 
    null_comparison_expression | 
    empty_collection_comparison_expression | 
    collection_member_expression 

between_expression
::= 
    arithmetic_expression [NOT] BETWEEN 
    arithmetic_expression
	AND arithmetic_expression 

in_expression 
::= 
    single_valued_path_expression 
    [NOT] IN (string_literal 
	[, string_literal]* ) 

like_expression 
::= 
    single_valued_path_expression 
    [NOT] LIKE pattern_value 
	[ESCAPE escape-character] 

null_comparison_expression
::= 
    single_valued_path_expression IS [NOT] NULL 

empty_collection_comparison_expression
::= 
    collection_valued_path_expression
	IS [NOT] EMPTY 

collection_member_expression 
::= 
    {single_valued_navigation 
	| identification_variable | 
    input_parameter} 
    [NOT] MEMBER [OF] 
	collection_valued_path_expression 

comparison_expression ::= 
    string_value { =|<>} 
	string_expression | 
    boolean_value { =|<>} 
	boolean_expression} | 
    datetime_value { = | <> | > | < } 
	datetime_expression | 
    entity_bean_value { = | <> } 
	entity_bean_expression | 
    arithmetic_value comparison_operator 
    single_value_designator 

arithmetic_value 
::= single_valued_path_expression | 
    functions_returning_numerics 

single_value_designator 
::= scalar_expression 

comparison_operator
::= 
    = | > | >= | < | <= | <> 

scalar_expression 
::= arithmetic_expression 

arithmetic_expression
::= arithmetic_term | 
    arithmetic_expression { + | - }
	arithmetic_term 

arithmetic_term 
::= arithmetic_factor | 
    arithmetic_term { * | / }
	arithmetic_factor 

arithmetic_factor ::= { + |- }
arithmetic_primary 

arithmetic_primary 
::= single_valued_path_expression | 
    literal | (arithmetic_expression) | 
    input_parameter
	| functions_returning_numerics 

string_value 
::= single_valued_path_expression | 
    functions_returning_strings 

string_expression 
::= string_primary | input_expression 

string_primary 
::= single_valued_path_expression 
| literal | 
    (string_expression)
	| functions_returning_strings 

datetime_value 
::= single_valued_path_expression 

datetime_expression 
::= datetime_value | input_parameter 

boolean_value 
::= single_valued_path_expression 

boolean_expression 
::= single_valued_path_expression | 
   literal | input_parameter 

entity_bean_value 
::= 
    single_valued_navigation
	| identification_variable 

entity_bean_expression 
::= entity_bean_value | input_parameter 

functions_returning_strings
::= 
    CONCAT(string_expression, 
	string_expression) | 
    SUBSTRING(string_expression,
	arithmetic_expression, 
    arithmetic_expression) 

functions_returning_numerics::= 
    LENGTH(string_expression) | 
    LOCATE(string_expression, 
    string_expression[, arithmetic_expression]) | 
    ABS(arithmetic_expression) | 
    SQRT(arithmetic_expression)


延伸阅读

文章来源于领测软件测试网 https://www.ltesting.net/


关于领测软件测试网 | 领测软件测试网合作伙伴 | 广告服务 | 投稿指南 | 联系我们 | 网站地图 | 友情链接
版权所有(C) 2003-2010 TestAge(领测软件测试网)|领测国际科技(北京)有限公司|软件测试工程师培训网 All Rights Reserved
北京市海淀区中关村南大街9号北京理工科技大厦1402室 京ICP备2023014753号-2
技术支持和业务联系:info@testage.com.cn 电话:010-51297073

软件测试 | 领测国际ISTQBISTQB官网TMMiTMMi认证国际软件测试工程师认证领测软件测试网