def _add_functions_and_triggers(connection):
    'Create triggers and application-defined functions *connection*.\n\n    Note: This function must not be executed on an empty connection.\n    The table schema must exist before triggers can be created.\n    '
    if (not SQLITE_JSON1_ENABLED):
        try:
            connection.create_function('is_wellformed_json', 1, _is_wellformed_json, deterministic=True)
            connection.create_function('is_wellformed_user_properties', 1, _is_wellformed_user_properties, deterministic=True)
            connection.create_function('is_wellformed_attributes', 1, _is_wellformed_attributes, deterministic=True)
        except TypeError:
            connection.create_function('is_wellformed_json', 1, _is_wellformed_json)
            connection.create_function('is_wellformed_user_properties', 1, _is_wellformed_user_properties)
            connection.create_function('is_wellformed_attributes', 1, _is_wellformed_attributes)
    connection.execute(_make_trigger_for_json('INSERT', 'property', 'value'))
    connection.execute(_make_trigger_for_json('UPDATE', 'property', 'value'))
    connection.execute(_make_trigger_for_user_properties('INSERT', 'edge', 'user_properties'))
    connection.execute(_make_trigger_for_user_properties('UPDATE', 'edge', 'user_properties'))
    jsonflatobj_columns = [('edge', 'type_info'), ('quantity', 'attributes'), ('weight', 'type_info')]
    for (table, column) in jsonflatobj_columns:
        connection.execute(_make_trigger_for_attributes('INSERT', table, column))
        connection.execute(_make_trigger_for_attributes('UPDATE', table, column))
Create triggers and application-defined functions *connection*.

Note: This function must not be executed on an empty connection.
The table schema must exist before triggers can be created.
def _add_functions_and_triggers(connection):
    'Create triggers and application-defined functions *connection*.\n\n    Note: This function must not be executed on an empty connection.\n    The table schema must exist before triggers can be created.\n    '
    if (not SQLITE_JSON1_ENABLED):
        try:
            connection.create_function('is_wellformed_json', 1, _is_wellformed_json, deterministic=True)
            connection.create_function('is_wellformed_user_properties', 1, _is_wellformed_user_properties, deterministic=True)
            connection.create_function('is_wellformed_attributes', 1, _is_wellformed_attributes, deterministic=True)
        except TypeError:
            connection.create_function('is_wellformed_json', 1, _is_wellformed_json)
            connection.create_function('is_wellformed_user_properties', 1, _is_wellformed_user_properties)
            connection.create_function('is_wellformed_attributes', 1, _is_wellformed_attributes)
    connection.execute(_make_trigger_for_json('INSERT', 'property', 'value'))
    connection.execute(_make_trigger_for_json('UPDATE', 'property', 'value'))
    connection.execute(_make_trigger_for_user_properties('INSERT', 'edge', 'user_properties'))
    connection.execute(_make_trigger_for_user_properties('UPDATE', 'edge', 'user_properties'))
    jsonflatobj_columns = [('edge', 'type_info'), ('quantity', 'attributes'), ('weight', 'type_info')]
    for (table, column) in jsonflatobj_columns:
        connection.execute(_make_trigger_for_attributes('INSERT', table, column))
        connection.execute(_make_trigger_for_attributes('UPDATE', table, column))