I don't use the DB for performance reasons - i use it because it's easier to handle (well, at least should be ;) ).
The images will change pretty often. If you consider file system vs. database performance, you also have to keep fragmentation in mind. Although modern *nix-filesystems tend to be resistant against fragmentation issues, a _very_ large fluctuation can still cause serious performance loss (as you can see with Gentoo Linux's portage tree).
But as said before - its just easy to handle. You don't have to care about potential security headaches with uploading binary files into your cgi-dir, permissions etc. Just 'insert' and 'select', and there you (should) go. And i still have to get the content-type, either by extracting it from the image (bad idea) or by getting it from the Database.
Some more Information about my problem:
System is a current Gentoo-Linux with perl 5.8.6, mysql-4.1.14, DBD::Mysql 2.9007, DBI 1.46.
When using the console-client 'mysql', everything works as expected. Same with phpMyAdmin.
The following code also works:
my $sql = "select type from bilder where id =?";
my $sth = $dbh->prepare($sql);
$sth->execute( $q->param('id') );
my $error = 0;
my $type = $sth->fetchrow || ( $error = 1 );
$sql = "select data from bilder where id =?";
$sth = $dbh->prepare($sql);
$sth->execute( $q->param('id') );
my $data = $sth->fetchrow();
binmode(STDOUT);
...
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.