SequoiaDB
 All Classes Functions
Public Member Functions | List of all members
pysequoiadb.cursor.cursor Class Reference
Inheritance diagram for pysequoiadb.cursor.cursor:

Public Member Functions

def __init__
 
def __del__
 
def next
 
def current
 
def close
 

Detailed Description

Cursor of SequoiaDB

All operation need deal with the error code returned first, if it has.
Every error code is not SDB_OK(or 0), it means something error has appeared,
and user should deal with it according the meaning of error code printed.

@version: execute to get version
          >>> import pysequoiadb
          >>> print pysequoiadb.get_version()

@notice : The dict of built-in Python is hashed and non-ordered. so the
          element in dict may not the order we make it. we make a dict and
          print it like this:
          ...
          >>> a = {"avg_age":24, "major":"computer science"}
          >>> a
          >>> {'major': 'computer science', 'avg_age': 24}
          ...
          the elements order it is not we make it!!
          therefore, we use bson.SON to make the order-sensitive dict if the
          order is important such as operations in "$sort", "$group",
          "split_by_condition", "aggregate","create_collection"...
          In every scene which the order is important, please make it using
          bson.SON and list. It is a subclass of built-in dict
          and order-sensitive

Constructor & Destructor Documentation

def pysequoiadb.cursor.cursor.__init__ (   self)
constructor of cursor

Exceptions:
   pysequoiadb.error.SDBBaseError
def pysequoiadb.cursor.cursor.__del__ (   self)
release cursor

Exceptions:
   pysequoiadb.error.SDBBaseError

Member Function Documentation

def pysequoiadb.cursor.cursor.close (   self)
Close the cursor's connection to database, we can't use this handle to
   get data again.

Exceptions:
   pysequoiadb.error.SDBBaseError
def pysequoiadb.cursor.cursor.current (   self,
  ordered = False 
)
Return the current document of cursor, and don't move.

Parameters:
   Name      Type  Info:
   ordered   bool  Set true if need field-ordered records, default false.

Return values:
   a dict object of record
Exceptions:
   pysequoiadb.error.SDBEndOfCursor
   pysequoiadb.error.SDBBaseError
def pysequoiadb.cursor.cursor.next (   self,
  ordered = False 
)
Return the next document of current cursor, and move forward.

Parameters:
   Name      Type  Info:
   ordered   bool  Set true if need field-ordered records, default false.

Return values:
   a dict object of record
Exceptions:
   pysequoiadb.error.SDBEndOfCursor
   pysequoiadb.error.SDBBaseError

The documentation for this class was generated from the following file: