TalkPHP

TalkPHP (http://www.talkphp.com/forums.php)
-   General (http://www.talkphp.com/general/)
-   -   what kind of data can go into a mysql database? (http://www.talkphp.com/general/2221-what-kind-data-can-go-into-mysql-database.html)

sarmenhb 02-10-2008 06:46 PM

what kind of data can go into a mysql database?
 
can huge zip files or .img files go in?

or is it best to put things like images etc.

TlcAndres 02-10-2008 07:34 PM

anything can go into a mysql database if you use blob

sarmenhb 02-10-2008 07:46 PM

do people usually insert files into their database or just trow it into a upload directory?

TlcAndres 02-10-2008 08:07 PM

Upload directory in tangent with databse to keep the the path to the files, megaupload does this.

Village Idiot 02-10-2008 08:27 PM

Never store files in mysql, its not mysql's purpose. You store the files as files on your hard drive (where it belongs) and the links to them in the database if need requires.

Salathe 02-10-2008 08:35 PM

If databases weren't meant to store binary data, why do we have the BLOB column type available? There are strong arguments for and against on both sides of the argument, though often the strongest side tends to be to store the files in the file system and make a reference to the file name and/or path using a simple VARCHAR column.

Orc 02-10-2008 09:28 PM

Databases store infinite amount of data.
And that data can be anything.

I think that vBulletin stores avatars in blob field types. :]

ReSpawN 02-10-2008 09:39 PM

I'm interested. How does vBulletin store that data? Is it the same if I open an .JPEG image with notepad?

Orc 02-10-2008 09:41 PM

Quote:

Originally Posted by ReSpawN (Post 10559)
I'm interested. How does vBulletin store that data? Is it the same if I open an .JPEG image with notepad?

blob :P Really, just get vbulletin some how ( no, don't warez it ), look it up yourself.

Village Idiot 02-10-2008 09:42 PM

Quote:

Originally Posted by Orc (Post 10557)
Databases store infinite amount of data.
And that data can be anything.

I think that vBulletin stores avatars in blob field types. :]

Nope
http://www.talkphp.com/avatars/orc.gif

Orc 02-10-2008 09:47 PM

Quote:

Originally Posted by Village Idiot (Post 10561)

No no no, not that, theres a different method, by storing it in a php file.

Orc 02-10-2008 09:48 PM

Quote:

Originally Posted by Village Idiot (Post 10561)

No no no, not that, theres a different method, by storing it in a php file.

The files aren't duplicated or created from the original, cause I looked all over in vbulletin. I dunno, check the dump

Alan @ CIT 02-10-2008 10:42 PM

If I had 10,000 2k images/files, I'd probably store them in the DB. If I 1000 100k files, I'd probably put them on the filesystem.

As for the vBulletin thing, vB has support for storing attachments, sig pics, profile pics, avatars and thumbnails in the database using Blob columns.

Alan

Orc 02-10-2008 10:44 PM

Quote:

Originally Posted by Alan @ CIT (Post 10564)
If I had 10,000 2k images/files, I'd probably store them in the DB. If I 1000 100k files, I'd probably put them on the filesystem.

As for the vBulletin thing, vB has support for storing attachments, sig pics, profile pics, avatars and thumbnails in the database using Blob columns.

Alan

Thank you for clearing that up.

sarmenhb 02-11-2008 12:15 AM

interesting,

now can someone explain why type of php code inserts an image uploaded into the db


thanks


wow i have so much gas, the smell is strong

Orc 02-11-2008 01:18 AM

Quote:

Originally Posted by sarmenhb (Post 10568)
interesting,

now can someone explain why type of php code inserts an image uploaded into the db


thanks


wow i have so much gas, the smell is strong

the below comment was not needed but umm, also, I've never tried inserting images, or anything into a blob field, just that I make it save the path in the database, and grab the image. thats about it.

TlcAndres 02-11-2008 01:28 AM

Google turned up a quick example

Uploading Files To MySQL Database Using PHP

and Ork was right...the last comment wasn't needed.

Speeple 02-23-2008 12:08 PM

One of the benefits of using a database system over the file system to store files is to overcome throughput issues.

Having directories of millions of files for example can kill IO throughput. Databases can overcome this because usually they use a single table space. Not to mention they have sophisticated data caching methods.

But do remember, a file system was designed to store files, so in the majority of cases it is advisable to use it.

ReSpawN 02-23-2008 01:21 PM

So the most likely conclusion is to store small types of binary data in the database, like documents and small images, but store files of great size, like say 100MB or maybe 1000MB (1GB) on the filesystem.

stewart 02-23-2008 07:42 PM

There is a significant amount of overhead when using the BLOB field type for storing much of anything last i knew :S


All times are GMT. The time now is 11:44 AM.

Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.1.0