  BLOBs for PHPLIB
  Sascha Schumann, sascha@schumann.cx
  $Date: 1999/07/07 20:43:43 $, $Revision: 1.3 $

  Attention: This is a RFD (request for discussion)

  11..  BBLLOOBB ((BBiinnaarryy LLaarrggee OOBBjjeeccttss))

  This chapter shall give you a quick introduction to BLOBs, their
  interface as adapted in PHPLIB and their respective usage.



  11..11..  WWhhyy tthheerree iiss aa nneeeedd ffoorr iitt

  In the process of making your application as portable as possible, you
  will always fall over one thing: Storing a special amount of data.

  There are many existing implementations of BLOBs used by different
  vendors. These BLOBs are sometimes accessed by using a special API,
  sometimes with standard SQL. Sometimes they require you to pay
  attention to every single SQL statement you use.

  The BLOB support folded into the db access class should make things
  easier for you and should guarantee (at least) code compatibility when
  using BLOBs.


  11..22..  HHooww tthhiinnggss wwoorrkk

  If you are used to standard UNIX file descriptors, you will happily
  adapt this model. Every BLOB can be referenced by a unique integer ID
  which is only handled by the blob class.

  The following is a short oversight how to use these BLOBs.


     bblloobb__ccrreeaattee(())

        This will create a new BLOB and return its ID. If it is
        unpossible to create a new BLOB, this function will halt() the
        execution and spit out some kind of error message.


     bblloobb__ooppeenn(($$IIDD))

        Opens the specified BLOB for reading and writing and returns
        true or false, respectively.


     bblloobb__cclloossee(($$IIDD))

        Closes the referenced BLOB. Do not forget this - it maybe
        necessary for some databases or you will lose data.


     bblloobb__ddeelleettee(($$IIDD))

        Deletes the specified BLOB. All associated memory is
        deallocated.  The BLOB doesn't may be referenced at a later
        time.


     bblloobb__rreeaadd(($$IIDD))

        Reads the entire data of BLOB and returns it.
     bblloobb__wwrriittee(($$IIDD,, $$DDAATTAA))

        Overwrites the whole BLOB with $DATA.



  11..33..  IImmpplleemmeennttaattiioonn iissssuueess

  This is a very light-weigth API which should be usable with every
  existing DBMS. There shouldn't be a problem with making it available
  through a file based system like GDBM or DB (unneeded for standard
  relational databases like MySQL, PostgreSQL or Informix).

  It should help PHPLIB to support even more databases - the ones which
  cannot store massive amounts of data through a single INSERT/UPDATE
  statement.

  I've done it already for PostgreSQL, we've seen a pseudo
  implementation for MySQL. Go for it :-)















































