one more idea:

try:
mysql --skip-column-names --raw  < test1 | tar xf -


> -----Original Message-----
> From: Denis Mercier [mailto:[EMAIL PROTECTED]
> Sent: Wednesday, November 19, 2003 2:41 PM
> To: [EMAIL PROTECTED]
> Subject: Re: piping blob into shell command (tar)
> 
> 
> On Wed, 2003-11-19 at 14:02, Paul DuBois wrote:
> > At 13:55 -0500 11/19/03, Denis Mercier wrote:
> > >On Wed, 2003-11-19 at 12:26, Paul DuBois wrote:
> > >>  At 11:03 -0500 11/19/03, Denis Mercier wrote:
> > >>
> > >>  >  > >>  >i also tried:
> > >>  >>  >>  >use my_db;
> > >>  >>  >>  >select * from my_table;
> > >>  >>  >>  >
> > >>  >>  >>  >so when i try shell> mysql --pager < test1 | tar x
> > >>  >>  >>  >
> > >>  >>  >>  >the tar file does not get written to 
> /usr/local/test1 but 
> > >>i still dont
> > >>  >>  >>  >get my untared files? write permissions are ok?
> > >>  >>  >>  >what am i missing?
> > >>  >>  >>
> > >>  >>  >>  Have you verified that the mysql command 
> actually writes 
> > >>any output, for
> > >>  >>  >>  example, with this command:
> > >>  >>  >>
> > >>  >>  >  > shell> mysql --pager < test1 | wc
> > >>  >>  >>
> > >>  >>  >>  Do you get any output from tar at all, such as 
> an error message?
> > >>  >>  >>  Maybe the output from mysql isn't suitable.  Couple of 
> > >>things to try:
> > >>  >>  >>
> > >>  >>  >The output from mysql seems fine because when it 
> does write the value
> > >>  >>  >of my blob I get a well formatted tar file,
> > >>  >>  >I'm thinking that maybe tar cannot handle a stream 
> as it's input?
> > >>  >>
> > >>  >>  That may be.  In that case, you should invoke tar as
> > >>  >>
> > >>  >>  tar xf -
> > >>  >>
> > >>  >
> > >>  >I have tried tar xf but tar gives me an error, it wants a file
> > >>  >specified.
> > >>
> > >>  But I didn't say to use "tar xf".  I said to use "tar 
> xf -".  That
> > >>  dash is highly significant.  It means "The file to read is the
> > >>  standard input".
> > >
> > >tried tar xf -
> > >mysql  < test1 |  tar xf -
> > >tar: This does not look like a tar archive
> > >tar: Skipping to next header
> > >tar: Error exit delayed from previous errors
> > >
> > >I dont get it, if i do this command:
> > >
> > >mysql> select * into dumpfile "/usr/local/test1.tar" from my_table
> > >
> > >I get a tar archive written to /usr/local/
> > >
> > >I'm using mysql client to store my tar file as a blob,
> > >mysql> insert into my_table 
> values(LOAD_FILE("/usr/local/test1.tar"));
> > >
> > >could this function cause my problem?
> > 
> > No.
> > 
> > The output when you retrieve the column and send it into the pipe
> > contains something that is not part of the column contents itself.
> > Likely the column header.  Try using the --skip-column-names option
> > to suppress the header.
> > 
> I tarred test1 recreated my_table, using LOAD_FILE put in test1.tar
> 30 B file before tarred, after tarred 10 K 
> 
> mysql --skip-column-names  < test1 | tar xf -
> tar: This does not look like a tar archive
> tar: Skipping to next header
> tar: Error exit delayed from previous errors
> 
> 
> mysql --skip-column-names  < test1 | more
> 
> ./test1\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\
> 0\0\0\0\0\0\0\0\0\0\0\0\0\0
> \0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0
> \0\0\0\0\0\0\0\0\0\0\0\0\0\0
> \0\0\0\0\0\00100644\00000000\00000000\000000000036\00775674053
> 0\0011034\0 0\0\0\0\0\0\0\0\
> 0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\
> 0\0\0\0\0\0\0\0\0\0\0\0\0\0\
> 0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\
> 0\0\0\0\0\0\0\0\0\0\0\0\0\0\
> 0\0\0ustar 
> \0root\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0
> root\0\0\0\0\0\0
> \0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0
> \0\0\0\0\0\0\0\0\0\0\0\0\0\0
> \0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0
> \0\0\0\0\0\0\0\0\0\0\0\0\0\0
> \0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0
> \0\0\0\0\0\0\0\0\0\0\0\0\0\0
> \0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0
> \0\0\0\0\0\0\0\0\0\0\0\0\0\0
> \0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0use test;\nselect *
> from test;\n\0\0\0\ ............>>lot more but all \0's
> 
> I dont know if tarring adds all this extra data? but tarring did
> increase the file size from 30 B to 10 K,
> I used vi to create test1,
> 
>  
> 
> > -- 
> > Paul DuBois, Senior Technical Writer
> > Madison, Wisconsin, USA
> > MySQL AB, www.mysql.com
> > 
> > Are you MySQL certified?  http://www.mysql.com/certification/
> > 
> 
> 
> -- 
> MySQL General Mailing List
> For list archives: http://lists.mysql.com/mysql
> To unsubscribe:    
> http://lists.mysql.com/[EMAIL PROTECTED]
> 
> 

--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/[EMAIL PROTECTED]

Reply via email to