1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132
|
BLOBs for PHPLIB
Sascha Schumann, sascha@schumann.cx
$Date: 1999/07/17 10:53:51 $, $Revision: 1.5 $
RFD on a BLOB API for PHPLIB
11.. BBLLOOBB ((BBiinnaarryy LLaarrggee OOBBjjeeccttss))
This chapter is intended to give you a quick introduction to BLOBs,
their interface as proposed for PHPLIB.
11..11.. DDeeffiinniinngg tthhee pprroobblleemm
Achieving the goal of creating portable applications is hindered by
the fact that no portable way of storing large amount of data exists.
Every database vendor defines his own application programming
interface (API) to access binary large objects, or uses other, non-
standard ways to enable the use of BLOBs.
Enhancing the existing vendor neutral support for databases in PHPLIB
to also include BLOB support could be a short-term solution to the
problem.
11..22.. PPrrooppoosseedd eexxtteennssiioonn AAPPII
An overview over the function calls follows.
bblloobb__ccrreeaattee(())
This will create a new BLOB and return its ID. If it is
impossible to create a new BLOB, this function will halt() the
execution and generate an error message.
bblloobb__ooppeenn(($$IIDD))
Opens the specified BLOB for reading and writing and returns
true or false on success or failure, respectively.
bblloobb__cclloossee(($$IIDD))
Closes the referenced BLOB. Do not forget this - it might be
necessary for some databases or you might face data loss.
bblloobb__ddeelleettee(($$IIDD))
Deletes the specified BLOB. All associated resources are freed.
The BLOB must not be referenced at a later time.
bblloobb__rreeaadd(($$IIDD))
Reads the entire data of BLOB and returns it.
bblloobb__wwrriittee(($$IIDD,, $$DDAATTAA))
Overwrites the whole BLOB with $DATA.
11..33.. DDeessiiggnn nnootteess
The goal was to create a vendor neutral API which could be implemented
easily with most databases. Eventually, it should provide a "fallback"
mode enabling the user to utilize BLOBs even if the database does not
support BLOBs natively. Keep in mind that it should be able to cover
as many databases as possible and therefore only implements a subset
of functionality provided by modern databases.
|