niXforums Forum Index
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   PreferencesPreferences   Log in to check your private messagesLog in to check your private messages   Log inLog in 
·  nixdoc.net ·  man pages ·  Linux HOWTOs ·  FreeBSD Tips ·  Forums
navigation Forum index » Databases » MySQL
retrieve value from an external file?
Post new topic   Reply to topic Page 1 of 1 [5 Posts] View previous topic :: View next topic
Author Message
Bing Du
*nix forums beginner


Joined: 18 May 2005
Posts: 26

PostPosted: Thu Jul 20, 2006 7:48 pm    Post subject: retrieve value from an external file? Reply with quote

Hello everyone,

Without scripting, can this be done from mysql> command line? The
'publications' field is mediumtext in table 'research'. Since
'publication' is pretty long, I want to save it in a file on the file
system. But I don't know how, or if that's even possible, to grab the
content from the file and use it in the following update statement?

mysql>update research set publications='loooong text in a file' where
uid=319;

Any ideas?

Thanks in advance,

Bing

--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe: http://lists.mysql.com/mysql?unsub=gcdmg-mysql@m.gmane.org
Back to top
Chris White
*nix forums beginner


Joined: 21 Apr 2006
Posts: 43

PostPosted: Thu Jul 20, 2006 8:07 pm    Post subject: Re: retrieve value from an external file? Reply with quote

On Thursday 20 July 2006 12:48 pm, Bing Du wrote:
Quote:
Hello everyone,

mysql>update research set publications='loooong text in a file' where
uid=319;

You already have the data in a storage system ( a file on the filesystem ).
That said, use what you have, store the location to the file, then grab that
and use it to open the file and get the contents, using that for whatever
purpose you may have.

--
Chris White
PHP Programmer/DBlarg
Interfuel

--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe: http://lists.mysql.com/mysql?unsub=gcdmg-mysql@m.gmane.org
Back to top
mos
*nix forums Guru Wannabe


Joined: 21 Feb 2005
Posts: 103

PostPosted: Thu Jul 20, 2006 8:28 pm    Post subject: Re: retrieve value from an external file? Reply with quote

At 02:48 PM 7/20/2006, you wrote:
Quote:
Hello everyone,

Without scripting, can this be done from mysql> command line? The
'publications' field is mediumtext in table 'research'. Since
'publication' is pretty long, I want to save it in a file on the file
system. But I don't know how, or if that's even possible, to grab the
content from the file and use it in the following update statement?

mysql>update research set publications='loooong text in a file' where
uid=319;

Any ideas?

Thanks in advance,

Bing

Bing,
You could create a temporary table with a single text field and
then use "Load Data Infile <filepath> ..." to put the text data into the
temporary table. Once it is there you can use the temporary table to update
your research table.

Mike

--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe: http://lists.mysql.com/mysql?unsub=gcdmg-mysql@m.gmane.org
Back to top
Bing Du
*nix forums beginner


Joined: 18 May 2005
Posts: 26

PostPosted: Fri Jul 21, 2006 2:06 pm    Post subject: Re: retrieve value from an external file? Reply with quote

Quote:
On Thursday 20 July 2006 12:48 pm, Bing Du wrote:
Hello everyone,

mysql>update research set publications='loooong text in a file' where
uid=319;

You already have the data in a storage system ( a file on the filesystem
).
That said, use what you have, store the location to the file, then grab
that
and use it to open the file and get the contents, using that for whatever
purpose you may have.


Thanks Chris. What you said makes sense to me. Sure I can do that in a
script. But I'm still not clear how it can be done from the 'mysql>'
command line. I cannot change the table definition to make the
'publications' field to store the location of the file. The
'publications' field stores the actual content of the file.

Bing

--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe: http://lists.mysql.com/mysql?unsub=gcdmg-mysql@m.gmane.org
Back to top
Bing Du
*nix forums beginner


Joined: 18 May 2005
Posts: 26

PostPosted: Fri Jul 21, 2006 2:07 pm    Post subject: Re: retrieve value from an external file? Reply with quote

Quote:
At 02:48 PM 7/20/2006, you wrote:
Hello everyone,

Without scripting, can this be done from mysql> command line? The
'publications' field is mediumtext in table 'research'. Since
'publication' is pretty long, I want to save it in a file on the file
system. But I don't know how, or if that's even possible, to grab the
content from the file and use it in the following update statement?

mysql>update research set publications='loooong text in a file' where
uid=319;

Any ideas?

Thanks in advance,

Bing

Bing,
You could create a temporary table with a single text field and
then use "Load Data Infile <filepath> ..." to put the text data into the
temporary table. Once it is there you can use the temporary table to
update
your research table.


That sounds like a good idea that's worth trying. Thanks much, Mike.

Bing

--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe: http://lists.mysql.com/mysql?unsub=gcdmg-mysql@m.gmane.org
Back to top
Google

Back to top
Display posts from previous:   
Post new topic   Reply to topic Page 1 of 1 [5 Posts] View previous topic :: View next topic
The time now is Sat Nov 22, 2008 8:50 pm | All times are GMT
navigation Forum index » Databases » MySQL
Jump to:  

Similar Topics
Topic Author Forum Replies Last Post
No new posts Running php file everyday on scheduled time sachin PHP 1 Fri Jul 21, 2006 12:49 pm
No new posts Regarding thesaurus iso file Srikanth modules 0 Fri Jul 21, 2006 10:42 am
No new posts how can i get a file descriptor not used? mars system 0 Fri Jul 21, 2006 7:41 am
No new posts small GTK "Open file" dialog David Siroky Debian 0 Fri Jul 21, 2006 7:30 am
No new posts Trouble Declaring 3D Array in Header File free2klim C++ 1 Fri Jul 21, 2006 4:07 am

Mortgages | Loans | Debt Help | Mobile Phone | Mortgages
Copyright © 2004-2005 DeniX Solutions SRL
 
Other DeniX Solutions sites: Unix/Linux blog |  electronics forum |  medicine forum |  science forum | 
Privacy Policy


Powered by phpBB © 2001, 2005 phpBB Group
[ Time: 0.1997s ][ Queries: 16 (0.1042s) ][ GZIP on - Debug on ]