def sqlquote( value ):
    """Naive SQL quoting
    All values except NULL are returned as SQL strings in single quotes,
    with any embedded quotes doubled.
    """
    if value is None or value=="":
        return 'NULL'
    return "'{}'".format(str(value).replace( "'", "''" ))