List:Commits« Previous MessageNext Message »
From:paul.dubois Date:June 9 2011 6:40pm
Subject:svn commit - mysqldoc@oter02: r26479 - in trunk: . refman-5.1 refman-5.5 refman-5.6 refman-6.0
View as plain text  
Author: pd221994
Date: 2011-06-09 20:40:58 +0200 (Thu, 09 Jun 2011)
New Revision: 26479

Log:
 r48806@dhcp-adc-twvpn-1-vpnpool-10-154-0-52:  paul | 2011-06-09 13:06:21 -0500
 Update audit plugin section
 Other minor plugin API revisions


Modified:
   svk:merge
   trunk/refman-5.1/extending-mysql.xml
   trunk/refman-5.5/extending-mysql.xml
   trunk/refman-5.6/extending-mysql.xml
   trunk/refman-6.0/extending-mysql.xml

Property changes on: trunk
___________________________________________________________________

Modified: svk:merge
===================================================================


Changed blocks: 0, Lines Added: 0, Lines Deleted: 0; 1277 bytes


Modified: trunk/refman-5.1/extending-mysql.xml
===================================================================
--- trunk/refman-5.1/extending-mysql.xml	2011-06-09 17:16:22 UTC (rev 26478)
+++ trunk/refman-5.1/extending-mysql.xml	2011-06-09 18:40:58 UTC (rev 26479)
Changed blocks: 2, Lines Added: 2, Lines Deleted: 2; 1055 bytes

@@ -3094,7 +3094,7 @@
 
           <listitem>
             <para>
-              To compile and install a plugin library object file, see
+              To compile and install a plugin library object file, use
               the instructions in
               <xref linkend="compiling-plugin-libraries"/>. For the
               <literal>simple_parser</literal> plugin, it is compiled

@@ -3357,7 +3357,7 @@
         </itemizedlist>
 
         <para>
-          To compile and install a plugin library object file, see the
+          To compile and install a plugin library object file, use the
           instructions in <xref linkend="compiling-plugin-libraries"/>.
           For the <literal>daemon_example</literal> plugin, it is
           compiled and installed when you build MySQL from source. It is


Modified: trunk/refman-5.5/extending-mysql.xml
===================================================================
--- trunk/refman-5.5/extending-mysql.xml	2011-06-09 17:16:22 UTC (rev 26478)
+++ trunk/refman-5.5/extending-mysql.xml	2011-06-09 18:40:58 UTC (rev 26479)
Changed blocks: 21, Lines Added: 161, Lines Deleted: 84; 15746 bytes

@@ -3663,7 +3663,7 @@
 
           <listitem>
             <para>
-              To compile and install a plugin library object file, see
+              To compile and install a plugin library object file, use
               the instructions in
               <xref linkend="compiling-plugin-libraries"/>. For the
               <literal>simple_parser</literal> plugin, it is compiled

@@ -3926,7 +3926,7 @@
         </itemizedlist>
 
         <para>
-          To compile and install a plugin library object file, see the
+          To compile and install a plugin library object file, use the
           instructions in <xref linkend="compiling-plugin-libraries"/>.
           For the <literal>daemon_example</literal> plugin, it is
           compiled and installed when you build MySQL from source. It is

@@ -4119,7 +4119,7 @@
         </para>
 
         <para>
-          To compile and install a plugin library object file, see the
+          To compile and install a plugin library object file, use the
           instructions in <xref linkend="compiling-plugin-libraries"/>.
           For the <literal>rpl_semi_sync_master</literal> and
           <literal>rpl_semi_sync_slave</literal> plugins, they are

@@ -4150,37 +4150,12 @@
         </para>
 
         <para>
-          This description includes references to audit plugin interface
-          elements that are present only as of MySQL 5.5.5:
+          This description is current as of MySQL 5.5.14. For
+          differences in the interface in earlier versions, see
+          <xref linkend="audit-plugin-interface-changes"/>.
         </para>
 
-        <itemizedlist>
-
-          <listitem>
-            <para>
-              The <literal>event_subclass</literal> member of
-              <literal>struct mysql_event_general</literal>
-            </para>
-          </listitem>
-
-          <listitem>
-            <para>
-              Status variables that count notifications for individual
-              event subclasses
-            </para>
-          </listitem>
-
-        </itemizedlist>
-
         <para>
-          A plugin that requires those elements must be compiled against
-          MySQL source for which the value of
-          <literal>MYSQL_AUDIT_INTERFACE_VERSION</literal>, the
-          type-specific interface version, is <literal>0x0200</literal>
-          or greater.
-        </para>
-
-        <para>
           Within the server, the pluggable audit interface is
           implemented in the <filename>sql_audit.h</filename> and
           <filename>sql_audit.cc</filename> files in the

@@ -4191,7 +4166,7 @@
           about the event if necessary. To see where such calls occur,
           look for invocations of functions with names of the form
           <filename>mysql_audit_<replaceable>xxx</replaceable>()</filename>.
-          Audit notification occurs for these server operations:
+          Audit notification occurs for server operations such as these:
         </para>
 
         <itemizedlist>

@@ -4242,9 +4217,10 @@
         </para>
 
         <para>
-          An audit plugin, like any MySQL plugin, has a general plugin
-          descriptor (see <xref linkend="server-plugin-descriptors"/>).
-          In <filename>audit_null.c</filename>, the general descriptor
+          An audit plugin, like any MySQL server plugin, has a general
+          plugin descriptor (see
+          <xref linkend="server-plugin-descriptors"/>). In
+          <filename>audit_null.c</filename>, the general descriptor
           looks like this:
         </para>
 

@@ -4254,12 +4230,12 @@
   MYSQL_AUDIT_PLUGIN,         /* type                            */
   &amp;audit_null_descriptor,     /* descriptor                      */
   "NULL_AUDIT",               /* name                            */
-  "Oracle Corporation",       /* author                          */
+  "Oracle Corp",              /* author                          */
   "Simple NULL Audit",        /* description                     */
   PLUGIN_LICENSE_GPL,
   audit_null_plugin_init,     /* init function (when loaded)     */
   audit_null_plugin_deinit,   /* deinit function (when unloaded) */
-  0x0001,                     /* version                         */
+  0x0002,                     /* version                         */
   simple_status,              /* status variables                */
   NULL,                       /* system variables                */
   NULL

@@ -4279,12 +4255,6 @@
         </para>
 
         <para>
-          The <literal>audit_null_descriptor</literal> value in the
-          general descriptor points to the type-specific descriptor,
-          described later.
-        </para>
-
-        <para>
           The general descriptor also refers to
           <literal>simple_status</literal>, a structure that exposes
           several status variables to the <literal role="stmt">SHOW

@@ -4317,8 +4287,9 @@
         </para>
 
         <para>
-          Audit plugins have a type-specific descriptor with this
-          structure:
+          The <literal>audit_null_descriptor</literal> value in the
+          general descriptor points to the type-specific descriptor. For
+          audit plugins, this descriptor has the following structure:
         </para>
 
 <programlisting>

@@ -4326,7 +4297,7 @@
 {
   int interface_version;
   void (*release_thd)(MYSQL_THD);
-  void (*event_notify)(MYSQL_THD, const struct mysql_event *);
+  void (*event_notify)(MYSQL_THD, unsigned int, const void *);
   unsigned long class_mask[MYSQL_AUDIT_CLASS_MASK_SIZE];
 };
 </programlisting>

@@ -4345,7 +4316,7 @@
               <literal>interface_version</literal> when it loads the
               plugin to see whether the plugin is compatible with it.
               For audit plugins, the value of the
-              <literal>interface_version</literal> field is
+              <literal>interface_version</literal> member is
               <literal>MYSQL_AUDIT_INTERFACE_VERSION</literal> (defined
               in <literal>plugin_audit.h</literal>).
             </para>

@@ -4374,7 +4345,8 @@
             <para>
               <literal>class_mask</literal>: A bit mask that indicates
               the event classes for which the plugin wants to receive
-              notification.
+              notification. If this value is 0, the server passes no
+              events to the plugin.
             </para>
           </listitem>
 

@@ -4425,8 +4397,8 @@
         </para>
 
         <para>
-          For the example audit plugin, the type-specific descriptor
-          looks like this:
+          For the <literal>NULL_AUDIT</literal> example audit plugin,
+          the type-specific descriptor looks like this:
         </para>
 
 <programlisting>

@@ -4447,10 +4419,10 @@
 
         <para>
           The event class mask indicates an interest in all events of
-          the <quote>general</quote> class. Currently, that is the only
-          event class. <filename>plugin_audit.h</filename> defines its
-          symbol, <literal>MYSQL_AUDIT_GENERAL_CLASS</literal>, and a
-          mask with a bit for this class:
+          the <quote>general</quote> class.
+          <filename>plugin_audit.h</filename> defines its symbol,
+          <literal>MYSQL_AUDIT_GENERAL_CLASS</literal>, and a mask with
+          a bit for this class:
         </para>
 
 <programlisting>

@@ -4459,34 +4431,55 @@
 </programlisting>
 
         <para>
+          <filename>plugin_audit.h</filename> also has defines for a
+          <quote>connection</quote> event class, although the
+          <literal>NULL_AUDIT</literal> plugin does nothing with such
+          events:
+        </para>
+
+<programlisting>
+#define MYSQL_AUDIT_CONNECTION_CLASS 1
+#define MYSQL_AUDIT_CONNECTION_CLASSMASK (1 &lt;&lt; MYSQL_AUDIT_CONNECTION_CLASS)
+</programlisting>
+
+        <para>
+          A plugin could be written to receive both general and
+          connection events by setting its type-specific descriptor like
+          this:
+        </para>
+
+<programlisting>
+  { (unsigned long) MYSQL_AUDIT_GENERAL_CLASSMASK |
+                 MYSQL_AUDIT_CONNECTION_CLASSMASK } /* class mask        */
+</programlisting>
+
+        <para>
           In the type-specific descriptor, the second parameter of the
-          <literal>event_notify</literal> function prototype is a
-          generic <literal>mysql_event</literal> pointer:
+          <literal>event_notify</literal> function prototype specifies
+          the event class and the third parameter is a generic pointer
+          representing an event structure:
         </para>
 
 <programlisting>
-void (*event_notify)(MYSQL_THD, const struct mysql_event *);
+void (*event_notify)(MYSQL_THD, unsigned int, const void *);
 </programlisting>
 
         <para>
-          The server actually passes the notification function a pointer
-          to a structure that depends on the event class. The first
-          member of all event structures must indicate the event class
-          to enable the notification function to determine what kind of
-          structure it was passed so that it can tell what other
-          structure members exist.
+          Events in different classes may have different structures. The
+          function can use the event class value to determine how to
+          interpret the pointer to the event structure.
         </para>
 
         <para>
-          The server passes events in the <quote>general</quote> event
-          class to the <literal>event_notify</literal> function using
-          this structure:
+          If the server calls the notification function with an event
+          class of <literal>MYSQL_AUDIT_GENERAL_CLASS</literal>, it
+          passes the event structure as a pointer to a
+          <literal>mysql_event_general</literal> structure:
         </para>
 
 <programlisting>
 struct mysql_event_general
 {
-  unsigned int event_class;
   unsigned int event_subclass;
   int general_error_code;
   unsigned long general_thread_id;

@@ -4511,14 +4504,6 @@
 
           <listitem>
             <para>
-              <literal>event_class</literal>: The event class, always
-              <literal>MYSQL_AUDIT_GENERAL_CLASS</literal> for
-              <quote>general</quote> events.
-            </para>
-          </listitem>
-
-          <listitem>
-            <para>
               <literal>event_subclass</literal>: The event subclass, one
               of the following values:
             </para>

@@ -4527,6 +4512,7 @@
 #define MYSQL_AUDIT_GENERAL_LOG 0
 #define MYSQL_AUDIT_GENERAL_ERROR 1
 #define MYSQL_AUDIT_GENERAL_RESULT 2
+#define MYSQL_AUDIT_GENERAL_STATUS 3
 </programlisting>
           </listitem>
 

@@ -4628,7 +4614,42 @@
         </itemizedlist>
 
         <para>
-          To compile and install a plugin library object file, see the
+          The <literal>NULL_AUDIT</literal> plugin notification function
+          it quite simple. It increments a global counter, verifies that
+          the event is of the <quote>general</quote> class, then looks
+          at the event subclass to determine which counter to increment:
+        </para>
+
+<programlisting>
+static void audit_null_notify(MYSQL_THD thd __attribute__((unused)),
+                              unsigned int event_class,
+                              const void *event)
+{
+  number_of_calls++;
+  if (event_class == MYSQL_AUDIT_GENERAL_CLASS)
+  {
+    const struct mysql_event_general *event_general=
+      (const struct mysql_event_general *) event;
+    switch (event_general-&gt;event_subclass)
+    {
+    case MYSQL_AUDIT_GENERAL_LOG:
+      number_of_calls_general_log++;
+      break;
+    case MYSQL_AUDIT_GENERAL_ERROR:
+      number_of_calls_general_error++;
+      break;
+    case MYSQL_AUDIT_GENERAL_RESULT:
+      number_of_calls_general_result++;
+      break;
+    default:
+      break;
+    }
+  }
+}
+</programlisting>
+
+        <para>
+          To compile and install a plugin library object file, use the
           instructions in <xref linkend="compiling-plugin-libraries"/>.
           For the <literal>AUDIT_NULL</literal> plugin, it is compiled
           and installed when you build MySQL from source. It is also

@@ -4663,7 +4684,8 @@
 
         <para>
           While the audit plugin is installed, it exposes status
-          variables that indicate how the plugin has been called:
+          variables that indicate the events for which the plugin has
+          been called:
         </para>
 
 <programlisting>

@@ -4671,17 +4693,17 @@
 +---------------------------+-------+
 | Variable_name             | Value |
 +---------------------------+-------+
-| Audit_null_called         | 2     |
-| Audit_null_general_error  | 0     |
-| Audit_null_general_log    | 1     |
-| Audit_null_general_result | 1     |
+| Audit_null_called         | 1385  |
+| Audit_null_general_error  | 1     |
+| Audit_null_general_log    | 741   |
+| Audit_null_general_result | 643   |
 +---------------------------+-------+
 </programlisting>
 
         <para>
-          <literal>Audit_null_called</literal> counts all events for any
-          subclass of the <quote>general</quote> class, and the others
-          count instances of each event subclass. The preceding
+          <literal>Audit_null_called</literal> counts all events, and
+          the other variables count events for each subclass of the
+          <quote>general</quote> class. The preceding
           <literal role="stmt">SHOW STATUS</literal> statement causes
           the server to send a result to the client and to write a
           message to the general query log if that log is enabled. Thus,

@@ -4692,6 +4714,61 @@
           incremented if the log is enabled.
         </para>
 
+        <bridgehead id="audit-plugin-interface-changes">
+          Audit Plugin Interface Changes
+        </bridgehead>
+
+        <para>
+          The audit plugin interface has undergone the following
+          changes:
+        </para>
+
+        <itemizedlist>
+
+          <listitem>
+            <para>
+              In MySQL 5.5.5, the <literal>event_subclass</literal>
+              member was added to the
+              <literal>mysql_event_general</literal> structure.
+              Corresponding to this change, the type-specific interface
+              version, <literal>MYSQL_AUDIT_INTERFACE_VERSION</literal>,
+              was increased from <literal>0x0100</literal> to
+              <literal>0x0200</literal> and
+            </para>
+          </listitem>
+
+          <listitem>
+            <para>
+              In MySQL 5.5.9, the
+              <literal>MYSQL_AUDIT_CONNECTION_CLASS</literal> event
+              class was added.
+            </para>
+          </listitem>
+
+          <listitem>
+            <para>
+              In MySQL 5.5.14, The <literal>event_class</literal> member
+              was removed from the
+              <literal>mysql_event_general</literal> structure and the
+              calling sequence for the notification function changed.
+              Originally, the second argument was a pointer to the event
+              structure. The function now receives this information as
+              two arguments: an event class number and a pointer to the
+              event. Corresponding to these changes,
+              <literal>MYSQL_AUDIT_INTERFACE_VERSION</literal> was
+              increased to <literal>0x0300</literal>.
+            </para>
+          </listitem>
+
+        </itemizedlist>
+
+        <para>
+          Each audit plugin should be compiled against MySQL source in
+          which the value of
+          <literal>MYSQL_AUDIT_INTERFACE_VERSION</literal> is
+          appropriate for the iterface version the plugin requires.
+        </para>
+
       </section>
 
     </section>


Modified: trunk/refman-5.6/extending-mysql.xml
===================================================================
--- trunk/refman-5.6/extending-mysql.xml	2011-06-09 17:16:22 UTC (rev 26478)
+++ trunk/refman-5.6/extending-mysql.xml	2011-06-09 18:40:58 UTC (rev 26479)
Changed blocks: 19, Lines Added: 103, Lines Deleted: 56; 12300 bytes

@@ -3663,7 +3663,7 @@
 
           <listitem>
             <para>
-              To compile and install a plugin library object file, see
+              To compile and install a plugin library object file, use
               the instructions in
               <xref linkend="compiling-plugin-libraries"/>. For the
               <literal>simple_parser</literal> plugin, it is compiled

@@ -3926,7 +3926,7 @@
         </itemizedlist>
 
         <para>
-          To compile and install a plugin library object file, see the
+          To compile and install a plugin library object file, use the
           instructions in <xref linkend="compiling-plugin-libraries"/>.
           For the <literal>daemon_example</literal> plugin, it is
           compiled and installed when you build MySQL from source. It is

@@ -4119,7 +4119,7 @@
         </para>
 
         <para>
-          To compile and install a plugin library object file, see the
+          To compile and install a plugin library object file, use the
           instructions in <xref linkend="compiling-plugin-libraries"/>.
           For the <literal>rpl_semi_sync_master</literal> and
           <literal>rpl_semi_sync_slave</literal> plugins, they are

@@ -4160,7 +4160,7 @@
           about the event if necessary. To see where such calls occur,
           look for invocations of functions with names of the form
           <filename>mysql_audit_<replaceable>xxx</replaceable>()</filename>.
-          Audit notification occurs for these server operations:
+          Audit notification occurs for server operations such as these:
         </para>
 
         <itemizedlist>

@@ -4211,9 +4211,10 @@
         </para>
 
         <para>
-          An audit plugin, like any MySQL plugin, has a general plugin
-          descriptor (see <xref linkend="server-plugin-descriptors"/>).
-          In <filename>audit_null.c</filename>, the general descriptor
+          An audit plugin, like any MySQL server plugin, has a general
+          plugin descriptor (see
+          <xref linkend="server-plugin-descriptors"/>). In
+          <filename>audit_null.c</filename>, the general descriptor
           looks like this:
         </para>
 

@@ -4223,12 +4224,12 @@
   MYSQL_AUDIT_PLUGIN,         /* type                            */
   &amp;audit_null_descriptor,     /* descriptor                      */
   "NULL_AUDIT",               /* name                            */
-  "Oracle Corporation",       /* author                          */
+  "Oracle Corp",              /* author                          */
   "Simple NULL Audit",        /* description                     */
   PLUGIN_LICENSE_GPL,
   audit_null_plugin_init,     /* init function (when loaded)     */
   audit_null_plugin_deinit,   /* deinit function (when unloaded) */
-  0x0001,                     /* version                         */
+  0x0002,                     /* version                         */
   simple_status,              /* status variables                */
   NULL,                       /* system variables                */
   NULL

@@ -4248,12 +4249,6 @@
         </para>
 
         <para>
-          The <literal>audit_null_descriptor</literal> value in the
-          general descriptor points to the type-specific descriptor,
-          described later.
-        </para>
-
-        <para>
           The general descriptor also refers to
           <literal>simple_status</literal>, a structure that exposes
           several status variables to the <literal role="stmt">SHOW

@@ -4286,8 +4281,9 @@
         </para>
 
         <para>
-          Audit plugins have a type-specific descriptor with this
-          structure:
+          The <literal>audit_null_descriptor</literal> value in the
+          general descriptor points to the type-specific descriptor. For
+          audit plugins, this descriptor has the following structure:
         </para>
 
 <programlisting>

@@ -4295,7 +4291,7 @@
 {
   int interface_version;
   void (*release_thd)(MYSQL_THD);
-  void (*event_notify)(MYSQL_THD, const struct mysql_event *);
+  void (*event_notify)(MYSQL_THD, unsigned int, const void *);
   unsigned long class_mask[MYSQL_AUDIT_CLASS_MASK_SIZE];
 };
 </programlisting>

@@ -4314,7 +4310,7 @@
               <literal>interface_version</literal> when it loads the
               plugin to see whether the plugin is compatible with it.
               For audit plugins, the value of the
-              <literal>interface_version</literal> field is
+              <literal>interface_version</literal> member is
               <literal>MYSQL_AUDIT_INTERFACE_VERSION</literal> (defined
               in <literal>plugin_audit.h</literal>).
             </para>

@@ -4343,7 +4339,8 @@
             <para>
               <literal>class_mask</literal>: A bit mask that indicates
               the event classes for which the plugin wants to receive
-              notification.
+              notification. If this value is 0, the server passes no
+              events to the plugin.
             </para>
           </listitem>
 

@@ -4394,8 +4391,8 @@
         </para>
 
         <para>
-          For the example audit plugin, the type-specific descriptor
-          looks like this:
+          For the <literal>NULL_AUDIT</literal> example audit plugin,
+          the type-specific descriptor looks like this:
         </para>
 
 <programlisting>

@@ -4416,10 +4413,10 @@
 
         <para>
           The event class mask indicates an interest in all events of
-          the <quote>general</quote> class. Currently, that is the only
-          event class. <filename>plugin_audit.h</filename> defines its
-          symbol, <literal>MYSQL_AUDIT_GENERAL_CLASS</literal>, and a
-          mask with a bit for this class:
+          the <quote>general</quote> class.
+          <filename>plugin_audit.h</filename> defines its symbol,
+          <literal>MYSQL_AUDIT_GENERAL_CLASS</literal>, and a mask with
+          a bit for this class:
         </para>
 
 <programlisting>

@@ -4428,34 +4425,55 @@
 </programlisting>
 
         <para>
+          <filename>plugin_audit.h</filename> also has defines for a
+          <quote>connection</quote> event class, although the
+          <literal>NULL_AUDIT</literal> plugin does nothing with such
+          events:
+        </para>
+
+<programlisting>
+#define MYSQL_AUDIT_CONNECTION_CLASS 1
+#define MYSQL_AUDIT_CONNECTION_CLASSMASK (1 &lt;&lt; MYSQL_AUDIT_CONNECTION_CLASS)
+</programlisting>
+
+        <para>
+          A plugin could be written to receive both general and
+          connection events by setting its type-specific descriptor like
+          this:
+        </para>
+
+<programlisting>
+  { (unsigned long) MYSQL_AUDIT_GENERAL_CLASSMASK |
+                 MYSQL_AUDIT_CONNECTION_CLASSMASK } /* class mask        */
+</programlisting>
+
+        <para>
           In the type-specific descriptor, the second parameter of the
-          <literal>event_notify</literal> function prototype is a
-          generic <literal>mysql_event</literal> pointer:
+          <literal>event_notify</literal> function prototype specifies
+          the event class and the third parameter is a generic pointer
+          representing an event structure:
         </para>
 
 <programlisting>
-void (*event_notify)(MYSQL_THD, const struct mysql_event *);
+void (*event_notify)(MYSQL_THD, unsigned int, const void *);
 </programlisting>
 
         <para>
-          The server actually passes the notification function a pointer
-          to a structure that depends on the event class. The first
-          member of all event structures must indicate the event class
-          to enable the notification function to determine what kind of
-          structure it was passed so that it can tell what other
-          structure members exist.
+          Events in different classes may have different structures. The
+          function can use the event class value to determine how to
+          interpret the pointer to the event structure.
         </para>
 
         <para>
-          The server passes events in the <quote>general</quote> event
-          class to the <literal>event_notify</literal> function using
-          this structure:
+          If the server calls the notification function with an event
+          class of <literal>MYSQL_AUDIT_GENERAL_CLASS</literal>, it
+          passes the event structure as a pointer to a
+          <literal>mysql_event_general</literal> structure:
         </para>
 
 <programlisting>
 struct mysql_event_general
 {
-  unsigned int event_class;
   unsigned int event_subclass;
   int general_error_code;
   unsigned long general_thread_id;

@@ -4480,14 +4498,6 @@
 
           <listitem>
             <para>
-              <literal>event_class</literal>: The event class, always
-              <literal>MYSQL_AUDIT_GENERAL_CLASS</literal> for
-              <quote>general</quote> events.
-            </para>
-          </listitem>
-
-          <listitem>
-            <para>
               <literal>event_subclass</literal>: The event subclass, one
               of the following values:
             </para>

@@ -4496,6 +4506,7 @@
 #define MYSQL_AUDIT_GENERAL_LOG 0
 #define MYSQL_AUDIT_GENERAL_ERROR 1
 #define MYSQL_AUDIT_GENERAL_RESULT 2
+#define MYSQL_AUDIT_GENERAL_STATUS 3
 </programlisting>
           </listitem>
 

@@ -4597,7 +4608,42 @@
         </itemizedlist>
 
         <para>
-          To compile and install a plugin library object file, see the
+          The <literal>NULL_AUDIT</literal> plugin notification function
+          it quite simple. It increments a global counter, verifies that
+          the event is of the <quote>general</quote> class, then looks
+          at the event subclass to determine which counter to increment:
+        </para>
+
+<programlisting>
+static void audit_null_notify(MYSQL_THD thd __attribute__((unused)),
+                              unsigned int event_class,
+                              const void *event)
+{
+  number_of_calls++;
+  if (event_class == MYSQL_AUDIT_GENERAL_CLASS)
+  {
+    const struct mysql_event_general *event_general=
+      (const struct mysql_event_general *) event;
+    switch (event_general-&gt;event_subclass)
+    {
+    case MYSQL_AUDIT_GENERAL_LOG:
+      number_of_calls_general_log++;
+      break;
+    case MYSQL_AUDIT_GENERAL_ERROR:
+      number_of_calls_general_error++;
+      break;
+    case MYSQL_AUDIT_GENERAL_RESULT:
+      number_of_calls_general_result++;
+      break;
+    default:
+      break;
+    }
+  }
+}
+</programlisting>
+
+        <para>
+          To compile and install a plugin library object file, use the
           instructions in <xref linkend="compiling-plugin-libraries"/>.
           For the <literal>AUDIT_NULL</literal> plugin, it is compiled
           and installed when you build MySQL from source. It is also

@@ -4632,7 +4678,8 @@
 
         <para>
           While the audit plugin is installed, it exposes status
-          variables that indicate how the plugin has been called:
+          variables that indicate the events for which the plugin has
+          been called:
         </para>
 
 <programlisting>

@@ -4640,17 +4687,17 @@
 +---------------------------+-------+
 | Variable_name             | Value |
 +---------------------------+-------+
-| Audit_null_called         | 2     |
-| Audit_null_general_error  | 0     |
-| Audit_null_general_log    | 1     |
-| Audit_null_general_result | 1     |
+| Audit_null_called         | 1385  |
+| Audit_null_general_error  | 1     |
+| Audit_null_general_log    | 741   |
+| Audit_null_general_result | 643   |
 +---------------------------+-------+
 </programlisting>
 
         <para>
-          <literal>Audit_null_called</literal> counts all events for any
-          subclass of the <quote>general</quote> class, and the others
-          count instances of each event subclass. The preceding
+          <literal>Audit_null_called</literal> counts all events, and
+          the other variables count events for each subclass of the
+          <quote>general</quote> class. The preceding
           <literal role="stmt">SHOW STATUS</literal> statement causes
           the server to send a result to the client and to write a
           message to the general query log if that log is enabled. Thus,


Modified: trunk/refman-6.0/extending-mysql.xml
===================================================================
--- trunk/refman-6.0/extending-mysql.xml	2011-06-09 17:16:22 UTC (rev 26478)
+++ trunk/refman-6.0/extending-mysql.xml	2011-06-09 18:40:58 UTC (rev 26479)
Changed blocks: 2, Lines Added: 2, Lines Deleted: 2; 1055 bytes

@@ -3267,7 +3267,7 @@
 
           <listitem>
             <para>
-              To compile and install a plugin library object file, see
+              To compile and install a plugin library object file, use
               the instructions in
               <xref linkend="compiling-plugin-libraries"/>. For the
               <literal>simple_parser</literal> plugin, it is compiled

@@ -3530,7 +3530,7 @@
         </itemizedlist>
 
         <para>
-          To compile and install a plugin library object file, see the
+          To compile and install a plugin library object file, use the
           instructions in <xref linkend="compiling-plugin-libraries"/>.
           For the <literal>daemon_example</literal> plugin, it is
           compiled and installed when you build MySQL from source. It is


Thread
svn commit - mysqldoc@oter02: r26479 - in trunk: . refman-5.1 refman-5.5 refman-5.6 refman-6.0paul.dubois9 Jun