bool BufferManager::commitCache(){ for(int i=0;i<max_connection;i++){ if(mdt[i].id != -1){ commitFile(i); } } return true; }
void ServerInterface::sentXMLDone() { disconnect(m_reply, SIGNAL(finished()), this, SLOT(sentXMLDone())); m_reply->deleteLater(); if(checkError()) { QString doctype = m_getDoc.first(); m_getDoc.removeFirst(); m_getData.removeFirst(); QByteArray response = m_reply->readAll(); QDomDocument doc; if(doc.setContent(response)) { QDomNodeList list = doc.elementsByTagName("TransactionTicket"); if(list.count() == 1 && list.at(0).isElement() && list.at(0).hasChildNodes()) { QDomElement element = list.at(0).toElement(); QString text = element.childNodes().at(0).toText().nodeValue(); emit commitFile(doctype, text.toInt()); } } if(m_getDoc.isEmpty()) { m_reply = NULL; emit commitDone(); } else { sendXML(); } } }
int BufferManager::closeDB(int mdtID){ if(mdtID > max_connection) return -6; if(mdt[mdtID].dbName == "") return -5; if(!mdt[mdtID].fd){ return -5; } if(mdtID < max_connection){ if(mdt[mdtID].id != -1){ if(mdt[mdtID].isopen){ commitFile(mdtID); mdt[mdtID].fd.close(); mdt[mdtID].isopen = false; return 1; } else return -2; } } return -1; }