ekmmeters.py
def mapTypeToSql(fld_type=FieldType.NoType, fld_len=0):
        """ Translate FieldType to portable SQL Type.  Override if needful.
        Args:
            fld_type (int): :class:`~ekmmeters.FieldType` in serial block.
            fld_len (int): Binary length in serial block

        Returns:
            string: Portable SQL type and length where appropriate.
        """
        if fld_type == FieldType.Float:
            return "FLOAT"
        elif fld_type == FieldType.String:
            return "VARCHAR(" + str(fld_len) + ")"
        elif fld_type == FieldType.Int:
            return "INT"
        elif fld_type == FieldType.Hex:
            return "VARCHAR(" + str(fld_len * 2) + ")"
        elif fld_type == FieldType.PowerFactor:
            return "VARCHAR(" + str(fld_len) + ")"
        else:
            ekm_log("Type " + str(type) + " not handled by mapTypeToSql, returned VARCHAR(255)")
            return "VARCHAR(255)"
def mapTypeToSql(fld_type=FieldType.NoType, fld_len=0):
        """ Translate FieldType to portable SQL Type.  Override if needful.
        Args:
            fld_type (int): :class:`~ekmmeters.FieldType` in serial block.
            fld_len (int): Binary length in serial block

        Returns:
            string: Portable SQL type and length where appropriate.
        """
        if fld_type == FieldType.Float:
            return "FLOAT"
        elif fld_type == FieldType.String:
            return "VARCHAR(" + str(fld_len) + ")"
        elif fld_type == FieldType.Int:
            return "INT"
        elif fld_type == FieldType.Hex:
            return "VARCHAR(" + str(fld_len * 2) + ")"
        elif fld_type == FieldType.PowerFactor:
            return "VARCHAR(" + str(fld_len) + ")"
        else:
            ekm_log("Type " + str(type) + " not handled by mapTypeToSql, returned VARCHAR(255)")
            return "VARCHAR(255)"
Translate FieldType to portable SQL Type.  Override if needful.
        Args:
            fld_type (int): :class:`~ekmmeters.FieldType` in serial block.
            fld_len (int): Binary length in serial block

        Returns:
            string: Portable SQL type and length where appropriate.