• andrey@lmy004.'s avatar
    fix for bug#16642 (Events: No INFORMATION_SCHEMA.EVENTS table) · d847ac54
    andrey@lmy004. authored
    post-review change - use pointer instead of copy on the stack.
    WL#1034 (Internal CRON)
     This patch adds INFORMATION_SCHEMA.EVENTS table with the following format:
      EVENT_CATALOG  - MYSQL_TYPE_STRING  (Always NULL)
      EVENT_SCHEMA   - MYSQL_TYPE_STRING  (the database)
      EVENT_NAME     - MYSQL_TYPE_STRING  (the name)
      DEFINER        - MYSQL_TYPE_STRING  (user@host)
      EVENT_BODY     - MYSQL_TYPE_STRING  (the body from mysql.event)
      EVENT_TYPE     - MYSQL_TYPE_STRING  ("ONE TIME" | "RECURRING")
      EXECUTE_AT     - MYSQL_TYPE_TIMESTAMP (set for "ONE TIME" otherwise NULL)
      INTERVAL_VALUE - MYSQL_TYPE_LONG    (set for RECURRING otherwise NULL)
      INTERVAL_FIELD - MYSQL_TYPE_STRING  (set for RECURRING otherwise NULL)
      SQL_MODE       - MYSQL_TYPE_STRING  (for now NULL)
      STARTS         - MYSQL_TYPE_TIMESTAMP (starts from mysql.event)
      ENDS           - MYSQL_TYPE_TIMESTAMP (ends from mysql.event)
      STATUS         - MYSQL_TYPE_STRING  (ENABLED | DISABLED)
      ON_COMPLETION  - MYSQL_TYPE_STRING  (NOT PRESERVE | PRESERVE)
      CREATED        - MYSQL_TYPE_TIMESTAMP
      LAST_ALTERED   - MYSQL_TYPE_TIMESTAMP
      LAST_EXECUTED  - MYSQL_TYPE_TIMESTAMP
      EVENT_COMMENT  - MYSQL_TYPE_STRING
    
      SQL_MODE is NULL for now, because the value is still not stored in mysql.event .
    Support will be added as a fix for another bug.
    
     This patch also adds SHOW [FULL] EVENTS [FROM db] [LIKE pattern]
    1. SHOW EVENTS shows always only the events on the same user,
       because the PK of mysql.event is (definer, db, name) several 
       users may have event with the same name -> no information disclosure.
    2. SHOW FULL EVENTS - shows the events (in the current db as SHOW EVENTS)
       of all users. The user has to have PROCESS privilege, if not then
       SHOW FULL EVENTS behave like SHOW EVENTS.
    3. If [FROM db] is specified then this db is considered.
    4. Event names can be filtered with LIKE pattern.
      SHOW EVENTS returns table with the following columns, which are subset of
      the data which is returned by SELECT * FROM I_S.EVENTS
       Db
       Name
       Definer 
       Type
       Execute at
       Interval value
       Interval field 
       Starts 
       Ends
       Status
    d847ac54
mysql_fix_privilege_tables.sql 27.2 KB