Modified to check if parameter is null when use sqlite3 api