当前位置: 首页>>代码示例>>Python>>正文


Python pysequoiadb._raise_if_error函数代码示例

本文整理汇总了Python中pysequoiadb._raise_if_error函数的典型用法代码示例。如果您正苦于以下问题:Python _raise_if_error函数的具体用法?Python _raise_if_error怎么用?Python _raise_if_error使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了_raise_if_error函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: get_nodebyname

   def get_nodebyname(self,nodename):
      """Get specified node from current replica group.
      
      Parameters:
         Name         Type     Info:
         nodename     str      The host name of the node.
      Return values:
         a replicanode object of query
      Exceptions:
         pysequoiadb.error.SDBTypeError
         pysequoiadb.error.SDBBaseError
      """
      if not isintance(nodename, basestring):
         raise SDBTypeError("nodename must be an instance of basestring")

      try:
         node = replicanode(self._client)
         rc = sdb.gp_get_nodebyname(self._group, node._node, nodename)
         pysequoiadb._raise_if_error("Failed to get node", rc)
      except SDBBaseError:
         del node
         node = None
         raise

      return node
开发者ID:247687009,项目名称:SequoiaDB,代码行数:25,代码来源:replicagroup.py

示例2: seek

   def seek(self, seek_pos, whence = 0) :
      """seek in lob.

      Parameters:
         Name        Type           Info:
         seek_pos    int            The length to seek
         whence      int            whence of seek, it must be 0/1/2
                                          0 means seek from begin to end of lob
                                          1 means seek from currend position to end of lob
                                          2 means seek from end to begin of lob
      Exceptions:
         pysequoiadb.error.SDBTypeError
         pysequoiadb.error.SDBBaseError
      """
      if not isinstance(seek_pos, int):
         raise SDBTypeError("seek_pos must be an instance of int")
      if not isinstance(whence, int):
         raise SDBTypeError("seek_pos must be an instance of int")
      if whence not in (0, 1, 2):
         raise InvalidParameter("value of whence is in valid",
                                const.SDB_INVALIDARG)
      try:
         rc = sdb.lob_seek(self._handle, seek_pos, whence)
         pysequoiadb._raise_if_error("Failed to seek lob", rc)
      except SDBBaseError:
         raise
开发者ID:247687009,项目名称:SequoiaDB,代码行数:26,代码来源:lob.py

示例3: eval_procedure

   def eval_procedure(self, name):
      """Eval a func.
      
      Parameters:
         Name         Type     Info:
         name         str      The name of store procedure.
      Return values:
         cursor object of current eval.
      Exceptions:
         pysequoiadb.error.SDBTypeError
         pysequoiadb.error.SDBBaseError
      """
      if not isinstance(name, basestring):
         raise SDBTypeError("code must be an instance of basestring")

      try:
         result = cursor()
         rc = sdb.sdb_eval_JS(self._client, result._cursor, name)
         pysequoiadb._raise_if_error("Failed to eval procedure", rc)
      except SDBBaseError:
         del result
         result = None
         raise

      return result
开发者ID:hanjirui,项目名称:SequoiaDB,代码行数:25,代码来源:client.py

示例4: create_node

   def create_node(self, hostname, servicename, dbpath, config = None):
      """Create node in a given replica group.

      Parameters:
         Name         Type     Info:
         hostname     str      The host name for the node.
         servicename  str      The servicename for the node.
         dbpath       str      The database path for the node.
         config       dict     The configurations for the node.
      Exceptions:
         pysequoiadb.error.SDBTypeError
         pysequoiadb.error.SDBBaseError
      """
      if not isinstance(hostname, basestring):
         raise SDBTypeError("host must be an instance of basestring")
      if not isinstance(servicename, basestring):
         raise SDBTypeError("service name must be an instance of basestring")
      if not isinstance(dbpath, basestring):
         raise SDBTypeError("path must be an instance of basestring")
      if config is not None and not isinstance(config, dict):
         raise SDBTypeError("config must be an instance of dict")

      if config is None:
         config = {}

      try:
         rc = sdb.gp_create_node(self._group, hostname, servicename,
                                          dbpath, config)
         pysequoiadb._raise_if_error("Failed to create node", rc)
      except SDBBaseError:
         raise
开发者ID:247687009,项目名称:SequoiaDB,代码行数:31,代码来源:replicagroup.py

示例5: get_collection

   def get_collection(self, cl_name):
      """Get the named collection.
         
      Parameters:
         Name         Type     Info:
         cl_name      str      The full name of the collection..
      Return values:
         a collection object of query
      Exceptions:
         pysequoiadb.error.SDBTypeError
         pysequoiadb.error.SDBBaseError
      """
      if not isinstance(cl_name, basestring):
         raise SDBTypeError("collection must be an instance of basestring")

      try:
         cl = collection()
         rc = sdb.cs_get_collection(self._cs, cl_name, cl._cl)
         pysequoiadb._raise_if_error("Failed to get collection: %s" %
                                     cl_name, rc)
      except SDBBaseError:
         del cl
         cl = None
         raise

      return cl
开发者ID:247687009,项目名称:SequoiaDB,代码行数:26,代码来源:collectionspace.py

示例6: exec_sql

   def exec_sql(self, sql):
      """Executing SQL command.

      Parameters:
         Name         Type     Info:
         sql          str      The SQL command.
      Return values:
         a cursor object of matching documents.
      Exceptions:
         pysequoiadb.error.SDBTypeError
         pysequoiadb.error.SDBBaseError
      """
      if not isinstance(sql, basestring):
         raise SDBTypeError("sql must be an instance of basestring")

      try:
         result = cursor()
         rc = sdb.sdb_exec_sql(self._client, sql, result._cursor)
         pysequoiadb._raise_if_error("Failed to execute sql command", rc)
      except SDBBaseError:
         del result
         result = None
         raise

      return result
开发者ID:hanjirui,项目名称:SequoiaDB,代码行数:25,代码来源:client.py

示例7: create_replica_group

   def create_replica_group(self, group_name):
      """Create the specified replica group.

      Parameters:
         Name        Type     Info:
         group_name  str      The name of replica group to be created.
      Return values:
         the replicagroup object created.
      Exceptions:
         pysequoiadb.error.SDBTypeError
         pysequoiadb.error.SDBBaseError
      """
      if not isinstance(group_name, basestring):
         raise SDBTypeError("group name must be an instance of basestring")

      try:
         replica_group = replicagroup(self._client)
         rc = sdb.sdb_create_replica_group(self._client, group_name,
                                             replica_group._group)
         pysequoiadb._raise_if_error("Failed to create replica group", rc)
      except SDBBaseError:
         del replica_group
         replica_group = None
         raise

      return replica_group
开发者ID:hanjirui,项目名称:SequoiaDB,代码行数:26,代码来源:client.py

示例8: create_replica_cata_group

   def create_replica_cata_group(self, host, service, path, configure):
      """Create a catalog replica group.

      Parameters:
         Name         Type     Info:
         host         str      The hostname for the catalog replica group.
         service      str      The servicename for the catalog replica group.
         path         str      The path for the catalog replica group.
         configure    dict     The configurations for the catalog replica group.
      Exceptions:
         pysequoiadb.error.SDBTypeError
         pysequoiadb.error.SDBBaseError
      """
      if not isinstance(host, basestring):
         raise SDBTypeError("host must be an instance of basestring")
      if not isinstance(service, basestring):
         raise SDBTypeError("service name must be an instance of basestring")
      if not isinstance(path, basestring):
         raise SDBTypeError("path must be an instance of basestring")
      if not isinstance(configure, dict):
         raise SDBTypeError("configure must be an instance of dict")

      bson_configure = bson.BSON.encode(configure)

      try:
         rc = sdb.sdb_create_replica_cata_group(self._client, host, service,
                                                  path, bson_configure)
         pysequoiadb._raise_if_error("Failed to create replica cate group", rc)
      except SDBBaseError:
         raise
开发者ID:hanjirui,项目名称:SequoiaDB,代码行数:30,代码来源:client.py

示例9: get_replica_group_by_name

   def get_replica_group_by_name(self, group_name):
      """Get the specified replica group of specified group name.

      Parameters:
         Name         Type     Info:
         group_name   str      The name of replica group.
      Return values:
         the replicagroup object of query.
      Exceptions:
         pysequoiadb.error.SDBTypeError
         pysequoiadb.error.SDBBaseError
      """
      if not isinstance(group_name, basestring):
         raise SDBTypeError("group name must be an instance of basestring")

      try:
         result = replicagroup(self._client)
         rc = sdb.sdb_get_replica_group_by_name(self._client, group_name,
                                                  result._group)
         pysequoiadb._raise_if_error("Failed to get specified group", rc)
      except SDBBaseError:
         del result
         result = None
         raise

      return result
开发者ID:hanjirui,项目名称:SequoiaDB,代码行数:26,代码来源:client.py

示例10: get_replica_group_by_id

   def get_replica_group_by_id(self, id):
      """Get the specified replica group of specified group id.

      Parameters:
         Name       Type     Info:
         id         str      The id of replica group.
      Return values:
         the replicagroup object of query.
      Exceptions:
         pysequoiadb.error.SDBTypeError
         pysequoiadb.error.SDBBaseError
      """
      if not isinstance(id, int):
         raise SDBTypeError("group id must be an instance of int")

      try:
         result = replicagroup(self._client)
         rc = sdb.sdb_get_replica_group_by_id(self._client, id, result._group)
         pysequoiadb._raise_if_error("Failed to get specified group", rc)
      except SDBBaseError:
         del result
         result = None
         raise

      return result
开发者ID:hanjirui,项目名称:SequoiaDB,代码行数:25,代码来源:client.py

示例11: get_collection_space

   def get_collection_space(self, cs_name):
      """Get the specified collection space.

      Parameters:
         Name         Type     Info:
         cs_name      str      The name of collection space.
      Return values:
         a collection space object of query.
      Exceptions:
         pysequoiadb.error.SDBTypeError
         pysequoiadb.error.SDBBaseError
      """
      if not isinstance(cs_name, basestring):
         raise SDBTypeError("name of collection space must be an instance of basestring")

      try:
         cs = collectionspace()
         rc = sdb.sdb_get_collection_space(self._client, cs_name, cs._cs)
         pysequoiadb._raise_if_error("Failed to get collection space", rc)
      except SDBBaseError:
         del cs
         cs = None
         raise

      return cs
开发者ID:hanjirui,项目名称:SequoiaDB,代码行数:25,代码来源:client.py

示例12: get_collection

   def get_collection(self, cl_full_name):
      """Get the specified collection.

      Parameters:
         Name         Type     Info:
         cl_full_name str      The full name of collection
      Return values:
         a collection object of query.
      Exceptions:
         pysequoiadb.error.SDBTypeError
         pysequoiadb.error.SDBBaseError
      """
      if not isinstance(cl_full_name, basestring):
         raise SDBTypeError("full name of collection must be an instance of basestring")
      if '.' not in cl_full_name:
         raise SDBTypeError("Full name must included '.'")

      try:
         cl = collection()
         rc = sdb.sdb_get_collection(self._client, cl_full_name, cl._cl)
         pysequoiadb._raise_if_error("Failed to get collection", rc)
      except SDBBaseError:
         del cl
         cl = None
         raise

      return cl
开发者ID:hanjirui,项目名称:SequoiaDB,代码行数:27,代码来源:client.py

示例13: __getattr__

   def __getattr__(self, name):
      """support client.cs to access to collection space.

         eg.
         cc = client()
         cs = cc.test # access to collection space named 'test'

         and we should pass '__members__' and '__methods__',
         becasue dir(cc) will invoke __getattr__("__members__") and
         __getattr__("__methods__").

         if success, a collection object will be returned, or None.
      Exceptions:
         pysequoiadb.error.SDBTypeError
         pysequoiadb.error.SDBBaseError
      """
      if '__members__' == name or '__methods__' == name:
         pass
      else:
         try:
            cs = collectionspace()
            rc = sdb.sdb_get_collection_space(self._client, name, cs._cs)
            pysequoiadb._raise_if_error("Failed to get collection space: %s" %
                                        name, rc)
         except SDBBaseError:
            del cs;
            cs = None
            raise

         return cs
开发者ID:hanjirui,项目名称:SequoiaDB,代码行数:30,代码来源:client.py

示例14: __getattr__

   def __getattr__(self, name):
      """support client.cs to access to collection.

         eg.
         cc = client()
         cs = cc.test
         cl = cs.test_cl  # access to collection named 'test_cl'

         and we should pass '__members__' and '__methods__',
         becasue dir(cc) will invoke __getattr__("__members__") and
         __getattr__("__methods__").

         if success, a collection object will be returned.

      Exceptions:
         pysequoiadb.error.SDBBaseError
      """
      if '__members__' == name or '__methods__' == name:
         pass
      else:
         try:
            cl = collection()
            rc = sdb.cs_get_collection(self._cs, name, cl._cl)
            pysequoiadb._raise_if_error("Failed to get collection: %s" %
                                        name, rc)
         except SDBBaseError:
            del cl;
            cl = None
            raise

         return cl
开发者ID:247687009,项目名称:SequoiaDB,代码行数:31,代码来源:collectionspace.py

示例15: list_procedures

   def list_procedures(self, condition):
      """List store procedures.

      Parameters:
         Name         Type     Info:
         condition    dict     The condition of list.
      Return values:
         an cursor object of result
      Exceptions:
         pysequoiadb.error.SDBTypeError
         pysequoiadb.error.SDBBaseError
      """
      if not isinstance(condition, dict):
         raise SDBTypeError("condition must be an instance of dict")

      bson_condition = bson.BSON.encode(condition)
      try:
         result = cursor()
         rc = sdb.sdb_list_procedures(self._client, result._cursor,
                                        bson_condition)
         pysequoiadb._raise_if_error("Failed to list procedures", rc)
      except SDBBaseError:
         del result
         result = None
         raise

      return result
开发者ID:hanjirui,项目名称:SequoiaDB,代码行数:27,代码来源:client.py


注:本文中的pysequoiadb._raise_if_error函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。