40:
41: procedure closeHdl(hdl in number) as LANGUAGE JAVA NAME
42: 'oracle.xquery.OXQServer.closeHdl(int)' ;
43:
44: /* return xmltype(content) */
45: FUNCTION exec_cont(hdl in number) return sys.xmltype is
46: clb clob := ' ';
47: ret xmltype := null;
48: outflg number := 0;
41: procedure closeHdl(hdl in number) as LANGUAGE JAVA NAME
42: 'oracle.xquery.OXQServer.closeHdl(int)' ;
43:
44: /* return xmltype(content) */
45: FUNCTION exec_cont(hdl in number) return sys.xmltype is
46: clb clob := ' ';
47: ret xmltype := null;
48: outflg number := 0;
49: fetch_ok number ;
43:
44: /* return xmltype(content) */
45: FUNCTION exec_cont(hdl in number) return sys.xmltype is
46: clb clob := ' ';
47: ret xmltype := null;
48: outflg number := 0;
49: fetch_ok number ;
50: begin
51:
53:
54: if fetch_ok >= 1 then
55: if outflg = QMXQRS_JAVA_FRAGMENT then
56: ret :=
57: xmltype.createxml(''|| clb || '',null,1,1).extract('/A/node()');
58: else
59: ret := xmltype.createxml(clb, null, 1,1);
60: end if;
61: end if;
55: if outflg = QMXQRS_JAVA_FRAGMENT then
56: ret :=
57: xmltype.createxml(''|| clb || '',null,1,1).extract('/A/node()');
58: else
59: ret := xmltype.createxml(clb, null, 1,1);
60: end if;
61: end if;
62:
63: /* we cache the xquery plan in qmxqrs.c level, so we don't close the
68:
69: end;
70:
71: /* return a sequence */
72: FUNCTION exec_seq(hdl in number) return sys.xmltype is
73: fetch_ok number;
74: str varchar2(4000);
75: clb clob := ' ';
76: xval xmltype;
72: FUNCTION exec_seq(hdl in number) return sys.xmltype is
73: fetch_ok number;
74: str varchar2(4000);
75: clb clob := ' ';
76: xval xmltype;
77: ret xmltype := null;
78: outflg number := 0;
79: xqtype number := QMTXT_INVALIDTYPE;
80: noDocWrap number := 0;
73: fetch_ok number;
74: str varchar2(4000);
75: clb clob := ' ';
76: xval xmltype;
77: ret xmltype := null;
78: outflg number := 0;
79: xqtype number := QMTXT_INVALIDTYPE;
80: noDocWrap number := 0;
81: begin
214: * sys_xqcon2seq() call below will make it turn on NO_DOCWRAP flag.
215: * Also, for the case of xquery DM node constructed from
216: * document {} constructor, the xquery java engine uses
217: * DOM QMXQRS_JAVA_FRAGMENT node to represent this, however, the
218: * noDocWrap =0 in this case and xmltype.extract() returning content
219: * which has NO NO_DOCWRAP flag on, which is right for this case.
220: */
221: xval :=
222: xmltype.createxml(''||clb ||'',null,1,1).extract('/A/node()');
218: * noDocWrap =0 in this case and xmltype.extract() returning content
219: * which has NO NO_DOCWRAP flag on, which is right for this case.
220: */
221: xval :=
222: xmltype.createxml(''||clb ||'',null,1,1).extract('/A/node()');
223: /*
224: select extract(xmltype.createxml(''||clb ||'',null,1,1),'/A/node()') into xval
225: from dual;
226: */
220: */
221: xval :=
222: xmltype.createxml(''||clb ||'',null,1,1).extract('/A/node()');
223: /*
224: select extract(xmltype.createxml(''||clb ||'',null,1,1),'/A/node()') into xval
225: from dual;
226: */
227: else
228: /* only document node or single element node goes to here */
225: from dual;
226: */
227: else
228: /* only document node or single element node goes to here */
229: xval := xmltype.createxml(clb,null,1,1);
230: end if;
231: clb := ' ';
232: end if;
233:
254: FUNCTION exec_exists(hdl in number, retseq in number) return number is
255: fetch_ok number;
256: str varchar2(4000);
257: clb clob := ' ';
258: xval xmltype;
259: ret number := 0;
260: outflg number := QMXQRS_JAVA_CHK_EXSTS; /* pass on flag for XMLEXISTS check*/
261: xqtype number := 0;
262: begin
276: return ret;
277: end;
278:
279: FUNCTION exec(hdl in number, retseq in number)
280: return sys.xmltype is
281: begin
282: if retseq = 1 then
283: return exec_seq(hdl);
284: else
294:
295: FUNCTION execallCmn(xqry in varchar2, nlssrt in varchar2, nlscmp in varchar2,
296: dbchr in varchar2, retseq in number, flags in number, xqryclb in clob,
297: xqisclob in number, hdl in out number)
298: return sys.xmltype is
299: --hdl number;
300: begin
301: if (hdl = 0) then
302: /* xquery plan has not been built, so let's build it */
332: end;
333:
334: FUNCTION execall(xqry in varchar2, nlssrt in varchar2, nlscmp in varchar2,
335: dbchr in varchar2, retseq in number, flags in number, hdl in out number)
336: return sys.xmltype is
337: begin
338: return execallCmn(xqry, nlssrt, nlscmp, dbchr, retseq, flags, null, 0, hdl);
339: end;
340:
339: end;
340:
341: FUNCTION execallxclb(xqryclb in clob, nlssrt in varchar2, nlscmp in varchar2,
342: dbchr in varchar2, retseq in number, flags in number, hdl in out number)
343: return sys.xmltype parallel_enable is
344: begin
345: return execallCmn(null, nlssrt, nlscmp, dbchr, retseq, flags, xqryclb, 1, hdl);
346: end;
347:
363: return execallCmn_exists(null, nlssrt, nlscmp, dbchr, retseq, flags, xqryclb, 1, hdl);
364: end;
365:
366: /* testing function */
367: FUNCTION executeCmn(xqry in varchar2, xctx in xmltype:=null, retseq in number := 0, xqryclb in clob, xqisclob in number)
368: return sys.xmltype parallel_enable is
369: a number := 0;
370: dbchr varchar2(30);
371: nlscmp varchar2(30);
364: end;
365:
366: /* testing function */
367: FUNCTION executeCmn(xqry in varchar2, xctx in xmltype:=null, retseq in number := 0, xqryclb in clob, xqisclob in number)
368: return sys.xmltype parallel_enable is
369: a number := 0;
370: dbchr varchar2(30);
371: nlscmp varchar2(30);
372: nlssrt varchar2(30);
397: return exec(hdl, retseq);
398:
399: end;
400:
401: FUNCTION execute(xqry in varchar2, xctx in xmltype:=null, retseq in number := 0)
402: return sys.xmltype parallel_enable is
403: begin
404: return executeCmn(xqry, xctx, retseq, null, 0);
405: end;
398:
399: end;
400:
401: FUNCTION execute(xqry in varchar2, xctx in xmltype:=null, retseq in number := 0)
402: return sys.xmltype parallel_enable is
403: begin
404: return executeCmn(xqry, xctx, retseq, null, 0);
405: end;
406:
403: begin
404: return executeCmn(xqry, xctx, retseq, null, 0);
405: end;
406:
407: function executexclb(xqry in clob, xctx in xmltype := null,
408: retseq in number := 0)
409: return sys.xmltype parallel_enable is
410: begin
411: return executeCmn(null, xctx, retseq, xqry, 1);
405: end;
406:
407: function executexclb(xqry in clob, xctx in xmltype := null,
408: retseq in number := 0)
409: return sys.xmltype parallel_enable is
410: begin
411: return executeCmn(null, xctx, retseq, xqry, 1);
412: end;
413: