Loading ...
Sorry, an error occurred while loading the content.
 

LOB oddness

Expand Messages
  • Lukas Smith
    Hi, I find this implementation a bit odd. Function ReadResultLOB($lob,&$data,$length) { if(!$this- RetrieveLOB($lob)) return(-1);
    Message 1 of 2 , May 1, 2003
      Hi,

      I find this implementation a bit odd.

      Function ReadResultLOB($lob,&$data,$length)
      {
      if(!$this->RetrieveLOB($lob))
      return(-1);

      $length=min($length,strlen($this->lobs[$lob]["Value"])-$this->lobs[$lob]
      ["Position"]);

      $data=substr($this->lobs[$lob]["Value"],$this->lobs[$lob]["Position"],$l
      ength);
      $this->lobs[$lob]["Position"]+=$length;
      return($length);
      }

      Why isn't the value appended to $data as follows:
      $data.=substr($this->lobs[$lob]["Value"],$this->lobs[$lob]["Position"],$
      length);

      Another thing I noticed:
      I didn't quickly find this in the code but according to the tutorial
      using the MetabaseReadLob with a length == 0 on a lob with
      type'outputfile' will read the entire lob. Is this also be the case for
      type 'resultlob'?

      Regards,
      Lukas Smith
      smith@...
      _______________________________
      BackendMedia
      www.backendmedia.com
      berlin@...

      Linn Zwoch Smith GbR
      Pariser Str. 44
      D-10707 Berlin

      Tel +49 30 83 22 50 00
      Fax +49 30 83 22 50 07
    • Manuel Lemos
      Hello, ... For the exact reason that the LOB interface provides access to streamed data. Appending data makes the scripts spend much more memory. If you have a
      Message 2 of 2 , May 2, 2003
        Hello,

        On 05/01/2003 04:41 PM, Lukas Smith wrote:
        > I find this implementation a bit odd.
        >
        > Function ReadResultLOB($lob,&$data,$length)
        > {
        > if(!$this->RetrieveLOB($lob))
        > return(-1);
        >
        > $length=min($length,strlen($this->lobs[$lob]["Value"])-$this->lobs[$lob]
        > ["Position"]);
        >
        > $data=substr($this->lobs[$lob]["Value"],$this->lobs[$lob]["Position"],$l
        > ength);
        > $this->lobs[$lob]["Position"]+=$length;
        > return($length);
        > }
        >
        > Why isn't the value appended to $data as follows:
        > $data.=substr($this->lobs[$lob]["Value"],$this->lobs[$lob]["Position"],$
        > length);

        For the exact reason that the LOB interface provides access to streamed
        data. Appending data makes the scripts spend much more memory. If you
        have a large object, after all what LOBs are, you may easily exceed the
        PHP memory limits making it unviable to handle large objects.



        > Another thing I noticed:
        > I didn't quickly find this in the code but according to the tutorial
        > using the MetabaseReadLob with a length == 0 on a lob with
        > type'outputfile' will read the entire lob. Is this also be the case for
        > type 'resultlob'?

        No. That is just for reading LOB data into files. Still internally, the
        length of 0 is in practice the limit length of the buffer . If the LOB
        is larger, it will repeat LOB to file retrieval until the LOB ends.

        --

        Regards,
        Manuel Lemos
      Your message has been successfully submitted and would be delivered to recipients shortly.