读取 mysql binlog 开始和结束时间(2)
来源:未知 责任编辑:责任编辑 发表时间:2014-05-26 11:01 点击:次
'server_id' => 'l',
'event_length' => 'l',
'next_position' => 'l',
'flags' => 's',
);
return $this->toPackStr($event_header_struct);
}
protected function formatDescriptionEventDataPackStr() {
$format_description_event_data_struct = array(
'binlog_version' => 's',
'server_version' => 'a50',
'create_timestamp' => 'l',
'head_length' => 'c'
);
return $this->toPackStr($format_description_event_data_struct);
}
protected function toPackStr($arr) {
$ret = '';
foreach ($arr as $k=>$v) {
$ret.= '/'.$v.$k;
}
$ret = substr($ret, 1);
return $ret;
}
/**
* @param resource $file
*
* Mysql binlog file begin with a 4 bytes head: "\xfebin".
*/
protected function isBinlog($file) {
rewind($file);
$head = fread($file, strlen(self::BINLOG_HEAD));
return $head == self::BINLOG_HEAD;
}
/**
* @param resource $file
*
* Format description event is the first event of a binlog file
*/
protected function readFormatDescriptionEvent($file) {
fseek($file, strlen(self::BINLOG_HEAD), SEEK_SET);
$head_str = fread($file, self::EVENT_HEAD_SIZE);
相关新闻>>
最新推荐更多>>>
- 发表评论
-
- 最新评论 更多>>