예제 #1
0
    def __init__(self, record):
        """Create a _StoredEntity object and store an entity.

    Args:
      record: the EntityRecord to store.
    """
        self.record = record

        entity = datastore_stub_util._ToStorageEntity(record)
        self.encoded_protobuf = entity.Encode()
  def _Put(self, record, insert):
    conn = self._GetConnection()
    try:
      self.__DeleteIndexEntries(conn, [record.entity.key()])
      record = datastore_stub_util.StoreRecord(record)
      entity_stored = datastore_stub_util._ToStorageEntity(record)
      self.__InsertEntities(conn, [entity_stored])

      self.__InsertIndexEntries(conn, [record.entity])
    finally:
      self._ReleaseConnection(conn)
예제 #3
0
  def _Put(self, record, insert):
    conn = self._GetConnection()
    try:
      self.__DeleteIndexEntries(conn, [record.entity.key()])
      record = datastore_stub_util.StoreRecord(record)
      entity_stored = datastore_stub_util._ToStorageEntity(record)
      self.__InsertEntities(conn, [entity_stored])

      self.__InsertIndexEntries(conn, [record.entity])
      self.__PersistCommitTimestamp(conn, self._GetReadTimestamp())
    finally:
      self._ReleaseConnection(conn)
  def __init__(self, record):
    """Create a _StoredEntity object and store an entity.

    Args:
      record: the EntityRecord to store.
    """
    self.record = record






    entity = datastore_stub_util._ToStorageEntity(record)
    self.encoded_protobuf = entity.Encode()