[EMAIL PROTECTED] writes:
> >Description:
> The following line inputs the current UNIX time into a field -
> date_start - with the date_stop filed defaulting to '0':
>
> insert into contract_work (sess_id,email,date_start)
> values('bde32bfde3ac89c7d510df573bb6bb88','Joe Bloggs',unix_timestamp())
>
>
> The result is as follows:
>
>
>+----+----------------------------------+-------------------+----------------+----------------+-------+------------+
> | id | sess_id | email | date_start |
>date_stop | hours | total_time |
>
>+----+----------------------------------+-------------------+----------------+----------------+-------+------------+
> | 1 | bde32bfde3ac89c7d510df573bb6bb88 | Joe Bloggs | 20001129051306 |
>00000000000000 | 0.00 | 0.00 |
>
>+----+----------------------------------+-------------------+----------------+----------------+-------+------------+
>
> However, when I want to update the date_stop field with a query like this:
>
> update contract_work set date_stop = unix_timestamp() where sess_id =
> 'bde32bfde3ac89c7d510df573bb6bb88' and email = 'Joe Bloggs'
>
> the result is this:
>
>
>+----+----------------------------------+-------------------+----------------+----------------+-------+------------+
> | id | sess_id | email | date_start |
>date_stop | hours | total_time |
>
>+----+----------------------------------+-------------------+----------------+----------------+-------+------------+
> | 1 | bde32bfde3ac89c7d510df573bb6bb88 | Joe Bloggs | 20010520045835 |
>20001129051515 | 0.00 | 0.00 |
>
>+----+----------------------------------+-------------------+----------------+----------------+-------+------------+
>
> NOTE: the date_start time is no longer a UNIX_TIMESTAMP, but is a
> current_date.
>
> >How-To-Repeat:
> I can repeat this ad nauseum by simply following the code above. The
> table description is as follows:
>
> +------------+---------------+------+-----+---------+----------------+
> | Field | Type | Null | Key | Default | Extra |
> +------------+---------------+------+-----+---------+----------------+
> | id | int(11) | | PRI | NULL | auto_increment |
> | sess_id | varchar(32) | YES | | NULL | |
> | email | varchar(64) | YES | | NULL | |
> | date_start | timestamp(14) | YES | | NULL | |
> | date_stop | timestamp(14) | YES | | NULL | |
> | hours | float(5,2) | | | 0.00 | |
> | total_time | float(5,2) | | | 0.00 | |
> +------------+---------------+------+-----+---------+----------------+
> >Fix:
> I have absolutely no idea how to fix this prob because I don't know
> what's causing it.
>
> >Submitter-Id: <submitter ID>
> >Originator: [EMAIL PROTECTED]
> >Organization: Webware Ktd
>
> >MySQL support: none
> >Synopsis: timestamp is updated fromunix timestamp to current timestamp
> without user intervention
> >Severity: If this is a bug - it's severe; if it's my coding, cane me!
> >Priority: High
> >Category: mysql
> >Class: sw-bug
> >Release: mysql-3.23.36 (Source distribution)
>
> >Environment:
>
> System: Linux ns2.thenet.co.nz 2.2.14-5.0 #1 Tue Mar 7 20:35:25 EST 2000 i686 unknown
> Architecture: i686
>
> Some paths: /usr/bin/perl /usr/bin/make /usr/bin/gmake /usr/bin/gcc /usr/bin/cc
> GCC: Reading specs from /usr/lib/gcc-lib/i386-redhat-linux/egcs-2.91.66/specs
> gcc version egcs-2.91.66 19990314/Linux (egcs-1.1.2 release)
> Compilation info: CC='gcc' CFLAGS='' CXX='c++' CXXFLAGS='' LDFLAGS=''
> LIBC:
> lrwxrwxrwx 1 root root 13 Mar 30 11:31 /lib/libc.so.6 ->
>libc-2.1.3.so
> -rwxr-xr-x 1 root root 4101324 Mar 1 2000 /lib/libc-2.1.3.so
> -rw-r--r-- 1 root root 20272704 Mar 1 2000 /usr/lib/libc.a
> -rw-r--r-- 1 root root 178 Mar 1 2000 /usr/lib/libc.so
> Configure command: ./configure --prefix=/usr/local/mysql --with-innobase
> Perl: This is perl, version 5.005_03 built for i386-linux
>
Hi!
The above behaviour is actually OK, because :
- timestamp is saved in datetime format
- first timestamp column is silently updated on each UPDATE
Regards,
Sinisa
____ __ _____ _____ ___ == MySQL AB
/*/\*\/\*\ /*/ \*\ /*/ \*\ |*| Sinisa Milivojevic
/*/ /*/ /*/ \*\_ |*| |*||*| mailto:[EMAIL PROTECTED]
/*/ /*/ /*/\*\/*/ \*\|*| |*||*| Larnaca, Cyprus
/*/ /*/ /*/\*\_/*/ \*\_/*/ |*|____
^^^^^^^^^^^^/*/^^^^^^^^^^^\*\^^^^^^^^^^^
/*/ \*\ Developers Team
---------------------------------------------------------------------
Before posting, please check:
http://www.mysql.com/manual.php (the manual)
http://lists.mysql.com/ (the list archive)
To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php