The database used by the New York Police Department violates state law and the Constitution, the Legal Aid Society contends in a lawsuit. Three years ago, Shakira Leslie was returning home from a cousin’s birthday party in the Bronx when officers pulled over her friend’s car for a traffic infraction. After she got out of the back seat, the police searched her and found nothing illegal. But when a gun was found in another passenger’s bag, everyone in the car was arrested, charged with weapon possession and taken to a precinct. There, Ms. Leslie waited for more than 12 hours...