from SqlDb import SqlDb
import mysql.connector


class Mysqldb(SqlDb):

    def create_connexion(self, user, password, host, database, string_connect):
        if string_connect:
            return mysql.connector.connect(string_connect)
        if database:
            #return mysql.connector.connect(user=user, password=password, host=host, database=database)
            return mysql.connector.connect(user=user, password=password, host=host, database=database)
            # return mysql.connector.connect(user=user, password=password, host=host, port=3306, database=database)
        else:
            return mysql.connector.connect(user=user, password=password, host=host)

    def get_size(self, cursor, db):
        query_size = "SELECT Round(Sum(data_length + index_length) / 1024 / 1024, 1) " \
                     "FROM information_schema.tables GROUP BY table_schema"
        cursor.execute(query_size)
        size = cursor.fetchone()[0]
        return size

10a1e48f59b97f12396d872a6046e59805d0b7ea
<mask token>


class Mysqldb(SqlDb):
    <mask token>
    <mask token>

<mask token>


class Mysqldb(SqlDb):
    <mask token>

    def get_size(self, cursor, db):
        query_size = (
            'SELECT Round(Sum(data_length + index_length) / 1024 / 1024, 1) FROM information_schema.tables GROUP BY table_schema'
            )
        cursor.execute(query_size)
        size = cursor.fetchone()[0]
        return size

<mask token>


class Mysqldb(SqlDb):

    def create_connexion(self, user, password, host, database, string_connect):
        if string_connect:
            return mysql.connector.connect(string_connect)
        if database:
            return mysql.connector.connect(user=user, password=password,
                host=host, database=database)
        else:
            return mysql.connector.connect(user=user, password=password,
                host=host)

    def get_size(self, cursor, db):
        query_size = (
            'SELECT Round(Sum(data_length + index_length) / 1024 / 1024, 1) FROM information_schema.tables GROUP BY table_schema'
            )
        cursor.execute(query_size)
        size = cursor.fetchone()[0]
        return size

from SqlDb import SqlDb
import mysql.connector


class Mysqldb(SqlDb):

    def create_connexion(self, user, password, host, database, string_connect):
        if string_connect:
            return mysql.connector.connect(string_connect)
        if database:
            return mysql.connector.connect(user=user, password=password,
                host=host, database=database)
        else:
            return mysql.connector.connect(user=user, password=password,
                host=host)

    def get_size(self, cursor, db):
        query_size = (
            'SELECT Round(Sum(data_length + index_length) / 1024 / 1024, 1) FROM information_schema.tables GROUP BY table_schema'
            )
        cursor.execute(query_size)
        size = cursor.fetchone()[0]
        return size

from SqlDb import SqlDb
import mysql.connector


class Mysqldb(SqlDb):

    def create_connexion(self, user, password, host, database, string_connect):
        if string_connect:
            return mysql.connector.connect(string_connect)
        if database:
            #return mysql.connector.connect(user=user, password=password, host=host, database=database)
            return mysql.connector.connect(user=user, password=password, host=host, database=database)
            # return mysql.connector.connect(user=user, password=password, host=host, port=3306, database=database)
        else:
            return mysql.connector.connect(user=user, password=password, host=host)

    def get_size(self, cursor, db):
        query_size = "SELECT Round(Sum(data_length + index_length) / 1024 / 1024, 1) " \
                     "FROM information_schema.tables GROUP BY table_schema"
        cursor.execute(query_size)
        size = cursor.fetchone()[0]
        return size
