Ejemplo n.º 1
0
void toResultModelEdit::deleteRow(QModelIndex index)
{
    if (!index.isValid() || index.row() >= Rows.size())
        return;

    toQueryAbstr::Row deleted = Rows[index.row()];
    toRowDesc rowDesc = deleted[0].getRowDesc();

    if (rowDesc.status == REMOVED)
    {
        //Make sure removed row can't be removed twice
        return;
    }
    else if (rowDesc.status == ADDED)
    {
        //Newly added record can be removed regularly
        beginRemoveRows(QModelIndex(), index.row(), index.row());
        Rows.takeAt(index.row());
        endRemoveRows();
    }
    else  //Existed and Modified
    {
        rowDesc.status = REMOVED;
        Rows[index.row()][0] = toQValue(rowDesc);
    }
    recordDelete(deleted);
}
Ejemplo n.º 2
0
 void receivedDelete(Message& m, stringstream &ss) {
     DbMessage d(m);
     const char *ns = d.getns();
     assert(*ns);
     uassert( "not master", isMasterNs( ns ) );
     setClient(ns);
     Client& client = cc();
     client.top.setWrite();
     int flags = d.pullInt();
     bool justOne = flags & 1;
     assert( d.moreJSObjs() );
     BSONObj pattern = d.nextJsObj();
     {
         string s = pattern.toString();
         ss << " query: " << s;
         CurOp& currentOp = *client.curop();
         strncpy(currentOp.query, s.c_str(), sizeof(currentOp.query)-2);
     }        
     int n = deleteObjects(ns, pattern, justOne, true);
     recordDelete( n );
 }
Ejemplo n.º 3
0
//delete all record of table 
//@param tableName : name of table 
void API::recordDelete(string tableName)
{
	vector<Condition> conditionVector;
	recordDelete(tableName, &conditionVector);
}