Re: How to insert entire text file in a table column
Excellent! It works. H M Kunzmann wrote: Yes there is ! Use LOAD_FILE(path_name) as the value component of the insert/update statement On Mon, 2003-01-13 at 00:41, Haisam K. Ido wrote: I have the following table, CREATE TABLE cp ( id INT(11) NOT NULL auto_increment, fileVARCHAR(128) NOT NULL, content LONGTEXT, UNIQUE KEY keyword(id,file), PRIMARY KEY (id) ) TYPE=INNODB; I want to insert into "content" an entire text document. How do I do that without puting the entire content into a variable, let's say in perl, and then writing the INSERT statement. Is there a way to give the path to a file and for mysql to use that path to insert the content? - Before posting, please check: http://www.mysql.com/manual.php (the manual) http://lists.mysql.com/ (the list archive) To request this thread, e-mail <[EMAIL PROTECTED]> To unsubscribe, e-mail <[EMAIL PROTECTED]> Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php - Before posting, please check: http://www.mysql.com/manual.php (the manual) http://lists.mysql.com/ (the list archive) To request this thread, e-mail <[EMAIL PROTECTED]> To unsubscribe, e-mail <[EMAIL PROTECTED]> Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php
Re: How to insert entire text file in a table column
Haisam, > I want to insert into "content" an entire text document. How do I do that without > puting the entire content into a variable, let's say in perl, and then writing the > INSERT statement. In MySQL, you have the LOAD_FILE() function to do this: http://www.mysql.com/doc/en/String_functions.html Regards, -- Stefan Hinz <[EMAIL PROTECTED]> Geschäftsführer / CEO iConnect GmbH <http://iConnect.de> Heesestr. 6, 12169 Berlin (Germany) Tel: +49 30 7970948-0 Fax: +49 30 7970948-3 - Original Message - From: "Haisam K. Ido" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Sunday, January 12, 2003 11:41 PM Subject: How to insert entire text file in a table column > I have the following table, > > CREATE TABLE cp ( > id INT(11) NOT NULL auto_increment, > fileVARCHAR(128) NOT NULL, > content LONGTEXT, > UNIQUE KEY keyword(id,file), > PRIMARY KEY (id) > ) TYPE=INNODB; > > I want to insert into "content" an entire text document. How do I do that without > puting the entire content into a variable, let's say in perl, and then writing the > INSERT statement. > > Is there a way to give the path to a file and for mysql to use that path to insert > the content? > > > - > Before posting, please check: >http://www.mysql.com/manual.php (the manual) >http://lists.mysql.com/ (the list archive) > > To request this thread, e-mail <[EMAIL PROTECTED]> > To unsubscribe, e-mail <[EMAIL PROTECTED]> > Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php > - Before posting, please check: http://www.mysql.com/manual.php (the manual) http://lists.mysql.com/ (the list archive) To request this thread, e-mail <[EMAIL PROTECTED]> To unsubscribe, e-mail <[EMAIL PROTECTED]> Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php
How to insert entire text file in a table column
I have the following table, CREATE TABLE cp ( id INT(11) NOT NULL auto_increment, fileVARCHAR(128) NOT NULL, content LONGTEXT, UNIQUE KEY keyword(id,file), PRIMARY KEY (id) ) TYPE=INNODB; I want to insert into "content" an entire text document. How do I do that without puting the entire content into a variable, let's say in perl, and then writing the INSERT statement. Is there a way to give the path to a file and for mysql to use that path to insert the content? - Before posting, please check: http://www.mysql.com/manual.php (the manual) http://lists.mysql.com/ (the list archive) To request this thread, e-mail <[EMAIL PROTECTED]> To unsubscribe, e-mail <[EMAIL PROTECTED]> Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php