Exemplo n.º 1
0
        public static Query ID_EQ_GDID(GDID id)
        {
            var result = new Query();

            result.Set(NFX.Serialization.BSON.RowConverter.GDID_CLRtoBSON(_ID, id));
            return(result);
        }
Exemplo n.º 2
0
        public static Query ID_EQ_BYTE_ARRAY(byte[] id)
        {
            var result = new Query();

            result.Set(NFX.Serialization.BSON.RowConverter.ByteBufferID_CLRtoBSON(_ID, id));
            return(result);
        }
Exemplo n.º 3
0
        public static Query ID_EQ_Int32(Int64 id)
        {
            var result = new Query();

            result.Set(new BSONInt64Element(_ID, id));
            return(result);
        }
Exemplo n.º 4
0
        protected virtual int DoUpdate(Connector.Database db, Row row, IDataStoreKey key, FieldFilterFunc filter = null)
        {
            var doc = convertRowToBSONDocumentWith_ID(row, "update", filter);
            var _id = doc[Connector.Protocol._ID];

            doc.Delete(Connector.Protocol._ID);
            if (doc.Count == 0)
            {
                return(0);              // nothing to update
            }
            //20160212 spol
            if (filter != null)
            {
                var wrapDoc = new BSONDocument();
                wrapDoc.Set(new BSONDocumentElement(Connector.Protocol.SET, doc));
                doc = wrapDoc;
            }

            var tname = GetCollectionName(row.Schema);

            var collection = db[tname];

            var qry = new Connector.Query();

            qry.Set(_id);
            var upd = new Connector.UpdateEntry(qry, doc, false, false);

            var result = collection.Update(upd);

            CheckCRUDResult(result, row.Schema.Name, "update");

            return(result.TotalDocumentsAffected);
        }
Exemplo n.º 5
0
    public static Query ID_EQ_String(string id)
    {
      if (id==null)
       throw new MongoDBConnectorException(StringConsts.ARGUMENT_ERROR+"ID_EQ_String(id==null)");

      var result = new Query();
      result.Set( new BSONStringElement(_ID, id) );
      return result;
    }
Exemplo n.º 6
0
        public static Query ID_EQ_String(string id)
        {
            if (id == null)
            {
                throw new MongoDBConnectorException(StringConsts.ARGUMENT_ERROR + "ID_EQ_String(id==null)");
            }

            var result = new Query();

            result.Set(new BSONStringElement(_ID, id));
            return(result);
        }
Exemplo n.º 7
0
        protected virtual int DoDelete(Connector.Database db, Row row, IDataStoreKey key)
        {
            var doc = convertRowToBSONDocumentWith_ID(row, "delete");

            var tname = GetCollectionName(row.Schema);

            var collection = db[tname];

            var qry = new Connector.Query();

            qry.Set(doc[Connector.Protocol._ID]);

            var result = collection.Delete(new Connector.DeleteEntry(qry, Connector.DeleteLimit.OnlyFirstMatch));

            CheckCRUDResult(result, row.Schema.Name, "delete");

            return(result.TotalDocumentsAffected);
        }
Exemplo n.º 8
0
        protected virtual int DoUpdate(Connector.Database db, Row row, IDataStoreKey key)
        {
            var doc = convertRowToBSONDocumentWith_ID(row, "update");

            var tname = GetCollectionName(row.Schema);

            var collection = db[tname];

            var qry = new Connector.Query();

            qry.Set(doc[Connector.Protocol._ID]);
            var upd = new Connector.UpdateEntry(qry, doc, false, false);

            var result = collection.Update(upd);

            checkCRUDResult(result, row.Schema.Name, "update");

            return(result.TotalDocumentsAffected);
        }
Exemplo n.º 9
0
 public static Query ID_EQ_GDID(GDID id)
 {
   var result = new Query();
   result.Set( NFX.Serialization.BSON.RowConverter.GDID_CLRtoBSON(_ID, id) );
   return result;
 }
Exemplo n.º 10
0
 public static Query ID_EQ_Int32(Int64 id)
 {
   var result = new Query();
   result.Set( new BSONInt64Element(_ID, id) );
   return result;
 }
Exemplo n.º 11
0
        protected virtual int DoDelete(Connector.Database db, Row row, IDataStoreKey key)
        {
          var doc = convertRowToBSONDocumentWith_ID(row, "delete");
          
          var tname = GetCollectionName(row.Schema);
          
          var collection = db[tname]; 
          
          var qry = new Connector.Query();
          qry.Set( doc[Connector.Protocol._ID] );

          var result = collection.Delete( new Connector.DeleteEntry( qry, Connector.DeleteLimit.OnlyFirstMatch) );
         
          checkCRUDResult(result, row.Schema.Name, "delete");

          return result.TotalDocumentsAffected;
        }
Exemplo n.º 12
0
        protected virtual int DoUpdate(Connector.Database db, Row row, IDataStoreKey key)
        {
          var doc = convertRowToBSONDocumentWith_ID(row, "update");
          
          var tname = GetCollectionName(row.Schema);
          
          var collection = db[tname]; 
          
          var qry = new Connector.Query();
          qry.Set( doc[Connector.Protocol._ID] );
          var upd = new Connector.UpdateEntry(qry, doc, false, false);

          var result = collection.Update( upd );

          checkCRUDResult(result, row.Schema.Name, "update");

          return result.TotalDocumentsAffected;
        }
Exemplo n.º 13
0
 public static Query ID_EQ_BYTE_ARRAY(byte[] id)
 {
     var result = new Query();
       result.Set( NFX.Serialization.BSON.RowConverter.ByteBufferID_CLRtoBSON(_ID, id) );
       return result;
 }
Exemplo n.º 14
0
        protected virtual int DoUpdate(Connector.Database db, Row row, IDataStoreKey key, FieldFilterFunc filter = null)
        {
            var doc = convertRowToBSONDocumentWith_ID(row, "update", filter);
              var _id = doc[Connector.Protocol._ID];

              //20160212 spol
              if (filter != null)
              {
            doc.Delete(Connector.Protocol._ID);
            if (doc.Count == 0) return 0; // nothing to update
            var wrapDoc = new BSONDocument();
            wrapDoc.Set(new BSONDocumentElement(Connector.Protocol.SET, doc));
            doc = wrapDoc;
              }

              var tname = GetCollectionName(row.Schema);

              var collection = db[tname];

              var qry = new Connector.Query();
              qry.Set( _id );
              var upd = new Connector.UpdateEntry(qry, doc, false, false);

              var result = collection.Update( upd );

              checkCRUDResult(result, row.Schema.Name, "update");

              return result.TotalDocumentsAffected;
        }