Related Documentation Download this Manual

31.2.3.2 Returning Multiple Rows

It is possible to return more than one row, using the result type CLASS_TYPE_1STCOL_ATTRIBUTES. This result type enables the return of a two-column result set as key-value pair. Unlike the default attributes, which are taken from the column name, the key is the attribute name and the value is the attribute value.

Important

The key value must be unique across the result set.

The following example shows how a 2-column result set is returned and formatted by the resulttype element:

  <class>
        <namespace>mysql</namespace>
        <classname>rpl_semi_sync_vars</classname>
        <query><![CDATA[
SHOW GLOBAL VARIABLES WHERE
Variable_name='rpl_semi_sync_master_timeout' OR
Variable_name='rpl_semi_sync_master_trace_level' OR
Variable_name='rpl_semi_sync_master_wait_no_slave' OR
Variable_name='rpl_semi_sync_master_enabled' OR
Variable_name='rpl_semi_sync_slave_enabled'
]]></query>
    <resulttype>CLASS_TYPE_1STCOL_ATTRIBUTES</resulttype>
     <attributes>
      <attribute name="rpl_semi_sync_master_timeout" counter="false" type="INTEGER"/>
      <attribute name="rpl_semi_sync_master_trace_level" counter="false" type="INTEGER"/>
      <attribute name="rpl_semi_sync_master_wait_no_slave" counter="false" type="STRING"/>
      <attribute name="rpl_semi_sync_master_enabled" counter="false" type="STRING"/>
      <attribute name="rpl_semi_sync_slave_enabled" counter="false" type="STRING"/>
     </attributes>
</class>

User Comments
User comments in this section are, as the name implies, provided by MySQL users. The MySQL documentation team is not responsible for, nor do they endorse, any of the information provided here.
Sign Up Login You must be logged in to post a comment.