roxen.lists.roxen.general

Subject Author Date
Re: Reading an Oracle LONG value from Pike/Roxen Michael Stenitzer <jenoe[dot]stenitzer[at]gmail[dot]com> 12-09-2006
hi,

On 9/12/06, Peter Ohlerich <<peter.ohlerich[at]uni-bielefeld.de>> wrote:
>
> I want to read the contents from a LONG field from an Oracle 9i
> database. The standard <emit sql> does not work here. Can I read this
> from inside Roxen (currently 4.0, 4.5 planned) or if this is not
> possible, how can I do this from a Pike script (maybe I can create a
> user tag from this)?
>

this is what we used with roxen 2.2 - 3.4 (IIRC) for oracle clobs
which should be probably rather similar to your problem. it should be
straight forward to write such code in pike.

<comment>Tag <comp_detail_clob>
         Extract one wert_clob by |id|
</comment>
<define tag="comp_detail_clob">
  <emit source="sql" host="energy" query="select
    DBMS_LOB.GETLENGTH(wert_clob) as LENGTH
      from comp_details
      where COMP_DTL_ID='&comp_detail_clob.id;'">
        <for variable="var.i" from="1" to="&sql.LENGTH;" step="2000">
          <emit source="sql" scope="sql2" host="energy" query="select
            DBMS_LOB.SUBSTR(wert_clob, 2000, &var.i;) as STR
            from comp_details
            where COMP_DTL_ID='&comp_detail_clob.id;'">
              &sql2.STR:none;
          </emit>
        </for>
   </emit>
</define>

Important note:
* you must remove all whitespace from this code. i just formatted it,
to make it more readable.
* we encountered major problems with oracle (memory leaks, roxen
instability) and current roxen versions (3.4, 4.0). so we switched to
mysql and did not regret.

/michael

-- 
Michael Stenitzer | WIENFLUSS information.design.solutions
www.wienfluss.net | linke wienzeile 178 / 3 / 142 | wien AT
fon ++43 650 wfluss 0 | fax  ++43 1 4854200 31