deleting from database

deleting from database

am 22.10.2003 15:46:10 von mark.r.osullivan

Hi,
Sorry about this but I'm having severe difficulty finding information on
this.
What is the correct syntax for deleting from a database in perl and mysql:
Example: DELETE candidate, task, estimatedSize, approved,completionDate,
successMeasuredBy FROM waitingroom WHERE candidate = '$user' and task =
'$task'
Thanks in advance,
Mark.



************************************************************ **********
This document is strictly confidential and is intended for use by
the addressee unless otherwise indicated.
Allied Irish Banks
************************************************************ **********


--
MySQL Perl Mailing List
For list archives: http://lists.mysql.com/perl
To unsubscribe: http://lists.mysql.com/perl?unsub=gcdmp-msql-mysql-modules@m .gmane.org

RE: deleting from database

am 22.10.2003 15:57:22 von michael.watson

I don't think you need the field list i.e.

DELETE FROM waitingroom WHERE candidate = '$user' and task = '$task'

You can't selectively delete data from selected fields in a record - if you delete a record, then all the fields have to go.
-----Original Message-----
From: mark o' sullivan [mailto:mark.r.osullivan@aib.ie]
Sent: 22 October 2003 14:46
To: perl@lists.mysql.com; msql-mysql-modules@lists.mysql.com
Subject: deleting from database


Hi,
Sorry about this but I'm having severe difficulty finding information on
this.
What is the correct syntax for deleting from a database in perl and mysql:
Example: DELETE candidate, task, estimatedSize, approved,completionDate,
successMeasuredBy FROM waitingroom WHERE candidate = '$user' and task =
'$task'
Thanks in advance,
Mark.



************************************************************ **********
This document is strictly confidential and is intended for use by
the addressee unless otherwise indicated.
Allied Irish Banks
************************************************************ **********


--
MySQL Perl Mailing List
For list archives: http://lists.mysql.com/perl
To unsubscribe: http://lists.mysql.com/perl?unsub=michael.watson@bbsrc.ac.uk

--
MySQL Perl Mailing List
For list archives: http://lists.mysql.com/perl
To unsubscribe: http://lists.mysql.com/perl?unsub=gcdmp-msql-mysql-modules@m .gmane.org

RE: deleting from database

am 22.10.2003 15:57:22 von michael.watson

I don't think you need the field list i.e.

DELETE FROM waitingroom WHERE candidate = '$user' and task = '$task'

You can't selectively delete data from selected fields in a record - if you delete a record, then all the fields have to go.
-----Original Message-----
From: mark o' sullivan [mailto:mark.r.osullivan@aib.ie]
Sent: 22 October 2003 14:46
To: perl@lists.mysql.com; msql-mysql-modules@lists.mysql.com
Subject: deleting from database


Hi,
Sorry about this but I'm having severe difficulty finding information on
this.
What is the correct syntax for deleting from a database in perl and mysql:
Example: DELETE candidate, task, estimatedSize, approved,completionDate,
successMeasuredBy FROM waitingroom WHERE candidate = '$user' and task =
'$task'
Thanks in advance,
Mark.



************************************************************ **********
This document is strictly confidential and is intended for use by
the addressee unless otherwise indicated.
Allied Irish Banks
************************************************************ **********


--
MySQL Perl Mailing List
For list archives: http://lists.mysql.com/perl
To unsubscribe: http://lists.mysql.com/perl?unsub=michael.watson@bbsrc.ac.uk

--
MySQL Perl Mailing List
For list archives: http://lists.mysql.com/perl
To unsubscribe: http://lists.mysql.com/perl?unsub=gcdmp-msql-mysql-modules@m .gmane.org

Re: deleting from database

am 22.10.2003 16:13:25 von Dave Howorth

mark o' sullivan wrote:
> Hi,
> Sorry about this but I'm having severe difficulty finding information on
> this.
> What is the correct syntax for deleting from a database in perl and mysql:

The answer is in the MySQL reference manual at
http://www.mysql.com/doc/en/DELETE.html

I'm surprised you're having difficulty finding it.

mark o' sullivan wrote:
> Hi,
> Anyone know is it possible to get a string from a drop-down menu in
> a form and pass it from one perl script to another.

The answer is quoting! You asked another question that involved quoting
yesterday. You need to read up and learn it. Apart from the MySQL
manual, the DBI docs are at
http://search.cpan.org/~timb/DBI-1.38/DBI.pm

Those two docs should answer most questions between them.

BTW, posting questions to two lists simultaneously is generally not
appreciated.

HTH, Dave


--
MySQL Perl Mailing List
For list archives: http://lists.mysql.com/perl
To unsubscribe: http://lists.mysql.com/perl?unsub=gcdmp-msql-mysql-modules@m .gmane.org

Re: deleting from database

am 22.10.2003 16:13:25 von Dave Howorth

mark o' sullivan wrote:
> Hi,
> Sorry about this but I'm having severe difficulty finding information on
> this.
> What is the correct syntax for deleting from a database in perl and mysql:

The answer is in the MySQL reference manual at
http://www.mysql.com/doc/en/DELETE.html

I'm surprised you're having difficulty finding it.

mark o' sullivan wrote:
> Hi,
> Anyone know is it possible to get a string from a drop-down menu in
> a form and pass it from one perl script to another.

The answer is quoting! You asked another question that involved quoting
yesterday. You need to read up and learn it. Apart from the MySQL
manual, the DBI docs are at
http://search.cpan.org/~timb/DBI-1.38/DBI.pm

Those two docs should answer most questions between them.

BTW, posting questions to two lists simultaneously is generally not
appreciated.

HTH, Dave


--
MySQL Perl Mailing List
For list archives: http://lists.mysql.com/perl
To unsubscribe: http://lists.mysql.com/perl?unsub=gcdmp-msql-mysql-modules@m .gmane.org

Re: deleting from database

am 22.10.2003 16:15:57 von Leif W

Straight from the manual, here's the MySQL syntax. As you can see, you
can't selectively delete columns. If you want to keep a row but change the
value of some columns but not others, then you'd need to do an UPDATE.
Check out the documentation, chapter 6, MySQL Language Reference.

Leif

6.4.6 DELETE Syntax

DELETE [LOW_PRIORITY] [QUICK] FROM table_name
[WHERE where_definition]
[ORDER BY ...]
[LIMIT rows]

or

DELETE [LOW_PRIORITY] [QUICK] table_name[.*] [,table_name[.*] ...]
FROM table-references
[WHERE where_definition]

or

DELETE [LOW_PRIORITY] [QUICK]
FROM table_name[.*], [table_name[.*] ...]
USING table-references
[WHERE where_definition]




----- Original Message -----
From: "mark o' sullivan"
To: ;
Sent: Wednesday, October 22, 2003 9:46 AM
Subject: deleting from database


> Hi,
> Sorry about this but I'm having severe difficulty finding information on
> this.
> What is the correct syntax for deleting from a database in perl and mysql:
> Example: DELETE candidate, task, estimatedSize, approved,completionDate,
> successMeasuredBy FROM waitingroom WHERE candidate = '$user' and task =
> '$task'
> Thanks in advance,
> Mark.
>
>
>
> ************************************************************ **********
> This document is strictly confidential and is intended for use by
> the addressee unless otherwise indicated.
> Allied Irish Banks
> ************************************************************ **********
>
>
> --
> MySQL Perl Mailing List
> For list archives: http://lists.mysql.com/perl
> To unsubscribe: http://lists.mysql.com/perl?unsub=warp-9.9@usa.net
>
>
>



--
MySQL Perl Mailing List
For list archives: http://lists.mysql.com/perl
To unsubscribe: http://lists.mysql.com/perl?unsub=gcdmp-msql-mysql-modules@m .gmane.org

Re: deleting from database

am 22.10.2003 16:15:57 von Leif W

Straight from the manual, here's the MySQL syntax. As you can see, you
can't selectively delete columns. If you want to keep a row but change the
value of some columns but not others, then you'd need to do an UPDATE.
Check out the documentation, chapter 6, MySQL Language Reference.

Leif

6.4.6 DELETE Syntax

DELETE [LOW_PRIORITY] [QUICK] FROM table_name
[WHERE where_definition]
[ORDER BY ...]
[LIMIT rows]

or

DELETE [LOW_PRIORITY] [QUICK] table_name[.*] [,table_name[.*] ...]
FROM table-references
[WHERE where_definition]

or

DELETE [LOW_PRIORITY] [QUICK]
FROM table_name[.*], [table_name[.*] ...]
USING table-references
[WHERE where_definition]




----- Original Message -----
From: "mark o' sullivan"
To: ;
Sent: Wednesday, October 22, 2003 9:46 AM
Subject: deleting from database


> Hi,
> Sorry about this but I'm having severe difficulty finding information on
> this.
> What is the correct syntax for deleting from a database in perl and mysql:
> Example: DELETE candidate, task, estimatedSize, approved,completionDate,
> successMeasuredBy FROM waitingroom WHERE candidate = '$user' and task =
> '$task'
> Thanks in advance,
> Mark.
>
>
>
> ************************************************************ **********
> This document is strictly confidential and is intended for use by
> the addressee unless otherwise indicated.
> Allied Irish Banks
> ************************************************************ **********
>
>
> --
> MySQL Perl Mailing List
> For list archives: http://lists.mysql.com/perl
> To unsubscribe: http://lists.mysql.com/perl?unsub=warp-9.9@usa.net
>
>
>



--
MySQL Perl Mailing List
For list archives: http://lists.mysql.com/perl
To unsubscribe: http://lists.mysql.com/perl?unsub=gcdmp-msql-mysql-modules@m .gmane.org

Re: deleting from database

am 22.10.2003 16:30:43 von Leif W

----- Original Message -----
From: "Dave Howorth"
To: "mark o' sullivan"
Cc: ;
Sent: Wednesday, October 22, 2003 10:13 AM
Subject: Re: deleting from database

> The answer is quoting! You asked another question that involved quoting
> yesterday. You need to read up and learn it.

Oh yes, that reminds me of a great article about SQL hacking and quoting and
data scrubbing and breaking out of the quotes by Rain Forest Puppy I read
some time ago. It may be dated material, but I believe it's still
worthwhile reading to understand how to build safer (perl) scripts that muck
around with databases. Read it over and over until you understand it.
Create test examples that intentionally open up security holes so that you
understand the scope of the concern. Best way to learn how to avoid it.

http://www.wiretrip.net/rfp/txt/rfp2k01.txt

> BTW, posting questions to two lists simultaneously is generally not
> appreciated.

AH yes forgot to comment on that. Especially when both lists are apparently
just a mirror of each other. I only subscribed to perl@lists.mysql.com, but
I get emails from msql-mysql-modules@lists.mysql.com as well. Sending mail
to one or the other should suffice, but not both. Someone correct me if
this is in error?

Leif



--
MySQL Perl Mailing List
For list archives: http://lists.mysql.com/perl
To unsubscribe: http://lists.mysql.com/perl?unsub=gcdmp-msql-mysql-modules@m .gmane.org

Re: deleting from database

am 22.10.2003 16:30:43 von Leif W

----- Original Message -----
From: "Dave Howorth"
To: "mark o' sullivan"
Cc: ;
Sent: Wednesday, October 22, 2003 10:13 AM
Subject: Re: deleting from database

> The answer is quoting! You asked another question that involved quoting
> yesterday. You need to read up and learn it.

Oh yes, that reminds me of a great article about SQL hacking and quoting and
data scrubbing and breaking out of the quotes by Rain Forest Puppy I read
some time ago. It may be dated material, but I believe it's still
worthwhile reading to understand how to build safer (perl) scripts that muck
around with databases. Read it over and over until you understand it.
Create test examples that intentionally open up security holes so that you
understand the scope of the concern. Best way to learn how to avoid it.

http://www.wiretrip.net/rfp/txt/rfp2k01.txt

> BTW, posting questions to two lists simultaneously is generally not
> appreciated.

AH yes forgot to comment on that. Especially when both lists are apparently
just a mirror of each other. I only subscribed to perl@lists.mysql.com, but
I get emails from msql-mysql-modules@lists.mysql.com as well. Sending mail
to one or the other should suffice, but not both. Someone correct me if
this is in error?

Leif



--
MySQL Perl Mailing List
For list archives: http://lists.mysql.com/perl
To unsubscribe: http://lists.mysql.com/perl?unsub=gcdmp-msql-mysql-modules@m .gmane.org