Bug #3263 Update value being changed automatically
Submitted: 22 Mar 2004 13:08 Modified: 22 Mar 2004 15:03
Reporter: brian u Email Updates:
Status: Not a Bug Impact on me:
None 
Category:Connector / J Severity:S2 (Serious)
Version:3.0.11 OS:Windows (Windows 2000)
Assigned to: Dean Ellis CPU Architecture:Any

[22 Mar 2004 13:08] brian u
Description:
I am using a Statement object to perform an update with code like the following:

update player set at_bats=5 and runs=3 and outs=3 where player_id=3

in the database, the first column in the set clause is always being set to the value 1, meaning with the code above, the at_bats for player_id 3 is being set to 1 as opposed to the value 5.  If I change around the SQL and make it:

update player set runs=3 and at_bats=5 and outs=3 where player_id=3

then the column runs gets updated with a value of 1.

I just downloaded the newest stable version of the driver 3.0.11 and I got the same results.

How to repeat:
code snipplet:

String sqlUpdate="update hit_stat set "
                + "hits='" + hs.getHits() + "' and "
                + "at_bats='" + hs.getAtBats() + "' and "
                + "runs='" + hs.getRuns() + "' and "
                + "doubles='" + hs.getDoubles() + "' and "
                + "triples='" + hs.getTriples() + "' and "
                + "hr='" + hs.getHomeRuns() + "' and "
                + "rbi='" + hs.getRunsBattedIn() + "' and "   
                + "walks='" + hs.getWalks() + "' and "
                + "sacs='" + hs.getSacs() + "' and "
                + "hbp='" + hs.getHitByPitch() + "' and "
                + "roe='" + hs.getReachedOnError() + "' and "
                + "so='" + hs.getStrikeOuts() + "' and "
                + "sb='" + hs.getStolenBases() + "' and "
                + "cs='" + hs.getCaughtStealing() + "'  "
                + "where "
                + "player_id='" + hs.getPlayerId() + "' and "
                + "game_id='" + hs.getGameId() + "' and "
                + "season_id='" + hs.getSeasonId() + "' and "
                + "team_id='" + hs.getTeamId() + "' and "
                + "stat_typ='" + hs.getStatType() + "';";
conn = getConnection();
stmt = conn.createStatement();
stmt.executeUpdate(sqlUpdate);
[22 Mar 2004 15:03] Dean Ellis
Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at
http://www.mysql.com/documentation/ and the instructions on
how to report a bug at http://bugs.mysql.com/how-to-report.php

Additional info:

You are setting at_bats to the result of (5 and runs=3 and outs=3).  You mean "at_bats=4, runs=3, outs=3".