Fix NULL to nullptr for SQL queries