Re: DB_Binary Draft

From: Date: Sat, 17 Mar 2001 01:53:45 +0000
Subject: Re: DB_Binary Draft
References: 1  Groups: php.pear.dev 
Request: Send a blank email to pear-dev+get-36@lists.php.net to get a copy of this message
Just out of curiosity, what would be the advantage/benefit of storing binary data in a database? It is not queryable, and it makes the database file bigger. I have not had the need to do this, just put the big binaries in the filesystem and a pointer to their path in the database. Apart from using a database as a filesystem in an embedded applications I cannot imagine when it would be a good option to put a binary in it, but my imagination is not as prolific as others. Any info/hints/pointers to articles would be greatly appreciated, so I can learn some more. --- yavo <yavo@itena.com.cy> wrote: > Here's a DB_Binary class, for storing binary files > in a database. It's not > finished but I wanted someone to take a look at it > to see if it's following > PEAR coding style etc. > > It's structured like this > Binary.php > Binary/ > oci8.php > {other extentions to come} > > > The DB_Binary class implements > // Constructor > DB_Binary($tableName="files", $tableKey="fileid", > $tableFile="file", > &$database) > // Connects and returns a new object > connect($database="") > // change properties after instantiation > setup($tableName, $tableKey, $tableFileType="", > $tableFilename="", > $tableFileSize="") > // stream, after the file is fetched, you can't > stream it to the clent.. > Uses header functions > function stream() > > The DB_Binary_oci8 class impements > // save, save the file to the db > function save($fileID="", $file, $filetype="", > $filename="", $filesize=""){ > // fetch, get the file from the db > function fetch($fileID) > > > > > // The reasons behand this class are than while > storing files in a databse > // in mysql is a breeze, in other databases (oracle, > pgsql) things are not > so > // smooth. I spend a long time in the > www.phpbuilder.com forums and a lot of > the questions > // there where how to store file in oracle and get > them out. Onother popular > // question was how to execute stored procedures, > espesially one returing > // recordsets. This class will support saving files > submitted from forms to > // the database, fetching them and/or streaming them > to the user, with the > apropriate > // file type if saved in the database. Future > extentions would be to include > dynamic resizing > // for images, but I have no idea how to do that. > Another idea for extedning > this would be > // to make it get multiple files, but that might > lead to performance hits > > > > ATTACHMENT part 2 application/zip name=DB_Binary.zip > > > -- > PEAR Development Mailing List (http://pear.php.net/) > To unsubscribe, e-mail: > pear-dev-unsubscribe@lists.php.net > For additional commands, e-mail: > pear-dev-help@lists.php.net > To contact the list administrators, e-mail: > php-list-admin@lists.php.net > ===== --- Jesus M. Castagnetto (jcastagnetto@yahoo.com) __________________________________________________ Do You Yahoo!? Get email at your own domain with Yahoo! Mail. http://personal.mail.yahoo.com/

« previous php.pear.dev (#36) next »