Files
Georg Richter a47d3e5d76 Implementation of CONPY-129:
Added connection attribute server_version_info and (for compatibiliry)
get_server_version() method.
Both return a tuple, describing the version number of connected server
in following format: (MAJOR_VERSION, MINOR_VERSION, PATCH_VERSION)
2020-11-16 10:03:05 +01:00

174 lines
8.1 KiB
HTML
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>The ConnectionPool class &#8212; MariaDB Connector/Python 1.0.0 documentation</title>
<link rel="stylesheet" href="_static/pygments.css" type="text/css" />
<link rel="stylesheet" href="_static/classic.css" type="text/css" />
<script id="documentation_options" data-url_root="./" src="_static/documentation_options.js"></script>
<script src="_static/jquery.js"></script>
<script src="_static/underscore.js"></script>
<script src="_static/doctools.js"></script>
<script src="_static/language_data.js"></script>
<link rel="index" title="Index" href="genindex.html" />
<link rel="search" title="Search" href="search.html" />
<link rel="next" title="Extensions to the DB API" href="extension.html" />
<link rel="prev" title="The cursor class" href="cursor.html" />
</head><body>
<div class="related" role="navigation" aria-label="related navigation">
<h3>Navigation</h3>
<ul>
<li class="right" style="margin-right: 10px">
<a href="genindex.html" title="General Index"
accesskey="I">index</a></li>
<li class="right" >
<a href="py-modindex.html" title="Python Module Index"
>modules</a> |</li>
<li class="right" >
<a href="extension.html" title="Extensions to the DB API"
accesskey="N">next</a> |</li>
<li class="right" >
<a href="cursor.html" title="The cursor class"
accesskey="P">previous</a> |</li>
<li class="nav-item nav-item-0"><a href="index.html">MariaDB Connector/Python 1.0.0 documentation</a> &#187;</li>
<li class="nav-item nav-item-this"><a href="">The ConnectionPool class</a></li>
</ul>
</div>
<div class="document">
<div class="documentwrapper">
<div class="bodywrapper">
<div class="body" role="main">
<div class="section" id="the-connectionpool-class">
<h1>The ConnectionPool class<a class="headerlink" href="#the-connectionpool-class" title="Permalink to this headline"></a></h1>
<dl class="py class">
<dt id="ConnectionPool">
<em class="property">class </em><code class="sig-name descname">ConnectionPool</code><a class="headerlink" href="#ConnectionPool" title="Permalink to this definition"></a></dt>
<dd><p>MariaDB Connector/Python supports simple connection pooling.
A connection pool holds a number of open connections and handles thread safety
when providing connections to threads.</p>
<p>The size of a connection pool is configurable at creation time, but cannot be
changed afterwards. The maximum size of a connection pool is limited to 64 connections.</p>
<dl class="py method">
<dt id="ConnectionPool.add_connection">
<code class="sig-name descname">add_connection</code><span class="sig-paren">(</span><em class="sig-param"><span class="n">connection</span></em><span class="sig-paren">)</span><a class="headerlink" href="#ConnectionPool.add_connection" title="Permalink to this definition"></a></dt>
<dd><p>Adds a connection object to the connection pool.</p>
<p>In case that pool doesnt have a free slot or is not configured a PoolError
exception will be raised.</p>
</dd></dl>
<dl class="py method">
<dt id="ConnectionPool.close">
<code class="sig-name descname">close</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#ConnectionPool.close" title="Permalink to this definition"></a></dt>
<dd><p>Closes the pool and all connection inside the pool.</p>
</dd></dl>
<div class="versionadded">
<p><span class="versionmodified added">New in version 1.0.1.</span></p>
</div>
<dl class="py method">
<dt id="ConnectionPool.get_connection">
<code class="sig-name descname">get_connection</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#ConnectionPool.get_connection" title="Permalink to this definition"></a></dt>
<dd><p>Returns a connection from the connection pool or raises a PoolError if no
connection is available.</p>
</dd></dl>
<dl class="py method">
<dt id="ConnectionPool.set_config">
<code class="sig-name descname">set_config</code><span class="sig-paren">(</span><em class="sig-param">\*\*kwargs</em><span class="sig-paren">)</span><a class="headerlink" href="#ConnectionPool.set_config" title="Permalink to this definition"></a></dt>
<dd><p>Sets the connection configuration for the connection pool. For valid connection
arguments see <a class="reference internal" href="module.html#mariadb.connect" title="mariadb.connect"><code class="xref py py-func docutils literal notranslate"><span class="pre">mariadb.connect()</span></code></a> method.</p>
<div class="admonition note">
<p class="admonition-title">Note</p>
<p>This method doesnt create connections in the pool. To fill the pool one has to use
the <a class="reference internal" href="#ConnectionPool.add_connection" title="ConnectionPool.add_connection"><code class="xref py py-func docutils literal notranslate"><span class="pre">add_connection()</span></code></a> ḿethod.</p>
</div>
</dd></dl>
<dl class="py data">
<dt id="ConnectionPool.max_size">
<code class="sig-name descname">max_size</code><a class="headerlink" href="#ConnectionPool.max_size" title="Permalink to this definition"></a></dt>
<dd><p>Returns the maximum allowed size of the pool</p>
</dd></dl>
<dl class="py data">
<dt id="ConnectionPool.pool_size">
<code class="sig-name descname">pool_size</code><a class="headerlink" href="#ConnectionPool.pool_size" title="Permalink to this definition"></a></dt>
<dd><p>Returns the size of connection pool</p>
</dd></dl>
<dl class="py data">
<dt id="ConnectionPool.pool_name">
<code class="sig-name descname">pool_name</code><a class="headerlink" href="#ConnectionPool.pool_name" title="Permalink to this definition"></a></dt>
<dd><p>Returns the name of the pool.</p>
</dd></dl>
</dd></dl>
</div>
<div class="clearer"></div>
</div>
</div>
</div>
<div class="sphinxsidebar" role="navigation" aria-label="main navigation">
<div class="sphinxsidebarwrapper">
<h4>Previous topic</h4>
<p class="topless"><a href="cursor.html"
title="previous chapter">The cursor class</a></p>
<h4>Next topic</h4>
<p class="topless"><a href="extension.html"
title="next chapter">Extensions to the DB API</a></p>
<div role="note" aria-label="source link">
<h3>This Page</h3>
<ul class="this-page-menu">
<li><a href="_sources/pool.rst.txt"
rel="nofollow">Show Source</a></li>
</ul>
</div>
<div id="searchbox" style="display: none" role="search">
<h3 id="searchlabel">Quick search</h3>
<div class="searchformwrapper">
<form class="search" action="search.html" method="get">
<input type="text" name="q" aria-labelledby="searchlabel" />
<input type="submit" value="Go" />
</form>
</div>
</div>
<script>$('#searchbox').show(0);</script>
</div>
</div>
<div class="clearer"></div>
</div>
<div class="related" role="navigation" aria-label="related navigation">
<h3>Navigation</h3>
<ul>
<li class="right" style="margin-right: 10px">
<a href="genindex.html" title="General Index"
>index</a></li>
<li class="right" >
<a href="py-modindex.html" title="Python Module Index"
>modules</a> |</li>
<li class="right" >
<a href="extension.html" title="Extensions to the DB API"
>next</a> |</li>
<li class="right" >
<a href="cursor.html" title="The cursor class"
>previous</a> |</li>
<li class="nav-item nav-item-0"><a href="index.html">MariaDB Connector/Python 1.0.0 documentation</a> &#187;</li>
<li class="nav-item nav-item-this"><a href="">The ConnectionPool class</a></li>
</ul>
</div>
<div class="footer" role="contentinfo">
&#169; Copyright 2019,2020 MariaDB Corporation and Georg Richter.
Created using <a href="https://www.sphinx-doc.org/">Sphinx</a> 3.3.1.
</div>
</body>
</html>