fix segment fault when query param repr string is large

fix segment fault when query param like

    connection.query("select '%s'", (range(1000),))