Would it make sense to expose this stuff as a stream using
the streams API, so the user would be able to fread($lob) etc?

You could still add functions for those things that aren't
covered already by streams (the erase() call).

One of the benefits would be avoiding adding more functions to
the global namespace, and also side stepping any naming convention
wars that might arise.

--Wez.

----- Original Message ----- 
From: "Antony Dovgal" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Cc: <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]>
Sent: Friday, December 05, 2003 1:30 PM
Subject: [PHP-DEV] [PATCH] for oci8 and some improvement proposals


> Hi, all!
>
> I want to propose a patch, that will add functions listed below to OCI8
extension.
> Similar functions exist in Postgres & Informix extensions, but they are
absent in OCI8 module.
> The patch is being used on 4 my servers (development, test & 2 production
servers) about a week and seems to be (almost? =)) bug-free.
>
> ocitelllob();          [ OCI_Lob->tell(); ]         - ftell(); analogue
for Lobs
> ociwritelob();         [ OCI_Lob->write(); ]        - fwrite(); analogue
for Lobs
> ocitruncatelob();      [ OCI_Lob->truncate(); ]     - ftruncate();
analogue for Lobs
> ocieraselob();         [ OCI_Lob->erase(); ]        - erases specified
part of a Lob (for BLOBs it means zero-filling, for CLOBs - space-filling)
> ociflushlob();         [ OCI_Lob->flush(); ]        - flushes Lob buffer
(if buffering was enabled before)
> ocisetbufferinglob();  [ OCI_Lob->setBuffering(); ] - turns on/off
buffering for the current Lob
> ocigetbufferinglob();  [ OCI_Lob->getBuffering(); ] - gets buffering'
current state
> ocirewindlob();        [ OCI_Lob->rewind(); ]       - rewind(); analogue
for Lobs
> ocireadlob();          [ OCI_Lob->read(); ]         - fread(); analogue
for Lobs
> ocieoflob();           [ OCI_Lob->eof(); ]          - feof(); analogue for
Lobs
> ociseeklob();          [ OCI_Lob->seek(); ]         - fseek(); analogue
for Lobs
> ocilobgetlength();     [ OCI_Lob->getLength(); ]    - filesize(); analogue
for Lobs
>
> ociappendlob();        - appends data from a Lob to another Lob
> ocicopylob();          - copies data from a Lob to another Lob
> ociisequallob();       - compares 2 Lobs and checks if they are equal
>
> All OCI-Lob methods could be rewritten to receive Lob as parameter, when
they aren't called as methods, but currently this is not done (should I do
it?).
>
> As you can see, I've added this check:
> if (oci_lobgetlen(descr->conn,descr,&len) == 0 && descr->lob_size >= 0)
> to almost all new functions.
> I propose to add this check to already existing functions (I mean, to
replace calls of CALL_OCI_RETURN()),
> 'cause at this moment they get Lob's length from Oracle each time they are
called and it's not the best decision imho.
>
> And there is another one thing I want to ask you about:
> ALL functions, which wrap database API's in PHP, are called like this:
<db>_<action>_<to>_<do>,
> but only OCI8 wrappers are called in another way: oci<action><to><do>
> Maybe it's time to declare this style deprecated and to change it to
oci_<action>_<to>_<do>?
> (especially after that endless discussion about studlyCaps =))

-- 
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to