[prev in list] [next in list] [prev in thread] [next in thread] 

List:       mysql
Subject:    length limit on INSERT?
From:       Hans Ecke <hecke () Mines ! EDU>
Date:       2000-04-02 4:18:50
[Download RAW message or body]

Hi List!

I really hope I'm not asking too much a RTFM question. I was looking at
the archive and the manual and could not find an answer there. If one is
indeed in there I'm really sorry but would very much appreciate a reply
with a pointer to the right post/manual page.

What I want to do: Insert pictures into a table. They have a size of
approximately 150kB. 

Here is a fragment of perl code:

open PHOTOFILE,"test.jpg";
$pho="";
while(<PHOTOFILE>) {     
     $pho=$pho . $_ ;
     }
close PHOTOFILE;  
$pho=&myquote($pho);                #does the necessary quoting

$exec_stmt="INSERT INTO MYTAB VALUES(someothers,\'$pho\',someothers)";

To actually call Mysql I have two possibilities:
Either going into perl's Mysql-module or I do the following:

print "use DB;\n";
print "$exec_stmt;\n"; 

The output of the "print" command is redirected into a file test.sql.
Then I call 
mysql -u user < test.sql

Result: Both ways don't work. Instead I get a message 
"Error 2006: server went away" and in a log file I can find 
"Packet too large (148155)"

Now this tells me that Mysql does not want so big a file on INSERT's
command line. Indeed, if I truncate $pho everything works just fine.

Does anybody know a workaround for this one? 

I'm using MySQL 3.21.33. I know thats old but I hope its not the reason.

Thank you very much 

Hans



-- 
Hans Ecke                      h_ecke@iname.com
Department of Geophysics       http://come.to/h_ecke
Colorado School of Mines       Tel: (USA) 303-279-1243
Golden, Colorado               Fax: (USA) 303-384-2125


-- 
---------------------------------------------------------------------
Please check "http://www.mysql.com/Manual_chapter/manual_toc.html" before
posting. To request this thread, e-mail mysql-thread32932@lists.mysql.com

To unsubscribe, send a message to:
    <mysql-unsubscribe-mysql=progressive-comp.com@lists.mysql.com>

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic