コード例 #1
0
ファイル: cc_storedvar.py プロジェクト: parijatsahai/camcops
def get_server_storedvar(name):
    """Fetches a ServerStoredVar() object, or None."""
    # lookup by name, not client ID
    try:
        row = pls.db.fetchone("SELECT name FROM {table} WHERE name=?".format(table=ServerStoredVar.TABLENAME), name)
    except Exception as inst:
        # May fail if e.g. no storedvar table created yet
        logger.error(str(inst))
        return None
    if row is None or row[0] is None:
        return None
    return ServerStoredVar(name)
コード例 #2
0
ファイル: cc_storedvar.py プロジェクト: parijatsahai/camcops
def get_device_storedvar(device, name, era):
    """Fetches a DeviceStoredVar() object, or None."""
    # lookup by name, not client ID
    try:
        row = pls.db.fetchone(
            """
                SELECT _pk
                FROM {table}
                WHERE _current AND _device=? AND name=? AND _era=?
            """.format(
                table=DeviceStoredVar.TABLENAME
            ),
            device,
            name,
            era,
        )
    except Exception as inst:
        # May fail if e.g. no storedvar table created yet
        logger.error(str(inst))
        return None
    if row is None or row[0] is None:
        return None
    return DeviceStoredVar(row[0])
コード例 #3
0
ファイル: cc_recipdef.py プロジェクト: parijatsahai/camcops
 def report_error(self, msg):
     logger.error("RecipientDefinition: {}".format(msg))