> Found a function that does exactly the same changing it.
> > I implemented the isBoundExternalVariable adding a new function in
> > context/dynamic_context called is_set_variable which returns true if it is
> set
> > or false if it doesn't I could have use the get_variable but I would have to
> > catch the error it throws when is not set.

I saw that you used the dynamic_context::exists_variable() method. This is not 
correct because it checks only if the variable is declared, not that it is also 
set. So, I have added the is_set_variable() method.

I did 3 other fixes in XQueryImpl::isBoundExternalVariable()

1. The method must check that the query has been compiled and is not closed.

2. The code of the method must be inside a try-catch

3. The way createQName was invoked, would cause the 2 strings to be copied. 
Now, the string copies are avoided. I don't expect isBoundExternalVariable to 
be any performance bottleneck, so saving the string is not such a big deal in 
this case. But, you should be aware when string copies are done and should try 
to avoid then as a matter of good practice. So, please do try to understand why 
the old way would cause the string copies and how the new way avoids them.

There is one more problem in isBoundExternalVariable that I did not fix. It 
should raise an error if the variable is not found in any of the static 
contextes. I let you fix this.
Your team Zorba Coders is subscribed to branch lp:zorba.

Mailing list: https://launchpad.net/~zorba-coders
Post to     : zorba-coders@lists.launchpad.net
Unsubscribe : https://launchpad.net/~zorba-coders
More help   : https://help.launchpad.net/ListHelp

Reply via email to