本文介绍了updateBuilder 并传递一个 xml的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在对一个对象进行更新,当我创建它时,xml 已成功存储:
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();
}
但是当我尝试更新时,它不起作用,当我传递随机文本时,它看起来有效,这是因为 xml 吗?
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>
推荐答案
只要做一个准备好的请求就会成功,我的控制台上没有任何错误,但问题来自单引号.
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.
这篇关于updateBuilder 并传递一个 xml的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!