mirror of
https://github.com/mariadb-corporation/mariadb-connector-python.git
synced 2025-08-11 02:43:15 +00:00
Various fixes and changes for SQLAlchemy support:
- added a thin python wrapper around mariadb module - added constansts under mariadb.constants (CLIENT, CURSOR, INDICATOR) - bench and test are now in testing subdirectory - updated documentation
This commit is contained in:
@ -84,11 +84,13 @@ if [ -n "$BENCH" ] ; then
|
|||||||
python setup.py build
|
python setup.py build
|
||||||
python setup.py install
|
python setup.py install
|
||||||
pip install mysql-connector-python pyperf
|
pip install mysql-connector-python pyperf
|
||||||
|
cd testing
|
||||||
export TEST_MODULE=mariadb
|
export TEST_MODULE=mariadb
|
||||||
python bench.py -o mariadb_bench_pypy3_6.json --inherit-environ=TEST_USER,TEST_HOST,TEST_PORT
|
python bench.py -o mariadb_bench_pypy3_6.json --inherit-environ=TEST_USER,TEST_HOST,TEST_PORT
|
||||||
export TEST_MODULE=mysql.connector
|
export TEST_MODULE=mysql.connector
|
||||||
python bench.py -o mysql_bench_pypy3_6.json --inherit-environ=TEST_USER,TEST_HOST,TEST_PORT
|
python bench.py -o mysql_bench_pypy3_6.json --inherit-environ=TEST_USER,TEST_HOST,TEST_PORT
|
||||||
python -m pyperf compare_to mysql_bench_pypy3_6.json mariadb_bench_pypy3_6.json --table
|
python -m pyperf compare_to mysql_bench_pypy3_6.json mariadb_bench_pypy3_6.json --table
|
||||||
|
cd ..
|
||||||
|
|
||||||
# python -m pyperf compare_to mysql_bench.json mariadb_bench.json mysql_bench_pypy3_6.json mariadb_bench_pypy3_6.json \
|
# python -m pyperf compare_to mysql_bench.json mariadb_bench.json mysql_bench_pypy3_6.json mariadb_bench_pypy3_6.json \
|
||||||
# mysql_bench_miniconda3_4_3_30.json mariadb_bench_miniconda3_4_3_30.json --table
|
# mysql_bench_miniconda3_4_3_30.json mariadb_bench_miniconda3_4_3_30.json --table
|
||||||
@ -98,8 +100,10 @@ else
|
|||||||
|
|
||||||
python setup.py build
|
python setup.py build
|
||||||
python setup.py install
|
python setup.py install
|
||||||
|
cd testing
|
||||||
|
|
||||||
python -m unittest discover -v
|
python -m unittest discover -v
|
||||||
|
cd ..
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
20
doc/Makefile
Normal file
20
doc/Makefile
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
# Minimal makefile for Sphinx documentation
|
||||||
|
#
|
||||||
|
|
||||||
|
# You can set these variables from the command line, and also
|
||||||
|
# from the environment for the first two.
|
||||||
|
SPHINXOPTS ?=
|
||||||
|
SPHINXBUILD ?= sphinx-build
|
||||||
|
SOURCEDIR = source
|
||||||
|
BUILDDIR = build
|
||||||
|
|
||||||
|
# Put it first so that "make" without argument is like "make help".
|
||||||
|
help:
|
||||||
|
@$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
|
||||||
|
|
||||||
|
.PHONY: help Makefile
|
||||||
|
|
||||||
|
# Catch-all target: route all unknown targets to Sphinx using the new
|
||||||
|
# "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS).
|
||||||
|
%: Makefile
|
||||||
|
@$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
|
86
doc/source/extension.rst
Normal file
86
doc/source/extension.rst
Normal file
@ -0,0 +1,86 @@
|
|||||||
|
.. _extensions:
|
||||||
|
|
||||||
|
Extensions to the DB API
|
||||||
|
========================
|
||||||
|
|
||||||
|
.. sectionauthor:: Georg Richter <georg@mariadb.com>
|
||||||
|
|
||||||
|
Constants
|
||||||
|
---------
|
||||||
|
For using constants of various types they have to be imported first:
|
||||||
|
|
||||||
|
.. code-block:: python
|
||||||
|
|
||||||
|
from mariadb.constants import *
|
||||||
|
|
||||||
|
|
||||||
|
Cursor types
|
||||||
|
^^^^^^^^^^^^
|
||||||
|
|
||||||
|
MariaDB Connector/Python defines the following cursor types for server side cursors:
|
||||||
|
|
||||||
|
.. data:: mariadb.constants.CURSOR.NONE
|
||||||
|
|
||||||
|
Don't use a server side cursor (default)
|
||||||
|
|
||||||
|
.. data:: mariadb.constants.CURSOR.READ_ONLY
|
||||||
|
|
||||||
|
Use a read-only server side cursor.
|
||||||
|
|
||||||
|
Indicators
|
||||||
|
^^^^^^^^^^
|
||||||
|
|
||||||
|
Indicators hold supplementary information when you are modify (insert/update/delete) data with cursors `executemany` method. There are several distinct uses for indicator variables:
|
||||||
|
|
||||||
|
.. data:: INDICATOR.NULL
|
||||||
|
|
||||||
|
A null value will be inserted or updated
|
||||||
|
|
||||||
|
.. data:: INDICATOR.DEFAULT
|
||||||
|
|
||||||
|
The default value of a column will be inserted or updated
|
||||||
|
|
||||||
|
.. data:: INDICATOR.IGNORE
|
||||||
|
|
||||||
|
Don't update column at all
|
||||||
|
|
||||||
|
.. data:: INDICATOR.IGNORE_ROW
|
||||||
|
|
||||||
|
Don't update or delete row
|
||||||
|
|
||||||
|
Capability flags
|
||||||
|
^^^^^^^^^^^^^^^^
|
||||||
|
|
||||||
|
These flags are used when establishing a connection or to check if the database is
|
||||||
|
capabable of a certain feature.
|
||||||
|
|
||||||
|
.. data:: CLIENT.MYSQL
|
||||||
|
|
||||||
|
not in use/supported by MariaDB Server
|
||||||
|
|
||||||
|
.. data:: CLIENT.FOUND_ROWS
|
||||||
|
|
||||||
|
return the number of matched rows instead of number of changed rows
|
||||||
|
|
||||||
|
.. data:: CLIENT.NO_SCHEMA
|
||||||
|
|
||||||
|
forbids the use of database.tablename.columnname syntax and forces SQL parser
|
||||||
|
to generate an error.
|
||||||
|
|
||||||
|
.. data:: CLIENT.LOCAL_FILES
|
||||||
|
|
||||||
|
Allows LOAD DATA LOCAL INFILE statements (if not disabled on server).
|
||||||
|
|
||||||
|
.. data:: CLIENT_COMPRESS
|
||||||
|
|
||||||
|
Use compressed protocol
|
||||||
|
|
||||||
|
.. data:: CLIENT_IGNORE_SPACE
|
||||||
|
|
||||||
|
Allows spaces after function names. This implies, that all function names will
|
||||||
|
become reserved words.
|
||||||
|
|
||||||
|
.. data:: CLIENT_MULTI_RESULZS
|
||||||
|
|
||||||
|
Indicates that the client is able to handle multiple result sets.
|
||||||
|
|
@ -20,6 +20,7 @@ client library for client server communication.
|
|||||||
connection
|
connection
|
||||||
cursor
|
cursor
|
||||||
pool
|
pool
|
||||||
|
extension
|
||||||
license
|
license
|
||||||
release
|
release
|
||||||
|
|
||||||
|
21
doc/source/release.rst
Normal file
21
doc/source/release.rst
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
Release history
|
||||||
|
===============
|
||||||
|
|
||||||
|
Stable releases (GA)
|
||||||
|
--------------------
|
||||||
|
|
||||||
|
MariaDB Connector/Python 1.0.0
|
||||||
|
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||||
|
|
||||||
|
Release date: June 24th 2020
|
||||||
|
|
||||||
|
Notable Updates:
|
||||||
|
- CONPY-81: Fixed crash when switching between text and binary protocol with same cursor
|
||||||
|
- CONPY-80: Parameters in set_config() method of ConnectionPool class have to be checked against the list of DSN keywords
|
||||||
|
- CONPY-79: When inserting NULL values with executemany() method on a server which doesn't support BULK statements NULL values weren't inserted correctly.
|
||||||
|
- CONPY-78: Since MaxScale doesn't support bulk operations yet, we have to check servers extended capability flag to determine if this feature is supported or not.
|
||||||
|
- CONPY-76: Added aliases username, passwd and db to connection keywords.
|
||||||
|
- CONPY-70: set_config() method needs to check the passed parameter and raise an exception if the parameter type is not a dictionary.
|
||||||
|
- CONPY-72: When deallocating the connection pool class, we need to check beside pool_size if the array containing the connections is valid.
|
||||||
|
- Fixed bug when inserting negative integer values with cursor.execute() method
|
||||||
|
- CONPY-69: Set default character set (utf8mb4) with authentication packet
|
@ -98,16 +98,18 @@ In certain situations, for example when inserting default values or NULL, specia
|
|||||||
.. code-block:: python
|
.. code-block:: python
|
||||||
:linenos:
|
:linenos:
|
||||||
|
|
||||||
|
from mariadb.constants import *
|
||||||
|
|
||||||
cursor.execute("CREATE TABLE cakes(id int, cake varchar(100), price decimal(10,2) default 1.99)")
|
cursor.execute("CREATE TABLE cakes(id int, cake varchar(100), price decimal(10,2) default 1.99)")
|
||||||
|
|
||||||
sql= "INSERT INTO cakes (id, cake, price) VALUES (?,?)"
|
sql= "INSERT INTO cakes (id, cake, price) VALUES (?,?)"
|
||||||
data= [(1, "Cherry Cake", 2.10), (2, "Apple Cake", mariadb.indicator_default)]
|
data= [(1, "Cherry Cake", 2.10), (2, "Apple Cake", INDICATOR.default)]
|
||||||
cursor.executemany(sql, data)
|
cursor.executemany(sql, data)
|
||||||
|
|
||||||
Beside the default indicator which inserts the default value of 1.99, the following indicators are supported:
|
Beside the default indicator which inserts the default value of 1.99, the following indicators are supported:
|
||||||
* indicator_ignore: Ignores the value (only update commands)
|
* INDICATOR.IGNORE: Ignores the value (only update commands)
|
||||||
* indicator_null: Value is NULL
|
* INDICATOR.NULL: Value is NULL
|
||||||
* indicator_row: Don't update or insert row
|
* INDICATOR.IGNORE_ROW: Don't update or insert row
|
||||||
|
|
||||||
.. note::
|
.. note::
|
||||||
* Mixing different parameter styles is not supported and will raise an exception
|
* Mixing different parameter styles is not supported and will raise an exception
|
||||||
@ -119,6 +121,33 @@ Beside the default indicator which inserts the default value of 1.99, the follow
|
|||||||
Supported Data types
|
Supported Data types
|
||||||
--------------------
|
--------------------
|
||||||
|
|
||||||
|
Several standard python types are converted into SQL types and returned as Python objects when a statement is executed.
|
||||||
|
|
||||||
|
.. list-table:: Supported Data Types
|
||||||
|
:align: left
|
||||||
|
:header-rows: 1
|
||||||
|
|
||||||
|
* - Python type
|
||||||
|
- SQL type
|
||||||
|
* - None
|
||||||
|
- NULL
|
||||||
|
* - Bool
|
||||||
|
- TINYINT
|
||||||
|
* - Float, Double
|
||||||
|
- DOUBLE
|
||||||
|
* - Decimal
|
||||||
|
- DECIMAL
|
||||||
|
* - Long
|
||||||
|
- TINYINT, SMALLINT, INT, BIGINT
|
||||||
|
* - String
|
||||||
|
- VARCHAR, VARSTRING, TEXT
|
||||||
|
* - ByteArray, Bytes
|
||||||
|
- TINYBLOB, MEDIUMBLOB, BLOB, LONGBLOB
|
||||||
|
* - DateTime
|
||||||
|
- DATETIME
|
||||||
|
* - Date
|
||||||
|
- DATE
|
||||||
|
* - Time
|
||||||
|
- TIME
|
||||||
|
* - Timestamp
|
||||||
|
- TIMESTAMP
|
||||||
|
219
docs/extension.html
Normal file
219
docs/extension.html
Normal file
@ -0,0 +1,219 @@
|
|||||||
|
|
||||||
|
<!DOCTYPE html>
|
||||||
|
|
||||||
|
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||||
|
<head>
|
||||||
|
<meta charset="utf-8" />
|
||||||
|
<title>Extensions to the DB API — MariaDB Connector/Python 1.0.0 documentation</title>
|
||||||
|
<link rel="stylesheet" href="_static/classic.css" type="text/css" />
|
||||||
|
<link rel="stylesheet" href="_static/pygments.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="License" href="license.html" />
|
||||||
|
<link rel="prev" title="The ConnectionPool class" href="pool.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="license.html" title="License"
|
||||||
|
accesskey="N">next</a> |</li>
|
||||||
|
<li class="right" >
|
||||||
|
<a href="pool.html" title="The ConnectionPool 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> »</li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="document">
|
||||||
|
<div class="documentwrapper">
|
||||||
|
<div class="bodywrapper">
|
||||||
|
<div class="body" role="main">
|
||||||
|
|
||||||
|
<div class="section" id="extensions-to-the-db-api">
|
||||||
|
<span id="extensions"></span><h1>Extensions to the DB API<a class="headerlink" href="#extensions-to-the-db-api" title="Permalink to this headline">¶</a></h1>
|
||||||
|
<div class="section" id="constants">
|
||||||
|
<h2>Constants<a class="headerlink" href="#constants" title="Permalink to this headline">¶</a></h2>
|
||||||
|
<p>For using constants of various types they have to be imported first:</p>
|
||||||
|
<div class="highlight-python notranslate"><div class="highlight"><pre><span></span><span class="kn">from</span> <span class="nn">mariadb.constants</span> <span class="kn">import</span> <span class="o">*</span>
|
||||||
|
</pre></div>
|
||||||
|
</div>
|
||||||
|
<div class="section" id="cursor-types">
|
||||||
|
<h3>Cursor types<a class="headerlink" href="#cursor-types" title="Permalink to this headline">¶</a></h3>
|
||||||
|
<p>MariaDB Connector/Python defines the following cursor types for server side cursors:</p>
|
||||||
|
<dl class="data">
|
||||||
|
<dt id="mariadb.constants.CURSOR.NONE">
|
||||||
|
<code class="sig-prename descclassname">mariadb.constants.CURSOR.</code><code class="sig-name descname">NONE</code><a class="headerlink" href="#mariadb.constants.CURSOR.NONE" title="Permalink to this definition">¶</a></dt>
|
||||||
|
<dd><p>Don’t use a server side cursor (default)</p>
|
||||||
|
</dd></dl>
|
||||||
|
|
||||||
|
<dl class="data">
|
||||||
|
<dt id="mariadb.constants.CURSOR.READ_ONLY">
|
||||||
|
<code class="sig-prename descclassname">mariadb.constants.CURSOR.</code><code class="sig-name descname">READ_ONLY</code><a class="headerlink" href="#mariadb.constants.CURSOR.READ_ONLY" title="Permalink to this definition">¶</a></dt>
|
||||||
|
<dd><p>Use a read-only server side cursor.</p>
|
||||||
|
</dd></dl>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
<div class="section" id="indicators">
|
||||||
|
<h3>Indicators<a class="headerlink" href="#indicators" title="Permalink to this headline">¶</a></h3>
|
||||||
|
<p>Indicators hold supplementary information when you are modify (insert/update/delete) data with cursors <cite>executemany</cite> method. There are several distinct uses for indicator variables:</p>
|
||||||
|
<dl class="data">
|
||||||
|
<dt id="INDICATOR.NULL">
|
||||||
|
<code class="sig-prename descclassname">INDICATOR.</code><code class="sig-name descname">NULL</code><a class="headerlink" href="#INDICATOR.NULL" title="Permalink to this definition">¶</a></dt>
|
||||||
|
<dd><p>A null value will be inserted or updated</p>
|
||||||
|
</dd></dl>
|
||||||
|
|
||||||
|
<dl class="data">
|
||||||
|
<dt id="INDICATOR.DEFAULT">
|
||||||
|
<code class="sig-prename descclassname">INDICATOR.</code><code class="sig-name descname">DEFAULT</code><a class="headerlink" href="#INDICATOR.DEFAULT" title="Permalink to this definition">¶</a></dt>
|
||||||
|
<dd><p>The default value of a column will be inserted or updated</p>
|
||||||
|
</dd></dl>
|
||||||
|
|
||||||
|
<dl class="data">
|
||||||
|
<dt id="INDICATOR.IGNORE">
|
||||||
|
<code class="sig-prename descclassname">INDICATOR.</code><code class="sig-name descname">IGNORE</code><a class="headerlink" href="#INDICATOR.IGNORE" title="Permalink to this definition">¶</a></dt>
|
||||||
|
<dd><p>Don’t update column at all</p>
|
||||||
|
</dd></dl>
|
||||||
|
|
||||||
|
<dl class="data">
|
||||||
|
<dt id="INDICATOR.IGNORE_ROW">
|
||||||
|
<code class="sig-prename descclassname">INDICATOR.</code><code class="sig-name descname">IGNORE_ROW</code><a class="headerlink" href="#INDICATOR.IGNORE_ROW" title="Permalink to this definition">¶</a></dt>
|
||||||
|
<dd><p>Don’t update or delete row</p>
|
||||||
|
</dd></dl>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
<div class="section" id="capability-flags">
|
||||||
|
<h3>Capability flags<a class="headerlink" href="#capability-flags" title="Permalink to this headline">¶</a></h3>
|
||||||
|
<p>These flags are used when establishing a connection or to check if the database is
|
||||||
|
capabable of a certain feature.</p>
|
||||||
|
<dl class="data">
|
||||||
|
<dt id="CLIENT.MYSQL">
|
||||||
|
<code class="sig-prename descclassname">CLIENT.</code><code class="sig-name descname">MYSQL</code><a class="headerlink" href="#CLIENT.MYSQL" title="Permalink to this definition">¶</a></dt>
|
||||||
|
<dd><p>not in use/supported by MariaDB Server</p>
|
||||||
|
</dd></dl>
|
||||||
|
|
||||||
|
<dl class="data">
|
||||||
|
<dt id="CLIENT.FOUND_ROWS">
|
||||||
|
<code class="sig-prename descclassname">CLIENT.</code><code class="sig-name descname">FOUND_ROWS</code><a class="headerlink" href="#CLIENT.FOUND_ROWS" title="Permalink to this definition">¶</a></dt>
|
||||||
|
<dd><p>return the number of matched rows instead of number of changed rows</p>
|
||||||
|
</dd></dl>
|
||||||
|
|
||||||
|
<dl class="data">
|
||||||
|
<dt id="CLIENT.NO_SCHEMA">
|
||||||
|
<code class="sig-prename descclassname">CLIENT.</code><code class="sig-name descname">NO_SCHEMA</code><a class="headerlink" href="#CLIENT.NO_SCHEMA" title="Permalink to this definition">¶</a></dt>
|
||||||
|
<dd><p>forbids the use of database.tablename.columnname syntax and forces SQL parser
|
||||||
|
to generate an error.</p>
|
||||||
|
</dd></dl>
|
||||||
|
|
||||||
|
<dl class="data">
|
||||||
|
<dt id="CLIENT.LOCAL_FILES">
|
||||||
|
<code class="sig-prename descclassname">CLIENT.</code><code class="sig-name descname">LOCAL_FILES</code><a class="headerlink" href="#CLIENT.LOCAL_FILES" title="Permalink to this definition">¶</a></dt>
|
||||||
|
<dd><p>Allows LOAD DATA LOCAL INFILE statements (if not disabled on server).</p>
|
||||||
|
</dd></dl>
|
||||||
|
|
||||||
|
<dl class="data">
|
||||||
|
<dt id="CLIENT_COMPRESS">
|
||||||
|
<code class="sig-name descname">CLIENT_COMPRESS</code><a class="headerlink" href="#CLIENT_COMPRESS" title="Permalink to this definition">¶</a></dt>
|
||||||
|
<dd><p>Use compressed protocol</p>
|
||||||
|
</dd></dl>
|
||||||
|
|
||||||
|
<dl class="data">
|
||||||
|
<dt id="CLIENT_IGNORE_SPACE">
|
||||||
|
<code class="sig-name descname">CLIENT_IGNORE_SPACE</code><a class="headerlink" href="#CLIENT_IGNORE_SPACE" title="Permalink to this definition">¶</a></dt>
|
||||||
|
<dd><p>Allows spaces after function names. This implies, that all function names will
|
||||||
|
become reserved words.</p>
|
||||||
|
</dd></dl>
|
||||||
|
|
||||||
|
<dl class="data">
|
||||||
|
<dt id="CLIENT_MULTI_RESULZS">
|
||||||
|
<code class="sig-name descname">CLIENT_MULTI_RESULZS</code><a class="headerlink" href="#CLIENT_MULTI_RESULZS" title="Permalink to this definition">¶</a></dt>
|
||||||
|
<dd><p>Indicates that the client is able to handle multiple result sets.</p>
|
||||||
|
</dd></dl>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="sphinxsidebar" role="navigation" aria-label="main navigation">
|
||||||
|
<div class="sphinxsidebarwrapper">
|
||||||
|
<h3><a href="index.html">Table of Contents</a></h3>
|
||||||
|
<ul>
|
||||||
|
<li><a class="reference internal" href="#">Extensions to the DB API</a><ul>
|
||||||
|
<li><a class="reference internal" href="#constants">Constants</a><ul>
|
||||||
|
<li><a class="reference internal" href="#cursor-types">Cursor types</a></li>
|
||||||
|
<li><a class="reference internal" href="#indicators">Indicators</a></li>
|
||||||
|
<li><a class="reference internal" href="#capability-flags">Capability flags</a></li>
|
||||||
|
</ul>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
|
||||||
|
<h4>Previous topic</h4>
|
||||||
|
<p class="topless"><a href="pool.html"
|
||||||
|
title="previous chapter">The ConnectionPool class</a></p>
|
||||||
|
<h4>Next topic</h4>
|
||||||
|
<p class="topless"><a href="license.html"
|
||||||
|
title="next chapter">License</a></p>
|
||||||
|
<div role="note" aria-label="source link">
|
||||||
|
<h3>This Page</h3>
|
||||||
|
<ul class="this-page-menu">
|
||||||
|
<li><a href="_sources/extension.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="license.html" title="License"
|
||||||
|
>next</a> |</li>
|
||||||
|
<li class="right" >
|
||||||
|
<a href="pool.html" title="The ConnectionPool class"
|
||||||
|
>previous</a> |</li>
|
||||||
|
<li class="nav-item nav-item-0"><a href="index.html">MariaDB Connector/Python 1.0.0 documentation</a> »</li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
<div class="footer" role="contentinfo">
|
||||||
|
© Copyright 2019,2020 MariaDB Corporation and Georg Richter.
|
||||||
|
Created using <a href="http://sphinx-doc.org/">Sphinx</a> 2.4.3.
|
||||||
|
</div>
|
||||||
|
</body>
|
||||||
|
</html>
|
@ -102,9 +102,25 @@
|
|||||||
<li><a href="connection.html#change_user">change_user()</a>
|
<li><a href="connection.html#change_user">change_user()</a>
|
||||||
</li>
|
</li>
|
||||||
<li><a href="connection.html#character_set">character_set (built-in variable)</a>
|
<li><a href="connection.html#character_set">character_set (built-in variable)</a>
|
||||||
|
</li>
|
||||||
|
<li><a href="extension.html#CLIENT.FOUND_ROWS">CLIENT.FOUND_ROWS (built-in variable)</a>
|
||||||
|
</li>
|
||||||
|
<li><a href="extension.html#CLIENT.LOCAL_FILES">CLIENT.LOCAL_FILES (built-in variable)</a>
|
||||||
|
</li>
|
||||||
|
<li><a href="extension.html#CLIENT.MYSQL">CLIENT.MYSQL (built-in variable)</a>
|
||||||
|
</li>
|
||||||
|
<li><a href="extension.html#CLIENT.NO_SCHEMA">CLIENT.NO_SCHEMA (built-in variable)</a>
|
||||||
|
</li>
|
||||||
|
<li><a href="extension.html#CLIENT_COMPRESS">CLIENT_COMPRESS (built-in variable)</a>
|
||||||
|
</li>
|
||||||
|
<li><a href="extension.html#CLIENT_IGNORE_SPACE">CLIENT_IGNORE_SPACE (built-in variable)</a>
|
||||||
|
</li>
|
||||||
|
<li><a href="extension.html#CLIENT_MULTI_RESULZS">CLIENT_MULTI_RESULZS (built-in variable)</a>
|
||||||
</li>
|
</li>
|
||||||
<li><a href="connection.html#close">close()</a>
|
<li><a href="connection.html#close">close()</a>
|
||||||
</li>
|
</li>
|
||||||
|
</ul></td>
|
||||||
|
<td style="width: 33%; vertical-align: top;"><ul>
|
||||||
<li><a href="cursor.html#closed">closed (built-in variable)</a>
|
<li><a href="cursor.html#closed">closed (built-in variable)</a>
|
||||||
</li>
|
</li>
|
||||||
<li><a href="connection.html#collation">collation (built-in variable)</a>
|
<li><a href="connection.html#collation">collation (built-in variable)</a>
|
||||||
@ -113,8 +129,6 @@
|
|||||||
</li>
|
</li>
|
||||||
<li><a href="module.html#mariadb.connect">connect() (in module mariadb)</a>
|
<li><a href="module.html#mariadb.connect">connect() (in module mariadb)</a>
|
||||||
</li>
|
</li>
|
||||||
</ul></td>
|
|
||||||
<td style="width: 33%; vertical-align: top;"><ul>
|
|
||||||
<li><a href="cursor.html#connection">connection (built-in variable)</a>
|
<li><a href="cursor.html#connection">connection (built-in variable)</a>
|
||||||
</li>
|
</li>
|
||||||
<li><a href="connection.html#connection_id">connection_id (built-in variable)</a>
|
<li><a href="connection.html#connection_id">connection_id (built-in variable)</a>
|
||||||
@ -197,14 +211,22 @@
|
|||||||
<h2 id="I">I</h2>
|
<h2 id="I">I</h2>
|
||||||
<table style="width: 100%" class="indextable genindextable"><tr>
|
<table style="width: 100%" class="indextable genindextable"><tr>
|
||||||
<td style="width: 33%; vertical-align: top;"><ul>
|
<td style="width: 33%; vertical-align: top;"><ul>
|
||||||
|
<li><a href="extension.html#INDICATOR.DEFAULT">INDICATOR.DEFAULT (built-in variable)</a>
|
||||||
|
</li>
|
||||||
|
<li><a href="extension.html#INDICATOR.IGNORE">INDICATOR.IGNORE (built-in variable)</a>
|
||||||
|
</li>
|
||||||
|
<li><a href="extension.html#INDICATOR.IGNORE_ROW">INDICATOR.IGNORE_ROW (built-in variable)</a>
|
||||||
|
</li>
|
||||||
|
<li><a href="extension.html#INDICATOR.NULL">INDICATOR.NULL (built-in variable)</a>
|
||||||
|
</li>
|
||||||
<li><a href="module.html#mariadb.indicator_default">indicator_default (in module mariadb)</a>
|
<li><a href="module.html#mariadb.indicator_default">indicator_default (in module mariadb)</a>
|
||||||
</li>
|
</li>
|
||||||
|
</ul></td>
|
||||||
|
<td style="width: 33%; vertical-align: top;"><ul>
|
||||||
<li><a href="module.html#mariadb.indicator_ignore">indicator_ignore (in module mariadb)</a>
|
<li><a href="module.html#mariadb.indicator_ignore">indicator_ignore (in module mariadb)</a>
|
||||||
</li>
|
</li>
|
||||||
<li><a href="module.html#mariadb.indicator_null">indicator_null (in module mariadb)</a>
|
<li><a href="module.html#mariadb.indicator_null">indicator_null (in module mariadb)</a>
|
||||||
</li>
|
</li>
|
||||||
</ul></td>
|
|
||||||
<td style="width: 33%; vertical-align: top;"><ul>
|
|
||||||
<li><a href="module.html#mariadb.indicator_row">indicator_row (in module mariadb)</a>
|
<li><a href="module.html#mariadb.indicator_row">indicator_row (in module mariadb)</a>
|
||||||
</li>
|
</li>
|
||||||
<li><a href="module.html#mariadb.IntegrityError">IntegrityError</a>
|
<li><a href="module.html#mariadb.IntegrityError">IntegrityError</a>
|
||||||
@ -238,9 +260,13 @@
|
|||||||
<li><a href="module.html#module-mariadb">mariadb (module)</a>
|
<li><a href="module.html#module-mariadb">mariadb (module)</a>
|
||||||
</li>
|
</li>
|
||||||
<li><a href="connection.html#mariadb.connection">mariadb.connection (built-in class)</a>
|
<li><a href="connection.html#mariadb.connection">mariadb.connection (built-in class)</a>
|
||||||
|
</li>
|
||||||
|
<li><a href="extension.html#mariadb.constants.CURSOR.NONE">mariadb.constants.CURSOR.NONE (built-in variable)</a>
|
||||||
</li>
|
</li>
|
||||||
</ul></td>
|
</ul></td>
|
||||||
<td style="width: 33%; vertical-align: top;"><ul>
|
<td style="width: 33%; vertical-align: top;"><ul>
|
||||||
|
<li><a href="extension.html#mariadb.constants.CURSOR.READ_ONLY">mariadb.constants.CURSOR.READ_ONLY (built-in variable)</a>
|
||||||
|
</li>
|
||||||
<li><a href="cursor.html#mariadb.cursor">mariadb.cursor (built-in class)</a>
|
<li><a href="cursor.html#mariadb.cursor">mariadb.cursor (built-in class)</a>
|
||||||
</li>
|
</li>
|
||||||
<li><a href="module.html#mariadb.mariadbapi_version">mariadbapi_version (in module mariadb)</a>
|
<li><a href="module.html#mariadb.mariadbapi_version">mariadbapi_version (in module mariadb)</a>
|
||||||
|
@ -76,11 +76,19 @@ client library for client server communication.</p>
|
|||||||
</ul>
|
</ul>
|
||||||
</li>
|
</li>
|
||||||
<li class="toctree-l1"><a class="reference internal" href="pool.html">The ConnectionPool class</a></li>
|
<li class="toctree-l1"><a class="reference internal" href="pool.html">The ConnectionPool class</a></li>
|
||||||
|
<li class="toctree-l1"><a class="reference internal" href="extension.html">Extensions to the DB API</a><ul>
|
||||||
|
<li class="toctree-l2"><a class="reference internal" href="extension.html#constants">Constants</a></li>
|
||||||
|
</ul>
|
||||||
|
</li>
|
||||||
<li class="toctree-l1"><a class="reference internal" href="license.html">License</a><ul>
|
<li class="toctree-l1"><a class="reference internal" href="license.html">License</a><ul>
|
||||||
<li class="toctree-l2"><a class="reference internal" href="license.html#mariadb-connector-python">MariaDB Connector/Python</a></li>
|
<li class="toctree-l2"><a class="reference internal" href="license.html#mariadb-connector-python">MariaDB Connector/Python</a></li>
|
||||||
<li class="toctree-l2"><a class="reference internal" href="license.html#mariadb-connector-python-documentation">MariaDB Connector/Python documentation</a></li>
|
<li class="toctree-l2"><a class="reference internal" href="license.html#mariadb-connector-python-documentation">MariaDB Connector/Python documentation</a></li>
|
||||||
</ul>
|
</ul>
|
||||||
</li>
|
</li>
|
||||||
|
<li class="toctree-l1"><a class="reference internal" href="release.html">Release history</a><ul>
|
||||||
|
<li class="toctree-l2"><a class="reference internal" href="release.html#stable-releases-ga">Stable releases (GA)</a></li>
|
||||||
|
</ul>
|
||||||
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
<div class="section" id="indices-and-tables">
|
<div class="section" id="indices-and-tables">
|
||||||
|
BIN
docs/objects.inv
BIN
docs/objects.inv
Binary file not shown.
@ -4,7 +4,7 @@
|
|||||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||||
<head>
|
<head>
|
||||||
<meta charset="utf-8" />
|
<meta charset="utf-8" />
|
||||||
<title>Release notes — MariaDB Connector/Python 1.0.0 documentation</title>
|
<title>Release history — MariaDB Connector/Python 1.0.0 documentation</title>
|
||||||
<link rel="stylesheet" href="_static/classic.css" type="text/css" />
|
<link rel="stylesheet" href="_static/classic.css" type="text/css" />
|
||||||
<link rel="stylesheet" href="_static/pygments.css" type="text/css" />
|
<link rel="stylesheet" href="_static/pygments.css" type="text/css" />
|
||||||
|
|
||||||
@ -39,79 +39,28 @@
|
|||||||
<div class="bodywrapper">
|
<div class="bodywrapper">
|
||||||
<div class="body" role="main">
|
<div class="body" role="main">
|
||||||
|
|
||||||
<div class="section" id="release-notes">
|
<div class="section" id="release-history">
|
||||||
<span id="id1"></span><h1>Release notes<a class="headerlink" href="#release-notes" title="Permalink to this headline">¶</a></h1>
|
<h1>Release history<a class="headerlink" href="#release-history" title="Permalink to this headline">¶</a></h1>
|
||||||
<div class="section" id="mariadb-connector-python-0-9-59-beta">
|
<div class="section" id="stable-releases-ga">
|
||||||
<h2>MariaDB Connector/Python 0.9.59 beta<a class="headerlink" href="#mariadb-connector-python-0-9-59-beta" title="Permalink to this headline">¶</a></h2>
|
<h2>Stable releases (GA)<a class="headerlink" href="#stable-releases-ga" title="Permalink to this headline">¶</a></h2>
|
||||||
<p>Release date: May 26th 2020</p>
|
<div class="section" id="mariadb-connector-python-1-0-0">
|
||||||
<p>Notable Updates:</p>
|
<h3>MariaDB Connector/Python 1.0.0<a class="headerlink" href="#mariadb-connector-python-1-0-0" title="Permalink to this headline">¶</a></h3>
|
||||||
<ul class="simple">
|
<p>Release date: June 24th 2020</p>
|
||||||
<li><p>CONPY-64: Fixed crash when a connection was established without parameters</p></li>
|
<dl class="simple">
|
||||||
<li><p>CONPY-66: Fixed windows build</p></li>
|
<dt>Notable Updates:</dt><dd><ul class="simple">
|
||||||
<li><p>CONPY-62: Fixed String to Decimal conversion (binary protocol)</p></li>
|
<li><p>CONPY-81: Fixed crash when switching between text and binary protocol with same cursor</p></li>
|
||||||
<li><p>CONPY-63: Implemented version and version_info for module</p></li>
|
<li><p>CONPY-80: Parameters in set_config() method of ConnectionPool class have to be checked against the list of DSN keywords</p></li>
|
||||||
|
<li><p>CONPY-79: When inserting NULL values with executemany() method on a server which doesn’t support BULK statements NULL values weren’t inserted correctly.</p></li>
|
||||||
|
<li><p>CONPY-78: Since MaxScale doesn’t support bulk operations yet, we have to check servers extended capability flag to determine if this feature is supported or not.</p></li>
|
||||||
|
<li><p>CONPY-76: Added aliases username, passwd and db to connection keywords.</p></li>
|
||||||
|
<li><p>CONPY-70: set_config() method needs to check the passed parameter and raise an exception if the parameter type is not a dictionary.</p></li>
|
||||||
|
<li><p>CONPY-72: When deallocating the connection pool class, we need to check beside pool_size if the array containing the connections is valid.</p></li>
|
||||||
|
<li><p>Fixed bug when inserting negative integer values with cursor.execute() method</p></li>
|
||||||
|
<li><p>CONPY-69: Set default character set (utf8mb4) with authentication packet</p></li>
|
||||||
</ul>
|
</ul>
|
||||||
|
</dd>
|
||||||
|
</dl>
|
||||||
</div>
|
</div>
|
||||||
<div class="section" id="mariadb-connector-python-0-9-58-beta">
|
|
||||||
<h2>MariaDB Connector/Python 0.9.58 beta<a class="headerlink" href="#mariadb-connector-python-0-9-58-beta" title="Permalink to this headline">¶</a></h2>
|
|
||||||
<p>Release date: May 6th 2020</p>
|
|
||||||
<p>Notable Updates:</p>
|
|
||||||
<ul class="simple">
|
|
||||||
<li><p>CONPY-62: When using binary protocol (which is forced when using a placeholder), the type NEW_DECIMAL was ignored and internally converted as string instead of Decimal</p></li>
|
|
||||||
<li><p>CONPY-61: Fixed bug in execute_many when using NULL values or indicator variables</p></li>
|
|
||||||
<li><p>CONPY-59: Fixed bug when converting invalid date “0000-00-00”. Instead of raising an exception it will be converted to None value.</p></li>
|
|
||||||
<li><p>CONPY-58: Fixed parameter error when using paramstyle PyFormat.</p></li>
|
|
||||||
</ul>
|
|
||||||
</div>
|
|
||||||
<div class="section" id="mariadb-connector-python-0-9-57-beta">
|
|
||||||
<h2>MariaDB Connector/Python 0.9.57 beta<a class="headerlink" href="#mariadb-connector-python-0-9-57-beta" title="Permalink to this headline">¶</a></h2>
|
|
||||||
<p>Release date: April 15th 2020</p>
|
|
||||||
<p>Notable Updates:</p>
|
|
||||||
<ul class="simple">
|
|
||||||
<li><p>Build: Posix builds don’t link statically against Connector/C anymore.</p></li>
|
|
||||||
<li><p>CONPY-53: Allow empty parameter sequence in execute() method</p></li>
|
|
||||||
<li><p>CONPY-56: Support dictionary option in cursor: Added anoptional boolean parameter ‘dictionary’ for cursor class. When dictionary parameter was set to true, the fetch operations will return rows from result set as Dict.</p></li>
|
|
||||||
<li><p>CONPY-55: Fixed memory leak when opening/closing cursor.</p></li>
|
|
||||||
</ul>
|
|
||||||
</div>
|
|
||||||
<div class="section" id="mariadb-connector-python-0-9-56-beta">
|
|
||||||
<h2>MariaDB Connector/Python 0.9.56 beta<a class="headerlink" href="#mariadb-connector-python-0-9-56-beta" title="Permalink to this headline">¶</a></h2>
|
|
||||||
<p>Release date: April 6th 2020</p>
|
|
||||||
<p>Notable Updates:</p>
|
|
||||||
<ul class="simple">
|
|
||||||
<li><p>CONPY-46: Implemented __enter__() and __exit__() methods for with statement (PEP-343). These methods are available now for connection and cursor class.</p></li>
|
|
||||||
<li><p>CONPY-47: When sending parameters PyBool_Type wasn’t supported. In case a boolean type (True/False) will be provided as a parameter, it will be converted to a tinyint (MYSQL_TYPE_TINY).</p></li>
|
|
||||||
<li><p>CONPY-48: Accept List of parameters for execute() method</p></li>
|
|
||||||
<li><p>CONPY-49: Added support for Decimal type When retrieving data with column type MYSQL_TYPE_NEWDECIMAL Connector/Python now loads the decimal module and converts data from string into Pythons decimal.Decimal type. Wnen sending a decimal.Decimal parameter, value will be converted to string and send with type MYSQL_TYPE_NEWDECIMAL to server.</p></li>
|
|
||||||
<li><p>CONPY-51: Store field_count internelly for buffered cursors to prevent overriding/clearing the value by connection methods which directly send commands to database server.</p></li>
|
|
||||||
<li><p>CONPY-52: Fixed double free of resultset.</p></li>
|
|
||||||
</ul>
|
|
||||||
</div>
|
|
||||||
<div class="section" id="mariadb-connector-python-0-9-55-beta">
|
|
||||||
<h2>MariaDB Connector/Python 0.9.55 beta<a class="headerlink" href="#mariadb-connector-python-0-9-55-beta" title="Permalink to this headline">¶</a></h2>
|
|
||||||
<p>Release date: March 30th 2020</p>
|
|
||||||
<p>Notable Updates:</p>
|
|
||||||
<ul class="simple">
|
|
||||||
<li><p>CONPY-9: Fixed description (character length/code points and precision scale)</p></li>
|
|
||||||
<li><p>CONPY-45: Fixed conversion from time and datetime column types</p></li>
|
|
||||||
<li><p>CONPY-32: Fixed crash when fetching GEOMETRY columns</p></li>
|
|
||||||
</ul>
|
|
||||||
</div>
|
|
||||||
<div class="section" id="mariadb-connector-python-0-9-54-beta">
|
|
||||||
<h2>MariaDB Connector/Python 0.9.54 beta<a class="headerlink" href="#mariadb-connector-python-0-9-54-beta" title="Permalink to this headline">¶</a></h2>
|
|
||||||
<p>Release date: Feb 18th 2020</p>
|
|
||||||
<p>Notable Updates:</p>
|
|
||||||
<ul class="simple">
|
|
||||||
<li><p>Fixed parameter sequence when creating a xid object</p></li>
|
|
||||||
<li><p>Added ssl_capath in connect() method</p></li>
|
|
||||||
<li><p>CONPY-40: ConnectionPool._setconfig now accepts only DSN parameters</p></li>
|
|
||||||
<li><p>CONPY-35: Close and reinitialize statement if the cursor was reused with a different SQL statement</p></li>
|
|
||||||
<li><p>CONPY-34: If a python object can’t be converted to a corresponding data type, an exception will be raised.</p></li>
|
|
||||||
<li><p>CONPY-39: If no pool_name was provided, an exception will be raised.</p></li>
|
|
||||||
<li><p>CONPY-33: Segfault when using auto completion in python shell</p></li>
|
|
||||||
<li><p>CONPY-37: Corrected option name: named_tuple</p></li>
|
|
||||||
<li><p>CONPY-36: connection key word socket was renamed to unix_socket</p></li>
|
|
||||||
</ul>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@ -123,13 +72,11 @@
|
|||||||
<div class="sphinxsidebarwrapper">
|
<div class="sphinxsidebarwrapper">
|
||||||
<h3><a href="index.html">Table of Contents</a></h3>
|
<h3><a href="index.html">Table of Contents</a></h3>
|
||||||
<ul>
|
<ul>
|
||||||
<li><a class="reference internal" href="#">Release notes</a><ul>
|
<li><a class="reference internal" href="#">Release history</a><ul>
|
||||||
<li><a class="reference internal" href="#mariadb-connector-python-0-9-59-beta">MariaDB Connector/Python 0.9.59 beta</a></li>
|
<li><a class="reference internal" href="#stable-releases-ga">Stable releases (GA)</a><ul>
|
||||||
<li><a class="reference internal" href="#mariadb-connector-python-0-9-58-beta">MariaDB Connector/Python 0.9.58 beta</a></li>
|
<li><a class="reference internal" href="#mariadb-connector-python-1-0-0">MariaDB Connector/Python 1.0.0</a></li>
|
||||||
<li><a class="reference internal" href="#mariadb-connector-python-0-9-57-beta">MariaDB Connector/Python 0.9.57 beta</a></li>
|
</ul>
|
||||||
<li><a class="reference internal" href="#mariadb-connector-python-0-9-56-beta">MariaDB Connector/Python 0.9.56 beta</a></li>
|
</li>
|
||||||
<li><a class="reference internal" href="#mariadb-connector-python-0-9-55-beta">MariaDB Connector/Python 0.9.55 beta</a></li>
|
|
||||||
<li><a class="reference internal" href="#mariadb-connector-python-0-9-54-beta">MariaDB Connector/Python 0.9.54 beta</a></li>
|
|
||||||
</ul>
|
</ul>
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
|
File diff suppressed because one or more lines are too long
@ -206,18 +206,22 @@ a loop, but much more effective is using the <a class="reference internal" href=
|
|||||||
2
|
2
|
||||||
3
|
3
|
||||||
4
|
4
|
||||||
5</pre></div></td><td class="code"><div class="highlight"><pre><span></span><span class="n">cursor</span><span class="o">.</span><span class="n">execute</span><span class="p">(</span><span class="s2">"CREATE TABLE cakes(id int, cake varchar(100), price decimal(10,2) default 1.99)"</span><span class="p">)</span>
|
5
|
||||||
|
6
|
||||||
|
7</pre></div></td><td class="code"><div class="highlight"><pre><span></span><span class="kn">from</span> <span class="nn">mariadb.constants</span> <span class="kn">import</span> <span class="o">*</span>
|
||||||
|
|
||||||
|
<span class="n">cursor</span><span class="o">.</span><span class="n">execute</span><span class="p">(</span><span class="s2">"CREATE TABLE cakes(id int, cake varchar(100), price decimal(10,2) default 1.99)"</span><span class="p">)</span>
|
||||||
|
|
||||||
<span class="n">sql</span><span class="o">=</span> <span class="s2">"INSERT INTO cakes (id, cake, price) VALUES (?,?)"</span>
|
<span class="n">sql</span><span class="o">=</span> <span class="s2">"INSERT INTO cakes (id, cake, price) VALUES (?,?)"</span>
|
||||||
<span class="n">data</span><span class="o">=</span> <span class="p">[(</span><span class="mi">1</span><span class="p">,</span> <span class="s2">"Cherry Cake"</span><span class="p">,</span> <span class="mf">2.10</span><span class="p">),</span> <span class="p">(</span><span class="mi">2</span><span class="p">,</span> <span class="s2">"Apple Cake"</span><span class="p">,</span> <span class="n">mariadb</span><span class="o">.</span><span class="n">indicator_default</span><span class="p">)]</span>
|
<span class="n">data</span><span class="o">=</span> <span class="p">[(</span><span class="mi">1</span><span class="p">,</span> <span class="s2">"Cherry Cake"</span><span class="p">,</span> <span class="mf">2.10</span><span class="p">),</span> <span class="p">(</span><span class="mi">2</span><span class="p">,</span> <span class="s2">"Apple Cake"</span><span class="p">,</span> <span class="n">INDICATOR</span><span class="o">.</span><span class="n">default</span><span class="p">)]</span>
|
||||||
<span class="n">cursor</span><span class="o">.</span><span class="n">executemany</span><span class="p">(</span><span class="n">sql</span><span class="p">,</span> <span class="n">data</span><span class="p">)</span>
|
<span class="n">cursor</span><span class="o">.</span><span class="n">executemany</span><span class="p">(</span><span class="n">sql</span><span class="p">,</span> <span class="n">data</span><span class="p">)</span>
|
||||||
</pre></div>
|
</pre></div>
|
||||||
</td></tr></table></div>
|
</td></tr></table></div>
|
||||||
<dl class="simple">
|
<dl class="simple">
|
||||||
<dt>Beside the default indicator which inserts the default value of 1.99, the following indicators are supported:</dt><dd><ul class="simple">
|
<dt>Beside the default indicator which inserts the default value of 1.99, the following indicators are supported:</dt><dd><ul class="simple">
|
||||||
<li><p>indicator_ignore: Ignores the value (only update commands)</p></li>
|
<li><p>INDICATOR.IGNORE: Ignores the value (only update commands)</p></li>
|
||||||
<li><p>indicator_null: Value is NULL</p></li>
|
<li><p>INDICATOR.NULL: Value is NULL</p></li>
|
||||||
<li><p>indicator_row: Don’t update or insert row</p></li>
|
<li><p>INDICATOR.IGNORE_ROW: Don’t update or insert row</p></li>
|
||||||
</ul>
|
</ul>
|
||||||
</dd>
|
</dd>
|
||||||
</dl>
|
</dl>
|
||||||
@ -233,6 +237,54 @@ a loop, but much more effective is using the <a class="reference internal" href=
|
|||||||
</div>
|
</div>
|
||||||
<div class="section" id="supported-data-types">
|
<div class="section" id="supported-data-types">
|
||||||
<h4>Supported Data types<a class="headerlink" href="#supported-data-types" title="Permalink to this headline">¶</a></h4>
|
<h4>Supported Data types<a class="headerlink" href="#supported-data-types" title="Permalink to this headline">¶</a></h4>
|
||||||
|
<p>Several standard python types are converted into SQL types and returned as Python objects when a statement is executed.</p>
|
||||||
|
<table class="docutils align-left" id="id1">
|
||||||
|
<caption><span class="caption-text">Supported Data Types</span><a class="headerlink" href="#id1" title="Permalink to this table">¶</a></caption>
|
||||||
|
<colgroup>
|
||||||
|
<col style="width: 50%" />
|
||||||
|
<col style="width: 50%" />
|
||||||
|
</colgroup>
|
||||||
|
<thead>
|
||||||
|
<tr class="row-odd"><th class="head"><p>Python type</p></th>
|
||||||
|
<th class="head"><p>SQL type</p></th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
<tr class="row-even"><td><p>None</p></td>
|
||||||
|
<td><p>NULL</p></td>
|
||||||
|
</tr>
|
||||||
|
<tr class="row-odd"><td><p>Bool</p></td>
|
||||||
|
<td><p>TINYINT</p></td>
|
||||||
|
</tr>
|
||||||
|
<tr class="row-even"><td><p>Float, Double</p></td>
|
||||||
|
<td><p>DOUBLE</p></td>
|
||||||
|
</tr>
|
||||||
|
<tr class="row-odd"><td><p>Decimal</p></td>
|
||||||
|
<td><p>DECIMAL</p></td>
|
||||||
|
</tr>
|
||||||
|
<tr class="row-even"><td><p>Long</p></td>
|
||||||
|
<td><p>TINYINT, SMALLINT, INT, BIGINT</p></td>
|
||||||
|
</tr>
|
||||||
|
<tr class="row-odd"><td><p>String</p></td>
|
||||||
|
<td><p>VARCHAR, VARSTRING, TEXT</p></td>
|
||||||
|
</tr>
|
||||||
|
<tr class="row-even"><td><p>ByteArray, Bytes</p></td>
|
||||||
|
<td><p>TINYBLOB, MEDIUMBLOB, BLOB, LONGBLOB</p></td>
|
||||||
|
</tr>
|
||||||
|
<tr class="row-odd"><td><p>DateTime</p></td>
|
||||||
|
<td><p>DATETIME</p></td>
|
||||||
|
</tr>
|
||||||
|
<tr class="row-even"><td><p>Date</p></td>
|
||||||
|
<td><p>DATE</p></td>
|
||||||
|
</tr>
|
||||||
|
<tr class="row-odd"><td><p>Time</p></td>
|
||||||
|
<td><p>TIME</p></td>
|
||||||
|
</tr>
|
||||||
|
<tr class="row-even"><td><p>Timestamp</p></td>
|
||||||
|
<td><p>TIMESTAMP</p></td>
|
||||||
|
</tr>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
43
mariadb/__init__.py
Normal file
43
mariadb/__init__.py
Normal file
@ -0,0 +1,43 @@
|
|||||||
|
'''
|
||||||
|
MariaDB Connector/Python enables python programs to access MariaDB and MySQL databases, using an API which is compliant with the Python DB API 2.0 (PEP-249). It is written in C and uses MariaDB Connector/C client library for client server communication.
|
||||||
|
|
||||||
|
Minimum supported Python version is 3.6
|
||||||
|
'''
|
||||||
|
|
||||||
|
from ._mariadb import (
|
||||||
|
BINARY,
|
||||||
|
Binary,
|
||||||
|
ConnectionPool,
|
||||||
|
DATETIME,
|
||||||
|
DataError,
|
||||||
|
DatabaseError,
|
||||||
|
Date,
|
||||||
|
DateFromTicks,
|
||||||
|
Error,
|
||||||
|
IntegrityError,
|
||||||
|
InterfaceError,
|
||||||
|
InternalError,
|
||||||
|
NUMBER,
|
||||||
|
NotSupportedError,
|
||||||
|
OperationalError,
|
||||||
|
PoolError,
|
||||||
|
ProgrammingError,
|
||||||
|
ROWID,
|
||||||
|
STRING,
|
||||||
|
Time,
|
||||||
|
TimeFromTicks,
|
||||||
|
Timestamp,
|
||||||
|
TimestampFromTicks,
|
||||||
|
Warning,
|
||||||
|
_CONNECTION_POOLS,
|
||||||
|
__version__,
|
||||||
|
__version_info__,
|
||||||
|
apilevel,
|
||||||
|
connect,
|
||||||
|
fieldinfo,
|
||||||
|
mariadbapi_version,
|
||||||
|
)
|
||||||
|
|
||||||
|
paramstyle= "qmark"
|
||||||
|
apilevel= "2.0"
|
||||||
|
threadsafety= 1
|
28
mariadb/constants/CLIENT.py
Normal file
28
mariadb/constants/CLIENT.py
Normal file
@ -0,0 +1,28 @@
|
|||||||
|
''' MariaDB client flags
|
||||||
|
|
||||||
|
These flags are used when establishing a connection to a MariaDB
|
||||||
|
database server or to check the capabilities of a MariaDB server.
|
||||||
|
'''
|
||||||
|
|
||||||
|
MYSQL = 1 # MariaDB
|
||||||
|
LONG_PASSWORD= 1 # MySQL
|
||||||
|
FOUND_ROWS = 2
|
||||||
|
LONG_FLAG = 4
|
||||||
|
CONNECT_WITH_DB = 8
|
||||||
|
NO_SCHEMA = 16
|
||||||
|
COMPRESS = 32
|
||||||
|
LOCAL_FILES = 128
|
||||||
|
IGNORE_SPACE = 256
|
||||||
|
INTERACTIVE = 1024
|
||||||
|
SSL = 2048
|
||||||
|
TRANSACTIONS = 8192
|
||||||
|
SECURE_CONNECTION = 32768
|
||||||
|
MULTI_STATEMENTS = 1 << 16
|
||||||
|
MULTI_RESULTS = 1 << 17
|
||||||
|
PS_MULTI_RESULTS = 1 << 18
|
||||||
|
PLUGIN_AUTH = 1 << 19
|
||||||
|
CONNECT_ATTRS = 1 << 20
|
||||||
|
CAN_HANDLE_EXPIRED_PASSWORDS = 1 < 22
|
||||||
|
SESSION_TRACKING = 1 << 23
|
||||||
|
SSL_VERIFY_SERVER_CERT = 1 << 30
|
||||||
|
REMEMBER_OPTIONS = 1 << 31
|
2
mariadb/constants/CURSOR.py
Normal file
2
mariadb/constants/CURSOR.py
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
NONE= 0
|
||||||
|
READ_ONLY= 1
|
13
mariadb/constants/INDICATOR.py
Normal file
13
mariadb/constants/INDICATOR.py
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
'''
|
||||||
|
MariaDB indicator variables
|
||||||
|
|
||||||
|
Indicator values are used in executemany() method of cursor class to
|
||||||
|
indicate special values.
|
||||||
|
'''
|
||||||
|
|
||||||
|
import mariadb._mariadb as m
|
||||||
|
|
||||||
|
NULL = m.indicator_null
|
||||||
|
DEFAULT = m.indicator_default
|
||||||
|
IGNORE = m.indicator_ignore
|
||||||
|
IGNORE_ROW = m.indicator_row
|
1
mariadb/constants/__init__.py
Normal file
1
mariadb/constants/__init__.py
Normal file
@ -0,0 +1 @@
|
|||||||
|
__all__ = ["CLIENT", "INDICATOR", "CURSOR"]
|
@ -100,27 +100,12 @@ Mariadb_Methods[] =
|
|||||||
static struct PyModuleDef
|
static struct PyModuleDef
|
||||||
mariadb_module= {
|
mariadb_module= {
|
||||||
PyModuleDef_HEAD_INIT,
|
PyModuleDef_HEAD_INIT,
|
||||||
"mariadb",
|
"_mariadb",
|
||||||
"MariaDB Connector for Python",
|
"MariaDB Connector for Python",
|
||||||
-1,
|
-1,
|
||||||
Mariadb_Methods
|
Mariadb_Methods
|
||||||
};
|
};
|
||||||
|
|
||||||
/* constants */
|
|
||||||
struct st_constants {
|
|
||||||
const char *name;
|
|
||||||
union {
|
|
||||||
long lvalue;
|
|
||||||
const char *strvalue;
|
|
||||||
} u;
|
|
||||||
};
|
|
||||||
|
|
||||||
static struct st_constants int_constants[]= {
|
|
||||||
{"CURSOR_TYPE_READ_ONLY", {CURSOR_TYPE_READ_ONLY}},
|
|
||||||
{"CURSOR_TYPE_NONE", {CURSOR_TYPE_NO_CURSOR}},
|
|
||||||
{NULL, {0}} /* Always last */
|
|
||||||
};
|
|
||||||
|
|
||||||
static void mariadb_add_exception(PyObject *module,
|
static void mariadb_add_exception(PyObject *module,
|
||||||
PyObject **exception,
|
PyObject **exception,
|
||||||
const char *exception_name,
|
const char *exception_name,
|
||||||
@ -137,11 +122,10 @@ static void mariadb_add_exception(PyObject *module,
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* MariaDB module initialization function */
|
/* MariaDB module initialization function */
|
||||||
PyMODINIT_FUNC PyInit_mariadb(void)
|
PyMODINIT_FUNC PyInit__mariadb(void)
|
||||||
{
|
{
|
||||||
PyObject *module= PyModule_Create(&mariadb_module);
|
PyObject *module= PyModule_Create(&mariadb_module);
|
||||||
PyObject *version_info;
|
PyObject *version_info;
|
||||||
struct st_constants *intvals= int_constants;
|
|
||||||
const char *pre_release="";
|
const char *pre_release="";
|
||||||
|
|
||||||
#ifdef PY_MARIADB_PRE_RELEASE_SEGMENT
|
#ifdef PY_MARIADB_PRE_RELEASE_SEGMENT
|
||||||
@ -194,13 +178,6 @@ PyMODINIT_FUNC PyInit_mariadb(void)
|
|||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Mariadb module constants */
|
|
||||||
while (intvals->name) {
|
|
||||||
PyModule_AddIntConstant(module, intvals->name,
|
|
||||||
intvals->u.lvalue);
|
|
||||||
intvals++;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* PEP-396: Module version numbers */
|
/* PEP-396: Module version numbers */
|
||||||
PyModule_AddObject(module, "__version__",
|
PyModule_AddObject(module, "__version__",
|
||||||
PyUnicode_FromString(PY_MARIADB_VERSION));
|
PyUnicode_FromString(PY_MARIADB_VERSION));
|
@ -851,7 +851,7 @@ mariadb_get_parameter(MrdbCursor *self,
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!(row= PyList_GetItem(self->data, row_nr)))
|
if (!(row= ListOrTuple_GetItem(self->data, row_nr)))
|
||||||
{
|
{
|
||||||
mariadb_throw_exception(self->stmt, Mariadb_DataError, 0,
|
mariadb_throw_exception(self->stmt, Mariadb_DataError, 0,
|
||||||
"Can't access row number %d", row_nr + 1);
|
"Can't access row number %d", row_nr + 1);
|
||||||
@ -1056,7 +1056,15 @@ mariadb_check_bulk_parameters(MrdbCursor *self,
|
|||||||
{
|
{
|
||||||
uint32_t i;
|
uint32_t i;
|
||||||
|
|
||||||
if (!(self->array_size= (uint32_t)PyList_Size(data)))
|
if (Py_TYPE(data) != &PyList_Type &&
|
||||||
|
Py_TYPE(data) != &PyTuple_Type)
|
||||||
|
{
|
||||||
|
mariadb_throw_exception(self->stmt, Mariadb_InterfaceError, 1,
|
||||||
|
"Data must be passed as sequence (Tuple or List)");
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!(self->array_size= (uint32_t)ListOrTuple_Size(data)))
|
||||||
{
|
{
|
||||||
mariadb_throw_exception(self->stmt, Mariadb_InterfaceError, 1,
|
mariadb_throw_exception(self->stmt, Mariadb_InterfaceError, 1,
|
||||||
"Empty parameter list. At least one row must be specified");
|
"Empty parameter list. At least one row must be specified");
|
||||||
@ -1065,7 +1073,7 @@ mariadb_check_bulk_parameters(MrdbCursor *self,
|
|||||||
|
|
||||||
for (i=0; i < self->array_size; i++)
|
for (i=0; i < self->array_size; i++)
|
||||||
{
|
{
|
||||||
PyObject *obj= PyList_GetItem(data, i);
|
PyObject *obj= ListOrTuple_GetItem(data, i);
|
||||||
if (self->parser->paramstyle != PYFORMAT &&
|
if (self->parser->paramstyle != PYFORMAT &&
|
||||||
(Py_TYPE(obj) != &PyTuple_Type &&
|
(Py_TYPE(obj) != &PyTuple_Type &&
|
||||||
Py_TYPE(obj) != &PyList_Type))
|
Py_TYPE(obj) != &PyList_Type))
|
@ -28,9 +28,9 @@ char *dsn_keys[]= {
|
|||||||
"ssl_key", "ssl_ca", "ssl_cert", "ssl_crl",
|
"ssl_key", "ssl_ca", "ssl_cert", "ssl_crl",
|
||||||
"ssl_cipher", "ssl_capath", "ssl_crlpath",
|
"ssl_cipher", "ssl_capath", "ssl_crlpath",
|
||||||
"ssl_verify_cert", "ssl",
|
"ssl_verify_cert", "ssl",
|
||||||
"client_flags", "pool_name", "pool_size",
|
"client_flag", "pool_name", "pool_size",
|
||||||
"pool_reset_connection", "plugin_dir",
|
"pool_reset_connection", "plugin_dir",
|
||||||
"username", "db", "passwd",
|
"username", "db", "passwd",
|
||||||
NULL
|
NULL
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -357,7 +357,7 @@ MrdbConnection_Initialize(MrdbConnection *self,
|
|||||||
if (mysql_options(self->mysql, MYSQL_SET_CHARSET_NAME, "utf8mb4"))
|
if (mysql_options(self->mysql, MYSQL_SET_CHARSET_NAME, "utf8mb4"))
|
||||||
{
|
{
|
||||||
mariadb_throw_exception(self->mysql, Mariadb_OperationalError, 1,
|
mariadb_throw_exception(self->mysql, Mariadb_OperationalError, 1,
|
||||||
"Can't set default character set utf8mb4");
|
"Can't set default character set.");
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
@ -1274,8 +1274,8 @@ MrdbCursor_executemany(MrdbCursor *self,
|
|||||||
|
|
||||||
self->data= NULL;
|
self->data= NULL;
|
||||||
|
|
||||||
if (!PyArg_ParseTuple(Args, "s#O!", &statement, &statement_len,
|
if (!PyArg_ParseTuple(Args, "s#O", &statement, &statement_len,
|
||||||
&PyList_Type, &self->data))
|
&self->data))
|
||||||
{
|
{
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
13
setup.py
13
setup.py
@ -75,12 +75,12 @@ setup(name='mariadb',
|
|||||||
"Documentation": "https://mariadb-corporation.github.io/mariadb-connector-python/",
|
"Documentation": "https://mariadb-corporation.github.io/mariadb-connector-python/",
|
||||||
"Source Code": "https://www.github.com/mariadb-corporation/mariadb-connector-python",
|
"Source Code": "https://www.github.com/mariadb-corporation/mariadb-connector-python",
|
||||||
},
|
},
|
||||||
ext_modules=[Extension('mariadb', ['src/mariadb.c', 'src/mariadb_connection.c',
|
ext_modules=[Extension('mariadb._mariadb', ['mariadb/mariadb.c', 'mariadb/mariadb_connection.c',
|
||||||
'src/mariadb_exception.c', 'src/mariadb_cursor.c',
|
'mariadb/mariadb_exception.c', 'mariadb/mariadb_cursor.c',
|
||||||
'src/mariadb_codecs.c', 'src/mariadb_field.c',
|
'mariadb/mariadb_codecs.c', 'mariadb/mariadb_field.c',
|
||||||
'src/mariadb_parser.c',
|
'mariadb/mariadb_parser.c',
|
||||||
'src/mariadb_pooling.c',
|
'mariadb/mariadb_pooling.c',
|
||||||
'src/mariadb_dbapitype.c', 'src/mariadb_indicator.c'],
|
'mariadb/mariadb_dbapitype.c', 'mariadb/mariadb_indicator.c'],
|
||||||
define_macros= define_macros,
|
define_macros= define_macros,
|
||||||
include_dirs=cfg.includes,
|
include_dirs=cfg.includes,
|
||||||
library_dirs=cfg.lib_dirs,
|
library_dirs=cfg.lib_dirs,
|
||||||
@ -89,4 +89,5 @@ setup(name='mariadb',
|
|||||||
extra_link_args = cfg.extra_link_args,
|
extra_link_args = cfg.extra_link_args,
|
||||||
extra_objects= cfg.extra_objects
|
extra_objects= cfg.extra_objects
|
||||||
)],
|
)],
|
||||||
|
py_modules=['mariadb.__init__', 'mariadb.constants.CLIENT', 'mariadb.constants.INDICATOR', 'mariadb.constants.CURSOR'],
|
||||||
)
|
)
|
||||||
|
@ -60,7 +60,7 @@ class TestConnection(unittest.TestCase):
|
|||||||
cursor.execute("CREATE TEMPORARY TABLE t1 (a int)")
|
cursor.execute("CREATE TEMPORARY TABLE t1 (a int)")
|
||||||
try:
|
try:
|
||||||
cursor.execute("LOAD DATA LOCAL INFILE 'x.x' INTO TABLE t1")
|
cursor.execute("LOAD DATA LOCAL INFILE 'x.x' INTO TABLE t1")
|
||||||
except mariadb.ProgrammingError:
|
except mariadb.DatabaseError:
|
||||||
pass
|
pass
|
||||||
del cursor
|
del cursor
|
||||||
del new_conn
|
del new_conn
|
@ -8,6 +8,7 @@ import os
|
|||||||
from decimal import Decimal
|
from decimal import Decimal
|
||||||
|
|
||||||
import mariadb
|
import mariadb
|
||||||
|
from mariadb.constants import *
|
||||||
|
|
||||||
from test.base_test import create_connection
|
from test.base_test import create_connection
|
||||||
|
|
||||||
@ -121,6 +122,24 @@ class TestCursor(unittest.TestCase):
|
|||||||
self.assertEqual(row[3], c4)
|
self.assertEqual(row[3], c4)
|
||||||
del cursor
|
del cursor
|
||||||
|
|
||||||
|
def test_inserttuple(self):
|
||||||
|
if os.environ.get("MAXSCALE_VERSION"):
|
||||||
|
self.skipTest("MAXSCALE doesn't support BULK yet")
|
||||||
|
cursor = self.connection.cursor()
|
||||||
|
cursor.execute("CREATE TEMPORARY TABLE test_inserttuple (id int, name varchar(64), "
|
||||||
|
"city varchar(64))");
|
||||||
|
params = ((1, u"Jack", u"Boston"),
|
||||||
|
(2, u"Martin", u"Ohio"),
|
||||||
|
(3, u"James", u"Washington"),
|
||||||
|
(4, u"Rasmus", u"Helsinki"),
|
||||||
|
(5, u"Andrey", u"Sofia"))
|
||||||
|
cursor.executemany("INSERT INTO test_inserttuple VALUES (?,?,?)", params);
|
||||||
|
|
||||||
|
cursor.execute("SELECT name FROM test_inserttuple ORDER BY id DESC")
|
||||||
|
row= cursor.fetchone()
|
||||||
|
self.assertEqual("Andrey", row[0]);
|
||||||
|
del cursor
|
||||||
|
|
||||||
def test_fetchmany(self):
|
def test_fetchmany(self):
|
||||||
if os.environ.get("MAXSCALE_VERSION"):
|
if os.environ.get("MAXSCALE_VERSION"):
|
||||||
self.skipTest("MAXSCALE doesn't support BULK yet")
|
self.skipTest("MAXSCALE doesn't support BULK yet")
|
||||||
@ -326,8 +345,8 @@ class TestCursor(unittest.TestCase):
|
|||||||
|
|
||||||
def test_multi_cursor(self):
|
def test_multi_cursor(self):
|
||||||
cursor = self.connection.cursor()
|
cursor = self.connection.cursor()
|
||||||
cursor1 = self.connection.cursor(cursor_type=1)
|
cursor1 = self.connection.cursor(cursor_type=CURSOR.READ_ONLY)
|
||||||
cursor2 = self.connection.cursor(cursor_type=1)
|
cursor2 = self.connection.cursor(cursor_type=CURSOR.READ_ONLY)
|
||||||
|
|
||||||
cursor.execute("CREATE TEMPORARY TABLE test_multi_cursor (a int)")
|
cursor.execute("CREATE TEMPORARY TABLE test_multi_cursor (a int)")
|
||||||
cursor.execute("INSERT INTO test_multi_cursor VALUES (1),(2),(3),(4),(5),(6),(7),(8)")
|
cursor.execute("INSERT INTO test_multi_cursor VALUES (1),(2),(3),(4),(5),(6),(7),(8)")
|
||||||
@ -384,7 +403,7 @@ class TestCursor(unittest.TestCase):
|
|||||||
|
|
||||||
cursor = self.connection.cursor()
|
cursor = self.connection.cursor()
|
||||||
cursor.execute("CREATE TEMPORARY TABLE ind1 (a int, b int default 2,c int)")
|
cursor.execute("CREATE TEMPORARY TABLE ind1 (a int, b int default 2,c int)")
|
||||||
vals = [(1,4,3),(mariadb.indicator_null, mariadb.indicator_default, 3)]
|
vals = [(1,4,3),(INDICATOR.NULL, INDICATOR.DEFAULT, 3)]
|
||||||
cursor.executemany("INSERT INTO ind1 VALUES (?,?,?)", vals)
|
cursor.executemany("INSERT INTO ind1 VALUES (?,?,?)", vals)
|
||||||
cursor.execute("SELECT a, b, c FROM ind1")
|
cursor.execute("SELECT a, b, c FROM ind1")
|
||||||
row = cursor.fetchone()
|
row = cursor.fetchone()
|
||||||
@ -744,7 +763,7 @@ class TestCursor(unittest.TestCase):
|
|||||||
|
|
||||||
def test_conpy35(self):
|
def test_conpy35(self):
|
||||||
con= create_connection()
|
con= create_connection()
|
||||||
cursor = con.cursor(cursor_type=mariadb.CURSOR_TYPE_READ_ONLY)
|
cursor = con.cursor(cursor_type=CURSOR.READ_ONLY)
|
||||||
cursor.execute("CREATE TEMPORARY table sample (id BIGINT AUTO_INCREMENT PRIMARY KEY, name VARCHAR(64))");
|
cursor.execute("CREATE TEMPORARY table sample (id BIGINT AUTO_INCREMENT PRIMARY KEY, name VARCHAR(64))");
|
||||||
|
|
||||||
for name in ('foo', 'bar', 'baz'):
|
for name in ('foo', 'bar', 'baz'):
|
||||||
@ -911,7 +930,7 @@ class TestCursor(unittest.TestCase):
|
|||||||
row= cursor.fetchone()
|
row= cursor.fetchone()
|
||||||
self.assertEqual(row[0], None)
|
self.assertEqual(row[0], None)
|
||||||
cursor.execute("DELETE FROM ind1")
|
cursor.execute("DELETE FROM ind1")
|
||||||
vals=[(1,4,3), (mariadb.indicator_null, mariadb.indicator_default, None)]
|
vals=[(1,4,3), (INDICATOR.NULL, INDICATOR.DEFAULT, None)]
|
||||||
cursor.executemany("INSERT INTO ind1 VALUES (?,?,?)", vals)
|
cursor.executemany("INSERT INTO ind1 VALUES (?,?,?)", vals)
|
||||||
cursor.execute("SELECT a, b, c FROM ind1")
|
cursor.execute("SELECT a, b, c FROM ind1")
|
||||||
row= cursor.fetchone()
|
row= cursor.fetchone()
|
Reference in New Issue
Block a user