BLOB Streaming For PHP
Contents |
[edit] BLOB Streaming For PHP
This is part of the Summer of Code 2008 project proposals.
[edit] Notes by Paul McCullagh (Mentor)
- The BLOB streaming engine for MySQL (http//www.blobstreaming.org) is a pluggable storage engine which allows BLOBs to be streamed directly in and out of a MySQL database. The streaming engine opens a TCP port and allows the BLOB data to be uploaded and downloaded using the HTTP PUT and GET methods.
- This project involves defining and implementing a set of functions (or classes) which allow developers to easily perform these operations in PHP. Integration with the MySQL native driver for PHP would be ideal. A small demo program and a tutorial should also be created.
- The project will be open source, and will be made available on the BLOB streaming web-site.
[edit] Notes by KishoreKumar Bairi
[edit] About MyBS
- Everything you ever want to know about BLOB Streaming and MyBS is given in its documentation page, [1]
- If that thirteen pages documentation has to be summarized in few points. It goes as follows:
- MyBS(BLOB Streaming for MySQL) storage engine engine specializes in the storage and retrieval of BLOB data. Unlike other storage engines, it does not actually provide table storage. So you would never actually create tables of type MyBS Instead, MyBS works together with a standard storage engine
- functionality provided by MyBS
- Direct HTTP stream-based access to database information(using light weight embedded web server).
- A repository for BLOB data. The details of why we need to have seperate respository for BLOB data is expalined in Presentation - Hamburg MySQL User Group, November 2007
- If your table field in a database is of type blob. say some data is stored in it. a query like "SELECT * FROM table" doesnt fetch you the data stored in the blob. The entire concept of BLOB streaming is storing and retrieving the blob data.
- It uses a concept called "BLOB Repository" which is nothing but a storage space provided to dump data into it. Every database has its own Repository. The each blob (data) you store in this repository has 'unique indentifier' which is used to retrieve or update the blob. All the parameters of the repository can be changed by corresponding system variables [2]
- Accessing,Updating & Inserting operations on blob can be done by sending MyBS(which has embedded light weight web server running on port 8080 by default) HTTP GET and PUT requests.
- The response of the HTTP put method is "Unique reference Id" which can be used to refer that blob using the URL mechanism [3]
[edit] Goal of the Project
Goal of the project is to implement the HTTP based Client API extension(for PHP) show in Tier#2 of above figure.
In simple terms write functions/methods that can be used to store & retrieve the blob data.
[edit] Implementaion
This task can be done in two ways.
- Directly using other PHP library like CURL & Network functions ( fsockopen() )
- cons: Though it makes implementation simple, the code can't be standardized.
- The functionality can't be given along with the PHP MySQL Connector.
The solution is use 2nd way.
- Integration with the MySQL native driver for PHP:
- Extend the php_mysql.c (in php/ext/mysql folder) or php-5.2.5/ext/mysqli.
- Add functions similar to get/setBinaryStream() and get/setBlob() in JDBC (OR) SQLGetData() and SQLPutData() in ODBC.
