That's really odd.  I've never experienced that problem, but I'm running the
latest production release (4.0.13), so I perhaps it's been fixed between
versions.

Edward Dudlik
Becoming Digital
www.becomingdigital.com


----- Original Message -----
From: "Lucas Heuman" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Cc: <[EMAIL PROTECTED]>
Sent: Tuesday, 17 June, 2003 14:05
Subject: Now() and time function bug??



Alright, I was messing around with some time functions in Mysql and ran
acrossed a wierd bug.

After I set starttime to now(), anytime I run another update query against
the row starttime changes to a new value.

Here is what I did when I noticed the bug.. Does anyone else have a
problem doing this?

I'm using (mysql  Ver 11.18 Distrib 3.23.56, for slackware-linux (i386))



mysql> select * from clientwork;
+----+--------+-----------+----------+----------------+----------------+--------
---+-------+
| id | active | companyid | worktype | starttime      | stoptime       |
totaltime | notes |
+----+--------+-----------+----------+----------------+----------------+--------
---+-------+
|  1 |      1 |         1 |        1 | 20030617123435 | 20030617123435 |
95 |       |
+----+--------+-----------+----------+----------------+----------------+--------
---+-------+
1 row in set (0.00 sec)

mysql> UPDATE clientwork SET totaltime=now()-starttime, stoptime=now()
where id="1";
Query OK, 1 row affected (0.00 sec)
Rows matched: 1  Changed: 1  Warnings: 0

mysql> select * from clientwork;
+----+--------+-----------+----------+----------------+----------------+--------
---+-------+
| id | active | companyid | worktype | starttime      | stoptime       |
totaltime | notes |
+----+--------+-----------+----------+----------------+----------------+--------
---+-------+
|  1 |      1 |         1 |        1 | 20030617124037 | 20030617124037 |
602 |       |
+----+--------+-----------+----------+----------------+----------------+--------
---+-------+
1 row in set (0.00 sec)

mysql> UPDATE clientwork SET totaltime=(now()-starttime), stoptime=(now())
where id="1";
Query OK, 1 row affected (0.00 sec)
Rows matched: 1  Changed: 1  Warnings: 0

mysql> select * from clientwork;
+----+--------+-----------+----------+----------------+----------------+--------
---+-------+
| id | active | companyid | worktype | starttime      | stoptime       |
totaltime | notes |
+----+--------+-----------+----------+----------------+----------------+--------
---+-------+
|  1 |      1 |         1 |        1 | 20030617124122 | 20030617124122 |
85 |       |
+----+--------+-----------+----------+----------------+----------------+--------
---+-------+
1 row in set (0.00 sec)

mysql> UPDATE clientwork SET notes="This is my note" where id="1";
Query OK, 1 row affected (0.00 sec)
Rows matched: 1  Changed: 1  Warnings: 0

mysql> select * from clientwork;
+----+--------+-----------+----------+----------------+----------------+--------
---+-----------------+
| id | active | companyid | worktype | starttime      | stoptime       |
totaltime | notes           |
+----+--------+-----------+----------+----------------+----------------+--------
---+-----------------+
|  1 |      1 |         1 |        1 | 20030617124213 | 20030617124122 |
85 | This is my note |
+----+--------+-----------+----------+----------------+----------------+--------
---+-----------------+
1 row in set (0.01 sec)

--
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]

Reply via email to