当前位置: 首页>>代码示例>>Python>>正文


Python Xquery._constructReturn方法代码示例

本文整理汇总了Python中eulexistdb.query.Xquery._constructReturn方法的典型用法代码示例。如果您正苦于以下问题:Python Xquery._constructReturn方法的具体用法?Python Xquery._constructReturn怎么用?Python Xquery._constructReturn使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在eulexistdb.query.Xquery的用法示例。


在下文中一共展示了Xquery._constructReturn方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: test_return_only

# 需要导入模块: from eulexistdb.query import Xquery [as 别名]
# 或者: from eulexistdb.query.Xquery import _constructReturn [as 别名]
    def test_return_only(self):
        xq = Xquery(xpath='/el')
        xq.xq_var = '$n'
        xq.return_only({'myid': '@id', 'some_name': 'name',
            'first_letter': 'substring(@n,1,1)'})
        xq_return = xq._constructReturn()
        self.assert_('return <el>' in xq_return)
        self.assert_('<field>{$n/@id}</field>' in xq_return)
        self.assert_('<field>{$n/name}</field>' in xq_return)
        self.assert_('<field>{substring($n/@n,1,1)}</field>' in xq_return)
        self.assert_('</el>' in xq_return)

        xq = Xquery(xpath='/some/el/notroot')
        xq.return_only({'id': '@id'})
        self.assert_('return <notroot>' in xq._constructReturn())

        # case where node test can't be the return element
        xq = Xquery(xpath='/foo/bar/node()')
        xq.return_only({'myid': '@id'})
        xq_return = xq._constructReturn()
        self.assert_('return <node>' in xq_return)

        xq = Xquery(xpath='/foo/bar/*')
        xq.return_only({'myid': '@id'})
        xq_return = xq._constructReturn()
        self.assert_('return <node>' in xq_return)
开发者ID:mangalam-research,项目名称:eulexistdb,代码行数:28,代码来源:test_query.py

示例2: test_return_also_raw

# 需要导入模块: from eulexistdb.query import Xquery [as 别名]
# 或者: from eulexistdb.query.Xquery import _constructReturn [as 别名]
    def test_return_also_raw(self):
        xq = Xquery(xpath='/el')
        xq.xq_var = '$n'
        xq._raw_prefix = 'r_'
        xq.return_also({'myid': 'count(util:expand(%(xq_var)s/@id))'}, raw=True)
        self.assert_('<r_myid>{count(util:expand($n/@id))}</r_myid>' in xq._constructReturn())

        xq = Xquery(xpath='/el')
        xq.xq_var = '$n'
        xq._raw_prefix = 'r_'
        xq.return_also({'myid': '@id'}, raw=True)
        self.assert_('<r_myid>{@id}</r_myid>' in xq._constructReturn())
开发者ID:codekansas,项目名称:eulexistdb,代码行数:14,代码来源:test_query.py

示例3: test_return_also__fulltext_score

# 需要导入模块: from eulexistdb.query import Xquery [as 别名]
# 或者: from eulexistdb.query.Xquery import _constructReturn [as 别名]
 def test_return_also__fulltext_score(self):
     xq = Xquery(xpath='/el')
     xq.xq_var = '$n'
     xq.return_also({'fulltext_score': ''})
     self.assert_('let $fulltext_score := ft:score($n)' in xq.getQuery())
     self.assert_('<fulltext_score>{$fulltext_score}</fulltext_score>' in xq._constructReturn())
开发者ID:codekansas,项目名称:eulexistdb,代码行数:8,代码来源:test_query.py

示例4: test_return_also

# 需要导入模块: from eulexistdb.query import Xquery [as 别名]
# 或者: from eulexistdb.query.Xquery import _constructReturn [as 别名]
 def test_return_also(self):
     xq = Xquery(xpath='/el')
     xq.xq_var = '$n'
     xq.return_also({'myid': '@id', 'some_name': 'name'})
     self.assert_('{$n}' in xq._constructReturn())
     self.assert_('<field>{$n/@id}</field>' in xq._constructReturn())
开发者ID:codekansas,项目名称:eulexistdb,代码行数:8,代码来源:test_query.py


注:本文中的eulexistdb.query.Xquery._constructReturn方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。