Re: [Vfs-devel] First on the topic list?
Status: Alpha
Brought to you by:
eesa
From: Abdul-Wahid P. <ee...@we...> - 2000-06-05 13:17:58
|
On Mon, 5 Jun 2000, Tony Kirk wrote: > We may have to work out another storage method for the files since not > all DBSs have comparable functions to the Postgres function; pg_lo_import. > On large files for servers without a function like that the only option > would really be to encode the file and store it or read the file in and > store it as a normal blob type. Both of which would be time consuming for > very large files (8 megs or more). How about storing the file as a file? > Creating a file named VFSXXXXX where X would be randomly generated > characters to insure unique file names. Just keep looping until you get a > random file name. Then store the original filename in the database so it can > be sent to the user with the correct file name. That would insure that > separate methods wouldn't be needed for storing the files with different > DBSs. Just an idea. Yes, I am aware of this problem and I think I included it on the original TODO list in the 0.1 distrbution. I agree with your solution as it is pretty much with what I already had in mind. The disadvantange of the filesystem way is that you need to have a webserver writeable directory. But apart from that it isn't really a problem. Everyfile has a unique file number "file_id". Maybe we could use that for the filesystem filename so that it becomes something like VFS$file_id. Is there any advantage of making the filename random? > Also we need to work out the layout of the scripts. If you want the > scripts as one set of files and the db_wrapper files to be separate - it > would require a small rewrite of some of the current code since there is SQL > statements being generated through the scripts. My idea for the layout would > be the following. > > config.inc > postgres_db_wrapper.inc > mysql_db_wrapper.inc > [then whatever other databases will be supported]_db_wrapper.inc > Then the rest of the scripts. I agree with this layout. However, I think we should take a look at the class.DBI. Although it would involve a lot being rewritten, they may have done a lot of work for us already. I am waiting for Roland to get back to us about it. He doesn't seem to have joined the mailing list yet. You can find out about class.DBI at http://evil.inetarena.com/php/DBI.php3 > In the config.inc file would be a setting like: > $dbtype = "postgres"; > > and in the scripts needing the db functions all you would need is: > > require("config.inc"); > require("$dbtype_db_wrapper.inc"); > > Does all of this make sense? It's a pretty typical setup for PHP apps that > support multiple DBSs. Yes it makes sense. I also wanted to move all the .inc files to be included from the header.inc file so that every page only needs to include one .inc file to get everything set-up as required. Regards, AW |