'Set a single value in the database, do not call the ORM triggers
but update the modified timestamp (unless specified not to).
**Warning:** this function will not call Document events and should be avoided in normal cases.
:param dt: DocType name.
:param dn: Document name.
:param field: Property / field name or dictionary of values to be updated
:param value: Value to be updated.
:param modified: Use this as the `modified` timestamp.
:param modified_by: Set this user as `modified_by`.
:param update_modified: default True. Set as false, if you don\'t want to update the timestamp.
:param debug: Print the query in the developer / js console.'

def set_value(self, dt, dn, field, val, modified=None, modified_by=None, update_modified=True, debug=False):

    if (not modified):
        modified = now()
    if (not modified_by):
        modified_by = frappe.session.user
    to_update = {}
    if update_modified:
        to_update = {u'modified': modified, u'modified_by': modified_by}
    if isinstance(field, dict):
        to_update.update(field)
    else:
        to_update.update({field: val})
    if (dn and (dt != dn)):
        (conditions, values) = self.build_conditions(dn)
        values.update(to_update)
        set_values = []
        for key in to_update:
            set_values.append(u'`{0}`=%({0})s'.format(key))
        self.sql(u'update    `tab{0}`\n DCTB  DCTB  DCTB  DCTB set    {1}    where    {2}'.format(dt, u',    '.join(set_values), conditions), values, debug=debug)
    else:
        keys = to_update.keys()
        self.sql(u'\n DCTB  DCTB  DCTB  DCTB delete    from    tabSingles\n DCTB  DCTB  DCTB  DCTB where    field    in    ({0})    and\n DCTB  DCTB  DCTB  DCTB  DCTB doctype=%s'.format(u',    '.join(([u'%s'] * len(keys)))), (keys + [dt]), debug=debug)
        for (key, value) in iteritems(to_update):
            self.sql(u'insert    into    tabSingles(doctype,    field,    value)    values    (%s,    %s,    %s)', (dt, key, value), debug=debug)
    if (dt in self.value_cache):
        del self.value_cache[dt]
