| Server IP : 180.180.241.3 / Your IP : 216.73.216.35 Web Server : Microsoft-IIS/7.5 System : Windows NT NETWORK-NHRC 6.1 build 7601 (Windows Server 2008 R2 Standard Edition Service Pack 1) i586 User : IUSR ( 0) PHP Version : 5.3.28 Disable Function : NONE MySQL : ON | cURL : ON | WGET : OFF | Perl : OFF | Python : OFF | Sudo : OFF | Pkexec : OFF Directory : C:/Program Files/MySQL/MySQL Workbench 6.3 CE/modules/ |
Upload File : |
2zXc @ sW d Z d d l Z d d l m Z m Z m Z d d l m Z m Z m Z d d l
m Z m Z m
Z
d d l m Z d d l Z d d l Z d d l Z d Z d e f d YZ d
e f d YZ d e f d
YZ d e f d YZ d e f d YZ d e f d YZ d e f d YZ d e f d YZ d S( s
.. module:: wb_log_reader
:synopsis: Reads and parses a log source to retrieve sets of records from it.
This module defines several classes to handle MySQL server logs. It supports logs
stored in the database as well as logs stored in files.
All of the defined classes adhere to a common interface defining and implementing
these public attributes and methods:
Attributes:
column_specs (tuple): Specifies each field in the log entries. The elements
of this tuple are also tuples having the form
(column_name, column_widh, [column_table_name])
where:
column_name (str): A human readable name for the column. Frontend
code should use this name wherever a column
title is needed.
column_width (int): The recommended with of the column
column_table_name (str): (Optional) the name of the field referred
by this column in the log table for DB logs
partial_support: False if the log source is fully supported or a
string explaining the limitations regarding the implemented
log source reader class otherwise.
Methods:
has_previous(): Returns True if there are older entries that can be
retrieved and False otherwise.
has_next(): Returns True if there are newer entries that can be
retrieved and False otherwise.
first(): Returns a list of the first (oldest) records in the log.
Each element in this list represents a single log entry
and is also a list whose elements are the values for the
columns defined in `column_specs`.
last(): The same as `first()` but the records returned are the
newest ones.
previous(): Returns the records that precede the last retrieved
records. Before calling it you should verify that
`has_previous()` returns True.
next(): Returns the records that follow the last retrieved
records. Before calling it you should verify that
`has_next()` returns True.
current(): Returns the last retrieved records.
range_text(): Returns a string that gives an indication of the position
of the current records in the existent log set (if
available). E.g. 'Records 1..50 of 145'
refresh(): After calling this function the log reader should be able
to manage new log entries that were added since the last
call to this function or since the creation of the log
reader object. This function doesn't return anything.
If it is not possible to read the log entries, the class should raise an
exception with a descriptive message to let the user know the reasons of
the failure.
Current limitations:
----------------------
* No remote server support for logs stored in files.
* Cannot read files that aren't readable by the user running Workbench.
iN( t log_infot log_errort log_warning( t SudoTailInputFilet LocalInputFilet
SFTPInputFile( t LogFileAccessErrort
ServerIOErrort InvalidPasswordError( t server_os_pathc C s | d d k r | d } n d | k rN | j d \ } } } d | } n d } yE t j t j j | d j } t j | t j | | SWn( t k
r } t
d | | f | SXd S( Nit Zt .t s %Y-%m-%dT%H:%M:%Ss Error parsing timestamp %s: %s
( t partitiont calendart timegmt datetimet strptimet timetuplet timet strftimet localtimet ExceptionR ( t tst fmtt _t mst
local_timet e( ( sF C:\Program Files\MySQL\MySQL Workbench 6.3 CE\modules\wb_log_reader.pyt ts_iso_to_localj s
$!t BaseQueryLogReaderc B sz e Z d Z d Z d Z d Z d Z d Z d Z d Z d Z
d Z d
Z d Z
d Z RS(
so
The base class for logs stored in a database.
**This is not intended for direct instantiation.**
c C s | | _ d | _ | | _ | | _ | | _ t | _ d | _ | j d | _
t | j | j
d | _ g | D] } | d ^ qu | _
d S( s Constructor
:param ctrl_be: Control backend instance to make queries
:param log_table: The name of the table where the log entries are stored
:type log_table: str
:param column_specs: Column definitions as explained in the module docstring
:type column_specs: tuple
:param ordering_column: The index for the column in `column_specs` that stores
the timestamp of the log entries
:type ordering_column: int
i i2 i N( t log_tablet Nonet log_filet ctrl_bet column_specst ordering_columnt Falset partial_supportt total_countt refresht
show_countt maxt
show_startt colnames( t selfR"