Merge lp:~zorba-coders/zorba/api_changes into lp:zorba

Proposed by Juan Zacarias
Status: Merged
Approved by: Matthias Brantner
Approved revision: 10558
Merged at revision: 10561
Proposed branch: lp:~zorba-coders/zorba/api_changes
Merge into: lp:zorba
Diff against target: 252 lines (+104/-15)
8 files modified
ChangeLog (+1/-1)
include/zorba/dynamic_context.h (+13/-0)
include/zorba/xquery.h (+0/-7)
src/api/dynamiccontextimpl.cpp (+34/-0)
src/api/dynamiccontextimpl.h (+6/-0)
src/api/xqueryimpl.cpp (+1/-2)
src/api/xqueryimpl.h (+2/-2)
test/unit/cxx_api_changes.cpp (+47/-3)
To merge this branch: bzr merge lp:~zorba-coders/zorba/api_changes
Reviewer Review Type Date Requested Status
Matthias Brantner Approve
Markos Zaharioudakis Approve
Review via email: mp+83426@code.launchpad.net

Commit message

API changes
Removed isBoundExternalVariable from xquery.h
Added 2 functions to dynamic_context.h
isBoundContextItem and isBoundExternalVariable

Description of the change

API changes
Removed isBoundExternalVariable from xquery.h
Added 2 functions to dynamic_context.h
isBoundContextItem and isBoundExternalVariable

To post a comment you must log in.
Revision history for this message
Markos Zaharioudakis (markos-za) :
review: Approve
Revision history for this message
Matthias Brantner (matthias-brantner) wrote :

The ChangeLog should also mention the function isBoundContextItem in the entry that currently already mentions isBoundExternalVariable.

Also, the diff looks like the commit was using tabs for indentation. Could you please change them into spaces?

review: Needs Fixing
Revision history for this message
Juan Zacarias (juan457) wrote :

done

Revision history for this message
Matthias Brantner (matthias-brantner) :
review: Approve
Revision history for this message
Zorba Build Bot (zorba-buildbot) wrote :
Revision history for this message
Zorba Build Bot (zorba-buildbot) wrote :

The attempt to merge lp:~zorba-coders/zorba/api_changes into lp:zorba failed. Below is the output from the failed tests.

CMake Error at /home/ceej/zo/testing/zorbatest/tester/TarmacLander.cmake:272 (message):
  Validation queue job api_changes-2011-11-29T00-19-04.132Z is finished. The
  final status was:

  No tests were run - build or configure step must have failed.

  Not commiting changes.

Error in read script: /home/ceej/zo/testing/zorbatest/tester/TarmacLander.cmake

Revision history for this message
Zorba Build Bot (zorba-buildbot) wrote :
Revision history for this message
Zorba Build Bot (zorba-buildbot) wrote :

The attempt to merge lp:~zorba-coders/zorba/api_changes into lp:zorba failed. Below is the output from the failed tests.

CMake Error at /home/ceej/zo/testing/zorbatest/tester/TarmacLander.cmake:272 (message):
  Validation queue job api_changes-2011-11-30T03-17-11.87Z is finished. The
  final status was:

  No tests were run - build or configure step must have failed.

  Not commiting changes.

Error in read script: /home/ceej/zo/testing/zorbatest/tester/TarmacLander.cmake

Revision history for this message
Zorba Build Bot (zorba-buildbot) wrote :
Revision history for this message
Zorba Build Bot (zorba-buildbot) wrote :

Validation queue job api_changes-2011-11-30T04-34-11.991Z is finished. The final status was:

All tests succeeded!

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'ChangeLog'
--- ChangeLog 2011-11-23 22:25:05 +0000
+++ ChangeLog 2011-11-28 23:55:27 +0000
@@ -8,7 +8,7 @@
8 * New node-reference module. References can be obtained for any node, and8 * New node-reference module. References can be obtained for any node, and
9 different nodes cannot have the same identifier.9 different nodes cannot have the same identifier.
10 * Custom Full-text thesaurus using Zorba URI resolver mechanism.10 * Custom Full-text thesaurus using Zorba URI resolver mechanism.
11 * Modified C++ API to add isSequential, getExternalVariables, and 11 * Modified C++ API to add isSequential, getExternalVariables, isBoundContextItem and
12 isBoundExternalVariable Functions12 isBoundExternalVariable Functions
13 * Collection allows to retrieve information about the type13 * Collection allows to retrieve information about the type
14 and the annotations of a static collection.14 and the annotations of a static collection.
1515
=== modified file 'include/zorba/dynamic_context.h'
--- include/zorba/dynamic_context.h 2011-10-20 17:17:48 +0000
+++ include/zorba/dynamic_context.h 2011-11-28 23:55:27 +0000
@@ -263,6 +263,19 @@
263 virtual ExternalFunctionParameter*263 virtual ExternalFunctionParameter*
264 getExternalFunctionParameter ( const String& aName ) const = 0;264 getExternalFunctionParameter ( const String& aName ) const = 0;
265265
266 /** \brief Returns true if the variable is bound to a value
267 *
268 * @param aNamespace the namespace of the qname of the variable to check
269 * @param aLocalname the localname of the qname of the variable to check
270 */
271 virtual bool
272 isBoundExternalVariable(const String& aNamespace, const String& aLocalname) const = 0;
273
274 /** \brief Returns true if a context item has been bound to the Dynamic Context
275 */
276 virtual bool
277 isBoundContextItem() const = 0;
278
266protected:279protected:
267 /** \brief Destructor280 /** \brief Destructor
268 */281 */
269282
=== modified file 'include/zorba/xquery.h'
--- include/zorba/xquery.h 2011-11-11 18:32:12 +0000
+++ include/zorba/xquery.h 2011-11-28 23:55:27 +0000
@@ -304,13 +304,6 @@
304 */304 */
305 virtual void305 virtual void
306 printPlan(std::ostream& aStream, bool aDotFormat = false) const = 0;306 printPlan(std::ostream& aStream, bool aDotFormat = false) const = 0;
307
308 /** \brief Returns true if the variable is bound to a value
309 *
310 * @param aQName the qname of the variable to check
311 */
312 virtual bool
313 isBoundExternalVariable(const String& aNamespace, const String& aLocalname) const = 0;
314307
315 /** 308 /**
316 * \brief Check if this query is an updating query.309 * \brief Check if this query is an updating query.
317310
=== modified file 'src/api/dynamiccontextimpl.cpp'
--- src/api/dynamiccontextimpl.cpp 2011-10-20 17:17:48 +0000
+++ src/api/dynamiccontextimpl.cpp 2011-11-28 23:55:27 +0000
@@ -182,6 +182,7 @@
182 return var;182 return var;
183}183}
184184
185
185/****************************************************************************//**186/****************************************************************************//**
186187
187********************************************************************************/188********************************************************************************/
@@ -592,6 +593,7 @@
592 return false;593 return false;
593}594}
594595
596
595/****************************************************************************//**597/****************************************************************************//**
596598
597********************************************************************************/599********************************************************************************/
@@ -607,5 +609,37 @@
607 return 0;609 return 0;
608}610}
609611
612
613/****************************************************************************//**
614
615********************************************************************************/
616bool
617DynamicContextImpl::isBoundExternalVariable(const String& aNamespace, const String& aLocalname) const
618{
619 ZORBA_DCTX_TRY
620 {
621 if(theQuery->isBoundVariable(aNamespace, aLocalname))
622 return true;
623 }
624 ZORBA_DCTX_CATCH
625 return false;
626}
627
628/****************************************************************************//**
629
630********************************************************************************/
631bool
632DynamicContextImpl::isBoundContextItem() const
633{
634 ZORBA_DCTX_TRY
635 {
636 String varName = Unmarshaller::newString(static_context::DOT_VAR_NAME);
637 if(theQuery->isBoundVariable("", varName))
638 return true;
639 }
640 ZORBA_DCTX_CATCH
641 return false;
642}
643
610} // namespace zorba644} // namespace zorba
611/* vim:set et sw=2 ts=2: */645/* vim:set et sw=2 ts=2: */
612646
=== modified file 'src/api/dynamiccontextimpl.h'
--- src/api/dynamiccontextimpl.h 2011-10-20 17:17:48 +0000
+++ src/api/dynamiccontextimpl.h 2011-11-28 23:55:27 +0000
@@ -143,6 +143,12 @@
143 virtual ExternalFunctionParameter*143 virtual ExternalFunctionParameter*
144 getExternalFunctionParameter ( const String& aName ) const;144 getExternalFunctionParameter ( const String& aName ) const;
145145
146 virtual bool
147 isBoundExternalVariable(const String& aNamespace, const String& aLocalname) const;
148
149 virtual bool
150 isBoundContextItem() const;
151
146protected:152protected:
147 void checkNoIterators() const;153 void checkNoIterators() const;
148154
149155
=== modified file 'src/api/xqueryimpl.cpp'
--- src/api/xqueryimpl.cpp 2011-11-11 18:32:12 +0000
+++ src/api/xqueryimpl.cpp 2011-11-28 23:55:27 +0000
@@ -772,11 +772,10 @@
772 QUERY_CATCH772 QUERY_CATCH
773}773}
774774
775
776/*******************************************************************************775/*******************************************************************************
777776
778********************************************************************************/777********************************************************************************/
779bool XQueryImpl::isBoundExternalVariable(778bool XQueryImpl::isBoundVariable(
780 const String& aNamespace,779 const String& aNamespace,
781 const String& aLocalname) const780 const String& aLocalname) const
782{781{
783782
=== modified file 'src/api/xqueryimpl.h'
--- src/api/xqueryimpl.h 2011-11-11 18:32:12 +0000
+++ src/api/xqueryimpl.h 2011-11-28 23:55:27 +0000
@@ -286,8 +286,6 @@
286286
287 void getExternalVariables(Iterator_t& aVarsIter) const;287 void getExternalVariables(Iterator_t& aVarsIter) const;
288288
289 bool isBoundExternalVariable(const String& aNamespace, const String& aLocalname) const;
290
291 bool isUpdating() const;289 bool isUpdating() const;
292 290
293 bool isSequential() const;291 bool isSequential() const;
@@ -399,6 +397,8 @@
399#endif397#endif
400398
401 void notifyAllWarnings() const;399 void notifyAllWarnings() const;
400
401 bool isBoundVariable(const String& aNamespace, const String& aLocalname) const;
402};402};
403403
404404
405405
=== modified file 'test/unit/cxx_api_changes.cpp'
--- test/unit/cxx_api_changes.cpp 2011-11-11 18:32:12 +0000
+++ test/unit/cxx_api_changes.cpp 2011-11-28 23:55:27 +0000
@@ -226,7 +226,7 @@
226 std::vector<Item>::const_iterator lEnd = lVars.end();226 std::vector<Item>::const_iterator lEnd = lVars.end();
227227
228 Item item = aZorba->getItemFactory()->createInt(4);228 Item item = aZorba->getItemFactory()->createInt(4);
229229
230230
231 bool isBound1;231 bool isBound1;
232 bool isBound2;232 bool isBound2;
@@ -234,10 +234,10 @@
234 for(; lIte != lEnd; ++lIte)234 for(; lIte != lEnd; ++lIte)
235 {235 {
236 Item qname = *lIte;236 Item qname = *lIte;
237 isBound1 = lQuery->isBoundExternalVariable(qname.getNamespace(), qname.getLocalName());237 isBound1 = lQuery->getDynamicContext()->isBoundExternalVariable(qname.getNamespace(), qname.getLocalName());
238 Item value = aZorba->getItemFactory()->createString("foo");238 Item value = aZorba->getItemFactory()->createString("foo");
239 lQuery->getDynamicContext()->setVariable(qname.getStringValue(), value);239 lQuery->getDynamicContext()->setVariable(qname.getStringValue(), value);
240 isBound2 = lQuery->isBoundExternalVariable(qname.getNamespace(), qname.getLocalName());240 isBound2 = lQuery->getDynamicContext()->isBoundExternalVariable(qname.getNamespace(), qname.getLocalName());
241 }241 }
242242
243 if (!isBound1 && isBound2)243 if (!isBound1 && isBound2)
@@ -258,6 +258,44 @@
258 return true;258 return true;
259}259}
260260
261bool
262cxx_api_changes_test6(Zorba* aZorba)
263{
264 try
265 {
266
267 std::string lIn = "1+1";
268
269 XQuery_t lQuery = aZorba->compileQuery(lIn);
270
271 Zorba* lZorba = Zorba::getInstance(0);
272
273 bool isBound1;
274 bool isBound2;
275
276 isBound1 = lQuery->getDynamicContext()->isBoundContextItem();
277
278 Item lContextItem = aZorba->getItemFactory()->createString("foo");
279 lQuery->getDynamicContext()->setContextItem(lContextItem);
280 isBound2 = lQuery->getDynamicContext()->isBoundContextItem();
281
282 if (!isBound1 && isBound2)
283 return true;
284
285 }
286 catch (XQueryException& qe)
287 {
288 std::cerr << qe << std::endl;
289 return false;
290 }
291 catch (ZorbaException& e)
292 {
293 std::cerr << e << std::endl;
294 return false;
295 }
296
297 return true;
298}
261299
262int300int
263cxx_api_changes (int argc, char* argv[])301cxx_api_changes (int argc, char* argv[])
@@ -295,6 +333,12 @@
295 return 5;333 return 5;
296 }334 }
297335
336 std::cout << "executing cxx_api_changes_test6" << std::endl;
337 if (!cxx_api_changes_test6(lZorba))
338 {
339 return 6;
340 }
341
298 lZorba->shutdown();342 lZorba->shutdown();
299 zorba::StoreManager::shutdownStore(lStore);343 zorba::StoreManager::shutdownStore(lStore);
300 return 0;344 return 0;

Subscribers

People subscribed via source and target branches