I'm returning this discussion to the list where it belongs....
 
Are you sure that the query you do on the command line is the same as the one you do in the program? Obviously, they can't be precisely identical because the program needs additional punctuation to work but is it functionally the same?
 
For example, does the command line version of the query have:
 
    passengerIndex = '15'
 
or
 
    passengerIndex = 15
 
If the passengerIndex column is defined to contain character data, the apostrophes are appropriate for both the command line and Perl versions of the statement; otherwise, the apostrophes should be omitted in both versions.
 
Also, have you typed the literal value 'Edo Budiharto' exactly the same in both queries? If the data contains a single space between the first name and the last name and the command line version of the query also contains one space but the Perl version contains two spaces, this could explain the different behaviour of the queries.
 
Did you commit the update before inspecting it? If I recall correctly, Perl, like other languages, requires that you commit updates before they are visible to users. Perhaps you failed to commit and that is why you aren't seeing any apparent change in your data. Try making sure that you did a commit - and that it worked! - before looking to see that the update worked. My Perl is VERY rusty but if it works like other languages, you will have an option to either "autocommit", i.e. commit after every statement, or you will be able to commit manually; if you say "autocommit=no" and fail to commit manually, your update won't be visible until a commit happens. (Typically, if the program ends normally, a commit will be issued "under the covers" but if you are inspecting the value from the command line before the program has ended, the commit may not have happened yet which would explain why the update doesn't appear to have taken place.)
 
Rhino
 
----- Original Message -----
To: Rhino
Sent: Sunday, March 20, 2005 10:57 AM
Subject: Re: update command

sorry Rhino,
what I mean with "does not work" is it does not update the value in the mysql, but it does not give any error message either.


Rhino <[EMAIL PROTECTED]> wrote:

----- Original Message -----
From: "Eko Budiharto" <[EMAIL PROTECTED]>
To: ; ;
<[EMAIL PROTECTED]>
Sent: Sunday, March 20, 2005 10:04 AM
Subject: update command


> Hi,
> I am having problem with update command. I run it directy in the mysql
console, it works. But when I run it from perl, it does not work.
>
> here is the perl script
>
> my $server2 = 'localhost';
> my $db2 = '';
> my $username2 = '';
> my $password2 = '>
> my $dbh2 = DBI->connect("dbi:mysql:$db2:$server2", $username2,
$password2);
>
> my $query = "UPDATE flightInfo SET route='chicago, atlanta' WHERE
passengerIndex='15' AND passengerName='Eko Budiharto';";
>
> $dbh2->disconnect;
> I do not why the "UPDATE" command does not work with the script. Please
help. I thought I used wrong syntax.
>

Define "doesn't work".

Do you mean that you get a compile error or a runtime error? In either case
what message are you getting?

Or do you mean that the statement works but doesn't give the expected
result? For instance, perhaps it gives no error message but the update
doesn't appear to have taken place when you look at the data later?

Remember, we only know what you tell us and you haven't told us enough.

Rhino



--
No virus found in this outgoing message.
Checked by AVG Anti-Virus.
Version: 7.0.308 / Virus Database: 266.7.3 - Release Date: 15/03/2005


Do you Yahoo!?
Yahoo! Small Business - Try our new resources site!


No virus found in this incoming message.
Checked by AVG Anti-Virus.
Version: 7.0.308 / Virus Database: 266.7.3 - Release Date: 15/03/2005
No virus found in this outgoing message.
Checked by AVG Anti-Virus.
Version: 7.0.308 / Virus Database: 266.7.3 - Release Date: 15/03/2005

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

Reply via email to