php-doc-en/reference/mysqlnd_qc/constants.xml
2010-07-09 16:02:41 +00:00

124 lines
3 KiB
XML

<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision$ -->
<appendix xml:id="mysqlnd-qc.constants" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
&reftitle.constants;
&extension.constants;
<para>
<emphasis role="bold">SQL hint related</emphasis>
</para>
<para>
<example>
<para>
The query cache is controled by SQL hints. SQL hints are used to enable and
disable caching. SQL hints can be used to set the
<literal>TTL</literal> of a query.
</para>
<para>
The SQL hints recognized by the query cache can be manually changed at
compile time. This makes it possible to use
<literal>mysqlnd_qc</literal> in environments in which the default
SQL hints are already taken and interpreted by other systems. Therefore
it is recommended to use the SQL hint string constants instead of
manually adding the default SQL hints to the query string.
</para>
<programlisting role="php">
<![CDATA[
<?php
/* Use constants for maximum portability */
$query = "/*" . MYSQLND_QC_ENABLE_SWITCH . "*/SELECT id FROM test";
/* Valid but less portable: default TTL */
$query = "/*qc=on*/SELECT id FROM test";
/* Valid but less portable: per statement TTL */
$query = "/*qc=on*//*qc_ttl=5*/SELECT id FROM test";
printf("MYSQLND_QC_ENABLE_SWITCH: %s\n", MYSQLND_QC_ENABLE_SWITCH);
printf("MYSQLND_QC_DISABLE_SWITCH: %s\n", MYSQLND_QC_DISABLE_SWITCH);
printf("MYSQLND_QC_TTL_SWITCH: %s\n", MYSQLND_QC_TTL_SWITCH);
?>
]]>
</programlisting>
&examples.outputs;
<screen>
<![CDATA[
MYSQLND_QC_ENABLE_SWITCH: qc=on
MYSQLND_QC_DISABLE_SWITCH: qc=off
MYSQLND_QC_TTL_SWITCH: qc_ttl=
]]>
</screen>
</example>
</para>
<para>
<variablelist>
<varlistentry>
<term>
<constant>MYSQLND_QC_ENABLE_SWITCH</constant>
(
<type>string</type>)
</term>
<listitem>
<simpara>
SQL hint used to enable caching of a query.
</simpara>
</listitem>
</varlistentry>
<varlistentry>
<term>
<constant>MYSQLND_QC_DISABLE_SWITCH</constant>
(
<type>string</type>)
</term>
<listitem>
<simpara>
SQL hint used to disable caching of a query if
<literal>mysqlnd_qc.cache_by_default = 1</literal>.
</simpara>
</listitem>
</varlistentry>
<varlistentry>
<term>
<constant>MYSQLND_QC_TTL_SWITCH</constant>
(
<type>string</type>)
</term>
<listitem>
<simpara>
SQL hint used to set the TTL of a result set.
</simpara>
</listitem>
</varlistentry>
</variablelist>
</para>
</appendix>
<!-- Keep this comment at the end of the file
Local variables:
mode: sgml
sgml-omittag:t
sgml-shorttag:t
sgml-minimize-attributes:nil
sgml-always-quote-attributes:t
sgml-indent-step:1
sgml-indent-data:t
indent-tabs-mode:nil
sgml-parent-document:nil
sgml-default-dtd-file:"~/.phpdoc/manual.ced"
sgml-exposed-tags:nil
sgml-local-catalogs:nil
sgml-local-ecat-files:nil
End:
vim600: syn=xml fen fdm=syntax fdl=2 si
vim: et tw=78 syn=sgml
vi: ts=1 sw=1
-->