Author: tbedford
Date: 2009-04-08 15:11:56 +0200 (Wed, 08 Apr 2009)
New Revision: 14548
Log:
Added info on getClientOption(), getSessionVariable(), setSessionVariable().
Modified:
trunk/refman-common/connector-cpp.xml
Modified: trunk/refman-common/connector-cpp.xml
===================================================================
--- trunk/refman-common/connector-cpp.xml 2009-04-08 11:48:02 UTC (rev 14547)
+++ trunk/refman-common/connector-cpp.xml 2009-04-08 13:11:56 UTC (rev 14548)
Changed blocks: 1, Lines Added: 119, Lines Deleted: 0; 4586 bytes
@@ -2396,6 +2396,125 @@
</itemizedlist>
</listitem>
+ <listitem>
+ <para>
+ &ccpp; includes a method
+ <literal>Connection::getClientOption()</literal> which is not
+ included in the JDBC API specification. The prototype is:
+ </para>
+
+<programlisting>void getClientOption(const std::string & optionName, void * optionValue)</programlisting>
+
+ <para>
+ The method can be used to check the value of connection
+ properties set when establishing a database connection. The
+ values are returned through the <literal>optionValue</literal>
+ argument passed to the method with the type <literal>void
+ *</literal>.
+ </para>
+
+ <para>
+ Currently, <literal>getClientOption()</literal> supports
+ fetching the <literal>optionValue</literal> of the following
+ options:
+
+ <itemizedlist>
+
+ <listitem>
+ <para>
+ <literal>metadataUseInfoSchema</literal>
+ </para>
+ </listitem>
+
+ <listitem>
+ <para>
+ <literal>defaultStatementResultType</literal>
+ </para>
+ </listitem>
+
+ <listitem>
+ <para>
+ <literal>defaultPreparedStatementResultType</literal>
+ </para>
+ </listitem>
+
+ </itemizedlist>
+
+ The connection option <literal>metadataUseInfoSchema</literal>
+ controls whether to use the
+ <literal>Information_Schemata</literal> for returning the meta
+ data of <literal>SHOW</literal> commands. In the case of
+ <literal>metadataUseInfoSchema</literal> the
+ <literal>optionValue</literal> argument should be interpreted
+ as a boolean upon return.
+ </para>
+
+ <para>
+ In the case of both
+ <literal>defaultStatementResultType</literal> and
+ <literal>defaultPreparedStatementResultType</literal>, the
+ <literal>optionValue</literal> argument should be interpreted
+ as an integer upon return.
+ </para>
+
+ <para>
+ The connection property can be either set when establishing
+ the connection through the connection property map or using
+ <literal>void Connection::setClientOption(const std::string
+ & optionName, const void * optionValue)</literal> where
+ <literal>optionName</literal> is assigned the value
+ <literal>metadataUseInfoSchema</literal>.
+ </para>
+
+ <para>
+ Some examples are given below:
+ </para>
+
+<programlisting>int defaultStmtResType;
+int defaultPStmtResType;
+conn->getClientOption("defaultStatementResultType", (void *) &defaultStmtResType);
+conn->getClientOption("defaultPreparedStatementResultType", (void *) &defaultPStmtResType);
+
+bool isInfoSchemaUsed;
+conn->getClientOption("metadataUseInfoSchema", (void *) &isInfoSchemaUsed);</programlisting>
+ </listitem>
+
+ <listitem>
+ <para>
+ &ccpp; also supports the following methods not found in the
+ JDBC API standard:
+ </para>
+
+<programlisting>std::string MySQL_Connection::getSessionVariable(const std::string & varname)</programlisting>
+
+<programlisting>void MySQL_Connection::setSessionVariable(const std::string & varname, const std::string & value)</programlisting>
+
+ <para>
+ Note that both methods are members of the
+ <literal>MySQL_Connection</literal> class. The methods get and
+ set MySQL session variables.
+ </para>
+
+ <para>
+ <literal>setSessionVariable()</literal> is equivalent to
+ executing:
+ </para>
+
+<programlisting>SET SESSION <varname> = <value></programlisting>
+
+ <para>
+ <literal>getSessionVariable()</literal> is equivalent to
+ executing the following and fetching the first return value:
+ </para>
+
+<programlisting>SHOW SESSION VARIABLES LIKE "<varname>"</programlisting>
+
+ <para>
+ You can use <quote>%</quote> and other placeholders in
+ <varname>, if the underlying MySQL server supports this.
+ </para>
+ </listitem>
+
</itemizedlist>
</section>
| Thread |
|---|
| • svn commit - mysqldoc@docsrva: r14548 - trunk/refman-common | anthony.bedford | 8 Apr |