Fix next_primary key. Use param to assemble SQL
Signed-off-by: JohnMave126 <johnmave126@gmail.com>