Determining whether a function exists

Tuesday, 15 January 2013 · 4 messages
CD
Charles Duffy15 Jan 2013 01:01 #

Howdy --

I'm trying to determine whether sql:execute-prepared exists, to have a module that functions in both BaseX 7.3 and 7.5.

However --

exists(function-lookup(xs:QName("sql:execute-prepared"), 2))

returns false even in BaseX 7.5, even though

function-name(function-lookup(xs:QName("sql:execute-prepared"), 2))

properly returns "sql:execute-prepared".

Am I going to have to use a try block to detect this case?

CG
Christian Grün15 Jan 2013 01:03 #

Hi Charles,

Quoted text · Charles Duffy · 1 line
> exists(function-lookup(xs:QName("sql:execute-prepared"), 2))

interesting one; this always gives me true, no matter how desperately I try; do you have some more hints how to make this happen? Are you sure you tried it with 7.5?

Christian

CD
Charles Duffy15 Jan 2013 02:12 #

You're right -- it does always give true.

However, exists(function-lookup(xs:QName("sql:i-do-not-exist"), 2))

also returns true 100% of the time.

On Mon, Jan 14, 2013 at 6:03 PM, Christian Grün <christian.gruen at gmail.com>wrote:

Quoted text · Christian Grün · 10 lines
> Hi Charles, > > > exists(function-lookup(xs:QName("sql:execute-prepared"), 2)) > > interesting one; this always gives me true, no matter how desperately > I try; do you have some more hints how to make this happen? Are you > sure you tried it with 7.5? > > Christian >
CG
Christian Grün15 Jan 2013 12:29 #
Quoted text · Charles Duffy · 2 lines
> However, exists(function-lookup(xs:QName("sql:i-do-not-exist"), 2)) > also returns true 100% of the time.

True 100%; fixed in the latest snapshot [1]. Christian

[1] http://files.basex.org/releases/latest/


⚡Generated with XQuery