mirror of
https://github.com/mariadb-corporation/mariadb-connector-python.git
synced 2025-08-14 08:56:00 +00:00
- minor Documentatiion fixes
- fixed test cases using removed character set option
This commit is contained in:
@ -4,24 +4,24 @@
|
|||||||
"\n"\
|
"\n"\
|
||||||
"Establishes a connection to a database server and returns a connection\n"\
|
"Establishes a connection to a database server and returns a connection\n"\
|
||||||
"object.\n\n"\
|
"object.\n\n"\
|
||||||
"Connection attributes:\n"\
|
"Connection parameters are provided as a set of keyword arguments:\n"\
|
||||||
"----------------------\n"\
|
"----------------------\n"\
|
||||||
"user: string\n"\
|
|
||||||
" username used to authenticate with the database server\n\n"\
|
|
||||||
"password: string\n"\
|
|
||||||
" password to authenticate\n\n"\
|
|
||||||
"host: string\n"\
|
"host: string\n"\
|
||||||
" host name or IP address of the database server\n\n"\
|
" The host name or IP address of the database server\n\n"\
|
||||||
|
"user: string\n"\
|
||||||
|
" The username used to authenticate with the database server\n\n"\
|
||||||
|
"password: string\n"\
|
||||||
|
" The password of the given user\n\n"\
|
||||||
"database: string\n"\
|
"database: string\n"\
|
||||||
" database (schema) name to used when connecting with the database\n"\
|
" database (schema) name to use when connecting with the database\n"\
|
||||||
" server\n\n"\
|
" server\n\n"\
|
||||||
"unix_socket: string\n"\
|
"unix_socket: string\n"\
|
||||||
" location of the unix socket file\n\n"\
|
" The location of the unix socket file to use instead of using an IP port\n"\
|
||||||
|
" to connect. If socket authentication is enabled, this can also be used\n"\
|
||||||
|
" in place of a password.\n\n"\
|
||||||
"port: integer\n"\
|
"port: integer\n"\
|
||||||
" port number of the database server. If not specified the default\n"\
|
" port number of the database server. If not specified the default\n"\
|
||||||
" value (=3306) will be used.\n\n"\
|
" value of 3306 will be used.\n\n"\
|
||||||
"charset: string\n"\
|
|
||||||
" default character set to be used\n\n"\
|
|
||||||
"connect_timeout: integer\n"\
|
"connect_timeout: integer\n"\
|
||||||
" connect timeout in seconds\n\n"\
|
" connect timeout in seconds\n\n"\
|
||||||
"read_timeout: integer\n"\
|
"read_timeout: integer\n"\
|
||||||
@ -67,4 +67,4 @@
|
|||||||
"ssl_verify_server_cert: boolean\n"\
|
"ssl_verify_server_cert: boolean\n"\
|
||||||
" Enables server certificate verification.\n\n"\
|
" Enables server certificate verification.\n\n"\
|
||||||
"ssl_enforce: Boolean\n"\
|
"ssl_enforce: Boolean\n"\
|
||||||
" Always use a secure TLS connection\n\n"
|
" The connection must use TLS security or it will fail.\n\n"
|
||||||
|
@ -24,7 +24,7 @@ PyDoc_STRVAR(
|
|||||||
PyDoc_STRVAR(
|
PyDoc_STRVAR(
|
||||||
connection__doc__,
|
connection__doc__,
|
||||||
"The Connection class is used to open and manage a connection to a\n"
|
"The Connection class is used to open and manage a connection to a\n"
|
||||||
"database server"
|
"MariaDB or compatible database server"
|
||||||
);
|
);
|
||||||
|
|
||||||
PyDoc_STRVAR(
|
PyDoc_STRVAR(
|
||||||
|
@ -18,7 +18,7 @@
|
|||||||
*************************************************************************************/
|
*************************************************************************************/
|
||||||
PyDoc_STRVAR(
|
PyDoc_STRVAR(
|
||||||
module_binary__doc__,
|
module_binary__doc__,
|
||||||
"binary(string)\n"
|
"Binary(string)\n"
|
||||||
"--\n"
|
"--\n"
|
||||||
"\n"
|
"\n"
|
||||||
"This function constructs an object capable of holding a binary (long)\n"
|
"This function constructs an object capable of holding a binary (long)\n"
|
||||||
|
@ -65,7 +65,7 @@ int clock_gettime(int dummy, struct timespec *ct);
|
|||||||
#endif /* L64 */
|
#endif /* L64 */
|
||||||
#endif /* _WIN32 */
|
#endif /* _WIN32 */
|
||||||
|
|
||||||
#define MAX_TPC_XID_SIZE 65
|
#define MAX_TPC_XID_SIZE 64
|
||||||
#define POOL_DEFAULT_SIZE 5
|
#define POOL_DEFAULT_SIZE 5
|
||||||
|
|
||||||
/* Magic constant for checking dynamic columns */
|
/* Magic constant for checking dynamic columns */
|
||||||
@ -134,7 +134,7 @@ typedef struct {
|
|||||||
uint8_t is_buffered;
|
uint8_t is_buffered;
|
||||||
uint8_t is_closed;
|
uint8_t is_closed;
|
||||||
enum enum_tpc_state tpc_state;
|
enum enum_tpc_state tpc_state;
|
||||||
char xid[MAX_TPC_XID_SIZE];
|
char xid[150]; /* large enough, to hold 2 * MAX_TPC_XID size + integer value */
|
||||||
PyObject *dsn; /* always null */
|
PyObject *dsn; /* always null */
|
||||||
PyObject *tls_cipher;
|
PyObject *tls_cipher;
|
||||||
PyObject *tls_version;
|
PyObject *tls_version;
|
||||||
|
4
setup.py
4
setup.py
@ -29,7 +29,7 @@ setup(name='mariadb',
|
|||||||
version='0.9.54',
|
version='0.9.54',
|
||||||
python_requires='>=3.6',
|
python_requires='>=3.6',
|
||||||
classifiers = [
|
classifiers = [
|
||||||
'Development Status :: 3 - Alpha',
|
'Development Status :: 4 - Beta',
|
||||||
'Environment :: Console',
|
'Environment :: Console',
|
||||||
'Environment :: MacOS X',
|
'Environment :: MacOS X',
|
||||||
'Environment :: Win32 (MS Windows)',
|
'Environment :: Win32 (MS Windows)',
|
||||||
@ -55,7 +55,7 @@ setup(name='mariadb',
|
|||||||
url='https://www.github.com/mariadb-corporation/mariadb-connector-python',
|
url='https://www.github.com/mariadb-corporation/mariadb-connector-python',
|
||||||
project_urls={
|
project_urls={
|
||||||
"Bug Tracker": "https://jira.mariadb.org/",
|
"Bug Tracker": "https://jira.mariadb.org/",
|
||||||
"Documentation": "https://github.com/mariadb-corporation/mariadb-connector-python/wiki",
|
"Documentation": "https://mariadb-connectorpython.readthedocs.io/en/latest/",
|
||||||
"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', ['src/mariadb.c', 'src/mariadb_connection.c',
|
||||||
|
@ -42,7 +42,6 @@ static PyObject *get_exception_type(const char *sqlstate)
|
|||||||
if (!sqlstate || strlen(sqlstate) != 5)
|
if (!sqlstate || strlen(sqlstate) != 5)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
|
|
||||||
if (!strncmp(sqlstate, "21", 2) ||
|
if (!strncmp(sqlstate, "21", 2) ||
|
||||||
!strncmp(sqlstate, "22", 2) ||
|
!strncmp(sqlstate, "22", 2) ||
|
||||||
!strncmp(sqlstate, "02", 2))
|
!strncmp(sqlstate, "02", 2))
|
||||||
@ -88,6 +87,7 @@ static PyObject *get_exception_type(const char *sqlstate)
|
|||||||
!strncmp(sqlstate, "42", 2) ||
|
!strncmp(sqlstate, "42", 2) ||
|
||||||
!strncmp(sqlstate, "70", 2))
|
!strncmp(sqlstate, "70", 2))
|
||||||
return Mariadb_ProgrammingError;
|
return Mariadb_ProgrammingError;
|
||||||
|
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -613,7 +613,7 @@ class TestCursor(unittest.TestCase):
|
|||||||
# F0 9F 8C B6 🌶 unicode 7 hot pepper
|
# F0 9F 8C B6 🌶 unicode 7 hot pepper
|
||||||
# F0 9F 8E A4 🎤 unicode 8 no microphones
|
# F0 9F 8E A4 🎤 unicode 8 no microphones
|
||||||
# F0 9F A5 82 🥂 unicode 9 champagne glass
|
# F0 9F A5 82 🥂 unicode 9 champagne glass
|
||||||
con = create_connection({"charset": "utf8mb4"})
|
con = create_connection()
|
||||||
cursor = con.cursor()
|
cursor = con.cursor()
|
||||||
cursor.execute(
|
cursor.execute(
|
||||||
"CREATE TEMPORARY TABLE `test_utf8` (`test` blob)")
|
"CREATE TEMPORARY TABLE `test_utf8` (`test` blob)")
|
||||||
@ -623,17 +623,6 @@ class TestCursor(unittest.TestCase):
|
|||||||
self.assertEqual(row[0], b"\xf0\x9f\x98\x8e\xf0\x9f\x8c\xb6\xf0\x9f\x8e\xa4\xf0\x9f\xa5\x82")
|
self.assertEqual(row[0], b"\xf0\x9f\x98\x8e\xf0\x9f\x8c\xb6\xf0\x9f\x8e\xa4\xf0\x9f\xa5\x82")
|
||||||
del cursor, con
|
del cursor, con
|
||||||
|
|
||||||
def test_latin2(self):
|
|
||||||
con = create_connection({"charset": "cp1251"})
|
|
||||||
cursor = con.cursor()
|
|
||||||
cursor.execute(
|
|
||||||
"CREATE TEMPORARY TABLE `test_latin2` (`test` blob)")
|
|
||||||
cursor.execute("INSERT INTO test_latin2 VALUES (?)", (b"\xA9\xB0",))
|
|
||||||
cursor.execute("SELECT * FROM test_latin2")
|
|
||||||
row = cursor.fetchone()
|
|
||||||
# self.assertEqual(row[0], b"\xf0\x9f\x98\x8e\xf0\x9f\x8c\xb6\xf0\x9f\x8e\xa4\xf0\x9f\xa5\x82")
|
|
||||||
del cursor, con
|
|
||||||
|
|
||||||
def test_conpy27(self):
|
def test_conpy27(self):
|
||||||
con = create_connection()
|
con = create_connection()
|
||||||
cursor = con.cursor(prepared=True)
|
cursor = con.cursor(prepared=True)
|
||||||
|
Reference in New Issue
Block a user