Products.ZMySQLDA.DA.Connection — Products.ZMySQLDA 4.0b2.dev0 documentation

# `Products.ZMySQLDA.DA.Connection`

The ZODB-based MySQL Database Connection object

class `Products.ZMySQLDA.DA.` `Connection`(id, title, connection_string, check, use_unicode=None, auto_create_db=None)

  Bases: `Shared.DC.ZRDB.Connection.Connection`

  Zope database adapter for MySQL/MariaDB

  `__init__`(id, title, connection_string, check, use_unicode=None, auto_create_db=None)

    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 type `CHAR`, `VARCHAR` and `TEXT` are returned as unicode strings by the database backend. Combined with the hardcoded `UTF-8` character set of this package the setting allows you to control the character set of database return values better. Default: False.
    Bool: | auto_create_db – If the database given in `connection_string` does not exist, create it automatically. Default: False.

  `connect`(conn_string)

    Base API. Opens connection to mysql. Raises if problems.

    String: | conn_string – The database connection string

  `factory`()

    Base API. Returns factory method for DB connections.

  `manage_edit`(title, connection_string, check=None, use_unicode=None, auto_create_db=None)

    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.
    Bool: | auto_create_db – If the database given in `connection_string` does not exist, create it automatically. Default: False.

  `sql_quote__`(sql_str, escapes={})

    Base API. Used to massage SQL strings for use in queries.

    String: | sql_str – The raw SQL string to transform.
    Dict: | escapes – Additional escape transformations. Default: empty `dict`.

  `tpValues`()

    Support the DTML `tree` tag

    Used in the Zope ZMI `Browse` tab

`Products.ZMySQLDA.DA.` `manage_addZMySQLConnection`(self, id, title, connection_string, check=None, use_unicode=None, auto_create_db=None, REQUEST=None)

  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 type `CHAR`, `VARCHAR` and `TEXT` are returned as unicode strings by the database backend. Combined with the hardcoded `UTF-8` character set of this package the setting allows you to control the character set of database return values better. Default: False.
  Bool: | auto_create_db – If the database given in `connection_string` does not exist, create it automatically. Default: False.
  Object: | REQUEST – The currently active Zope request object. Default: None.