2009-06-15 45 views

回答

5

嗯......我不會推薦將圖像存儲在任何數據庫中(我更喜歡將圖像存儲在文件系統中,並將圖像存儲在數據庫中)但是......該場景在DBD文檔中是正確的:: SQLite

use DBI qw(:sql_types); 
my $dbh = DBI->connect("dbi:SQLite:dbfile","",""); 

my $blob = `cat foo.jpg`; 
my $sth = $dbh->prepare("INSERT INTO mytable VALUES (1, ?)"); 
$sth->bind_param(1, $blob, SQL_BLOB); 
$sth->execute(); 
+0

...但文件系統*是*數據庫:) – ysth 2009-06-15 23:40:42

相關問題