RE: piping blob into shell command (tar)
On Wed, 2003-11-19 at 15:08, Dan Greene wrote: > one more idea: > > try: > mysql --skip-column-names --raw < test1 | tar xf - no output, mysql --skip-column-names --raw < test1 | more ./test1 > > > > -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
RE: piping blob into shell command (tar)
On Wed, 2003-11-19 at 15:00, Dan Greene wrote: > ok... try this: > > mysql --skip-column-names < test1 > mytestoutput.tar the content does get redirected into mytestoutput.tar > > tar xvf mytestoutput.tar tar: This does not look like a tar archive tar: Skipping to next header tar: Error exit delayed from previous errors there must be more than the column header being added? > > and if it works, try > > cat mytestoutput.tar | tar xf - tar: This does not look like a tar archive tar: Skipping to next header tar: Error exit delayed from previous errors > > to see if it works > > > > -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
RE: piping blob into shell command (tar)
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\\\0036\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]
RE: piping blob into shell command (tar)
ok... try this: mysql --skip-column-names < test1 > mytestoutput.tar tar xvf mytestoutput.tar and if it works, try cat mytestoutput.tar | tar xf - to see if it works > -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\\\0036\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]
RE: piping blob into shell command (tar)
On Wed, 2003-11-19 at 14:03, Dan Greene wrote: > This may be simplistic, but is mysql putting any text before / after blob content, > such as column name, '1 row processed OK', that may be 'corrupting' the tar data? > > using a very small tar file, and run your command, piping to more instead of tar to > see if there is any extra text that mysql is adding in when it's not explictly > running 'into dumpfile' I tried your suggestion,result in other post, I took your idea further, instead of a tar file I stored my test1 file as is, using FILE_LOAD(). before: use test; select * from test; after: mysql --skip-column-names < test1 | more use test;\nselect * from test;\n \n's are added? > > -Original Message- > > From: Denis Mercier [mailto:[EMAIL PROTECTED] > > Sent: Wednesday, November 19, 2003 1:55 PM > > To: [EMAIL PROTECTED] > > Subject: Re: piping blob into shell command (tar) > > > > > > 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? > > Thanks > > > > > > > > > > > -- > > > 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]
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\\\0036\007756740530\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\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\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0 \0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0 \0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0 \0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0 \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]
Re: piping blob into shell command (tar)
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. -- 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]
RE: piping blob into shell command (tar)
This may be simplistic, but is mysql putting any text before / after blob content, such as column name, '1 row processed OK', that may be 'corrupting' the tar data? using a very small tar file, and run your command, piping to more instead of tar to see if there is any extra text that mysql is adding in when it's not explictly running 'into dumpfile' > -Original Message- > From: Denis Mercier [mailto:[EMAIL PROTECTED] > Sent: Wednesday, November 19, 2003 1:55 PM > To: [EMAIL PROTECTED] > Subject: Re: piping blob into shell command (tar) > > > 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? > Thanks > > > > > > > -- > > 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]
Re: piping blob into shell command (tar)
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? Thanks > > > -- > 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]
Re: piping blob into shell command (tar)
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". -- 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]
Re: piping blob into shell command (tar)
On Tue, 2003-11-18 at 18:32, Paul DuBois wrote: > Please reply to the list, not to me personally, so that > others can follow this discussion. that was my intention, sorry, I just used reply from my e-mail client and realized too late that it did not default to the mysql list. > > At 17:05 -0500 11/18/03, Denis Mercier wrote: > >On Tue, 2003-11-18 at 16:40, Paul DuBois wrote: > >> At 16:21 -0500 11/18/03, Denis Mercier wrote: > >> >here's what im trying to do, i have a tar file in a blob field > >> >and i'm trying to retrieve it and pipe it directly into tar > >> >to decompress it, without first writing it to the hard drive, > >> > > >> >here's what i've tried so far, > >> >I create a text file called test1: > >> >use my_db; > >> >select * into dumpfile "/usr/local/test1" from my_table; > >> > > >> >so when i try shell> mysql --pager < test1 | tar x > >> > > >> >the tar file does get written to /usr/local/test1 which is the step i'm > >> >trying to avoid, and nothing seems to get piped to tar? > >> > >> Right, because you've told the SELECT to write its output to > >> /usr/local/test1, not to its standard output. Hence, tar > >> receives nothing. > >> > >> > > >> > > >> >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. I'll keep trying different tactics and share my findings, there must be an answer! > rather than as > > tar x > > -- > 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]
Re: piping blob into shell command (tar)
Please reply to the list, not to me personally, so that others can follow this discussion. At 17:05 -0500 11/18/03, Denis Mercier wrote: On Tue, 2003-11-18 at 16:40, Paul DuBois wrote: At 16:21 -0500 11/18/03, Denis Mercier wrote: >here's what im trying to do, i have a tar file in a blob field >and i'm trying to retrieve it and pipe it directly into tar >to decompress it, without first writing it to the hard drive, > >here's what i've tried so far, >I create a text file called test1: >use my_db; >select * into dumpfile "/usr/local/test1" from my_table; > >so when i try shell> mysql --pager < test1 | tar x > >the tar file does get written to /usr/local/test1 which is the step i'm >trying to avoid, and nothing seems to get piped to tar? Right, because you've told the SELECT to write its output to /usr/local/test1, not to its standard output. Hence, tar receives nothing. > > >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 - rather than as tar x -- 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]
Re: piping blob into shell command (tar)
On Tue, 2003-11-18 at 16:40, Paul DuBois wrote: > At 16:21 -0500 11/18/03, Denis Mercier wrote: > >here's what im trying to do, i have a tar file in a blob field > >and i'm trying to retrieve it and pipe it directly into tar > >to decompress it, without first writing it to the hard drive, > > > >here's what i've tried so far, > >I create a text file called test1: > >use my_db; > >select * into dumpfile "/usr/local/test1" from my_table; > > > >so when i try shell> mysql --pager < test1 | tar x > > > >the tar file does get written to /usr/local/test1 which is the step i'm > >trying to avoid, and nothing seems to get piped to tar? > > Right, because you've told the SELECT to write its output to > /usr/local/test1, not to its standard output. Hence, tar > receives nothing. > > > > > > >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 if i dont use into dumpfile "/usr/local/test1" mysql --pager < test1 | wc wc: :2: Invalid or incomplete multibyte or wide character 21093 87836 I get this: with raw mysql --raw < test1 | wc 2 2 11 Invoke mysql, then issue a \h command and look in the output for the line that begins with "system". system (\!)Execute a system shell command. Im running redhat 9 > 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: > > 1) --pager should be omitted. It serves no function here. > 2) You might want to add --raw to the mysql command > > > > -- > Paul DuBois, Senior Technical Writer > Madison, Wisconsin, USA > MySQL A > B, 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]
Re: piping blob into shell command (tar)
At 16:21 -0500 11/18/03, Denis Mercier wrote: here's what im trying to do, i have a tar file in a blob field and i'm trying to retrieve it and pipe it directly into tar to decompress it, without first writing it to the hard drive, here's what i've tried so far, I create a text file called test1: use my_db; select * into dumpfile "/usr/local/test1" from my_table; so when i try shell> mysql --pager < test1 | tar x the tar file does get written to /usr/local/test1 which is the step i'm trying to avoid, and nothing seems to get piped to tar? Right, because you've told the SELECT to write its output to /usr/local/test1, not to its standard output. Hence, tar receives nothing. 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: 1) --pager should be omitted. It serves no function here. 2) You might want to add --raw to the mysql command -- Paul DuBois, Senior Technical Writer Madison, Wisconsin, USA MySQL A B, 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]
piping blob into shell command (tar)
here's what im trying to do, i have a tar file in a blob field and i'm trying to retrieve it and pipe it directly into tar to decompress it, without first writing it to the hard drive, here's what i've tried so far, I create a text file called test1: use my_db; select * into dumpfile "/usr/local/test1" from my_table; so when i try shell> mysql --pager < test1 | tar x the tar file does get written to /usr/local/test1 which is the step i'm trying to avoid, and nothing seems to get piped to tar? 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? any ideas would be appreciated thanks Denis -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]