Exemple #1
0
    def get_lob(self, oid):
        """get the specified lob.

      Parameters:
         Name     Type                 Info:
         oid      str/bson.ObjectId    The specified oid
      Return values:
         a lob object
      Exceptions:
         pysequoiadb.error.SDBTypeError
         pysequoiadb.error.SDBBaseError
      """
        if not isinstance(oid, bson.ObjectId) and not isinstance(
                oid, basestring):
            raise SDBTypeError("oid must be bson.ObjectId or string")

        if isinstance(oid, bson.ObjectId):
            str_id = str(oid)
        else:
            str_id = oid
        try:
            obj = lob()
            rc = sdb.cl_get_lob(self._cl, obj._handle, str_id)
            pysequoiadb._raise_if_error("Failed to get specified lob", rc)
        except SDBBaseError:
            raise

        return obj
Exemple #2
0
   def get_lob(self, oid):
      """get the specified lob.

      Parameters:
         Name     Type                 Info:
         oid      str/bson.ObjectId    The specified oid
      Return values:
         a lob object
      Exceptions:
         pysequoiadb.error.SDBTypeError
         pysequoiadb.error.SDBBaseError
      """
      if not isinstance(oid, bson.ObjectId) and not isinstance(oid, basestring):
         raise SDBTypeError("oid must be bson.ObjectId or string")

      if isinstance(oid, bson.ObjectId):
         str_id = str(oid)
      else:
         str_id = oid
      try:
         obj = lob()
         rc = sdb.cl_get_lob(self._cl, obj._handle, str_id)
         pysequoiadb._raise_if_error("Failed to get specified lob", rc)
      except SDBBaseError:
         raise

      return obj
Exemple #3
0
    def create_lob(self, oid=None):
        """create lob.

      Parameters:
         Name     Type           Info:
         oid      bson.ObjectId  Specified the oid of lob to be created,
                                       if None, the oid is generated automatically
      Return values:
         a lob object
      Exceptions:
         pysequoiadb.error.SDBTypeError
         pysequoiadb.error.SDBBaseError
      """
        if oid is None:
            str_id = None
        elif isinstance(oid, bson.ObjectId):
            str_id = str(oid)
        else:
            raise SDBTypeError("oid must be an instance of bson.ObjectId")

        try:
            obj = lob()
            rc = sdb.cl_create_lob(self._cl, obj._handle, str_id)
            pysequoiadb._raise_if_error("Failed to create lob", rc)
        except SDBBaseError:
            raise

        return obj
Exemple #4
0
   def create_lob(self, oid = None):
      """create lob.

      Parameters:
         Name     Type           Info:
         oid      bson.ObjectId  Specified the oid of lob to be created,
                                       if None, the oid is generated automatically
      Return values:
         a lob object
      Exceptions:
         pysequoiadb.error.SDBTypeError
         pysequoiadb.error.SDBBaseError
      """
      if oid is None:
         str_id = None
      elif isinstance(oid, bson.ObjectId):
         str_id = str(oid)
      else:
         raise SDBTypeError("oid must be an instance of bson.ObjectId")

      try:
         obj = lob()
         rc = sdb.cl_create_lob(self._cl, obj._handle, str_id)
         pysequoiadb._raise_if_error("Failed to create lob", rc)
      except SDBBaseError:
         raise

      return obj