日期:2014-05-16  浏览次数:20882 次

db4o SODA query hacking之正则匹配支持

db4o的SODA查询貌似不支持正则匹配。API中关于Constraint接口的Method Summary如下

Method Summary
?Constraint and (Constraint ?with)
??????????links two Constraints for AND evaluation.
?Constraint byExample ()
??????????set the evaluation mode to object comparison (query by example).
?Constraint contains ()
??????????sets the evaluation mode to containment comparison.
?Constraint endsWith (boolean?caseSensitive)
??????????sets the evaluation mode to string endsWith comparison.
?Constraint equal ()
??????????Used in conjunction with smaller() or greater() to create constraints like "smaller or equal", "greater or equal".
?java.lang.Object getObject ()
??????????returns the Object the query graph was constrained with to create this Constraint .
?Constraint greater ()
??????????sets the evaluation mode to > .
?Constraint identity ()
??????????sets the evaluation mode to identity comparison.
?Constraint like ()
??????????sets the evaluation mode to "like" comparison.
?Constraint not ()
??????????turns on not() comparison.
?Constraint or (Constraint ?with)
??????????links two Constraints for OR evaluation.
?Constraint smaller ()
??????????sets the evaluation mode to < .
?Constraint startsWith (boolean?caseSensitive)
??????????sets the evaluation mode to string startsWith comparison.

?

endsWith跟 startsWith只提供了很弱的字符串匹配功能,不能实现正则表达式模式的匹配。

?

在db4o论坛找到这么一个帖子(http://developer.db4o.com/Forums/tabid/98/aft/10103/Default.aspx),有个叫gamlerhart的人的回复很有意思。

gamlerhart 写道
11 Aug 2010 10:51 AM ?

Just a note to the Regex-Evaluation. It's possible to make it more generic. Build an evaluator to run the regex against a string. Then descend to the string-field and use the evaluator on

友情链接: 爱易网 云虚拟主机技术 云服务器技术 程序设计技术 开发网站 APP开发教程
Copyright © 2013-2026 爱易网页 当前在线:302人  网站在3时39分47秒内访问总人数:36243人 当前 54.66%  粤ICP备18100884号-2