Products.ZMySQLDA.DA.Connection
¶
The ZODB-based MySQL Database Connection object
- class Products.ZMySQLDA.DA.Connection(id, title, connection_string, check, use_unicode=None, charset=None, auto_create_db=None, timeout=None)[source]¶
Bases:
Connection
Zope database adapter for MySQL/MariaDB
- __init__(id, title, connection_string, check, use_unicode=None, charset=None, auto_create_db=None, timeout=None)[source]¶
Instance setup. Optionally opens the connection.
- String:
id – The id of the ZMySQLDA Connection
- String:
title – The title of the ZMySQLDA Connection
- String:
connection_string – The connection string describes how to connect to the relational database. See the documentation for details.
- Bool:
check – Check if the database connection can be opened after instantiation.
- Bool:
use_unicode – If set to
True
, values from columns of typeCHAR
,VARCHAR
andTEXT
are returned as unicode strings by the database backend. Combined with the hardcodedutf8
character set of this package the setting allows you to control the character set of database return values better. Default: False.- String:
charset – The character set for the connection. MySQL/MariaDB will encode query results to this character set.
Only utf8 will work. Default: utf8
- Bool:
auto_create_db – If the database given in
connection_string
does not exist, create it automatically. Default: False.- Int:
timeout – The connect timeout for the connection in seconds. Default: None
- connect(conn_string)[source]¶
Base API. Opens connection to mysql. Raises if problems.
- String:
conn_string – The database connection string
- manage_edit(title, connection_string, check=None, use_unicode=None, charset=None, auto_create_db=None, timeout=None, REQUEST=None)[source]¶
Edit the connection attributes through the Zope ZMI.
- String:
title – The title of the ZMySQLDA Connection
- String:
connection_string – The connection string describes how to connect to the relational database. See the documentation for details.
- Bool:
check – Check if the database connection can be opened after instantiation. Default: False.
- Bool:
use_unicode – Use unicode internally. Default: False.
- String:
charset – The character set for the connection. MySQL/MariaDB will encode query results to this character set.
Only utf8 will work. Default: utf8
- Bool:
auto_create_db – If the database given in
connection_string
does not exist, create it automatically. Default: False.- Int:
timeout – The connect timeout for the connection in seconds. Default: None
- Request:
REQUEST – A Zope REQUEST object
- Products.ZMySQLDA.DA.manage_addZMySQLConnection(self, id, title, connection_string, check=None, use_unicode=None, auto_create_db=None, charset=None, timeout=None, REQUEST=None)[source]¶
Factory function to add a connection object from the Zope ZMI.
- String:
id – The id of the ZMySQLDA Connection
- String:
title – The title of the ZMySQLDA Connection
- String:
connection_string – The connection string describes how to connect to the relational database. See the documentation for details.
- Bool:
check – Check if the database connection can be opened after instantiation. Default: False.
- Bool:
use_unicode – If set to
True
, values from columns of typeCHAR
,VARCHAR
andTEXT
are returned as unicode strings by the database backend. Combined with the hardcodedutf8
character set of this package the setting allows you to control the character set of database return values better. Default: False.- String:
charset – The character set for the connection. MySQL/MariaDB will encode query results to this character set.
Only utf8 will work. Default: utf8
- Bool:
auto_create_db – If the database given in
connection_string
does not exist, create it automatically. Default: False.- Int:
timeout – The connect timeout for the connection in seconds. Default: None
- Object:
REQUEST – The currently active Zope request object. Default: None.