Remi, Michael,
On Fri, Jan 03, 2003 at 11:39:44AM -0500, Michael T. Babcock wrote:
> Fred van Engen wrote:
>
> >SET TIMESTAMP=1039489014;
> >
> >Each time with the current timestamp of course. I haven't checked
> >if it is actually used by the slave however.
> >
> >
>
> If it is used, I would imagine its for TIMESTAMP columns, not your own
> that include "blah = now()".
Looking at the sources, it seems to be used for the NOW function as well.
Anyway, I would consider it a bug if it wasn't used for the NOW function.
A. The slave sets the timestamp with set_time():
slave.cc:
switch(type_code) {
case QUERY_EVENT:
{
Query_log_event* qev = (Query_log_event*)ev;
int q_len = qev->q_len;
int expected_error,actual_error = 0;
init_sql_alloc(&thd->mem_root, 8192,0);
thd->db = rewrite_db((char*)qev->db);
if (db_ok(thd->db, replicate_do_db, replicate_ignore_db))
{
thd->query = (char*)qev->query;
** thd->set_time((time_t)qev->when);
B. The timestamp may be queried with current_thd->query_start():
sql_class.h:
** inline time_t query_start() { query_start_used=1; return start_time; }
inline void set_time() { if (user_time)
start_time=time_after_lock=user_time; else time_after_lock=time(&start_time); }
inline void end_time() { time(&start_time); }
** inline void set_time(time_t t) { time_after_lock=start_time=user_time=t; }
inline void lock_time() { time(&time_after_lock); }
C. The NOW() call gets its timestamp from current_thd->query_start():
sql_yacc.yy:
| NOW_SYM optional_braces
** { $$= new Item_func_now(); }
item_timefunc.cc:
void Item_func_now::fix_length_and_dec()
{
struct tm tm_tmp,*start;
** time_t query_start=current_thd->query_start();
> I believe now() is processed as the time
> when the command is run, even if run from the update log. You could
> presumably replace all occurences of now() with the previous TIMESTAMP
> value using some simple PERL of course ...
>
True.
Regards,
Fred.
--
Fred van Engen XB Networks B.V.
email: [EMAIL PROTECTED] Televisieweg 2
tel: +31 36 5462400 1322 AC Almere
fax: +31 36 5462424 The Netherlands
---------------------------------------------------------------------
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