~drizzle-trunk/drizzle/development

1 by brian
clean slate
1
# include/wait_for_binlog_event.inc
2
#
3
# SUMMARY
4
#
5
#    Waits until SHOW BINLOG EVENTS has returned in last event a specified substring.
6
#
7
# USAGE
8
#
9
#    let $wait_binlog_event= DROP;
10
#    --source include/wait_for_binlog_event.inc
11
12
let $_loop_count= 300;
13
let $_last_event= ;
14
let $_event_pos= 1;
15
16
while (`SELECT INSTR("$_last_event","$wait_binlog_event") = 0`)
17
{
18
  dec $_loop_count;
19
  if (!$_loop_count)
20
  {
21
    SHOW BINLOG EVENTS;
22
    --die ERROR: failed while waiting for $wait_binlog_event in binlog 
23
  }
24
  real_sleep 0.1;
25
  let $_event= query_get_value(SHOW BINLOG EVENTS, Info, $_event_pos);
26
  let $_last_event= $_event;
27
  while (`SELECT "$_event" != "No such row"`)
28
  {
29
    inc $_event_pos;
30
    let $_last_event= $_event;
31
    let $_event= query_get_value(SHOW BINLOG EVENTS, Info, $_event_pos);
32
  }
33
}