Re: How to overwrite existing file with SELECT .. INTO?

2007-04-17 Thread Atle Veka
There is no option to do this to my knowledge. However, this would be a
quick workaround:
- TRUNCATE TABLE table; # clears table completely, akin to doing
DROP/CREATE TABLE
- INSERT INTO table SELECT .. FROM ..;



On Mon, 16 Apr 2007, Amer Neely wrote:

  At 08:14 AM 4/13/2007, Amer Neely wrote:
  I'm using MySQL 5.0.21 and am trying to find out if it is possible to 
  overwrite an existing file when using a 'SELECT ... INTO' command from the 
  command line. Is there another parameter that can do this? I've looked 
  through the online reference manual, but found no specific help there.
  --
  Amer Neely
 
  Amer,
  Why can't you do:
 
  drop table if exists mynewtable;select .. into mynewtable
 
  Mike

 :) Thanks, but you missed the part about '.. an existing file..'. I'm
 hoping there is an option for the SELECT INTO to do this. I'm doing some
 extensive testing and it's getting tiresome having to delete a file each
 time I run the test.

 --
 Amer Neely
 w: www.softouch.on.ca/
 Perl | MySQL programming for all data entry forms.
 We make web sites work!



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



Re: How to overwrite existing file with SELECT .. INTO?

2007-04-17 Thread Amer Neely

Atle Veka wrote:

There is no option to do this to my knowledge. However, this would be a
quick workaround:
- TRUNCATE TABLE table; # clears table completely, akin to doing
DROP/CREATE TABLE
- INSERT INTO table SELECT .. FROM ..;




Again, you missed the critical part. I'm trying to replace a FILE, not a 
TABLE. Perhaps a better Subject should have been 'How to overwrite 
existing file with SELECT .. INTO OUTFILE'.


I think I'll end up writing a Perl script to do this.



On Mon, 16 Apr 2007, Amer Neely wrote:


At 08:14 AM 4/13/2007, Amer Neely wrote:

I'm using MySQL 5.0.21 and am trying to find out if it is possible to overwrite 
an existing file when using a 'SELECT ... INTO' command from the command line. 
Is there another parameter that can do this? I've looked through the online 
reference manual, but found no specific help there.
--
Amer Neely

Amer,
Why can't you do:

drop table if exists mynewtable;select .. into mynewtable

Mike

:) Thanks, but you missed the part about '.. an existing file..'. I'm
hoping there is an option for the SELECT INTO to do this. I'm doing some
extensive testing and it's getting tiresome having to delete a file each
time I run the test.

--
Amer Neely
w: www.softouch.on.ca/
Perl | MySQL programming for all data entry forms.
We make web sites work!








--
Amer Neely
w: www.softouch.on.ca/
Perl | MySQL programming for all data entry forms.
We make web sites work!

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



Re: How to overwrite existing file with SELECT .. INTO?

2007-04-17 Thread Paul DuBois

At 10:14 AM -0400 4/13/07, Amer Neely wrote:
I'm using MySQL 5.0.21 and am trying to find out if it is possible 
to overwrite an existing file when using a 'SELECT ... INTO' command 
from the command line. Is there another parameter that can do this? 
I've looked through the online reference manual, but found no 
specific help there.


You cannot.  This is a security feature.  Otherwise, you might be able
to select into such files as /etc/password or /etc/shells.

From the manual:

The SELECT ... INTO OUTFILE 'file_name' form of SELECT writes the 
selected rows to a file. The file is created on the server host, so 
you must have the FILE privilege to use this syntax. file_name cannot 
be an existing file, which among other things prevents files such as 
/etc/passwd and database tables from being destroyed.


http://dev.mysql.com/doc/refman/5.0/en/select.html

--
Paul DuBois, MySQL Documentation Team
Madison, Wisconsin, USA
MySQL AB, www.mysql.com

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



Re: How to overwrite existing file with SELECT .. INTO?

2007-04-17 Thread Amer Neely

Paul DuBois wrote:

At 10:14 AM -0400 4/13/07, Amer Neely wrote:
I'm using MySQL 5.0.21 and am trying to find out if it is possible to 
overwrite an existing file when using a 'SELECT ... INTO' command from 
the command line. Is there another parameter that can do this? I've 
looked through the online reference manual, but found no specific help 
there.


You cannot.  This is a security feature.  Otherwise, you might be able
to select into such files as /etc/password or /etc/shells.

 From the manual:

The SELECT ... INTO OUTFILE 'file_name' form of SELECT writes the 
selected rows to a file. The file is created on the server host, so you 
must have the FILE privilege to use this syntax. file_name cannot be an 
existing file, which among other things prevents files such as 
/etc/passwd and database tables from being destroyed.


http://dev.mysql.com/doc/refman/5.0/en/select.html



Thank you. Makes sense once you think about it. That settles it then. 
Perl script it is.


--
Amer Neely
w: www.softouch.on.ca/
Perl | MySQL programming for all data entry forms.
We make web sites work!

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



Re: How to overwrite existing file with SELECT .. INTO?

2007-04-16 Thread Amer Neely

At 08:14 AM 4/13/2007, Amer Neely wrote:

I'm using MySQL 5.0.21 and am trying to find out if it is possible to overwrite 
an existing file when using a 'SELECT ... INTO' command from the command line. 
Is there another parameter that can do this? I've looked through the online 
reference manual, but found no specific help there.
--
Amer Neely


Amer,
Why can't you do:

drop table if exists mynewtable;select .. into mynewtable

Mike


:) Thanks, but you missed the part about '.. an existing file..'. I'm 
hoping there is an option for the SELECT INTO to do this. I'm doing some 
extensive testing and it's getting tiresome having to delete a file each 
time I run the test.


--
Amer Neely
w: www.softouch.on.ca/
Perl | MySQL programming for all data entry forms.
We make web sites work!

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



Re: How to overwrite existing file with SELECT .. INTO?

2007-04-15 Thread Devi

Hello Mike,

AFAIK,
What you have specified is applicable only for tables! But for file in 
Select ..into outfile, sure Exit handler is declared when we try to 
overwrite an existing file!


Thanks
DEVI.G
- Original Message - 
From: mos [EMAIL PROTECTED]

To: mysql@lists.mysql.com
Sent: Sunday, April 15, 2007 8:36 AM
Subject: Re: How to overwrite existing file with SELECT .. INTO?



At 08:14 AM 4/13/2007, Amer Neely wrote:
I'm using MySQL 5.0.21 and am trying to find out if it is possible to 
overwrite an existing file when using a 'SELECT ... INTO' command from the 
command line. Is there another parameter that can do this? I've looked 
through the online reference manual, but found no specific help there.

--
Amer Neely


Amer,
Why can't you do:

drop table if exists mynewtable;select .. into mynewtable

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




--
No virus found in this incoming message.
Checked by AVG Free Edition.
Version: 7.5.446 / Virus Database: 269.4.0/762 - Release Date: 4/15/2007 
4:22 PM






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



Re: How to overwrite existing file with SELECT .. INTO?

2007-04-14 Thread mos

At 08:14 AM 4/13/2007, Amer Neely wrote:
I'm using MySQL 5.0.21 and am trying to find out if it is possible to 
overwrite an existing file when using a 'SELECT ... INTO' command from the 
command line. Is there another parameter that can do this? I've looked 
through the online reference manual, but found no specific help there.

--
Amer Neely


Amer,
Why can't you do:

drop table if exists mynewtable;select .. into mynewtable

Mike 


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



How to overwrite existing file with SELECT .. INTO?

2007-04-13 Thread Amer Neely
I'm using MySQL 5.0.21 and am trying to find out if it is possible to 
overwrite an existing file when using a 'SELECT ... INTO' command from 
the command line. Is there another parameter that can do this? I've 
looked through the online reference manual, but found no specific help 
there.

--
Amer Neely
w: www.softouch.on.ca/
Perl | MySQL programming for all data entry forms.
We make web sites work!

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