updateBuilder and pass an xml

2019-09-15 21:05发布

问题:

I'm working on updates on an object, when I create it the xml was successefuly stored:

                        DatabaseHelper db = new DatabaseHelper(getActivity());

                        Dao<Demandes, Integer> demandesDao = null;

                        try {
                            demandesDao = db.getDemandesDao();
                            Demandes maDemande = new Demandes(xml, 0, null, 0, "", 0, null);
                            demandesDao.create(maDemande);
                            demandeId = maDemande.getId();
                            xml = xml.replace("<IdContactClient></IdContactClient>", "<IdContactClient>" + demandeId + "</IdContactClient>");
                            System.out.println(xml);
                            AsyncSoapCall task = new AsyncSoapCall(maDemande);
                            task.execute();
                        } catch (SQLException e) {
                            e.printStackTrace();
                        }

But when I'm trying to update, it doesn't work, and when I pass a random text, it looks working, it is because of the xml ?

                        DatabaseHelper db = new DatabaseHelper(getActivity());

                        Dao<Demandes, Integer> demandesDao = null;
                        try {
                            demandesDao = db.getDemandesDao();
                            UpdateBuilder<Demandes,Integer> updateBuilder = demandesDao.updateBuilder();
                            updateBuilder.where().eq("id", demande.getId());


                            updateBuilder.updateColumnValue("statutEnvoieSendLead", 1);
                            updateBuilder.updateColumnValue("dateEnvoieSendLead", new Date());
                            updateBuilder.updateColumnValue("contactWebId", slr.getOption().getContactWebID());


                            GoogleAnalytics ga = new GoogleAnalytics(getActivity());
                            ga.envoieTracker(idApplication, demandeId, logement, typeForm);


                            XMLSendSimulation xmlSendSimulation = new XMLSendSimulation(slr.getOption().getContactWebID());
                            xml = XMLGenerator.GenerateSendSimulationXml(xmlSendSimulation);
                            //xml = "test test test fkzejfiehzifhh ghreuhgiuhguiheuiguiehgiuhughheghiuehiue hhuih guh gheugregergergergregregergregg hgu hghhguherhrehgheghegerhgueuihguhge   rge g e ger 123";
                            updateBuilder.updateColumnValue("xmlSimulation", xml);
                            updateBuilder.update();

                            SendSimulationReponse sr = soapContact.Simulation(xml);

                            openSimulation = sr.getOption().getOpenSimulation();


                            if (sr.getCode() == 1){

                                Date dateSimulation = new Date();

                                updateBuilder.updateColumnValue("dateEnvoieSimulation", new Date());
                                updateBuilder.updateColumnValue("statutEnvoieSimulation", 1);

                                if (openSimulation == true){
                                    resultatDemande = 1;
                                } else if (openSimulation == false) {
                                    resultatDemande = 2;
                                }

                            }


                        } catch (SQLException e) {
                            e.printStackTrace();
                        }

xml:

<?xml version='1.0' encoding='UTF-8' standalone='yes' ?><CourtactSioux><ListeContact><IdContactClient>120000379</IdContactClient></ListeContact></CourtactSioux>

回答1:

Just by doing a prepared request will success this, I haven't get any error on my console, but the problem came from singles quotes.