SequoiaDB
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
Macros | Typedefs | Enumerations | Functions
client.h File Reference

C Client Driver. More...

#include "core.h"
#include "ossTypes.h"
#include "bson/bson.h"
#include "jstobs.h"
#include "spd.h"
#include "clientDef.h"

Go to the source code of this file.

Macros

#define SDB_PAGESIZE_4K   4096
 
#define SDB_PAGESIZE_8K   8192
 
#define SDB_PAGESIZE_16K   16384
 
#define SDB_PAGESIZE_32K   32768
 
#define SDB_PAGESIZE_64K   65536
 
#define SDB_PAGESIZE_DEFAULT   0
 
#define SDB_INVALID_HANDLE   ((ossValuePtr) 0)
 
#define sdbCreateReplicaNode   sdbCreateNode
 
#define sdbRemoveReplicaNode   sdbRemoveNode
 
#define sdbGetReplicaNodeMaster   sdbGetNodeMaster
 
#define sdbGetReplicaNodeSlave   sdbGetNodeSlave
 
#define sdbGetReplicaNodeByName   sdbGetNodeByName
 
#define sdbGetReplicaNodeByHost   sdbGetNodeByHost
 
#define sdbGetReplicaNodeSddr   sdbGetNodeAddr
 
#define sdbStartReplicaNode   sdbStartNode
 
#define sdbStopReplicaNode   sdbStopNode
 
#define sdbReleaseReplicaNode   sdbReleaseNode
 
#define QUERY_FORCE_HINT   0x00000080
 
#define QUERY_PARALLED   0x00000100
 
#define QUERY_WITH_RETURNDATA   0x00000200
 
#define QUERY_PREPARE_MORE   0x00004000
 
#define QUERY_KEEP_SHARDINGKEY_IN_UPDATE   0x00008000
 
#define QUERY_FOR_UPDATE   0x00010000
 
#define FLG_INSERT_CONTONDUP   0x00000001
 
#define FLG_INSERT_REPLACEONDUP   0x00000004
 
#define FLG_INSERT_CONTONDUP_ID   0x00000020
 
#define FLG_INSERT_REPLACEONDUP_ID   0x00000040
 
#define FLG_INSERT_RETURN_OID   0x10000000
 
#define UPDATE_KEEP_SHARDINGKEY   QUERY_KEEP_SHARDINGKEY_IN_UPDATE
 

Typedefs

typedef enum _SDB_LOB_OPEN_MODE SDB_LOB_OPEN_MODE
 The open mode.
 
typedef enum _SDB_LOB_SEEK SDB_LOB_SEEK
 The whence of seek.
 
typedef ossValuePtr sdbConnectionHandle
 
typedef ossValuePtr sdbCSHandle
 
typedef ossValuePtr sdbCollectionHandle
 
typedef ossValuePtr sdbCursorHandle
 
typedef ossValuePtr sdbReplicaGroupHandle
 
typedef ossValuePtr sdbNodeHandle
 
typedef ossValuePtr sdbDomainHandle
 
typedef ossValuePtr sdbLobHandle
 
typedef ossValuePtr sdbDCHandle
 
typedef ossValuePtr sdbSequenceHandle
 
typedef void(* ERROR_ON_REPLY_FUNC )(const CHAR *pErrorObj, UINT32 objSize, INT32 flag, const CHAR *pDescription, const CHAR *pDetail)
 
typedef sdbNodeHandle sdbReplicaNodeHandle
 

Enumerations

enum  _SDB_LOB_OPEN_MODE { SDB_LOB_CREATEONLY = 0x00000001, SDB_LOB_READ = 0x00000004, SDB_LOB_WRITE = 0x00000008, SDB_LOB_SHAREREAD = 0x00000040 }
 
enum  _SDB_LOB_SEEK { SDB_LOB_SEEK_SET = 0, SDB_LOB_SEEK_CUR, SDB_LOB_SEEK_END }
 

Functions

SDB_EXPORT void sdbSetErrorOnReplyCallback (ERROR_ON_REPLY_FUNC func)
 Set the callback function when reply message if error from server.
 
SDB_EXPORT INT32 initClient (sdbClientConf *config)
 set client global configuration such as cache strategy to improve performance
 
SDB_EXPORT INT32 sdbGetPasswdByCipherFile (const CHAR *pUsrName, const CHAR *pToken, const CHAR *pCipherFile, CHAR *pUser, CHAR *pPasswd)
 get user password by decrypting the cipherfile
 
SDB_EXPORT INT32 sdbConnect (const CHAR *pHostName, const CHAR *pServiceName, const CHAR *pUsrName, const CHAR *pPasswd, sdbConnectionHandle *handle)
 Connect to database.
 
SDB_EXPORT INT32 sdbConnect1 (const CHAR **pConnAddrs, INT32 arrSize, const CHAR *pUsrName, const CHAR *pPasswd, sdbConnectionHandle *handle)
 Connect to database used a random valid address in the array.
 
SDB_EXPORT INT32 sdbSecureConnect (const CHAR *pHostName, const CHAR *pServiceName, const CHAR *pUsrName, const CHAR *pPasswd, sdbConnectionHandle *handle)
 Connect to database with SSL.
 
SDB_EXPORT INT32 sdbSecureConnect1 (const CHAR **pConnAddrs, INT32 arrSize, const CHAR *pUsrName, const CHAR *pPasswd, sdbConnectionHandle *handle)
 Connect to database used a random valid address in the array, with SSL.
 
SDB_EXPORT void sdbDisconnect (sdbConnectionHandle handle)
 Disconnect to database.
 
SDB_EXPORT INT32 sdbCreateUsr (sdbConnectionHandle cHandle, const CHAR *pUsrName, const CHAR *pPasswd)
 Create an account.
 
SDB_EXPORT INT32 sdbRemoveUsr (sdbConnectionHandle cHandle, const CHAR *pUsrName, const CHAR *pPasswd)
 Delete an account.
 
SDB_EXPORT INT32 sdbGetDataBlocks (sdbCollectionHandle cHandle, bson *condition, bson *select, bson *orderBy, bson *hint, INT64 numToSkip, INT64 numToReturn, sdbCursorHandle *handle)
 Get the data blocks' infomation for concurrent query.
 
SDB_EXPORT INT32 sdbGetQueryMeta (sdbCollectionHandle cHandle, bson *condition, bson *orderBy, bson *hint, INT64 numToSkip, INT64 numToReturn, sdbCursorHandle *handle)
 Get the index blocks' or data blocks' infomations for concurrent query.
 
SDB_EXPORT INT32 sdbGetSnapshot (sdbConnectionHandle cHandle, INT32 snapType, bson *condition, bson *selector, bson *orderBy, sdbCursorHandle *handle)
 Get the snapshot.
 
SDB_EXPORT INT32 sdbGetSnapshot1 (sdbConnectionHandle cHandle, INT32 snapType, bson *condition, bson *selector, bson *orderBy, bson *hint, INT64 numToSkip, INT64 numToReturn, sdbCursorHandle *handle)
 Get the snapshot.
 
SDB_EXPORT INT32 sdbResetSnapshot (sdbConnectionHandle cHandle, bson *options)
 Reset the snapshot.
 
SDB_EXPORT INT32 sdbTraceStart (sdbConnectionHandle cHandle, UINT32 traceBufferSize, CHAR *component, CHAR *breakPoint, UINT32 *tids, UINT32 nTids)
 Start trace with given trace buffer size and component list.
 
SDB_EXPORT INT32 sdbTraceResume (sdbConnectionHandle cHandle)
 Resume trace.
 
SDB_EXPORT INT32 sdbTraceStop (sdbConnectionHandle cHandle, const CHAR *pDumpFileName)
 Stop trace and dump into file.
 
SDB_EXPORT INT32 sdbTraceStatus (sdbConnectionHandle cHandle, sdbCursorHandle *handle)
 Get the current status for trace.
 
SDB_EXPORT INT32 sdbGetList (sdbConnectionHandle cHandle, INT32 listType, bson *condition, bson *selector, bson *orderBy, sdbCursorHandle *handle)
 Get the specified list.
 
SDB_EXPORT INT32 sdbGetList1 (sdbConnectionHandle cHandle, INT32 listType, bson *condition, bson *selector, bson *orderBy, bson *hint, INT64 numToSkip, INT64 numToReturn, sdbCursorHandle *handle)
 Get the specified list.
 
SDB_EXPORT INT32 sdbGetCollection (sdbConnectionHandle cHandle, const CHAR *pCollectionFullName, sdbCollectionHandle *handle)
 Get the specified collection.
 
SDB_EXPORT INT32 sdbGetCollectionSpace (sdbConnectionHandle cHandle, const CHAR *pCollectionSpaceName, sdbCSHandle *handle)
 Get the specified collection space.
 
SDB_EXPORT INT32 sdbGetReplicaGroup (sdbConnectionHandle cHandle, const CHAR *pRGName, sdbReplicaGroupHandle *handle)
 Get the specified replica group.
 
SDB_EXPORT INT32 sdbGetReplicaGroup1 (sdbConnectionHandle cHandle, UINT32 id, sdbReplicaGroupHandle *handle)
 Get the specified replica group.
 
SDB_EXPORT INT32 sdbGetReplicaGroupName (sdbReplicaGroupHandle cHandle, CHAR **ppRGName)
 Get the specified replica group's name.
 
SDB_EXPORT INT32 sdbGetRGName (sdbReplicaGroupHandle cHandle, CHAR *pBuffer, INT32 size)
 Get the specified replica group's name.
 
SDB_EXPORT BOOLEAN sdbIsReplicaGroupCatalog (sdbReplicaGroupHandle cHandle)
 Test whether the specified replica group is catalog.
 
SDB_EXPORT INT32 sdbCreateCollectionSpace (sdbConnectionHandle cHandle, const CHAR *pCollectionSpaceName, INT32 iPageSize, sdbCSHandle *handle)
 Create the specified collection space.
 
SDB_EXPORT INT32 sdbCreateCollectionSpaceV2 (sdbConnectionHandle cHandle, const CHAR *pCollectionSpaceName, bson *options, sdbCSHandle *handle)
 Create the specified collection space.
 
SDB_EXPORT INT32 sdbDropCollectionSpace (sdbConnectionHandle cHandle, const CHAR *pCollectionSpaceName)
 Drop the specified collection space.
 
SDB_EXPORT INT32 sdbDropCollectionSpace1 (sdbConnectionHandle cHandle, const CHAR *pCollectionSpaceName, bson *options)
 Drop the specified collection space.
 
SDB_EXPORT INT32 sdbCreateReplicaGroup (sdbConnectionHandle cHandle, const CHAR *pRGName, sdbReplicaGroupHandle *handle)
 Create the specified replica group.
 
SDB_EXPORT INT32 sdbRemoveReplicaGroup (sdbConnectionHandle cHandle, const CHAR *pRGName)
 Remove the specified replica group.
 
SDB_EXPORT INT32 sdbStartReplicaGroup (sdbReplicaGroupHandle cHandle)
 Start and activate the specified replica group.
 
SDB_EXPORT INT32 sdbGetNodeMaster (sdbReplicaGroupHandle cHandle, sdbNodeHandle *handle)
 Get the master node of the specified replica group.
 
SDB_EXPORT INT32 sdbGetNodeSlave (sdbReplicaGroupHandle cHandle, sdbNodeHandle *handle)
 Get one of slave node of the specified replica group, if no slave exists then get master.
 
SDB_EXPORT INT32 sdbGetNodeSlave1 (sdbReplicaGroupHandle cHandle, const INT32 *positionsArray, INT32 positionsCount, sdbNodeHandle *handle)
 Get one of slave node of the specified replica group, if no slave exists then get master.
 
SDB_EXPORT INT32 sdbGetNodeByName (sdbReplicaGroupHandle cHandle, const CHAR *pNodeName, sdbNodeHandle *handle)
 Get the node from the specified replica group.
 
SDB_EXPORT INT32 sdbGetNodeByHost (sdbReplicaGroupHandle cHandle, const CHAR *pHostName, const CHAR *pServiceName, sdbNodeHandle *handle)
 Get the node from the specified replica group.
 
SDB_EXPORT INT32 sdbGetNodeAddr (sdbNodeHandle cHandle, const CHAR **ppHostName, const CHAR **ppServiceName, const CHAR **ppNodeName, INT32 *pNodeID)
 Get the host and service name for the specified node.
 
SDB_EXPORT INT32 sdbStartNode (sdbNodeHandle cHandle)
 Start up the specified node.
 
SDB_EXPORT INT32 sdbStopNode (sdbNodeHandle cHandle)
 Stop the specified node.
 
SDB_EXPORT INT32 sdbStopReplicaGroup (sdbReplicaGroupHandle cHandle)
 Stop the specified replica group.
 
SDB_EXPORT INT32 sdbCreateReplicaCataGroup (sdbConnectionHandle cHandle, const CHAR *pHostName, const CHAR *pServiceName, const CHAR *pDatabasePath, bson *configure)
 Create a catalog replica group.
 
SDB_EXPORT INT32 sdbCreateNode (sdbReplicaGroupHandle cHandle, const CHAR *pHostName, const CHAR *pServiceName, const CHAR *pDatabasePath, bson *configure)
 Create node in a given replica group.
 
SDB_EXPORT INT32 sdbRemoveNode (sdbReplicaGroupHandle cHandle, const CHAR *pHostName, const CHAR *pServiceName, bson *configure)
 remove node in a given replica group
 
SDB_EXPORT INT32 sdbListCollectionSpaces (sdbConnectionHandle cHandle, sdbCursorHandle *handle)
 List all collection space of current database(include temporary collection space)
 
SDB_EXPORT INT32 sdbListCollections (sdbConnectionHandle cHandle, sdbCursorHandle *handle)
 List all collection of current database(not include temporary collection of temporary collection space)
 
SDB_EXPORT INT32 sdbListSequences (sdbConnectionHandle cHandle, sdbCursorHandle *handle)
 List all sequences of current database.
 
SDB_EXPORT INT32 sdbListReplicaGroups (sdbConnectionHandle cHandle, sdbCursorHandle *handle)
 List all the replica groups of current database.
 
SDB_EXPORT INT32 sdbFlushConfigure (sdbConnectionHandle cHandle, bson *options)
 flush the options to configure file.
 
SDB_EXPORT INT32 sdbCrtJSProcedure (sdbConnectionHandle cHandle, const CHAR *code)
 create a store procedure.
 
SDB_EXPORT INT32 sdbRmProcedure (sdbConnectionHandle cHandle, const CHAR *spName)
 remove a store procedure.
 
SDB_EXPORT INT32 sdbListProcedures (sdbConnectionHandle cHandle, bson *condition, sdbCursorHandle *handle)
 List store procedures.
 
SDB_EXPORT INT32 sdbEvalJS (sdbConnectionHandle cHandle, const CHAR *code, SDB_SPD_RES_TYPE *type, sdbCursorHandle *handle, bson *errmsg)
 Eval a func. \ type is declared in spd.h. see SDB_FMP_RES_TYPE.
 
SDB_EXPORT INT32 sdbGetCollection1 (sdbCSHandle cHandle, const CHAR *pCollectionName, sdbCollectionHandle *handle)
 Get the specified collection of current collection space.
 
SDB_EXPORT INT32 sdbCreateCollection (sdbCSHandle cHandle, const CHAR *pCollectionName, sdbCollectionHandle *handle)
 Create the specified collection in current collection space This function creates a non-sharded collection with default replsize.
 
SDB_EXPORT INT32 sdbCreateCollection1 (sdbCSHandle cHandle, const CHAR *pCollectionName, bson *options, sdbCollectionHandle *handle)
 Create the specified collection in current collection space.
 
SDB_EXPORT INT32 sdbAlterCollection (sdbCollectionHandle cHandle, bson *options)
 Alter the specified collection.
 
SDB_EXPORT INT32 sdbDropCollection (sdbCSHandle cHandle, const CHAR *pCollectionName)
 Drop the specified collection in current collection space.
 
SDB_EXPORT INT32 sdbGetCSName (sdbCSHandle cHandle, CHAR *pBuffer, INT32 size)
 Get the specified collection space name.
 
SDB_EXPORT INT32 sdbRenameCollection (sdbCSHandle cHandle, const CHAR *pOldName, const CHAR *pNewName, bson *options)
 Rename collection name.
 
SDB_EXPORT INT32 sdbAlterCollectionSpace (sdbCSHandle cHandle, bson *options)
 Alter the specified collection space.
 
SDB_EXPORT INT32 sdbCSSetDomain (sdbCSHandle cHandle, bson *options)
 Alter the specified collection space to set domain.
 
SDB_EXPORT INT32 sdbCSGetDomainName (sdbCSHandle cHandle, CHAR *pResult, INT32 size)
 Get the domain name which the collection space belongs to.
 
SDB_EXPORT INT32 sdbCSRemoveDomain (sdbCSHandle cHandle)
 Alter the specified collection space to remove domain.
 
SDB_EXPORT INT32 sdbCSEnableCapped (sdbCSHandle cHandle)
 Alter the specified collection space to enable capped.
 
SDB_EXPORT INT32 sdbCSDisableCapped (sdbCSHandle cHandle)
 Alter the specified collection space to disable capped.
 
SDB_EXPORT INT32 sdbCSSetAttributes (sdbCSHandle cHandle, bson *options)
 Alter the specified collection space.
 
SDB_EXPORT INT32 sdbCSListCollections (sdbCSHandle cHandle, sdbCursorHandle *handle)
 List all the collection of current collection space.
 
SDB_EXPORT INT32 sdbGetCLName (sdbCollectionHandle cHandle, CHAR *pBuffer, INT32 size)
 Get the specified collection name.
 
SDB_EXPORT INT32 sdbGetCLFullName (sdbCollectionHandle cHandle, CHAR *pBuffer, INT32 size)
 Get the specified collection full name.
 
SDB_EXPORT INT32 sdbSplitCollection (sdbCollectionHandle cHandle, const CHAR *pSourceRG, const CHAR *pTargetRG, const bson *pSplitCondition, const bson *pSplitEndCondition)
 Split the specified collection from source replica group to target by range.
 
SDB_EXPORT INT32 sdbSplitCLAsync (sdbCollectionHandle cHandle, const CHAR *pSourceRG, const CHAR *pTargetRG, const bson *pSplitCondition, const bson *pSplitEndCondition, SINT64 *taskID)
 Split the specified collection from source replica group to target by range.
 
SDB_EXPORT INT32 sdbSplitCollectionByPercent (sdbCollectionHandle cHandle, const CHAR *pSourceRG, const CHAR *pTargetRG, FLOAT64 percent)
 Split the specified collection from source replica group to target by percent.
 
SDB_EXPORT INT32 sdbSplitCLByPercentAsync (sdbCollectionHandle cHandle, const CHAR *pSourceRG, const CHAR *pTargetRG, FLOAT64 percent, SINT64 *taskID)
 Split the specified collection from source replica group to target by percent.
 
SDB_EXPORT INT32 sdbCreateIndex (sdbCollectionHandle cHandle, bson *indexDef, const CHAR *pIndexName, BOOLEAN isUnique, BOOLEAN isEnforced)
 Create the index in current collection.
 
SDB_EXPORT INT32 sdbCreateIndex1 (sdbCollectionHandle cHandle, bson *indexDef, const CHAR *pIndexName, BOOLEAN isUnique, BOOLEAN isEnforced, INT32 sortBufferSize)
 Create the index in current collection.
 
SDB_EXPORT INT32 sdbCreateIndex2 (sdbCollectionHandle cHandle, bson *indexDef, const CHAR *pIndexName, bson *options)
 Create the index in current collection.
 
SDB_EXPORT INT32 sdbGetIndexes (sdbCollectionHandle cHandle, const CHAR *pIndexName, sdbCursorHandle *handle)
 Get all of or one of the indexes in current collection.
 
SDB_EXPORT INT32 sdbGetIndex (sdbCollectionHandle cHandle, const CHAR *pIndexName, bson *info)
 Get the information of the specified index in current collection.
 
SDB_EXPORT INT32 sdbGetIndexInfo (sdbCollectionHandle cHandle, sdbCursorHandle *handle)
 Get the information of all the indexes in current collection.
 
SDB_EXPORT INT32 sdbDropIndex (sdbCollectionHandle cHandle, const CHAR *pIndexName)
 Drop the index in current collection.
 
SDB_EXPORT INT32 sdbGetCount (sdbCollectionHandle cHandle, bson *condition, SINT64 *count)
 Get the count of documents in specified collection.
 
SDB_EXPORT INT32 sdbGetCount1 (sdbCollectionHandle cHandle, bson *condition, bson *hint, SINT64 *count)
 Get the count of documents in specified collection.
 
SDB_EXPORT INT32 sdbInsert (sdbCollectionHandle cHandle, bson *obj)
 Insert a bson object into current collection.
 
SDB_EXPORT INT32 sdbInsert1 (sdbCollectionHandle cHandle, bson *obj, bson_iterator *pId)
 Insert a bson object into current collection.
 
SDB_EXPORT INT32 sdbInsert2 (sdbCollectionHandle cHandle, bson *obj, INT32 flags, bson *pResult)
 Insert a bson object into current collection.
 
SDB_EXPORT INT32 sdbBulkInsert (sdbCollectionHandle cHandle, SINT32 flags, bson **objs, SINT32 num)
 Insert a bulk of bson objects into current collection.
 
SDB_EXPORT INT32 sdbBulkInsert2 (sdbCollectionHandle cHandle, SINT32 flags, bson **objs, SINT32 num, bson *pResult)
 Insert a bulk of bson objects into current collection.
 
SDB_EXPORT INT32 sdbUpdate (sdbCollectionHandle cHandle, bson *rule, bson *condition, bson *hint)
 Update the matching documents in current collection.
 
SDB_EXPORT INT32 sdbUpdate1 (sdbCollectionHandle cHandle, bson *rule, bson *condition, bson *hint, INT32 flag)
 Update the matching documents in current collection.
 
SDB_EXPORT INT32 sdbUpdate2 (sdbCollectionHandle cHandle, bson *rule, bson *condition, bson *hint, INT32 flag, bson *pResult)
 Update the matching documents in current collection.
 
SDB_EXPORT INT32 sdbUpsert (sdbCollectionHandle cHandle, bson *rule, bson *condition, bson *hint)
 Update the matching documents in current collection, insert if no matching.
 
SDB_EXPORT INT32 sdbUpsert1 (sdbCollectionHandle cHandle, bson *rule, bson *condition, bson *hint, bson *setOnInsert)
 Update the matching documents in current collection, insert if no matching.
 
SDB_EXPORT INT32 sdbUpsert2 (sdbCollectionHandle cHandle, bson *rule, bson *condition, bson *hint, bson *setOnInsert, INT32 flag)
 Update the matching documents in current collection, insert if no matching.
 
SDB_EXPORT INT32 sdbUpsert3 (sdbCollectionHandle cHandle, bson *rule, bson *condition, bson *hint, bson *setOnInsert, INT32 flag, bson *pResult)
 Update the matching documents in current collection, insert if no matching.
 
SDB_EXPORT INT32 sdbDelete (sdbCollectionHandle cHandle, bson *condition, bson *hint)
 Delete the matching documents in current collection, never rollback if failed.
 
SDB_EXPORT INT32 sdbDelete1 (sdbCollectionHandle cHandle, bson *condition, bson *hint, INT32 flag, bson *pResult)
 Delete the matching documents in current collection, never rollback if failed.
 
SDB_EXPORT INT32 sdbQuery1 (sdbCollectionHandle cHandle, bson *condition, bson *select, bson *orderBy, bson *hint, INT64 numToSkip, INT64 numToReturn, INT32 flags, sdbCursorHandle *handle)
 Get the matching documents in current collection.
 
SDB_EXPORT INT32 sdbQuery (sdbCollectionHandle cHandle, bson *condition, bson *select, bson *orderBy, bson *hint, INT64 numToSkip, INT64 numToReturn, sdbCursorHandle *handle)
 Get the matching documents in current collection.
 
SDB_EXPORT INT32 sdbQueryAndUpdate (sdbCollectionHandle cHandle, bson *condition, bson *select, bson *orderBy, bson *hint, bson *update, INT64 numToSkip, INT64 numToReturn, INT32 flag, BOOLEAN returnNew, sdbCursorHandle *handle)
 Get the matching documents in current collection and update.
 
SDB_EXPORT INT32 sdbQueryAndRemove (sdbCollectionHandle cHandle, bson *condition, bson *select, bson *orderBy, bson *hint, INT64 numToSkip, INT64 numToReturn, INT32 flag, sdbCursorHandle *handle)
 Get the matching documents in current collection and remove.
 
SDB_EXPORT INT32 sdbExplain (sdbCollectionHandle cHandle, bson *condition, bson *select, bson *orderBy, bson *hint, INT32 flag, INT64 numToSkip, INT64 numToReturn, bson *options, sdbCursorHandle *handle)
 get access plan of query
 
SDB_EXPORT INT32 sdbNext (sdbCursorHandle cHandle, bson *obj)
 Return the next document of current cursor, and move forward.
 
SDB_EXPORT INT32 sdbCurrent (sdbCursorHandle cHandle, bson *obj)
 Return the current document of cursor, and don't move.
 
SDB_EXPORT INT32 sdbCloseCursor (sdbCursorHandle cHandle)
 Close the cursor's connection to database, we can't use this handle to get data again.
 
SDB_EXPORT INT32 sdbCloseAllCursors (sdbConnectionHandle cHandle)
 Send a "Interrpt" message to engine, as a result, all the cursors and lobs created by current connection will be closed.
 
SDB_EXPORT INT32 sdbInterrupt (sdbConnectionHandle cHandle)
 Send a "Interrpt" message to engine, as a result, all the cursors and lobs created by current connection will be closed.
 
SDB_EXPORT INT32 sdbInterruptOperation (sdbConnectionHandle cHandle)
 Send "INTERRUPT_SELF" message to engine to stop the current operation. When the current operation had finish, nothing happend, Otherwise, the current operation will be stop, and return error.
 
SDB_EXPORT INT32 sdbExec (sdbConnectionHandle cHandle, const CHAR *sql, sdbCursorHandle *result)
 Executing SQL command.
 
SDB_EXPORT INT32 sdbExecUpdate (sdbConnectionHandle cHandle, const CHAR *sql)
 Executing SQL command for updating.
 
SDB_EXPORT INT32 sdbTransactionBegin (sdbConnectionHandle cHandle)
 Transaction begin.
 
SDB_EXPORT INT32 sdbTransactionCommit (sdbConnectionHandle cHandle)
 Transaction commit.
 
SDB_EXPORT INT32 sdbTransactionRollback (sdbConnectionHandle cHandle)
 Transaction rollback.
 
SDB_EXPORT void sdbReleaseConnection (sdbConnectionHandle cHandle)
 Release the database connection handle.
 
SDB_EXPORT void sdbReleaseCollection (sdbCollectionHandle cHandle)
 Release collection handle, the cursor handle of this collection will still available.
 
SDB_EXPORT void sdbReleaseCS (sdbCSHandle cHandle)
 Release the collection space handle, the collecion and cursor handle of this collection space will still available.
 
SDB_EXPORT void sdbReleaseCursor (sdbCursorHandle cHandle)
 Release the cursor handle.
 
SDB_EXPORT void sdbReleaseReplicaGroup (sdbReplicaGroupHandle cHandle)
 Release the replica group handle.
 
SDB_EXPORT void sdbReleaseNode (sdbNodeHandle cHandle)
 Release the node handle.
 
SDB_EXPORT void sdbReleaseDomain (sdbDomainHandle cHandle)
 Release the domain handle.
 
SDB_EXPORT void sdbReleaseDC (sdbDCHandle cHandle)
 
SDB_EXPORT INT32 sdbAggregate (sdbCollectionHandle cHandle, bson **obj, SINT32 num, sdbCursorHandle *handle)
 Execute aggregate operation in specified collection.
 
SDB_EXPORT INT32 sdbAttachCollection (sdbCollectionHandle cHandle, const CHAR *subClFullName, bson *options)
 Attach the specified collection.
 
SDB_EXPORT INT32 sdbDetachCollection (sdbCollectionHandle cHandle, const CHAR *subClFullName)
 Detach the specified collection.
 
SDB_EXPORT INT32 sdbBackupOffline (sdbConnectionHandle cHandle, bson *options)
 Backup database.
 
SDB_EXPORT INT32 sdbBackup (sdbConnectionHandle cHandle, bson *options)
 Backup database.
 
SDB_EXPORT INT32 sdbListBackup (sdbConnectionHandle cHandle, bson *options, bson *condition, bson *selector, bson *orderBy, sdbCursorHandle *handle)
 List the backups.
 
SDB_EXPORT INT32 sdbRemoveBackup (sdbConnectionHandle cHandle, bson *options)
 Remove the backups.
 
SDB_EXPORT INT32 sdbListTasks (sdbConnectionHandle cHandle, bson *condition, bson *selector, bson *orderBy, bson *hint, sdbCursorHandle *handle)
 List the tasks.
 
SDB_EXPORT INT32 sdbWaitTasks (sdbConnectionHandle cHandle, const SINT64 *taskIDs, SINT32 num)
 Wait the tasks to finish.
 
SDB_EXPORT INT32 sdbCancelTask (sdbConnectionHandle cHandle, SINT64 taskID, BOOLEAN isAsync)
 Cancel the specified task.
 
SDB_EXPORT INT32 sdbSetSessionAttr (sdbConnectionHandle cHandle, bson *options)
 Set the attributes of the current session.
 
SDB_EXPORT INT32 sdbGetSessionAttr (sdbConnectionHandle cHandle, bson *result)
 Get the attributes of the current session from the local cache if possible.
 
SDB_EXPORT INT32 sdbGetSessionAttrEx (sdbConnectionHandle cHandle, BOOLEAN useCache, bson *result)
 Get the attributes of the current session.
 
SDB_EXPORT BOOLEAN sdbIsClosed (sdbConnectionHandle cHandle)
 Judge whether the connection is closed or not.
 
SDB_EXPORT BOOLEAN sdbIsValid (sdbConnectionHandle cHandle)
 Judge whether the connection is valid.
 
SDB_EXPORT INT32 _sdbMsg (sdbConnectionHandle cHandle, const CHAR *msg)
 
SDB_EXPORT INT32 sdbCreateDomain (sdbConnectionHandle cHandle, const CHAR *pDomainName, bson *options, sdbDomainHandle *handle)
 Create a domain.
 
SDB_EXPORT INT32 sdbDropDomain (sdbConnectionHandle cHandle, const CHAR *pDomainName)
 Drop a domain.
 
SDB_EXPORT INT32 sdbGetDomain (sdbConnectionHandle cHandle, const CHAR *pDomainName, sdbDomainHandle *handle)
 Get a domain.
 
SDB_EXPORT INT32 sdbListDomains (sdbConnectionHandle cHandle, bson *condition, bson *selector, bson *orderBy, sdbCursorHandle *handle)
 List the domains.
 
SDB_EXPORT INT32 sdbAlterDomain (sdbDomainHandle cHandle, const bson *options)
 alter the current domain.
 
SDB_EXPORT INT32 sdbDomainAddGroups (sdbDomainHandle cHandle, const bson *options)
 alter the current domain.
 
SDB_EXPORT INT32 sdbDomainRemoveGroups (sdbDomainHandle cHandle, const bson *options)
 alter the current domain to remove groups.
 
SDB_EXPORT INT32 sdbDomainSetGroups (sdbDomainHandle cHandle, const bson *options)
 alter the current domain to set groups.
 
SDB_EXPORT INT32 sdbDomainSetAttributes (sdbDomainHandle cHandle, const bson *options)
 alter the current domain.
 
SDB_EXPORT INT32 sdbListCollectionSpacesInDomain (sdbDomainHandle cHandle, sdbCursorHandle *cursor)
 list the collection spaces in domain.
 
SDB_EXPORT INT32 sdbListCollectionsInDomain (sdbDomainHandle cHandle, sdbCursorHandle *cursor)
 list the collections in domain.
 
SDB_EXPORT INT32 sdbListGroupsInDomain (sdbDomainHandle cHandle, sdbCursorHandle *cursor)
 list the groups in domain.
 
SDB_EXPORT INT32 sdbInvalidateCache (sdbConnectionHandle cHandle, bson *options)
 invalidate cache on specified nodes.
 
SDB_EXPORT INT32 sdbForceSession (sdbConnectionHandle cHandle, SINT64 sessionID, bson *options)
 interrupte the session.
 
SDB_EXPORT INT32 sdbCreateLobID (sdbCollectionHandle cHandle, bson_oid_t *oid)
 create a large object id.
 
SDB_EXPORT INT32 sdbCreateLobID1 (sdbCollectionHandle cHandle, const CHAR *pTimeStamp, bson_oid_t *oid)
 create a large object id.
 
SDB_EXPORT INT32 sdbGetLobId (sdbLobHandle lobHandle, bson_oid_t *oid)
 use a lobHandle to get a large object id.
 
SDB_EXPORT INT32 sdbOpenLob (sdbCollectionHandle cHandle, const bson_oid_t *oid, INT32 mode, sdbLobHandle *lobHandle)
 create a large object or open a large object to read or write.
 
SDB_EXPORT INT32 sdbWriteLob (sdbLobHandle lobHandle, const CHAR *buf, UINT32 len)
 write lob
 
SDB_EXPORT INT32 sdbLockLob (sdbLobHandle lobHandle, INT64 offset, INT64 length)
 lock LOB section for write mode
 
SDB_EXPORT INT32 sdbLockAndSeekLob (sdbLobHandle lobHandle, INT64 offset, INT64 length)
 lock LOB section for write mode and seek to the offset position
 
SDB_EXPORT INT32 sdbReadLob (sdbLobHandle lobHandle, UINT32 len, CHAR *buf, UINT32 *read)
 read lob
 
SDB_EXPORT INT32 sdbCloseLob (sdbLobHandle *lobHandle)
 close lob
 
SDB_EXPORT INT32 sdbRemoveLob (sdbCollectionHandle cHandle, const bson_oid_t *oid)
 remove lob
 
SDB_EXPORT INT32 sdbTruncateLob (sdbCollectionHandle cHandle, const bson_oid_t *oid, INT64 length)
 truncate lob
 
SDB_EXPORT INT32 sdbGetLobSize (sdbLobHandle lobHandle, SINT64 *size)
 get the lob's size
 
SDB_EXPORT INT32 sdbGetLobCreateTime (sdbLobHandle lobHandle, UINT64 *millis)
 get lob's create time
 
SDB_EXPORT INT32 sdbGetLobModificationTime (sdbLobHandle lobHandle, UINT64 *millis)
 get lob's last modification time
 
SDB_EXPORT BOOLEAN sdbLobIsEof (sdbLobHandle lobHandle)
 Check whether current offset has reached to the max size of current lob.
 
SDB_EXPORT INT32 sdbSeekLob (sdbLobHandle lobHandle, SINT64 size, SDB_LOB_SEEK whence)
 seek the place to read or write
 
SDB_EXPORT INT32 sdbListLobs (sdbCollectionHandle cHandle, sdbCursorHandle *cursor)
 list all the lobs' meta data in current collection
 
SDB_EXPORT INT32 sdbListLobs1 (sdbCollectionHandle cHandle, bson *condition, bson *selected, bson *orderBy, bson *hint, INT64 numToSkip, INT64 numToReturn, sdbCursorHandle *cursor)
 list all the lobs' meta data in current collection
 
SDB_EXPORT INT32 sdbListLobPieces (sdbCollectionHandle cHandle, sdbCursorHandle *cursor)
 list all the pieces in the lob
 
SDB_EXPORT INT32 sdbListLobPieces1 (sdbCollectionHandle cHandle, bson *condition, bson *selected, bson *orderBy, bson *hint, INT64 numToSkip, INT64 numToReturn, sdbCursorHandle *cursor)
 list all the pieces in the lob
 
SDB_EXPORT INT32 sdbGetRunTimeDetail (sdbLobHandle lobHandle, bson *detail)
 Get the run time detail information of lob.
 
SDB_EXPORT INT32 sdbReelect (sdbReplicaGroupHandle cHandle, const bson *options)
 
SDB_EXPORT INT32 sdbForceStepUp (sdbConnectionHandle cHandle, const bson *options)
 
SDB_EXPORT INT32 sdbTruncateCollection (sdbConnectionHandle cHandle, const CHAR *fullName)
 truncate the collection
 
SDB_EXPORT INT32 sdbDetachNode (sdbReplicaGroupHandle cHandle, const CHAR *hostName, const CHAR *serviceName, const bson *options)
 detach a node from the group
 
SDB_EXPORT INT32 sdbAttachNode (sdbReplicaGroupHandle cHandle, const CHAR *hostName, const CHAR *serviceName, const bson *options)
 attach a node to the group.
 
SDB_EXPORT INT32 sdbCreateIdIndex (sdbCollectionHandle cHandle, const bson *args)
 Create $id index in collection.
 
SDB_EXPORT INT32 sdbDropIdIndex (sdbCollectionHandle cHandle)
 Drop $id index in collection.
 
SDB_EXPORT INT32 sdbEnableSharding (sdbCollectionHandle cHandle, const bson *args)
 Enable sharding of collection.
 
SDB_EXPORT INT32 sdbDisableSharding (sdbCollectionHandle cHandle)
 Disable sharding of collection.
 
SDB_EXPORT INT32 sdbEnableCompression (sdbCollectionHandle cHandle, const bson *args)
 Enable compression of collection.
 
SDB_EXPORT INT32 sdbDisableCompression (sdbCollectionHandle cHandle)
 Disable compression of collection.
 
SDB_EXPORT INT32 sdbCreateAutoIncrement (sdbCollectionHandle cHandle, const bson *options)
 Create an autoincrement field on collection.
 
SDB_EXPORT INT32 sdbDropAutoIncrement (sdbCollectionHandle cHandle, const bson *options)
 Drop an autoincrement field on collection.
 
SDB_EXPORT INT32 sdbCLSetAttributes (sdbCollectionHandle cHandle, const bson *options)
 Alter the specified collection.
 
SDB_EXPORT INT32 sdbCLGetDetail (sdbCollectionHandle cHandle, sdbCursorHandle *handle)
 Get the detail of the collection.
 
SDB_EXPORT INT32 sdbCLGetIndexStat (sdbCollectionHandle cHandle, const CHAR *pIndexName, bson *result)
 Get the statistics of the index.
 
SDB_EXPORT INT32 sdbCLGetIndexStat1 (sdbCollectionHandle cHandle, const CHAR *pIndexName, bson *result, BOOLEAN detail)
 Get the statistics of the index.
 
SDB_EXPORT INT32 sdbPop (sdbCollectionHandle cHandle, bson *options)
 
SDB_EXPORT INT32 sdbGetDCName (sdbDCHandle cHandle, CHAR *pBuffer, INT32 size)
 
SDB_EXPORT INT32 sdbGetDC (sdbConnectionHandle cHandle, sdbDCHandle *handle)
 
SDB_EXPORT INT32 sdbGetDCDetail (sdbDCHandle cHandle, bson *retInfo)
 
SDB_EXPORT INT32 sdbActivateDC (sdbDCHandle cHandle)
 
SDB_EXPORT INT32 sdbDeactivateDC (sdbDCHandle cHandle)
 
SDB_EXPORT INT32 sdbEnableReadOnly (sdbDCHandle cHandle, BOOLEAN isReadOnly)
 
SDB_EXPORT INT32 sdbCreateImage (sdbDCHandle cHandle, const CHAR *pCataAddrList)
 
SDB_EXPORT INT32 sdbRemoveImage (sdbDCHandle cHandle)
 
SDB_EXPORT INT32 sdbEnableImage (sdbDCHandle cHandle)
 
SDB_EXPORT INT32 sdbDisableImage (sdbDCHandle cHandle)
 
SDB_EXPORT INT32 sdbAttachGroups (sdbDCHandle cHandle, bson *info)
 
SDB_EXPORT INT32 sdbDetachGroups (sdbDCHandle cHandle, bson *info)
 
SDB_EXPORT INT32 sdbSyncDB (sdbConnectionHandle cHandle, bson *options)
 sync database which are specified
 
SDB_EXPORT INT32 sdbLoadCollectionSpace (sdbConnectionHandle cHandle, const CHAR *csName, bson *options)
 Load the specified collection space to database from file.
 
SDB_EXPORT INT32 sdbUnloadCollectionSpace (sdbConnectionHandle cHandle, const CHAR *csName, bson *options)
 Unload the specified collection space from database.
 
SDB_EXPORT INT32 sdbSetPDLevel (sdbConnectionHandle cHandle, INT32 pdLevel, bson *options)
 Set the node's diagnostic level.
 
SDB_EXPORT INT32 sdbReloadConfig (sdbConnectionHandle cHandle, bson *options)
 Force the node to reload configs online.
 
SDB_EXPORT INT32 sdbUpdateConfig (sdbConnectionHandle cHandle, bson *configs, bson *options)
 Force the node to update configs online.
 
SDB_EXPORT INT32 sdbDeleteConfig (sdbConnectionHandle cHandle, bson *configs, bson *options)
 Force the node to delete configs online.
 
SDB_EXPORT INT32 sdbRenameCollectionSpace (sdbConnectionHandle cHandle, const CHAR *pOldName, const CHAR *pNewName, bson *options)
 Rename the collectionspace name.
 
SDB_EXPORT void sdbSetConnectionInterruptFunc (sdbConnectionHandle cHandle, socketInterruptFunc func)
 Set the callback function for connection interruption.
 
SDB_EXPORT INT32 sdbAnalyze (sdbConnectionHandle cHandle, bson *options)
 Analyze collection or index to collect statistics information.
 
SDB_EXPORT INT32 sdbGetLastErrorObj (sdbConnectionHandle cHandle, bson *errObj)
 Get the error object(only return by engine) of the last operation. The error object will not be clean up automatically until the next error object cover it.
 
SDB_EXPORT void sdbCleanLastErrorObj (sdbConnectionHandle cHandle)
 Clean the last error object(returned by engine) of current connection.
 
SDB_EXPORT INT32 sdbCreateSequence (sdbConnectionHandle cHandle, const CHAR *pSequenceName, const bson *options, sdbSequenceHandle *sHandle)
 Create the specified sequence.
 
SDB_EXPORT INT32 sdbGetSequence (sdbConnectionHandle cHandle, const CHAR *pSequenceName, sdbSequenceHandle *sHandle)
 Get the named sequence.
 
SDB_EXPORT INT32 sdbRenameSequence (sdbConnectionHandle cHandle, const CHAR *pOldName, const CHAR *pNewName)
 Rename sequence.
 
SDB_EXPORT INT32 sdbDropSequence (sdbConnectionHandle cHandle, const CHAR *pSequenceName)
 Drop the specified sequence.
 
SDB_EXPORT void sdbReleaseSequence (sdbSequenceHandle sHandle)
 Release the sequence handle.
 
SDB_EXPORT INT32 sdbSeqSetAttributes (sdbSequenceHandle sHandle, const bson *options)
 Alter the specified sequence.
 
SDB_EXPORT INT32 sdbSeqGetNextValue (sdbSequenceHandle sHandle, INT64 *value)
 Get the next value of sequence.
 
SDB_EXPORT INT32 sdbSeqGetCurrentValue (sdbSequenceHandle sHandle, INT64 *value)
 Get the current value of sequence.
 
SDB_EXPORT INT32 sdbSeqSetCurrentValue (sdbSequenceHandle sHandle, const INT64 value)
 Set the current value to sequence.
 
SDB_EXPORT INT32 sdbSeqFetch (sdbSequenceHandle sHandle, const INT32 fetchNum, INT64 *nextValue, INT32 *returnNum, INT32 *increment)
 Fetch a bulk of continuous values.
 
SDB_EXPORT INT32 sdbSeqRestart (sdbSequenceHandle sHandle, const INT64 startValue)
 Restart sequence from the given value.
 

Detailed Description

C Client Driver.

Macro Definition Documentation

#define FLG_INSERT_CONTONDUP   0x00000001

The flag represent whether insert continue(no errors were reported) when hitting index key duplicate error

#define FLG_INSERT_CONTONDUP_ID   0x00000020

The flag is not currently supported The flag is for internal use only The flag represent the error of the dup key will be ignored when the dup key is '_id'.

#define FLG_INSERT_REPLACEONDUP   0x00000004

The flag represent whether insert return detail result The flag represent replacing the existing record by the new record and continuing when insert hitting index key duplicate error

#define FLG_INSERT_REPLACEONDUP_ID   0x00000040

The flag represents the error of the dup key will be ignored when the dup key is '_id', and the original record will be replaced by new record.

#define FLG_INSERT_RETURN_OID   0x10000000

The flag represent whether insert return the "_id" field of the record for user

#define QUERY_FOR_UPDATE   0x00010000

When the transaction is turned on and the transaction isolation level is "RC", the transaction lock will be released after the record is read by default. However, when setting this flag, the transaction lock will not be released until the transaction is committed or rollbacked. When the transaction is turned off or the transaction isolation level is "RU", the flag does not work.

#define QUERY_FORCE_HINT   0x00000080

Force to use specified hint to query, if database has no index assigned by the hint, fail to query.

#define QUERY_KEEP_SHARDINGKEY_IN_UPDATE   0x00008000

The sharding key in update rule is not filtered, when executing queryAndUpdate.

#define QUERY_PARALLED   0x00000100

Enable parallel sub-query, each sub-query will finish scanning different part of data.

#define QUERY_PREPARE_MORE   0x00004000

Enable prepare more data when querying

#define QUERY_WITH_RETURNDATA   0x00000200

In general, query won't return data until cursor gets the record from database, when adding this flag, return data in query response, it will be more high-performance

#define SDB_INVALID_HANDLE   ((ossValuePtr) 0)

define sequoiadb invalid handle

#define SDB_PAGESIZE_16K   16384

define page size to 16k

#define SDB_PAGESIZE_32K   32768

define page size to 32k

#define SDB_PAGESIZE_4K   4096

define page size to 4k

#define SDB_PAGESIZE_64K   65536

define page size to 64k

#define SDB_PAGESIZE_8K   8192

define page size to 8k

#define SDB_PAGESIZE_DEFAULT   0

0 means using database's default pagesize, it 64k now

#define sdbCreateReplicaNode   sdbCreateNode

sdbCreateReplicaNode will be deprecated in version 2.x, use sdbCreateNode instead of it.

#define sdbGetReplicaNodeByHost   sdbGetNodeByHost

sdbGetReplicaNodeByHost will be deprecated in version 2.x, use sdbGetNodeByHost instead of it.

#define sdbGetReplicaNodeByName   sdbGetNodeByName

sdbGetReplicaNodeByName will be deprecated in version 2.x, use sdbGetNodeByName instead of it.

#define sdbGetReplicaNodeMaster   sdbGetNodeMaster

sdbGetReplicaNodeMaster will be deprecated in version 2.x, use sdbGetNodeMaster instead of it.

#define sdbGetReplicaNodeSddr   sdbGetNodeAddr

sdbGetReplicaNodeSddr will be deprecated in version 2.x, use sdbGetNodeAddr instead of it.

#define sdbGetReplicaNodeSlave   sdbGetNodeSlave

sdbGetReplicaNodeSlave will be deprecated in version 2.x, use sdbGetNodeSlave instead of it.

#define sdbReleaseReplicaNode   sdbReleaseNode

sdbReleaseReplicaNode will be deprecated in version 2.x, use sdbReleaseNode instead of it.

#define sdbRemoveReplicaNode   sdbRemoveNode

sdbRemoveReplicaNode will be deprecated in version 2.x, use sdbRemoveNode instead of it.

#define sdbStartReplicaNode   sdbStartNode

sdbStartReplicaNode will be deprecated in version 2.x, use sdbStartNode instead of it.

#define sdbStopReplicaNode   sdbStopNode

sdbStopReplicaNode will be deprecated in version 2.x, use sdbStopNode instead of it.

#define UPDATE_KEEP_SHARDINGKEY   QUERY_KEEP_SHARDINGKEY_IN_UPDATE

The sharding key in update rule is not filtered, when executing update or upsert.

Typedef Documentation

typedef void(* ERROR_ON_REPLY_FUNC)(const CHAR *pErrorObj, UINT32 objSize, INT32 flag, const CHAR *pDescription, const CHAR *pDetail)

Callback function when the reply message is error

typedef ossValuePtr sdbCollectionHandle

sequoiadb collection handle

typedef ossValuePtr sdbConnectionHandle

sequoiadb database connection handle

typedef ossValuePtr sdbCSHandle

sequoiadb collection space handle

typedef ossValuePtr sdbCursorHandle

sequoiadb cursor handle

typedef ossValuePtr sdbDCHandle

sequoiadb data center handle

typedef ossValuePtr sdbDomainHandle

sequoiadb domain handle

typedef ossValuePtr sdbLobHandle

sequoiadb large object handle

typedef ossValuePtr sdbNodeHandle

sequoiadb node handle

typedef ossValuePtr sdbReplicaGroupHandle

sequoiadb replica group handle

sdbReplicaNodeHandle will be deprecated in version 2.x, use sdbNodeHandle instead of it.

typedef ossValuePtr sdbSequenceHandle

sequoiadb sequence handle

Enumeration Type Documentation

Enumerator:
SDB_LOB_CREATEONLY 

Open a new lob only

SDB_LOB_READ 

Open an existing lob to read

SDB_LOB_WRITE 

Open an existing lob to write

SDB_LOB_SHAREREAD 

Open an existing lob to share read

Enumerator:
SDB_LOB_SEEK_SET 

Seek from the beginning of file

SDB_LOB_SEEK_CUR 

Seek from the current place

SDB_LOB_SEEK_END 

Seek from the end of file

Function Documentation

INT32 initClient ( sdbClientConf config)

set client global configuration such as cache strategy to improve performance

The flag represent whether update return detail result The flag represent whether update return detail result

Parameters
[in]configThe configuration struct, see detail of sdbClientConf
Return values
SDB_OKopen cache strategy Success
OthersFail
INT32 sdbAggregate ( sdbCollectionHandle  cHandle,
bson **  obj,
SINT32  num,
sdbCursorHandle handle 
)

Execute aggregate operation in specified collection.

Parameters
[in]cHandleThe collection handle
[in]objThe array of bson objects
[in]numThe number of inserted bson objects
[out]handleThe cursor handle of result
Return values
SDB_OKOperation Success
OthersOperation Fail
INT32 rc = 0 ;
INT32 i = 0 ;
sdbCursorHandle cursor ;
const INT32 num = 2 ;
bson* obj[num] ;
const CHAR* pArr[num] = {
"{ $match: { $and: [ { no: { $gt: 1002 } },{ no: { $lt: 1015 } },{ dep
: \"IT Academy\" } ] } }",
"{ $project: { no: 1, \"info.name\": 1, major: 1 } }"
} ;
// create bson poiter array
for ( i = 0; i < num; i++ )
{
obj[i] = bson_create();
jsonToBson ( obj[i], pArr[i] ) ;
}
// TODO: get collection handle
// aggregate
//rc = sdbAggregate ( cl, obj, num, &cursor ) ;
if ( rc )
printf ( "something wrong, rc = %d.\n", rc ) ;
// free memory
for ( i = 0; i < num; i++ )
{
bson_print( obj[i] ) ;
bson_dispose ( obj[i] ) ;
}
// TODO: release collection and cursor handles
INT32 sdbAlterCollection ( sdbCollectionHandle  cHandle,
bson *  options 
)

Alter the specified collection.

Parameters
[in]cHandleThe colleciton handle
[in]optionsThe options are as following:
ReplSize            : Assign how many replica nodes need to be synchronized when a write
                      request (insert, update, etc) is executed, default is 1
ShardingKey         : Assign the sharding key, foramt: { ShardingKey: { <key name>: <1/-1>} },
                      1 indicates positive order, -1 indicates reverse order.
                      e.g. { ShardingKey: { age: 1 } }
ShardingType        : Assign the sharding type, default is "hash"
Partition           : The number of partition, it is valid when ShardingType is "hash",
                      the range is [2^3, 2^20], default is 4096
AutoSplit           : Whether to enable the automatic partitioning, it is valid when
                      ShardingType is "hash", defalut is false
EnsureShardingIndex : Whether to build sharding index, default is true
Compressed          : Whether to enable data compression, default is true
CompressionType     : The compression type of data, could be "snappy" or "lzw", default is "lzw"
StrictDataMode      : Whether to enable strict date mode in numeric operations, default is false
AutoIncrement       : Assign attributes of an autoincrement field or batch autoincrement fields
                      e.g. { AutoIncrement : { Field : "a", MaxValue : 2000 } },
                      { AutoIncrement : [ { Field : "a", MaxValue : 2000}, { Field : "a", MaxValue : 4000 } ] }
AutoIndexId         : Whether to build "$id" index, default is true
Note
Can't alter attributes about split in partition collection; After altering a collection to be a partition collection, need to split this collection manually
Return values
SDB_OKOperation Success
OthersOperation Fail
INT32 sdbAlterCollectionSpace ( sdbCSHandle  cHandle,
bson *  options 
)

Alter the specified collection space.

Parameters
[in]cHandleThe collection space handle
[in]optionsThe options of collection space to be changed, e.g. { "PageSize": 4096, "Domain": "mydomain" }.
PageSize     : The page size of the collection space
LobPageSize  : The page size of LOB objects in the collection space
Domain       : The domain which the collection space belongs to
Return values
SDB_OKOperation Success
OthersOperation Fail
INT32 sdbAlterDomain ( sdbDomainHandle  cHandle,
const bson *  options 
)

alter the current domain.

Parameters
[in]cHandleThe domain handle
[in]optionsThe options user wants to alter
Groups:    The list of replica groups' names which the domain is going to contain.
           eg: { "Groups": [ "group1", "group2", "group3" ] }, it means that domain
           changes to contain "group1" "group2" or "group3".
           We can add or remove groups in current domain. However, if a group has data
           in it, remove it out of domain will be failing.
AutoSplit: Alter current domain to have the ability of automatically split or not.
           If this option is set to be true, while creating collection(ShardingType is "hash") in this domain,
           the data of this collection will be split(hash split) into all the groups in this domain automatically.
           However, it won't automatically split data into those groups which were add into this domain later.
           eg: { "Groups": [ "group1", "group2", "group3" ], "AutoSplit: true" }
Return values
SDB_OKOperation Success
OthersOperation Fail
INT32 sdbAnalyze ( sdbConnectionHandle  cHandle,
bson *  options 
)

Analyze collection or index to collect statistics information.

Parameters
[in]cHandleThe database connection handle
[in]optionsThe control options:
CollectionSpace : (String) Specify the collection space to be analyzed.
Collection      : (String) Specify the collection to be analyzed.
Index           : (String) Specify the index to be analyzed.
Mode            : (Int32) Specify the analyze mode (default is 1):
                  Mode 1 will analyze with data samples.
                  Mode 2 will analyze with full data.
                  Mode 3 will generate default statistics.
                  Mode 4 will reload statistics into memory cache.
                  Mode 5 will clear statistics from memory cache.
Other options   : Some of other options are as below:(only take effect
                  in coordinate nodes, please visit the official website
                  to search "analyze" or "Location Elements" for more
                  detail.)
                  GroupID:INT32,
                  GroupName:String,
                  NodeID:INT32,
                  HostName:String,
                  svcname:String,
                  ...
Return values
SDB_OKOperation Success
OthersOperation Fail
INT32 sdbAttachCollection ( sdbCollectionHandle  cHandle,
const CHAR *  subClFullName,
bson *  options 
)

Attach the specified collection.

Parameters
[in]cHandleThe collection handle
[in]subClFullNameThe name of the subcollection
[in]optionsThe low boudary and up boudary eg: {"LowBound":{a:1},"UpBound":{a:100}}
Return values
SDB_OKOperation Success
OthersOperation Fail
INT32 sdbAttachNode ( sdbReplicaGroupHandle  cHandle,
const CHAR *  hostName,
const CHAR *  serviceName,
const bson *  options 
)

attach a node to the group.

Parameters
[in]cHandleThe handle of group.
[in]hostNameThe host name of node.
[in]serviceNameThe service name of node.
[in]optionsThe options of attach. Can not be null or empty. Can be the follow options:
  • KeepData : Whether to keep the original data of the new node. This option has no default value. User should specify its value explicitly.
Return values
SDB_OKOperation Success
OthersOperation Fail
INT32 sdbBackup ( sdbConnectionHandle  cHandle,
bson *  options 
)

Backup database.

Parameters
[in]cHandleThe connection handle
[in]optionsContains a series of backup configuration infomations. Backup the whole cluster if null. The "options" contains 5 options as below. All the elements in options are optional. eg: {"GroupName":["RGName1", "RGName2"], "Path":"/opt/sequoiadb/backup", "Name":"backupName", "Description":description, "EnsureInc":true, "OverWrite":true}
GroupID     : The id(s) of replica group(s) which to be backuped
GroupName   : The replica groups which to be backuped
Path        : The backup path, if not assign, use the backup path assigned in the configuration file,
              the path support to use wildcard(%g/%G:group name, %h/%H:host name, %s/%S:service name). e.g.  {Path:"/opt/sequoiadb/backup/%g"}
isSubDir    : Whether the path specified by paramer "Path" is a subdirectory of the path specified in the configuration file, default to be false
Name        : The name for the backup
Prefix      : The prefix of name for the backup, default to be null. e.g. {Prefix:"%g_bk_"}
EnableDateDir : Whether turn on the feature which will create subdirectory named to current date like "YYYY-MM-DD" automatically, default to be false
Description : The description for the backup
EnsureInc   : Whether excute increment synchronization, default to be false
OverWrite   : Whether overwrite the old backup file, default to be false
Return values
SDB_OKOperation Success
OthersOperation Fail
INT32 sdbBackupOffline ( sdbConnectionHandle  cHandle,
bson *  options 
)

Backup database.

Parameters
[in]cHandleThe connection handle
[in]optionsContains a series of backup configuration infomations. Backup the whole cluster if null. The "options" contains 5 options as below. All the elements in options are optional. eg: {"GroupName":["RGName1", "RGName2"], "Path":"/opt/sequoiadb/backup", "Name":"backupName", "Description":description, "EnsureInc":true, "OverWrite":true}
GroupID     : The id(s) of replica group(s) which to be backuped
GroupName   : The replica groups which to be backuped
Path        : The backup path, if not assign, use the backup path assigned in the configuration file,
              the path support to use wildcard(%g/%G:group name, %h/%H:host name, %s/%S:service name). e.g.  {Path:"/opt/sequoiadb/backup/%g"}
isSubDir    : Whether the path specified by paramer "Path" is a subdirectory of the path specified in the configuration file, default to be false
Name        : The name for the backup
Prefix      : The prefix of name for the backup, default to be null. e.g. {Prefix:"%g_bk_"}
EnableDateDir : Whether turn on the feature which will create subdirectory named to current date like "YYYY-MM-DD" automatically, default to be false
Description : The description for the backup
EnsureInc   : Whether excute increment synchronization, default to be false
OverWrite   : Whether overwrite the old backup file, default to be false
Return values
SDB_OKOperation Success
OthersOperation Fail
Deprecated:
Rename to "sdbBackup".
INT32 sdbBulkInsert ( sdbCollectionHandle  cHandle,
SINT32  flags,
bson **  objs,
SINT32  num 
)

Insert a bulk of bson objects into current collection.

Parameters
[in]cHandleThe collection handle.
[in]flagsThe flag to control the behavior of inserting. The value of flags default to be 0, and it can choose the follow values:
  • 0: while 0 is set(default to be 0), database will stop inserting when the record hit index key duplicate error.
  • FLG_INSERT_CONTONDUP: if the record hit index key duplicate error, database will skip them and go on inserting.
  • FLG_INSERT_REPLACEONDUP: if the record hit index key duplicate error, database will replace the existing record by the inserting new record and then go on inserting.

[in]objsThe array of bson objects to be inserted, cannot be null.
[in]numThe number of inserted bson objects.
Return values
SDB_OKOperation Success.
OthersOperation Fail.
INT32 rc = 0 ;
INT32 i = 0 ;
const INT32 num = 10 ;
bson* obj[num] ;
// create bson poiter array
for ( i = 0; i < num; i++ )
{
obj[i] = bson_create();
rc = bson_append_int( obj[i], "num", i ) ;
if ( rc != 0 )
printf ( "something wrong.\n" ) ;
rc = bson_finish ( obj[i] ) ;
if ( rc != 0 )
printf ( "something wrong.\n" ) ;
}
// bulk insert
rc = sdbBulkInsert ( cl, 0, obj, num ) ;
if ( rc )
printf ( "something wrong, rc = %d.\n", rc ) ;
// free memory
for ( i = 0; i < num; i++ )
{
bson_dispose ( obj[i] ) ;
}
INT32 sdbBulkInsert2 ( sdbCollectionHandle  cHandle,
SINT32  flags,
bson **  objs,
SINT32  num,
bson *  pResult 
)

Insert a bulk of bson objects into current collection.

Parameters
[in]cHandleThe collection handle.
[in]flagsThe flag to control the behavior of inserting. The value of flags default to be 0, and it can choose the follow values:
  • 0: while 0 is set(default to be 0), database will stop inserting when the record hit index key duplicate error.
  • FLG_INSERT_CONTONDUP: if the record hit index key duplicate error, database will skip them and go on inserting.
  • FLG_INSERT_RETURN_OID: return the value of "_id" field in the records.
  • FLG_INSERT_REPLACEONDUP: if the record hit index key duplicate error, database will replace the existing record by the inserting new record and then go on inserting.

[in]objsThe array of bson objects to be inserted, cannot be null.
[in]numThe number of inserted bson objects.
[out]pResultThe result of inserting. Can be NULL or a bson:
  • NULL: when this argument is NULL.
  • bson: an empty bson on error, or a bson whose contains the insert details on success, as follows:

    InsertedNum: The number of records successfully inserted, including replaced and ignored records. DuplicatedNum: The number of records ignored or replaced due to duplicate key conflicts. LastGenerateID: The max value of all autoIncrements in current collection. The result will include field "LastGenerateID" if current collection has autoIncrements. _id: Obecjt ID of the inserted record. The result will include field "_id" if FLG_INSERT_RETURN_OID is used.

Return values
SDB_OKOperation Success.
OthersOperation Fail.
INT32 sdbCancelTask ( sdbConnectionHandle  cHandle,
SINT64  taskID,
BOOLEAN  isAsync 
)

Cancel the specified task.

Parameters
[in]cHandleThe connection handle
[in]taskIDThe task id
[in]isAsyncThe operation "cancel task" is async or not, "true" for async, "false" for sync. Default sync.
Return values
SDB_OKOperation Success
OthersOperation Fail
void sdbCleanLastErrorObj ( sdbConnectionHandle  cHandle)

Clean the last error object(returned by engine) of current connection.

Parameters
[in]cHandleThe handle of current connection.
INT32 sdbCLGetDetail ( sdbCollectionHandle  cHandle,
sdbCursorHandle handle 
)

Get the detail of the collection.

Parameters
[in]cHandleThe collection handle
[out]handleReturn the all the info of current collection.
Return values
SDB_OKOperation Success
OthersOperation Fail
INT32 sdbCLGetIndexStat ( sdbCollectionHandle  cHandle,
const CHAR *  pIndexName,
bson *  result 
)

Get the statistics of the index.

Parameters
[in]cHandleThe collection handle
[in]pIndexNameThe name of index
[out]resultThe statistics of index
Return values
SDB_OKOperation Success
OthersOperation Fail
INT32 sdbCLGetIndexStat1 ( sdbCollectionHandle  cHandle,
const CHAR *  pIndexName,
bson *  result,
BOOLEAN  detail 
)

Get the statistics of the index.

Parameters
[in]cHandleThe collection handle
[in]pIndexNameThe name of index
[out]resultThe statistics of index
[in]detailWhether show the detail information
Return values
SDB_OKOperation Success
OthersOperation Fail
INT32 sdbCloseAllCursors ( sdbConnectionHandle  cHandle)

Send a "Interrpt" message to engine, as a result, all the cursors and lobs created by current connection will be closed.

Parameters
[in]cHandleThe database connection handle
Return values
SDB_OKOperation Success
OthersOperation Fail
INT32 sdbCloseCursor ( sdbCursorHandle  cHandle)

Close the cursor's connection to database, we can't use this handle to get data again.

Parameters
[in]cHandleThe cursor handle
Note
Don't call this method after the connection handle had been released.
Return values
SDB_OKOperation Success
OthersOperation Fail
INT32 sdbCloseLob ( sdbLobHandle lobHandle)

close lob

Parameters
[in]lobHandleThe large object handle
Return values
SDB_OKOperation Success
OthersOperation Fail
INT32 sdbCLSetAttributes ( sdbCollectionHandle  cHandle,
const bson *  options 
)

Alter the specified collection.

Parameters
[in]cHandleThe collection handle
[in]optionsThe options are as following:
ReplSize     : Assign how many replica nodes need to be synchronized when a write request(insert, update, etc) is executed
ShardingKey  : Assign the sharding key
ShardingType : Assign the sharding type
Partition    : When the ShardingType is "hash", need to assign Partition, it's the bucket number for hash, the range is [2^3,2^20]
CompressionType : The compression type of data, could be "snappy" or "lzw"
EnsureShardingIndex : Assign to true to build sharding index
StrictDataMode : Using strict date mode in numeric operations or not
                 e.g. {RepliSize:0, ShardingKey:{a:1}, ShardingType:"hash", Partition:1024}
AutoIncrement: Assign attributes of an autoincrement field or batch autoincrement fields.
               e.g. {AutoIncrement:{Field:"a",MaxValue:2000}}
                    {AutoIncrement:[{Field:"a",MaxValue:2000},{Field:"a",MaxValue:4000}]}
Return values
SDB_OKOperation Success
OthersOperation Fail
INT32 sdbConnect ( const CHAR *  pHostName,
const CHAR *  pServiceName,
const CHAR *  pUsrName,
const CHAR *  pPasswd,
sdbConnectionHandle handle 
)

Connect to database.

Parameters
[in]pHostNameThe Host Name or IP Address of Database Server
[in]pServiceNameThe Service Name or Port of Database Server
[in]pUsrNameThe User's Name of the account
[in]pPasswdThe Password of the account
[out]handleThe database connection handle, when fail to connect, *handle == SDB_INVALID_HANDLE and error code is return
Return values
SDB_OKConnection Success
OthersConnection Fail
INT32 sdbConnect1 ( const CHAR **  pConnAddrs,
INT32  arrSize,
const CHAR *  pUsrName,
const CHAR *  pPasswd,
sdbConnectionHandle handle 
)

Connect to database used a random valid address in the array.

Parameters
[in]pConnAddrsThe array of the coord's address
[in]arrSizeThe size of the array
[in]pUsrNameThe User's Name of the account
[in]pPasswdThe Password of the account
[out]handleThe database connection handle
Return values
SDB_OKConnection Success
OthersConnection Fail
INT32 sdbCreateAutoIncrement ( sdbCollectionHandle  cHandle,
const bson *  options 
)

Create an autoincrement field on collection.

Parameters
[in]cHandleThe collection handle.
[in]optionsThe arguments of autoincrement field. e.g. { Field: "a", MaxValue:2000 }
 Field          : The name of autoincrement field
 StartValue     : The start value of autoincrement field
 MinValue       : The minimum value of autoincrement field
 MaxValue       : The maxmun value of autoincrement field
 Increment      : The increment value of autoincrement field
 CacheSize      : The cache size of autoincrement field
 AcquireSize    : The acquire size of autoincrement field
 Cycled         : The cycled flag of autoincrement field
 Generated      : The generated mode of autoincrement field
Return values
SDB_OKOperation Success
OthersOperation Fail
INT32 sdbCreateCollection ( sdbCSHandle  cHandle,
const CHAR *  pCollectionName,
sdbCollectionHandle handle 
)

Create the specified collection in current collection space This function creates a non-sharded collection with default replsize.

Parameters
[in]cHandleThe collection space handle
[in]pCollectionNameThe collection name
[out]handleThe collection handle, when fail to create collection, *handle == -1 and error code is return
Return values
SDB_OKOperation Success
OthersOperation Fail
INT32 sdbCreateCollection1 ( sdbCSHandle  cHandle,
const CHAR *  pCollectionName,
bson *  options,
sdbCollectionHandle handle 
)

Create the specified collection in current collection space.

Parameters
[in]cHandleThe collection space handle
[in]pCollectionNameThe collection name
[in]optionsThe options are as following:
ShardingKey          : Assign the sharding key, foramt: { ShardingKey: { <key name>: <1/-1>} },
                       1 indicates positive order, -1 indicates reverse order.
                       e.g. { ShardingKey: { age: 1 } }
ShardingType         : Assign the sharding type, default is "hash"
Partition            : The number of partition, it is valid when ShardingType is "hash",
                       the range is [2^3, 2^20], default is 4096
ReplSize             : Assign how many replica nodes need to be synchronized when a write
                       request (insert, update, etc) is executed, default is 1
Compressed           : Whether to enable data compression, default is true
CompressionType      : The compression type of data, could be "snappy" or "lzw", default is "lzw"
AutoSplit            : Whether to enable the automatic partitioning, it is valid when ShardingType
                       is "hash", defalut is false
Group                : Assign the data group to which it belongs, default: The collection will
                       be created in any data group of the domain that the collection belongs to
AutoIndexId          : Whether to build "$id" index, default is true
EnsureShardingIndex  : Whether to build sharding index, default is true
StrictDataMode       : Whether to enable strict date mode in numeric operations, default is false
AutoIncrement        : Assign attributes of an autoincrement field or batch autoincrement fields
                       e.g. { AutoIncrement : { Field : "a", MaxValue : 2000 } },
                       { AutoIncrement : [ { Field : "a", MaxValue : 2000}, { Field : "a", MaxValue : 4000 } ] }
LobShardingKeyFormat : Assign the format of lob sharding key, could be "YYYYMMDD", "YYYYMM" or "YYYY".
                       It is valid when the collection is main collection
IsMainCL             : Main collection or not, default is false, which means it is not main collection
DataSource           : The name of the date soure used
Mapping              : The name of the collection to be mapped
[out]handleThe collection handle when fail to create collection, *handle == -1 and error code is return
Return values
SDB_OKOperation Success
OthersOperation Fail
INT32 sdbCreateCollectionSpace ( sdbConnectionHandle  cHandle,
const CHAR *  pCollectionSpaceName,
INT32  iPageSize,
sdbCSHandle handle 
)

Create the specified collection space.

Parameters
[in]cHandleThe database connection handle
[in]pCollectionSpaceNameThe name of collection space
[in]iPageSizeThe Page Size as below
SDB_PAGESIZE_4K
SDB_PAGESIZE_8K
SDB_PAGESIZE_16K
SDB_PAGESIZE_32K
SDB_PAGESIZE_64K
SDB_PAGESIZE_DEFAULT
[out]handleThe collection space handle when fail to create collection space, *handle == -1 and error code is return
Return values
SDB_OKOperation Success
OthersOperation Fail
INT32 sdbCreateCollectionSpaceV2 ( sdbConnectionHandle  cHandle,
const CHAR *  pCollectionSpaceName,
bson *  options,
sdbCSHandle handle 
)

Create the specified collection space.

Parameters
[in]cHandleThe database connection handle
[in]pCollectionSpaceNameThe name of collection space
[in]optionsThe options specified by user, e.g. {"PageSize": 4096, "Domain": "mydomain"}.
PageSize   : Assign the pagesize of the collection space
Domain     : Assign which domain does current collection space belong to
[out]handleThe collection space handle when fail to create collection space, *handle == -1 and error code is return
Return values
SDB_OKOperation Success
OthersOperation Fail
INT32 sdbCreateDomain ( sdbConnectionHandle  cHandle,
const CHAR *  pDomainName,
bson *  options,
sdbDomainHandle handle 
)

Create a domain.

Parameters
[in]cHandleThe database connection handle
[in]pDomainNameThe name of the domain
[in]optionsThe options for the domain. The options are as below:
Groups:    The list of replica groups' names which the domain is going to contain.
           eg: { "Groups": [ "group1", "group2", "group3" ] }
           If this argument is not included, the domain will contain all replica groups in the cluster.
AutoSplit: If this option is set to be true, while creating collection(ShardingType is "hash") in this domain,
           the data of this collection will be split(hash split) into all the groups in this domain automatically.
           However, it won't automatically split data into those groups which were add into this domain later.
           eg: { "Groups": [ "group1", "group2", "group3" ], "AutoSplit: true" }
[out]handleThe domain handle
Return values
SDB_OKOperation Success
OthersOperation Fail
INT32 sdbCreateIdIndex ( sdbCollectionHandle  cHandle,
const bson *  args 
)

Create $id index in collection.

Parameters
[in]cHandleThe collection handle.
[in]argsThe arguments of creating id index. set it as null if no args. e.g.{SortBufferSize:64}
SortBufferSize     : The size of sort buffer used when creating index, the unit is MB,
                     zero means don't use sort buffer.
Return values
SDB_OKOperation Success
OthersOperation Fail
INT32 sdbCreateIndex ( sdbCollectionHandle  cHandle,
bson *  indexDef,
const CHAR *  pIndexName,
BOOLEAN  isUnique,
BOOLEAN  isEnforced 
)

Create the index in current collection.

Parameters
[in]cHandleThe collection handle
[in]indexDefThe bson structure of index element, e.g. {name:1, age:-1}
[in]pIndexNameThe index name
[in]isUniqueWhether the index elements are unique or not
[in]isEnforcedWhether the index is enforced unique This element is meaningful when isUnique is set to true
Return values
SDB_OKOperation Success
OthersOperation Fail
INT32 sdbCreateIndex1 ( sdbCollectionHandle  cHandle,
bson *  indexDef,
const CHAR *  pIndexName,
BOOLEAN  isUnique,
BOOLEAN  isEnforced,
INT32  sortBufferSize 
)

Create the index in current collection.

Parameters
[in]cHandleThe collection handle
[in]indexDefThe bson structure of index element, e.g. {name:1, age:-1}
[in]pIndexNameThe index name
[in]isUniqueWhether the index elements are unique or not
[in]isEnforcedWhether the index is enforced unique This element is meaningful when isUnique is set to true
[in]sortBufferSizeThe size of sort buffer used when creating index, the unit is MB, zero means don't use sort buffer
Return values
SDB_OKOperation Success
OthersOperation Fail
INT32 sdbCreateIndex2 ( sdbCollectionHandle  cHandle,
bson *  indexDef,
const CHAR *  pIndexName,
bson *  options 
)

Create the index in current collection.

Parameters
[in]cHandleThe collection handle
[in]indexDefThe bson structure of index element, e.g. {name:1, age:-1}
[in]pIndexNameThe index name
[in]optionsThe options are as below:
Unique:    Whether the index elements are unique or not
Enforced:  Whether the index is enforced unique.
           This element is meaningful when Unique is true
NotNull:   Any field of index key should exist and cannot be null when NotNull is true
SortBufferSize: The size of sort buffer used when creating index.
                Unit is MB. Zero means don't use sort buffer
NotArray:  Any field of index not support array when NotArray is true
Return values
SDB_OKOperation Success
OthersOperation Fail
INT32 sdbCreateLobID ( sdbCollectionHandle  cHandle,
bson_oid_t *  oid 
)

create a large object id.

Parameters
[in]cHandleThe collection handle
[out]oidThe large object id
Return values
SDB_OKOperation Success
OthersOperation Fail
INT32 sdbCreateLobID1 ( sdbCollectionHandle  cHandle,
const CHAR *  pTimeStamp,
bson_oid_t *  oid 
)

create a large object id.

Parameters
[in]cHandleThe collection handle
[in]pTimestampPoint of Timestamp(format:YYYY-MM-DD-HH.mm.ss). if Timestamp is NULL the Timestamp will be generated by server
[out]oidThe large object id
Return values
SDB_OKOperation Success
OthersOperation Fail
INT32 sdbCreateNode ( sdbReplicaGroupHandle  cHandle,
const CHAR *  pHostName,
const CHAR *  pServiceName,
const CHAR *  pDatabasePath,
bson *  configure 
)

Create node in a given replica group.

Parameters
[in]cHandleThe replica group handle
[in]pHostNameThe hostname for the node
[in]pServiceNameThe servicename for the node
[in]pDatabasePathThe database path for the node
[in]configureThe configurations for the node
Return values
SDB_OKOperation Success
OthersOperation Fail
INT32 sdbCreateReplicaCataGroup ( sdbConnectionHandle  cHandle,
const CHAR *  pHostName,
const CHAR *  pServiceName,
const CHAR *  pDatabasePath,
bson *  configure 
)

Create a catalog replica group.

Parameters
[in]cHandleThe database connection handle
[in]pHostNameThe hostname for the catalog replica group
[in]pServiceNameThe servicename for the catalog replica group
[in]pDatabasePathThe path for the catalog replica group
[in]configureThe configurations for the catalog replica group
Return values
SDB_OKOperation Success
OthersOperation Fail
INT32 sdbCreateReplicaGroup ( sdbConnectionHandle  cHandle,
const CHAR *  pRGName,
sdbReplicaGroupHandle handle 
)

Create the specified replica group.

Parameters
[in]cHandleThe database connection handle
[in]pRGNameThe name of the replica group
[out]handleThe replica group handle
Return values
SDB_OKOperation Success
OthersOperation Fail
INT32 sdbCreateSequence ( sdbConnectionHandle  cHandle,
const CHAR *  pSequenceName,
const bson *  options,
sdbSequenceHandle sHandle 
)

Create the specified sequence.

Parameters
[in]cHandleThe database connection handle
[in]pSequenceNameThe name of sequence
[in]optionsThe options specified by user, e.g. {"Increment": 2, "Cycled": true}
 StartValue     : The start value of sequence
 MinValue       : The minimum value of sequence
 MaxValue       : The maxmun value of sequence
 Increment      : The increment value of sequence
 CacheSize      : The cache size of sequence
 AcquireSize    : The acquire size of sequence
 Cycled         : The cycled flag of sequence
[out]sHandleThe sequence handle when fail to create sequence, *handle == -1 and error code is return
Return values
SDB_OKOperation Success
OthersOperation Fail
INT32 sdbCreateUsr ( sdbConnectionHandle  cHandle,
const CHAR *  pUsrName,
const CHAR *  pPasswd 
)

Create an account.

Parameters
[in]cHandleThe database connection handle
[in]pUsrNameThe User's Name of the account
[in]pPasswdThe Password of the account
Return values
SDB_OKConnection Success
OthersConnection Fail
INT32 sdbCrtJSProcedure ( sdbConnectionHandle  cHandle,
const CHAR *  code 
)

create a store procedure.

Parameters
[in]cHandleThe collection space space handle
[in]codeThe code of store procedures
Return values
SDB_OKOperation Success
OthersOperation Fail
INT32 sdbCSDisableCapped ( sdbCSHandle  cHandle)

Alter the specified collection space to disable capped.

Parameters
[in]cHandleThe collection space handle
Return values
SDB_OKOperation Success
OthersOperation Fail
INT32 sdbCSEnableCapped ( sdbCSHandle  cHandle)

Alter the specified collection space to enable capped.

Return values
SDB_OKOperation Success
OthersOperation Fail
INT32 sdbCSGetDomainName ( sdbCSHandle  cHandle,
CHAR *  pResult,
INT32  size 
)

Get the domain name which the collection space belongs to.

Parameters
[in]cHandleThe collection space handle
[in]pResultThe result for output domain name
[in]sizeThe size of the buffer
Return values
SDB_OKOperation Success
OthersOperation Fail
INT32 sdbCSListCollections ( sdbCSHandle  cHandle,
sdbCursorHandle handle 
)

List all the collection of current collection space.

Parameters
[in]cHandleThe collection space handle
[out]handleThe cursor handle of returns
Return values
SDB_OKOperation Success
OthersOperation Fail
INT32 sdbCSRemoveDomain ( sdbCSHandle  cHandle)

Alter the specified collection space to remove domain.

Parameters
[in]cHandleThe collection space handle
Return values
SDB_OKOperation Success
OthersOperation Fail
INT32 sdbCSSetAttributes ( sdbCSHandle  cHandle,
bson *  options 
)

Alter the specified collection space.

Parameters
[in]cHandleThe collection space handle
[in]optionsThe options of collection space to be changed, e.g. { "PageSize": 4096, "Domain": "mydomain" }.
PageSize     : The page size of the collection space
LobPageSize  : The page size of LOB objects in the collection space
Domain       : The domain which the collection space belongs to
Return values
SDB_OKOperation Success
OthersOperation Fail
INT32 sdbCSSetDomain ( sdbCSHandle  cHandle,
bson *  options 
)

Alter the specified collection space to set domain.

Parameters
[in]cHandleThe collection space handle
[in]optionsThe options of collection space to be changed.
Domain : The domain which the collection space belongs to
Return values
SDB_OKOperation Success
OthersOperation Fail
INT32 sdbCurrent ( sdbCursorHandle  cHandle,
bson *  obj 
)

Return the current document of cursor, and don't move.

Parameters
[in]cHandleThe cursor handle
[out]objThe return bson object
Return values
SDB_OKOperation Success
OthersOperation Fail
INT32 sdbDelete ( sdbCollectionHandle  cHandle,
bson *  condition,
bson *  hint 
)

Delete the matching documents in current collection, never rollback if failed.

Parameters
[in]cHandleThe collection handle
[in]conditionThe matching rule, delete all the documents if null
[in]hintSpecified the index used to scan data. e.g. {"":"ageIndex"} means using index "ageIndex" to scan data(index scan); {"":null} means table scan. when hint is null, database automatically match the optimal index to scan data
Return values
SDB_OKOperation Success
OthersOperation Fail
INT32 sdbDelete1 ( sdbCollectionHandle  cHandle,
bson *  condition,
bson *  hint,
INT32  flag,
bson *  pResult 
)

Delete the matching documents in current collection, never rollback if failed.

Parameters
[in]cHandleThe collection handle
[in]conditionThe matching rule, delete all the documents if null
[in]hintSpecified the index used to scan data. e.g. {"":"ageIndex"} means using index "ageIndex" to scan data(index scan); {"":null} means table scan. when hint is null, database automatically match the optimal index to scan data
[in]flagThe update flag, default to be 0.
[out]pResultThe result of deleting. Can be NULL or a bson:
  • NULL: when this argument is NULL.
  • bson: an empty bson on error, or a bson whose contains the delete details on success, as follows:

    DeletedNum: The number of records successfully deleted.

[out]pResultThe result of deleting.
Return values
SDB_OKOperation Success
OthersOperation Fail
INT32 sdbDeleteConfig ( sdbConnectionHandle  cHandle,
bson *  configs,
bson *  options 
)

Force the node to delete configs online.

Parameters
[in]cHandleThe database connection handle
[in]configsthe specific configuration parameters to delete
[in]optionsThe control options:(Only take effect in coordinate nodes) GroupID:INT32, GroupName:String, NodeID:INT32, HostName:String, svcname:String, ...
Return values
SDB_OKOperation Success
OthersOperation Fail
INT32 sdbDetachCollection ( sdbCollectionHandle  cHandle,
const CHAR *  subClFullName 
)

Detach the specified collection.

Parameters
[in]cHandleThe collection handle
[in]subClFullNameThe name of the subcollection
Return values
SDB_OKOperation Success
OthersOperation Fail
INT32 sdbDetachNode ( sdbReplicaGroupHandle  cHandle,
const CHAR *  hostName,
const CHAR *  serviceName,
const bson *  options 
)

detach a node from the group

Parameters
[in]cHandleThe handle of group.
[in]hostNameThe host name of node.
[in]serviceNameThe service name of node.
[in]optionsThe options of detach. Can not be null or empty. Can be the follow options:
  • KeepData: Whether to keep the original data of the detached node. This option has no default value. User should specify its value explicitly.
  • Enforced: Whether to detach the node forcibly, default to be false.
Return values
SDB_OKOperation Success
OthersOperation Fail
INT32 sdbDisableCompression ( sdbCollectionHandle  cHandle)

Disable compression of collection.

Parameters
[in]cHandleThe collection handle
Return values
SDB_OKOperation Success
OthersOperation Fail
INT32 sdbDisableSharding ( sdbCollectionHandle  cHandle)

Disable sharding of collection.

Parameters
[in]cHandleThe collection handle
Return values
SDB_OKOperation Success
OthersOperation Fail
void sdbDisconnect ( sdbConnectionHandle  handle)

Disconnect to database.

Parameters
[in]handleThe database connection handle
INT32 sdbDomainAddGroups ( sdbDomainHandle  cHandle,
const bson *  options 
)

alter the current domain.

Parameters
[in]cHandleThe domain handle
[in]optionsThe options user wants to alter
Groups:    The list of replica groups' names to be added into the domain.
           eg: { "Groups": [ "group1", "group2", "group3" ] }, it means that domain
           changes to add "group1", "group2" and "group3".
Return values
SDB_OKOperation Success
OthersOperation Fail
INT32 sdbDomainRemoveGroups ( sdbDomainHandle  cHandle,
const bson *  options 
)

alter the current domain to remove groups.

Parameters
[in]cHandleThe domain handle
[in]optionsThe options user wants to alter
Groups:    The list of replica groups' names to be removed from the domain.
           eg: { "Groups": [ "group1", "group2", "group3" ] }, it means that domain
           changes to remove "group1", "group2" and "group3".
           However, if a group has data in it, remove it out of domain will be failing.
Return values
SDB_OKOperation Success
OthersOperation Fail
INT32 sdbDomainSetAttributes ( sdbDomainHandle  cHandle,
const bson *  options 
)

alter the current domain.

Parameters
[in]cHandleThe domain handle
[in]optionsThe options user wants to alter
Groups:    The list of replica groups' names which the domain is going to contain.
           eg: { "Groups": [ "group1", "group2", "group3" ] }, it means that domain
           changes to contain "group1" "group2" or "group3".
           We can add or remove groups in current domain. However, if a group has data
           in it, remove it out of domain will be failing.
AutoSplit: Alter current domain to have the ability of automatically split or not.
           If this option is set to be true, while creating collection(ShardingType is "hash") in this domain,
           the data of this collection will be split(hash split) into all the groups in this domain automatically.
           However, it won't automatically split data into those groups which were add into this domain later.
           eg: { "Groups": [ "group1", "group2", "group3" ], "AutoSplit: true" }
Return values
SDB_OKOperation Success
OthersOperation Fail
INT32 sdbDomainSetGroups ( sdbDomainHandle  cHandle,
const bson *  options 
)

alter the current domain to set groups.

Parameters
[in]cHandleThe domain handle
[in]optionsThe options user wants to alter
Groups:    The list of replica groups' names which the domain is going to contain.
           eg: { "Groups": [ "group1", "group2", "group3" ] }, it means that domain
           changes to be "group1" "group2" and "group3".
           We can add or remove groups in current domain. However, if a group has data
           in it, remove it out of domain will be failing.
Return values
SDB_OKOperation Success
OthersOperation Fail
INT32 sdbDropAutoIncrement ( sdbCollectionHandle  cHandle,
const bson *  options 
)

Drop an autoincrement field on collection.

Parameters
[in]cHandleThe collection handle.
[in]optionsThe name of autoincrement field. e.g. { Field: "a" }
 Field          : The name of autoincrement field
Return values
SDB_OKOperation Success
OthersOperation Fail
INT32 sdbDropCollection ( sdbCSHandle  cHandle,
const CHAR *  pCollectionName 
)

Drop the specified collection in current collection space.

Parameters
[in]cHandleThe collection space handle
[in]pCollectionNameThe collection name
Return values
SDB_OKOperation Success
OthersOperation Fail
INT32 sdbDropCollectionSpace ( sdbConnectionHandle  cHandle,
const CHAR *  pCollectionSpaceName 
)

Drop the specified collection space.

Parameters
[in]cHandleThe database connection handle
[in]pCollectionSpaceNameThe name of collection space
Return values
SDB_OKOperation Success
OthersOperation Fail
INT32 sdbDropCollectionSpace1 ( sdbConnectionHandle  cHandle,
const CHAR *  pCollectionSpaceName,
bson *  options 
)

Drop the specified collection space.

Parameters
[in]cHandleThe database connection handle
[in]pCollectionSpaceNameThe name of collection space
[in]optionsThe options specified by user, e.g. {"EnsureEmpty": true}.
EnsureEmpty   : Check whether the collection space is empty when deleting it. false in default.
                if EnsureEmpty is true but CollectionSpace is not empty, it will report SDB_DMS_CS_NOT_EMPTY error code. 
Return values
SDB_OKOperation Success
OthersOperation Fail
INT32 sdbDropDomain ( sdbConnectionHandle  cHandle,
const CHAR *  pDomainName 
)

Drop a domain.

Parameters
[in]cHandleThe database connection handle
[in]pDomainNameThe name of the domain
Return values
SDB_OKOperation Success
OthersOperation Fail
INT32 sdbDropIdIndex ( sdbCollectionHandle  cHandle)

Drop $id index in collection.

Parameters
[in]cHandleThe collection handle
Return values
SDB_OKOperation Success
OthersOperation Fail
Note
delete, update and upsert do not work after index "$id" was drop
INT32 sdbDropIndex ( sdbCollectionHandle  cHandle,
const CHAR *  pIndexName 
)

Drop the index in current collection.

Parameters
[in]cHandleThe collection handle
[in]pIndexNameThe index name
Return values
SDB_OKOperation Success
OthersOperation Fail
INT32 sdbDropSequence ( sdbConnectionHandle  cHandle,
const CHAR *  pSequenceName 
)

Drop the specified sequence.

Parameters
[in]cHandleThe database connection handle
[in]pSequenceNameThe name of sequence
Return values
SDB_OKOperation Success
OthersOperation Fail
INT32 sdbEnableCompression ( sdbCollectionHandle  cHandle,
const bson *  args 
)

Enable compression of collection.

Parameters
[in]cHandleThe collection handle.
[in]argsThe arguments of compression. e.g. { ShardingKey: { a: 1 } }
 CompressionType      : The type of compression, "snappy" or "lzw"
Return values
SDB_OKOperation Success
OthersOperation Fail
INT32 sdbEnableSharding ( sdbCollectionHandle  cHandle,
const bson *  args 
)

Enable sharding of collection.

Parameters
[in]cHandleThe collection handle.
[in]argsThe arguments of sharding. e.g. { ShardingKey: { a: 1 } }
 ShardingKey          : The key of sharding
 ShardingType         : The type of sharding, "hash" or "range"
 Partition            : The number of partitions of "hash" sharding
 EnsureShardingIndex  : Whether to build sharding index
Return values
SDB_OKOperation Success
OthersOperation Fail
INT32 sdbEvalJS ( sdbConnectionHandle  cHandle,
const CHAR *  code,
SDB_SPD_RES_TYPE type,
sdbCursorHandle handle,
bson *  errmsg 
)

Eval a func. \ type is declared in spd.h. see SDB_FMP_RES_TYPE.

Parameters
[in]cHandleThe collection space space handle
[in]codeThe code to eval
[out]typeThe type of value
[out]handleThe cursor handle of current eval
[out]errmsgThe errmsg from eval
Return values
SDB_OKOperation Success
OthersOperation Fail
INT32 sdbExec ( sdbConnectionHandle  cHandle,
const CHAR *  sql,
sdbCursorHandle result 
)

Executing SQL command.

Parameters
[in]cHandleThe database connection handle
[in]sqlThe SQL command.
[out]resultThe return cursor handle of matching documents.
Return values
SDB_OKOperation Success
OthersOperation Fail
INT32 sdbExecUpdate ( sdbConnectionHandle  cHandle,
const CHAR *  sql 
)

Executing SQL command for updating.

Parameters
[in]cHandleThe database connection handle
[in]sqlThe SQL command.
Return values
SDB_OKOperation Success
OthersOperation Fail
INT32 sdbExplain ( sdbCollectionHandle  cHandle,
bson *  condition,
bson *  select,
bson *  orderBy,
bson *  hint,
INT32  flag,
INT64  numToSkip,
INT64  numToReturn,
bson *  options,
sdbCursorHandle handle 
)

get access plan of query

Parameters
[in]cHandleThe collection handle
[in]conditionThe matching rule, return all the documents if null
[in]selectThe selective rule, return the whole document if null
[in]orderByThe ordered rule, never sort if null
[in]hintSpecified the index used to scan data. e.g. {"":"ageIndex"} means using index "ageIndex" to scan data(index scan); {"":null} means table scan. when hint is null, database automatically match the optimal index to scan data
[in]flagThe query flag, default to be 0. Please see the definition of follow flags for more detail. Usage: e.g. set ( QUERY_FORCE_HINT | QUERY_WITH_RETURNDATA ) to param flag
[in]numToSkipSkip the first numToSkip documents, never skip if this parameter is 0
[in]numToReturnOnly return numToReturn documents, return all if this parameter is -1
[in]optionsthe rules of explain, the options are as below:
Run     : Whether execute query explain or not, true for excuting query explain then get
          the data and time information; false for not excuting query explain but get the
          query explain information only. e.g. {Run:true}
[out]handleThe cursor handle of current query
Return values
SDB_OKOperation Success
OthersOperation Fail
INT32 sdbFlushConfigure ( sdbConnectionHandle  cHandle,
bson *  options 
)

flush the options to configure file.

Parameters
[in]cHandleThe connection handle
[in]optionsThe configure infomation, pass {"Global":true} or {"Global":false} In cluster environment, passing {"Global":true} will flush data's and catalog's configuration file, while passing {"Global":false} will flush coord's configuration file. In stand-alone environment, both them have the same behaviour.
Return values
SDB_OKOperation Success
OthersOperation Fail
INT32 sdbForceSession ( sdbConnectionHandle  cHandle,
SINT64  sessionID,
bson *  options 
)

interrupte the session.

Parameters
[in]cHandleThe connection handle
[in]sessionIDThe id of the session which we want to inerrupt
[in]optionsThe location information, such as NodeID, HostName and svcname
Return values
SDB_OKOperation Success
OthersOperation Fail
INT32 sdbForceStepUp ( sdbConnectionHandle  cHandle,
const bson *  options 
)
Parameters
[in]cHandleThe connection handle
[in]optionsThe options of step up
Return values
SDB_OKOperation Success
OthersOperation Fail
INT32 sdbGetCLFullName ( sdbCollectionHandle  cHandle,
CHAR *  pBuffer,
INT32  size 
)

Get the specified collection full name.

Parameters
[in]cHandleThe collection handle
[in]pBufferThe buffer for output cl full name
[in]sizeThe size of the buffer
Return values
SDB_OKOperation Success
OthersOperation Fail
INT32 sdbGetCLName ( sdbCollectionHandle  cHandle,
CHAR *  pCLName,
INT32  size 
)

Get the specified collection name.

Parameters
[in]cHandleThe collection handle
[in]pBufferThe buffer for output cl name
[in]sizeThe size of the buffer
Return values
SDB_OKOperation Success
OthersOperation Fail
INT32 sdbGetCollection ( sdbConnectionHandle  cHandle,
const CHAR *  pCollectionFullName,
sdbCollectionHandle handle 
)

Get the specified collection.

Parameters
[in]cHandleThe database connection handle
[in]pCollectionFullNameThe full name of collection
[out]handleThe collection handle
Return values
SDB_OKOperation Success
OthersOperation Fail
INT32 sdbGetCollection1 ( sdbCSHandle  cHandle,
const CHAR *  pCollectionName,
sdbCollectionHandle handle 
)

Get the specified collection of current collection space.

Get the specified collection.

Parameters
[in]cHandleThe collection space handle
[in]pCollectionNameThe collection name
[out]handleThe collection handle
Return values
SDB_OKOperation Success
OthersOperation Fail
Parameters
[in]cHandleThe database connection handle
[in]pCollectionNameThe name of collection
[out]handleThe collection handle
Return values
SDB_OKOperation Success
OthersOperation Fail
INT32 sdbGetCollectionSpace ( sdbConnectionHandle  cHandle,
const CHAR *  pCollectionSpaceName,
sdbCSHandle handle 
)

Get the specified collection space.

Parameters
[in]cHandleThe database connection handle
[in]pCollectionSpaceNameThe name of collection space
[out]handleThe collection space handle
Return values
SDB_OKOperation Success
OthersOperation Fail
INT32 sdbGetCount ( sdbCollectionHandle  cHandle,
bson *  condition,
SINT64 *  count 
)

Get the count of documents in specified collection.

Parameters
[in]cHandleThe collection handle
[in]conditionThe matching rule, return the count of all documents if this parameter is null
[out]countThe count of matching documents
Return values
SDB_OKOperation Success
OthersOperation Fail
INT32 sdbGetCount1 ( sdbCollectionHandle  cHandle,
bson *  condition,
bson *  hint,
SINT64 *  count 
)

Get the count of documents in specified collection.

Parameters
[in]cHandleThe collection handle
[in]conditionThe matching rule, return the count of all documents if this parameter is null
[in]hintSpecified the index used to scan data. e.g. {"":"ageIndex"} means using index "ageIndex" to scan data(index scan); {"":null} means table scan. when hint is null, database automatically match the optimal index to scan data
[out]countThe count of matching documents
Return values
SDB_OKOperation Success
OthersOperation Fail
INT32 sdbGetCSName ( sdbCSHandle  cHandle,
CHAR *  pCSName,
INT32  size 
)

Get the specified collection space name.

Parameters
[in]cHandleThe collection space handle
[in]pBufferThe buffer for output cs name
[in]sizeThe size of the buffer
Return values
SDB_OKOperation Success
OthersOperation Fail
INT32 sdbGetDataBlocks ( sdbCollectionHandle  cHandle,
bson *  condition,
bson *  select,
bson *  orderBy,
bson *  hint,
INT64  numToSkip,
INT64  numToReturn,
sdbCursorHandle handle 
)

Get the data blocks' infomation for concurrent query.

Parameters
[in]cHandleThe connection handle
[in]conditionThe matching rule, return all the documents if null
[in]selectThe selective rule, return the whole document if null
[in]orderByThe ordered rule, never sort if null
[in]hintThe hint, The collection full name eg: {"Collection":"foo.bar"} while "foo.bar" is the full name of current collection
[in]numToSkipSkip the first numToSkip documents, never skip if this parameter is 0
[in]numToReturnOnly return numToReturn documents, return all if this parameter is -1
[out]handleThe cursor handle of current query
Return values
SDB_OKOperation Success
OthersOperation Fail
Deprecated:
this API only support in java
INT32 sdbGetDomain ( sdbConnectionHandle  cHandle,
const CHAR *  pDomainName,
sdbDomainHandle handle 
)

Get a domain.

Parameters
[in]cHandleThe database connection handle
[in]pDomainNameThe name of the domain
[out]handleThe domain handle
Return values
SDB_OKOperation Success
OthersOperation Fail
INT32 sdbGetIndex ( sdbCollectionHandle  cHandle,
const CHAR *  pIndexName,
bson *  info 
)

Get the information of the specified index in current collection.

Parameters
[in]cHandleThe collection handle.
[in]pIndexNameThe index name, returns all of the indexes if this parameter is null
[out]infoThe information of index.
Return values
SDB_OKOperation Success
OthersOperation Fail
INT32 sdbGetIndexes ( sdbCollectionHandle  cHandle,
const CHAR *  pIndexName,
sdbCursorHandle handle 
)

Get all of or one of the indexes in current collection.

Parameters
[in]cHandleThe collection handle
[in]pIndexNameThe index name, returns all of the indexes if this parameter is null
[out]handleThe cursor handle of returns
Return values
SDB_OKOperation Success
OthersOperation Fail
Deprecated:
use sdbGetIndex and sdbGetIndexInfo instead.
INT32 sdbGetIndexInfo ( sdbCollectionHandle  cHandle,
sdbCursorHandle handle 
)

Get the information of all the indexes in current collection.

Parameters
[in]cHandleThe collection handle.
[out]handleThe cursor of the information of indexes.
Return values
SDB_OKOperation Success
OthersOperation Fail
void sdbGetLastErrorObj ( sdbConnectionHandle  cHandle,
bson *  errObj 
)

Get the error object(only return by engine) of the last operation. The error object will not be clean up automatically until the next error object cover it.

Parameters
[in]cHandleThe handle of current connection.
[out]errObjThe return error bson object. Please reference here for more detail.
Return values
SDB_OKGet error object Success.
SDB_DMS_EOCThere is no error object.
OthersGet error object Fail.
INT32 sdbGetList ( sdbConnectionHandle  cHandle,
INT32  listType,
bson *  condition,
bson *  selector,
bson *  orderBy,
sdbCursorHandle handle 
)

Get the specified list.

Parameters
[in]cHandleThe collection handle
[in]listTypeThe list type as below
SDB_LIST_CONTEXTS         : Get all contexts list
SDB_LIST_CONTEXTS_CURRENT : Get contexts list for the current session
SDB_LIST_SESSIONS         : Get all sessions list
SDB_LIST_SESSIONS_CURRENT : Get the current session
SDB_LIST_COLLECTIONS      : Get all collections list
SDB_LIST_COLLECTIONSPACES : Get all collecion spaces' list
SDB_LIST_STORAGEUNITS     : Get storage units list
SDB_LIST_GROUPS           : Get replicaGroup list ( only applicable in sharding env )
SDB_LIST_STOREPROCEDURES  : Get all the stored procedure list
SDB_LIST_DOMAINS          : Get all the domains list
SDB_LIST_TASKS            : Get all the running split tasks ( only applicable in sharding env )
SDB_LIST_TRANSACTIONS     : Get all the transactions information.
SDB_LIST_TRANSACTIONS_CURRENT : Get the transactions information of current session.
SDB_LIST_SVCTASKS         : Get all the schedule task informations
SDB_LIST_SEQUENCES        : Get all the sequence informations
SDB_LIST_USERS            : Get all the user informations
SDB_LIST_BACKUPS          : Get all the backups
[in]conditionThe matching rule, match all the documents if null
[in]selectThe selective rule, return the whole document if null
[in]orderByThe ordered rule, never sort if null
[out]handleThe cursor handle of current query
Return values
SDB_OKOperation Success
OthersOperation Fail
INT32 sdbGetList1 ( sdbConnectionHandle  cHandle,
INT32  listType,
bson *  condition,
bson *  selector,
bson *  orderBy,
bson *  hint,
INT64  numToSkip,
INT64  numToReturn,
sdbCursorHandle handle 
)

Get the specified list.

Parameters
[in]cHandleThe collection handle
[in]listTypeThe list type as below
SDB_LIST_CONTEXTS         : Get all contexts list
SDB_LIST_CONTEXTS_CURRENT : Get contexts list for the current session
SDB_LIST_SESSIONS         : Get all sessions list
SDB_LIST_SESSIONS_CURRENT : Get the current session
SDB_LIST_COLLECTIONS      : Get all collections list
SDB_LIST_COLLECTIONSPACES : Get all collecion spaces' list
SDB_LIST_STORAGEUNITS     : Get storage units list
SDB_LIST_GROUPS           : Get replicaGroup list ( only applicable in sharding env )
SDB_LIST_STOREPROCEDURES  : Get all the stored procedure list
SDB_LIST_DOMAINS          : Get all the domains list
SDB_LIST_TASKS            : Get all the running split tasks ( only applicable in sharding env )
SDB_LIST_TRANSACTIONS     : Get all the transactions information.
SDB_LIST_TRANSACTIONS_CURRENT : Get the transactions information of current session.
SDB_LIST_SVCTASKS         : Get all the schedule task informations
SDB_LIST_SEQUENCES        : Get all the sequence informations
SDB_LIST_USERS            : Get all the user informations
SDB_LIST_BACKUPS          : Get all the backups
[in]conditionThe matching rule, match all the documents if null
[in]selectThe selective rule, return the whole document if null
[in]orderByThe ordered rule, never sort if null
[in]hintThe options provided for specific list type. Reserved.
[in]numToSkipSkip the first numToSkip documents.
[in]numToReturnOnly return numToReturn documents. -1 means return all matched results.
[out]handleThe cursor handle of current query
Return values
SDB_OKOperation Success
OthersOperation Fail
INT32 sdbGetLobCreateTime ( sdbLobHandle  lobHandle,
UINT64 *  millis 
)

get lob's create time

Parameters
[in]lobHandleThe large object handle
[out]millisThe create time in milliseconds of lob
Return values
SDB_OKOperation Success
OthersOperation Fail
INT32 sdbGetLobId ( sdbLobHandle  lobHandle,
bson_oid_t *  oid 
)

use a lobHandle to get a large object id.

Parameters
[in]cHandleThe lob handle
[out]oidThe large object id
Return values
SDB_OKOperation Success
OthersOperation Fail
INT32 sdbGetLobModificationTime ( sdbLobHandle  lobHandle,
UINT64 *  millis 
)

get lob's last modification time

Parameters
[in]lobHandleThe large object handle
[out]millisThe modification time in milliseconds of lob
Return values
SDB_OKOperation Success
OthersOperation Fail
INT32 sdbGetLobSize ( sdbLobHandle  lobHandle,
SINT64 *  size 
)

get the lob's size

Parameters
[in]lobHandleThe large object handle
[out]sizeThe size of lob
Return values
SDB_OKOperation Success
OthersOperation Fail
INT32 sdbGetNodeAddr ( sdbNodeHandle  cHandle,
const CHAR **  ppHostName,
const CHAR **  ppServiceName,
const CHAR **  ppNodeName,
INT32 *  pNodeID 
)

Get the host and service name for the specified node.

Parameters
[in]cHandleThe node handle
[out]ppHostNameThe hostname for the node
[out]ppServiceNameThe servicename for the node
[out]ppNodeNameThe name for the node
[out]pNodeIDThe id for the node
Return values
SDB_OKOperation Success
OthersOperation Fail
INT32 sdbGetNodeByHost ( sdbReplicaGroupHandle  cHandle,
const CHAR *  pHostName,
const CHAR *  pServiceName,
sdbNodeHandle handle 
)

Get the node from the specified replica group.

Parameters
[in]cHandleThe replica group handle
[in]pHostNameThe host of node
[in]pServiceNameThe service name of the node
[out]handleThe node handle, when fail to get node, *handle == -1, and error code is return
Return values
SDB_OKOperation Success
OthersOperation Fail
INT32 sdbGetNodeByName ( sdbReplicaGroupHandle  cHandle,
const CHAR *  pNodeName,
sdbNodeHandle handle 
)

Get the node from the specified replica group.

Parameters
[in]cHandleThe replica group handle
[in]pNodeNameThe name of the node, with the format of "hostname:port".
[out]handleThe node handle, when fail to get node, *handle == -1, and error code is return
Return values
SDB_OKOperation Success
OthersOperation Fail
INT32 sdbGetNodeMaster ( sdbReplicaGroupHandle  cHandle,
sdbNodeHandle handle 
)

Get the master node of the specified replica group.

Parameters
[in]cHandleThe replica group handle
[out]handleThe master node handle
Return values
SDB_OKOperation Success
OthersOperation Fail
INT32 sdbGetNodeSlave ( sdbReplicaGroupHandle  cHandle,
sdbNodeHandle handle 
)

Get one of slave node of the specified replica group, if no slave exists then get master.

Parameters
[in]cHandleThe replica group handle
[out]handleThe slave node handle
Return values
SDB_OKOperation Success
OthersOperation Fail
INT32 sdbGetNodeSlave1 ( sdbReplicaGroupHandle  cHandle,
const INT32 *  positionsArray,
INT32  positionsCount,
sdbNodeHandle handle 
)

Get one of slave node of the specified replica group, if no slave exists then get master.

Parameters
[in]cHandleThe replica group handle
[in]positionsArrayThe array of node's position, the array elements can be 1-7.
[in]positionsCountThe amount of node's position.
[out]handleThe slave node handle
Return values
SDB_OKOperation Success
OthersOperation Fail
INT32 sdbGetPasswdByCipherFile ( const CHAR *  pUsrName,
const CHAR *  pToken,
const CHAR *  pCipherFile,
CHAR *  pUser,
CHAR *  pPasswd 
)

get user password by decrypting the cipherfile

Parameters
[in]pUsrNameThe User's Name in the cipherfile
[in]pTokenThe Password encryption token
[in]pCipherFileThe Cipherfile location, default ./passwd
[out]pUsera buffer to hold usrName without @ and following text, this user name is used for database connection
[out]pPasswda buffer to hold decrypted Password
Return values
SDB_OKRetrieval Success
OthersRetrieval Fail
INT32 sdbGetQueryMeta ( sdbCollectionHandle  cHandle,
bson *  condition,
bson *  orderBy,
bson *  hint,
INT64  numToSkip,
INT64  numToReturn,
sdbCursorHandle handle 
)

Get the index blocks' or data blocks' infomations for concurrent query.

Parameters
[in]conditionThe matching rule, return all the documents if null
[in]orderByThe ordered rule, never sort if null
[in]hintSpecified the index used to scan data. e.g. {"":"ageIndex"} means using index "ageIndex" to scan data(index scan); {"":null} means table scan. when hint is null, database automatically match the optimal index to scan data
[in]numToSkipSkip the first numToSkip documents, never skip if this parameter is 0
[in]numToReturnOnly return numToReturn documents, return all if this parameter is -1
[out]handleThe handle of query result
Return values
SDB_OKOperation Success
OthersOperation Fail
Deprecated:
this API only support in java
INT32 sdbGetReplicaGroup ( sdbConnectionHandle  cHandle,
const CHAR *  pRGName,
sdbReplicaGroupHandle handle 
)

Get the specified replica group.

Parameters
[in]cHandleThe database connection handle
[in]pRGNameThe name of replica group
[out]handleThe replica group handle
Return values
SDB_OKOperation Success
OthersOperation Fail
INT32 sdbGetReplicaGroup1 ( sdbConnectionHandle  cHandle,
UINT32  id,
sdbReplicaGroupHandle handle 
)

Get the specified replica group.

Parameters
[in]cHandleThe database connection handle
[in]idThe id of the replica group
[out]handleThe replica group handle
Return values
SDB_OKOperation Success
OthersOperation Fail
INT32 sdbGetReplicaGroupName ( sdbReplicaGroupHandle  cHandle,
CHAR **  ppRGName 
)

Get the specified replica group's name.

Parameters
[in]cHandleThe replica group handle
[out]ppRGNameThe replica group name
Return values
SDB_OKOperation Success
OthersOperation Fail
Deprecated:
This api will be deprecated at version 2.x
INT32 sdbGetRGName ( sdbReplicaGroupHandle  cHandle,
CHAR *  pBuffer,
INT32  size 
)

Get the specified replica group's name.

Parameters
[in]cHandleThe replica group handle
[in]pBufferThe buffer for output replica group name
[in]sizethe size of the buffer
Return values
SDB_OKOperation Success
OthersOperation Fail
INT32 sdbGetRunTimeDetail ( sdbLobHandle  lobHandle,
bson *  detail 
)

Get the run time detail information of lob.

Return values
SDB_OKOperation Success
OthersOperation Fail
INT32 sdbGetSequence ( sdbConnectionHandle  cHandle,
const CHAR *  pSequenceName,
sdbSequenceHandle sHandle 
)

Get the named sequence.

Parameters
[in]cHandleThe database connection handle
[in]pSequenceNameThe name of sequence
[out]sHandleThe sequence handle
Return values
SDB_OKOperation Success
OthersOperation Fail
INT32 sdbGetSessionAttr ( sdbConnectionHandle  cHandle,
bson *  result 
)

Get the attributes of the current session from the local cache if possible.

Parameters
[in]cHandleThe connection handle.
[out]resultThe return bson object.
Return values
SDB_OKOperation Success
OthersOperation Fail
INT32 sdbGetSessionAttrEx ( sdbConnectionHandle  cHandle,
BOOLEAN  useCache,
bson *  result 
)

Get the attributes of the current session.

Parameters
[in]cHandleThe connection handle.
[in]useCacheWhether to use cache in local.
[out]resultThe return bson object.
Return values
SDB_OKOperation Success
OthersOperation Fail
INT32 sdbGetSnapshot ( sdbConnectionHandle  cHandle,
INT32  snapType,
bson *  condition,
bson *  selector,
bson *  orderBy,
sdbCursorHandle handle 
)

Get the snapshot.

Parameters
[in]cHandleThe connection handle
[in]snapTypeThe snapshot type as below
SDB_SNAP_CONTEXTS         : Get the snapshot of all the contexts
SDB_SNAP_CONTEXTS_CURRENT : Get the snapshot of current context
SDB_SNAP_SESSIONS         : Get the snapshot of all the sessions
SDB_SNAP_SESSIONS_CURRENT : Get the snapshot of current session
SDB_SNAP_COLLECTIONS      : Get the snapshot of all the collections
SDB_SNAP_COLLECTIONSPACES : Get the snapshot of all the collection spaces
SDB_SNAP_DATABASE         : Get the snapshot of the database
SDB_SNAP_SYSTEM           : Get the snapshot of the system
SDB_SNAP_CATALOG          : Get the snapshot of the catalog
SDB_SNAP_TRANSACTIONS     : Get snapshot of transactions in current session
SDB_SNAP_TRANSACTIONS_CURRENT : Get snapshot of all the transactions
SDB_SNAP_ACCESSPLANS      : Get the snapshot of cached access plans
SDB_SNAP_HEALTH           : Get snapshot of node health detection
SDB_SNAP_CONFIGS          : Get snapshot of node configurations
SDB_SNAP_SVCTASKS         : Get all the information of schedule task
SDB_SNAP_SEQUENCES        : Get the snapshot of sequences
SDB_SNAP_INDEXSTATS       : Get the snapshot of index statistics
SDB_SNAP_TRANSWAITS       : Get the snapshot of transaction waits 
SDB_SNAP_TRANSDEADLOCK    : Get the snapshot of transaction deadlock
[in]conditionThe matching rule, match all the documents if null
[in]selectThe selective rule, return the whole document if null
[in]orderByThe ordered rule, never sort if null
[out]handleThe cursor handle of current query
Return values
SDB_OKOperation Success
OthersOperation Fail
INT32 sdbGetSnapshot1 ( sdbConnectionHandle  cHandle,
INT32  snapType,
bson *  condition,
bson *  selector,
bson *  orderBy,
bson *  hint,
INT64  numToSkip,
INT64  numToReturn,
sdbCursorHandle handle 
)

Get the snapshot.

Parameters
[in]cHandleThe connection handle
[in]snapTypeThe snapshot type as below
SDB_SNAP_CONTEXTS         : Get the snapshot of all the contexts
SDB_SNAP_CONTEXTS_CURRENT : Get the snapshot of current context
SDB_SNAP_SESSIONS         : Get the snapshot of all the sessions
SDB_SNAP_SESSIONS_CURRENT : Get the snapshot of current session
SDB_SNAP_COLLECTIONS      : Get the snapshot of all the collections
SDB_SNAP_COLLECTIONSPACES : Get the snapshot of all the collection spaces
SDB_SNAP_DATABASE         : Get the snapshot of the database
SDB_SNAP_SYSTEM           : Get the snapshot of the system
SDB_SNAP_CATALOG          : Get the snapshot of the catalog
SDB_SNAP_TRANSACTIONS     : Get snapshot of transactions in current session
SDB_SNAP_TRANSACTIONS_CURRENT : Get snapshot of all the transactions
SDB_SNAP_ACCESSPLANS      : Get the snapshot of cached access plans
SDB_SNAP_HEALTH           : Get snapshot of node health detection
SDB_SNAP_CONFIGS          : Get snapshot of node configurations
SDB_SNAP_SVCTASKS         : Get all the information of schedule task
SDB_SNAP_SEQUENCES        : Get the snapshot of sequences
SDB_SNAP_INDEXSTATS       : Get the snapshot of index statistics
SDB_SNAP_TRANSWAITS       : Get the snapshot of transaction waits 
SDB_SNAP_TRANSDEADLOCK    : Get the snapshot of transaction deadlock
[in]conditionThe matching rule, match all the documents if null
[in]selectThe selective rule, return the whole document if null
[in]orderByThe ordered rule, never sort if null
[in]hintThe options provided for specific snapshot type. format:{ '$Options': { <options> } }
[in]numToSkipSkip the first numToSkip documents, default is 0
[in]numToReturnOnly return numToReturn documents, default is -1 for returning all results
[out]handleThe cursor handle of current query
Return values
SDB_OKOperation Success
OthersOperation Fail
INT32 sdbInsert ( sdbCollectionHandle  cHandle,
bson *  obj 
)

Insert a bson object into current collection.

Parameters
[in]cHandleThe collection handle.
[in]objThe bson object to be inserted, cannot be null.
Return values
SDB_OKOperation Success.
OthersOperation Fail.
INT32 sdbInsert1 ( sdbCollectionHandle  cHandle,
bson *  obj,
bson_iterator *  pId 
)

Insert a bson object into current collection.

Parameters
[in]cHandleThe collection handle.
[in]objThe bson object to be inserted, cannot be null.
[out]pIdThe object id of inserted bson object. Can be the follow value:
  • NULL: when this argument is NULL.
  • value of "_id" field: pId points the position of the record where the value of "_id" field is. Note that: the memory of pId will be invalidated when next insert/bulkInsert is performed or the inserted bson object is destroyed.
Return values
SDB_OKOperation Success.
OthersOperation Fail.
INT32 sdbInsert2 ( sdbCollectionHandle  cHandle,
bson *  obj,
INT32  flags,
bson *  pResullt 
)

Insert a bson object into current collection.

Parameters
[in]cHandleThe collection handle.
[in]objThe bson object to be inserted, cannot be null.
[in]flagsThe flag to control the behavior of inserting. The value of flags default to be 0, and it can choose the follow values:
  • 0: while 0 is set(default to be 0), database will stop inserting when the record hit index key duplicate error.
  • FLG_INSERT_CONTONDUP: if the record hit index key duplicate error, database will skip them and go on inserting.
  • FLG_INSERT_RETURN_OID: return the value of "_id" field in the record.
  • FLG_INSERT_REPLACEONDUP: if the record hit index key duplicate error, database will replace the existing record by the inserting new record.

[out]pResultThe result of inserting. Can be NULL or a bson:
  • NULL: when this argument is NULL.
  • bson: an empty bson on error, or a bson whose contains the insert details on success, as follows:

    InsertedNum: The number of records successfully inserted, including replaced and ignored records. DuplicatedNum: The number of records ignored or replaced due to duplicate key conflicts. LastGenerateID: The max value of all autoIncrements in current collection. The result will include field "LastGenerateID" if current collection has autoIncrements. _id: Obecjt ID of the inserted record. The result will include field "_id" if FLG_INSERT_RETURN_OID is used.

Return values
SDB_OKOperation Success.
OthersOperation Fail.
INT32 sdbInterrupt ( sdbConnectionHandle  cHandle)

Send a "Interrpt" message to engine, as a result, all the cursors and lobs created by current connection will be closed.

Parameters
[in]cHandleThe database connection handle
Return values
SDB_OKOperation Success
OthersOperation Fail
INT32 sdbInterruptOperation ( sdbConnectionHandle  cHandle)

Send "INTERRUPT_SELF" message to engine to stop the current operation. When the current operation had finish, nothing happend, Otherwise, the current operation will be stop, and return error.

Parameters
[in]cHandleThe database connection handle
Return values
SDB_OKOperation Success
OthersOperation Fail
INT32 sdbInvalidateCache ( sdbConnectionHandle  cHandle,
bson *  options 
)

invalidate cache on specified nodes.

Parameters
[in]cHandleThe connection handle
[in]optionsThe control options:(Only take effect in coordinate nodes). About the parameter 'options', please reference to the official website(www.sequoiadb.com) and then search "位置命令参数" for more details. Some of its optional parameters are as bellow:
  • Global(Bool) : execute this command in global or not. While 'options' is null, it's equals to {Glocal: true}.
  • GroupID(INT32 or INT32 Array) : specified one or several groups by their group IDs. e.g. {GroupID:[1001, 1002]}.
  • GroupName(String or String Array) : specified one or several groups by their group names. e.g. {GroupID:"group1"}.
  • ...
Return values
SDB_OKOperation Success
OthersOperation Fail
BOOLEAN sdbIsClosed ( sdbConnectionHandle  cHandle)

Judge whether the connection is closed or not.

Parameters
[in]cHandlethe connection handle.
Return values
TRUEfor connection is closed while FALSE for not.
BOOLEAN sdbIsReplicaGroupCatalog ( sdbReplicaGroupHandle  cHandle)

Test whether the specified replica group is catalog.

Parameters
[in]cHandleThe replica group handle
Return values
TRUEThe replica group is catalog
FALSEThe replica group is not catalog
BOOLEAN sdbIsValid ( sdbConnectionHandle  cHandle)

Judge whether the connection is valid.

Parameters
[in]cHandlethe connection handle.
Return values
TRUEfor connection is valid while FALSE for not.
INT32 sdbListBackup ( sdbConnectionHandle  cHandle,
bson *  options,
bson *  condition,
bson *  selector,
bson *  orderBy,
sdbCursorHandle handle 
)

List the backups.

Parameters
[in]cHandleThe connection handle
[in]optionsContains configuration information for listing backups, list all the backups in the default backup path if null. The "options" contains several options as below. All the elements in options are optional. eg: {"GroupName":["RGName1", "RGName2"], "Path":"/opt/sequoiadb/backup", "Name":"backupName"}
GroupID     : Specified the group id of the backups, default to list all the backups of all the groups.
GroupName   : Specified the group name of the backups, default to list all the backups of all the groups.
Path        : Specified the path of the backups, default to use the backup path asigned in the configuration file.
Name        : Specified the name of backup, default to list all the backups.
IsSubDir    : Specified the "Path" is a subdirectory of the backup path assigned in the configuration file or not, default to be false.
Prefix      : Specified the prefix name of the backups, support for using wildcards("%g","%G","%h","%H","%s","%s"),such as: Prefix:"%g_bk_", default to not using wildcards.
Detail      : Display the detail of the backups or not, default to be false.
[in]conditionThe matching rule, return all the documents if null
[in]selectorThe selective rule, return the whole document if null
[in]orderByThe ordered rule, never sort if null
[out]handleThe cusor handle of result
Return values
SDB_OKOperation Success
OthersOperation Fail
INT32 sdbListCollections ( sdbConnectionHandle  cHandle,
sdbCursorHandle handle 
)

List all collection of current database(not include temporary collection of temporary collection space)

Parameters
[in]cHandleThe database connection handle
[out]handleThe cursor handle of all collection names
Return values
SDB_OKOperation Success
OthersOperation Fail
INT32 sdbListCollectionsInDomain ( sdbDomainHandle  cHandle,
sdbCursorHandle cursor 
)

list the collections in domain.

Parameters
[in]cHandleThe domain handle
[out]handleThe cusor handle of result
Return values
SDB_OKOperation Success
OthersOperation Fail
INT32 sdbListCollectionSpaces ( sdbConnectionHandle  cHandle,
sdbCursorHandle handle 
)

List all collection space of current database(include temporary collection space)

Parameters
[in]cHandleThe database connection handle
[out]handleThe cursor handle of all collection space names
Return values
SDB_OKOperation Success
OthersOperation Fail
INT32 sdbListCollectionSpacesInDomain ( sdbDomainHandle  cHandle,
sdbCursorHandle cursor 
)

list the collection spaces in domain.

Parameters
[in]cHandleThe domain handle
[out]handleThe cusor handle of result
Return values
SDB_OKOperation Success
OthersOperation Fail
INT32 sdbListDomains ( sdbConnectionHandle  cHandle,
bson *  condition,
bson *  selector,
bson *  orderBy,
sdbCursorHandle handle 
)

List the domains.

Parameters
[in]cHandleThe connection handle
[in]conditionThe matching rule, return all the documents if null
[in]selectorThe selective rule, return the whole document if null
[in]orderByThe ordered rule, never sort if null
[in]hintSpecified the index used to scan data. e.g. {"":"ageIndex"} means using index "ageIndex" to scan data(index scan); {"":null} means table scan. when hint is null, database automatically match the optimal index to scan data
[out]handleThe cusor handle of result
Return values
SDB_OKOperation Success
OthersOperation Fail
INT32 sdbListGroupsInDomain ( sdbDomainHandle  cHandle,
sdbCursorHandle cursor 
)

list the groups in domain.

Parameters
[in]cHandleThe domain handle
[out]handleThe cusor handle of result
Return values
SDB_OKOperation Success
OthersOperation Fail
INT32 sdbListLobPieces ( sdbCollectionHandle  cHandle,
sdbCursorHandle cursor 
)

list all the pieces in the lob

Parameters
[in]cHandleThe collection handle
[out]cursorThe cursor handle of current query
Return values
SDB_OKOperation Success
OthersOperation Fail
INT32 sdbListLobPieces1 ( sdbCollectionHandle  cHandle,
bson *  condition,
bson *  selected,
bson *  orderBy,
bson *  hint,
INT64  numToSkip,
INT64  numToReturn,
sdbCursorHandle cursor 
)

list all the pieces in the lob

Parameters
[in]cHandleThe collection handle
[in]conditionThe matching rule, return all the lob if not provided
[in]selectedThe selective rule, return the whole infomation if not provided
[in]orderByThe ordered rule, result set is unordered if not provided
[in]hintSpecified options. e.g. {"ListPieces": 1} means get the detail piece info of lobs;
[in]numToSkipSkip the first numToSkip lob, default is 0
[in]numToReturnOnly return numToReturn lob, default is -1 for returning all results
[out]cursorThe cursor handle of current query
Return values
SDB_OKOperation Success
OthersOperation Fail
INT32 sdbListLobs ( sdbCollectionHandle  cHandle,
sdbCursorHandle cursor 
)

list all the lobs' meta data in current collection

Parameters
[in]cHandleThe collection handle
[out]cursorThe cursor handle of current query
Return values
SDB_OKOperation Success
OthersOperation Fail
INT32 sdbListLobs1 ( sdbCollectionHandle  cHandle,
bson *  condition,
bson *  selected,
bson *  orderBy,
bson *  hint,
INT64  numToSkip,
INT64  numToReturn,
sdbCursorHandle cursor 
)

list all the lobs' meta data in current collection

Parameters
[in]cHandleThe collection handle
[in]conditionThe matching rule, return all the lob if not provided
[in]selectedThe selective rule, return the whole infomation if not provided
[in]orderByThe ordered rule, result set is unordered if not provided
[in]hintSpecified options. e.g. {"ListPieces": 1} means get the detail piece info of lobs;
[in]numToSkipSkip the first numToSkip lob, default is 0
[in]numToReturnOnly return numToReturn lob, default is -1 for returning all results
[out]cursorThe cursor handle of current query
Return values
SDB_OKOperation Success
OthersOperation Fail
INT32 sdbListProcedures ( sdbConnectionHandle  cHandle,
bson *  condition,
sdbCursorHandle handle 
)

List store procedures.

Parameters
[in]cHandleThe collection space space handle
[in]conditionThe condition of list
[out]handleThe cursor handle
Return values
SDB_OKOperation Success
OthersOperation Fail
INT32 sdbListReplicaGroups ( sdbConnectionHandle  cHandle,
sdbCursorHandle handle 
)

List all the replica groups of current database.

Parameters
[in]cHandleThe database connection handle
[out]handleThe cursor handle of all replica groups
Return values
SDB_OKOperation Success
OthersOperation Fail
INT32 sdbListSequences ( sdbConnectionHandle  cHandle,
sdbCursorHandle handle 
)

List all sequences of current database.

Parameters
[in]cHandleThe database connection handle
[out]handleThe cursor handle of all sequences names
Return values
SDB_OKOperation Success
OthersOperation Fail
INT32 sdbListTasks ( sdbConnectionHandle  cHandle,
bson *  condition,
bson *  selector,
bson *  orderBy,
bson *  hint,
sdbCursorHandle handle 
)

List the tasks.

Parameters
[in]cHandleThe connection handle
[in]conditionThe matching rule, return all the documents if null
[in]selectorThe selective rule, return the whole document if null
[in]orderByThe ordered rule, never sort if null
[in]hintSpecified the index used to scan data. e.g. {"":"ageIndex"} means using index "ageIndex" to scan data(index scan); {"":null} means table scan. when hint is null, database automatically match the optimal index to scan data
[out]handleThe cusor handle of result
Return values
SDB_OKOperation Success
OthersOperation Fail
INT32 sdbLoadCollectionSpace ( sdbConnectionHandle  cHandle,
const CHAR *  csName,
bson *  options 
)

Load the specified collection space to database from file.

Parameters
[in]cHandleThe database connection handle
[in]csNameThe specified collection space name
[in]optionsThe control options:(Only take effect in coordinate nodes) GroupID:INT32, GroupName:String, NodeID:INT32, HostName:String, svcname:String, ...
Return values
SDB_OKOperation Success
OthersOperation Fail
BOOLEAN sdbLobIsEof ( sdbLobHandle  lobHandle)

Check whether current offset has reached to the max size of current lob.

Parameters
[in]lobHandleThe large object handle
Return values
Returntrue if yes while false for not, while the input handle is invalid, return true.
INT32 sdbLockAndSeekLob ( sdbLobHandle  lobHandle,
INT64  offset,
INT64  length 
)

lock LOB section for write mode and seek to the offset position

Parameters
[in]lobHandleThe large object handle
[in]offsetThe lock start position
[in]lengthThe lock length, -1 means lock to the end of lob
Return values
SDB_OKOperation Success
OthersOperation Fail
INT32 sdbLockLob ( sdbLobHandle  lobHandle,
INT64  offset,
INT64  length 
)

lock LOB section for write mode

Parameters
[in]lobHandleThe large object handle
[in]offsetThe lock start position
[in]lengthThe lock length, -1 means lock to the end of lob
Return values
SDB_OKOperation Success
OthersOperation Fail
INT32 sdbNext ( sdbCursorHandle  cHandle,
bson *  obj 
)

Return the next document of current cursor, and move forward.

Parameters
[in]cHandleThe cursor handle
[out]objThe return bson object
Return values
SDB_OKOperation Success
OthersOperation Fail
INT32 sdbOpenLob ( sdbCollectionHandle  cHandle,
const bson_oid_t *  oid,
INT32  mode,
sdbLobHandle lobHandle 
)

create a large object or open a large object to read or write.

Parameters
[in]cHandleThe collection handle
[in]oidThe large object id, if mode is SDB_LOB_CREATEONLY, the oid can be NULL
[in]modeThe open mode: SDB_LOB_CREATEONLY,SDB_LOB_READ,SDB_LOB_WRITE,SDB_LOB_SHAREREAD, SDB_LOB_WRITE | SDB_LOB_SHAREREAD
[out]lobHandleThe handle of object
Return values
SDB_OKOperation Success
OthersOperation Fail
INT32 sdbQuery ( sdbCollectionHandle  cHandle,
bson *  condition,
bson *  select,
bson *  orderBy,
bson *  hint,
INT64  numToSkip,
INT64  numToReturn,
sdbCursorHandle handle 
)

Get the matching documents in current collection.

Parameters
[in]cHandleThe collection handle
[in]conditionThe matching rule, return all the documents if null
[in]selectThe selective rule, return the whole document if null
[in]orderByThe ordered rule, never sort if null
[in]hintSpecified the index used to scan data. e.g. {"":"ageIndex"} means using index "ageIndex" to scan data(index scan); {"":null} means table scan. when hint is null, database automatically match the optimal index to scan data
[in]numToSkipSkip the first numToSkip documents, never skip if this parameter is 0
[in]numToReturnOnly return numToReturn documents, return all if this parameter is -1
[out]handleThe cursor handle of current query
Return values
SDB_OKOperation Success
OthersOperation Fail
INT32 sdbQuery1 ( sdbCollectionHandle  cHandle,
bson *  condition,
bson *  select,
bson *  orderBy,
bson *  hint,
INT64  numToSkip,
INT64  numToReturn,
INT32  flag,
sdbCursorHandle handle 
)

Get the matching documents in current collection.

Parameters
[in]cHandleThe collection handle
[in]conditionThe matching rule, return all the documents if null
[in]selectThe selective rule, return the whole document if null
[in]orderByThe ordered rule, never sort if null
[in]hintSpecified the index used to scan data. e.g. {"":"ageIndex"} means using index "ageIndex" to scan data(index scan); {"":null} means table scan. when hint is null, database automatically match the optimal index to scan data
[in]numToSkipSkip the first numToSkip documents, never skip if this parameter is 0
[in]numToReturnOnly return numToReturn documents, return all if this parameter is -1
[in]flagThe query flag, default to be 0. Please see the definition of follow flags for more detail. Usage: e.g. set ( QUERY_FORCE_HINT | QUERY_WITH_RETURNDATA ) to param flag
[out]handleThe cursor handle of current query
Return values
SDB_OKOperation Success
OthersOperation Fail
INT32 sdbQueryAndRemove ( sdbCollectionHandle  cHandle,
bson *  condition,
bson *  select,
bson *  orderBy,
bson *  hint,
INT64  numToSkip,
INT64  numToReturn,
INT32  flag,
sdbCursorHandle handle 
)

Get the matching documents in current collection and remove.

Parameters
[in]cHandleThe collection handle
[in]conditionThe matching rule, return all the documents if null
[in]selectThe selective rule, return the whole document if null
[in]orderByThe ordered rule, never sort if null
[in]hintSpecified the index used to scan data. e.g. {"":"ageIndex"} means using index "ageIndex" to scan data(index scan); {"":null} means table scan. when hint is null, database automatically match the optimal index to scan data
[in]numToSkipSkip the first numToSkip documents, never skip if this parameter is 0
[in]numToReturnOnly return numToReturn documents, return all if this parameter is -1
[in]flagThe query flag, default to be 0. Please see the definition of follow flags for more detail. Usage: e.g. set ( QUERY_FORCE_HINT | QUERY_WITH_RETURNDATA ) to param flag
[out]handleThe cursor handle of current query
Return values
SDB_OKOperation Success
OthersOperation Fail
INT32 sdbQueryAndUpdate ( sdbCollectionHandle  cHandle,
bson *  condition,
bson *  select,
bson *  orderBy,
bson *  hint,
bson *  update,
INT64  numToSkip,
INT64  numToReturn,
INT32  flag,
BOOLEAN  returnNew,
sdbCursorHandle handle 
)

Get the matching documents in current collection and update.

Parameters
[in]cHandleThe collection handle
[in]conditionThe matching rule, return all the documents if null
[in]selectThe selective rule, return the whole document if null
[in]orderByThe ordered rule, never sort if null
[in]hintSpecified the index used to scan data. e.g. {"":"ageIndex"} means using index "ageIndex" to scan data(index scan); {"":null} means table scan. when hint is null, database automatically match the optimal index to scan data
[in]updateThe update rule, can't be null
[in]numToSkipSkip the first numToSkip documents, never skip if this parameter is 0
[in]numToReturnOnly return numToReturn documents, return all if this parameter is -1
[in]flagThe query flag, default to be 0. Please see the definition of follow flags for more detail. Usage: e.g. set ( QUERY_FORCE_HINT | QUERY_WITH_RETURNDATA ) to param flag
[in]returnNewWhen TRUE, returns the updated document rather than the original
[out]handleThe cursor handle of current query
Return values
SDB_OKOperation Success
OthersOperation Fail
INT32 sdbReadLob ( sdbLobHandle  lobHandle,
UINT32  len,
CHAR *  buf,
UINT32 *  read 
)

read lob

Parameters
[in]lobHandleThe large object handle
[in]lenThe length want to read
[out]bufPut the data into buf
[out]readThe length of read
Return values
SDB_OKOperation Success
OthersOperation Fail
INT32 sdbReelect ( sdbReplicaGroupHandle  cHandle,
const bson *  options 
)
Parameters
[in]cHandleThe replica group handle
[in]optionsThe options of reelection. Please reference here for more detail.
Return values
SDB_OKOperation Success
OthersOperation Fail
void sdbReleaseCollection ( sdbCollectionHandle  cHandle)

Release collection handle, the cursor handle of this collection will still available.

Parameters
[in]cHandleThe collection handle
void sdbReleaseConnection ( sdbConnectionHandle  cHandle)

Release the database connection handle.

Parameters
[in]cHandleThe database connection handle
void sdbReleaseCS ( sdbCSHandle  cHandle)

Release the collection space handle, the collecion and cursor handle of this collection space will still available.

Parameters
[in]cHandleThe collection space handle
void sdbReleaseCursor ( sdbCursorHandle  cHandle)

Release the cursor handle.

Parameters
[in]cHandleThe cursor handle
void sdbReleaseDomain ( sdbDomainHandle  cHandle)

Release the domain handle.

Parameters
[in]cHandlethe domain handle
void sdbReleaseNode ( sdbNodeHandle  cHandle)

Release the node handle.

Parameters
[in]cHandleThe node handle
void sdbReleaseReplicaGroup ( sdbReplicaGroupHandle  cHandle)

Release the replica group handle.

Parameters
[in]cHandleThe replica group handle
void sdbReleaseSequence ( sdbSequenceHandle  sHandle)

Release the sequence handle.

Parameters
[in]sHandleThe sequence handle
INT32 sdbReloadConfig ( sdbConnectionHandle  cHandle,
bson *  options 
)

Force the node to reload configs online.

Parameters
[in]cHandleThe database connection handle
[in]optionsThe control options:(Only take effect in coordinate nodes) GroupID:INT32, GroupName:String, NodeID:INT32, HostName:String, svcname:String, ...
Return values
SDB_OKOperation Success
OthersOperation Fail
INT32 sdbRemoveBackup ( sdbConnectionHandle  cHandle,
bson *  options 
)

Remove the backups.

Parameters
[in]cHandleThe connection handle
[in]optionsContains configuration infomations for removing backups, remove all the backups in the default backup path if null. The "options" contains several options as below. All the elements in options are optional. eg: {"GroupName":["RGName1", "RGName2"], "Path":"/opt/sequoiadb/backup", "Name":"backupName"}
GroupID     : Specified the group id of the backups, default to list all the backups of all the groups.
GroupName   : Specified the group name of the backups, default to list all the backups of all the groups.
Path        : Specified the path of the backups, default to use the backup path asigned in the configuration file.
Name        : Specified the name of backup, default to list all the backups.
IsSubDir    : Specified the "Path" is a subdirectory of the backup path assigned in the configuration file or not, default to be false.
Prefix      : Specified the prefix name of the backups, support for using wildcards("%g","%G","%h","%H","%s","%s"),such as: Prefix:"%g_bk_", default to not using wildcards.
Detail      : Display the detail of the backups or not, default to be false.
Return values
SDB_OKOperation Success
OthersOperation Fail
INT32 sdbRemoveLob ( sdbCollectionHandle  cHandle,
const bson_oid_t *  oid 
)

remove lob

Parameters
[in]cHandleThe handle of collection
[in]oidThe large object id
Return values
SDB_OKOperation Success
OthersOperation Fail
INT32 sdbRemoveNode ( sdbReplicaGroupHandle  cHandle,
const CHAR *  pHostName,
const CHAR *  pServiceName,
bson *  configure 
)

remove node in a given replica group

Parameters
[in]cHandleThe replica group handle
[in]pHostNameThe hostname for the node
[in]pServiceNameThe servicename for the node
[in]configureThe configurations for the node
Return values
SDB_OKOperation Success
OthersOperation Fail
INT32 sdbRemoveReplicaGroup ( sdbConnectionHandle  cHandle,
const CHAR *  pRGName 
)

Remove the specified replica group.

Parameters
[in]cHandleThe database connection handle
[in]pRGNameThe name of the replica group
Return values
SDB_OKOperation Success
OthersOperation Fail
INT32 sdbRemoveUsr ( sdbConnectionHandle  cHandle,
const CHAR *  pUsrName,
const CHAR *  pPasswd 
)

Delete an account.

Parameters
[in]cHandleThe database connection handle
[in]pUsrNameThe User's Name of the account
[in]pPasswdThe Password of the account
Return values
SDB_OKConnection Success
OthersConnection Fail
INT32 sdbRenameCollection ( sdbCSHandle  cHandle,
const CHAR *  pOldName,
const CHAR *  pNewName,
bson *  options 
)

Rename collection name.

Parameters
[in]cHandleThe collection space handle
[in]pOldNameThe old collection short name
[in]pNewNameThe new collection short name
[in]optionsReserved
Return values
SDB_OKOperation Success
OthersOperation Fail
INT32 sdbRenameCollectionSpace ( sdbConnectionHandle  cHandle,
const CHAR *  pOldName,
const CHAR *  pNewName,
bson *  options 
)

Rename the collectionspace name.

Parameters
[in]cHandleThe database connection handle
[in]pOldNameThe old collection space name
[in]pNewNameThe new collection space name
[in]optionsReserved
Return values
SDB_OKOperation Success
OthersOperation Fail
INT32 sdbRenameSequence ( sdbConnectionHandle  cHandle,
const CHAR *  pOldName,
const CHAR *  pNewName 
)

Rename sequence.

Parameters
[in]cHandleThe database connection handle
[in]pOldNameThe old sequence name
[in]pNewNameThe new sequence name
Return values
SDB_OKOperation Success
OthersOperation Fail
INT32 sdbResetSnapshot ( sdbConnectionHandle  cHandle,
bson *  options 
)

Reset the snapshot.

Parameters
[in]cHandleThe connection handle
[in]optionsThe control options:
Type            : (String) Specify the snapshot type to be reset.( defalut is "all" )
                  "sessions"
                  "sessions current"
                  "database"
                  "health"
                  "all"
SessionID       : (INT32) Specify the session ID to be reset.
Other options   : Some of other options are as below: (please visit the official website to
                  search "Location Elements" for more detail.)
                  GroupID   :INT32,
                  GroupName :String,
                  NodeID    :INT32,
                  HostName  :String,
                  svcname   :String,
                  ...
Return values
SDB_OKOperation Success
OthersOperation Fail
INT32 sdbRmProcedure ( sdbConnectionHandle  cHandle,
const CHAR *  spName 
)

remove a store procedure.

Parameters
[in]cHandleThe collection space space handle
[in]spNameThe name of store procedure
Return values
SDB_OKOperation Success
OthersOperation Fail
INT32 sdbSecureConnect ( const CHAR *  pHostName,
const CHAR *  pServiceName,
const CHAR *  pUsrName,
const CHAR *  pPasswd,
sdbConnectionHandle handle 
)

Connect to database with SSL.

Parameters
[in]pHostNameThe Host Name or IP Address of Database Server
[in]pServiceNameThe Service Name or Port of Database Server
[in]pUsrNameThe User's Name of the account
[in]pPasswdThe Password of the account
[out]handleThe database connection handle, when fail to connect, *handle == SDB_INVALID_HANDLE and error code is return
Return values
SDB_OKConnection Success
OthersConnection Fail
INT32 sdbSecureConnect1 ( const CHAR **  pConnAddrs,
INT32  arrSize,
const CHAR *  pUsrName,
const CHAR *  pPasswd,
sdbConnectionHandle handle 
)

Connect to database used a random valid address in the array, with SSL.

Parameters
[in]pConnAddrsThe array of the coord's address
[in]arrSizeThe size of the array
[in]pUsrNameThe User's Name of the account
[in]pPasswdThe Password of the account
[out]handleThe database connection handle
Return values
SDB_OKConnection Success
OthersConnection Fail
INT32 sdbSeekLob ( sdbLobHandle  lobHandle,
SINT64  size,
SDB_LOB_SEEK  whence 
)

seek the place to read or write

Parameters
[in]lobHandleThe large object handle
[in]sizeThe size of seek
[in]whenceThe whence of seek
Return values
SDB_OKOperation Success
OthersOperation Fail
INT32 sdbSeqFetch ( sdbSequenceHandle  sHandle,
const INT32  fetchNum,
INT64 *  nextValue,
INT32 *  returnNum,
INT32 *  increment 
)

Fetch a bulk of continuous values.

Parameters
[in]sHandleThe sequence handle
[in]fetchNumThe number of values to be fetched.
[out]nextValueThe next value and also the first returned value.
[out]returnNumThe number of values returned.
[out]incrementIncrement of values.
Return values
SDB_OKOperation Success
OthersOperation Fail
INT32 sdbSeqGetCurrentValue ( sdbSequenceHandle  sHandle,
INT64 *  value 
)

Get the current value of sequence.

Parameters
[in]sHandleThe sequence handle
[out]valueThe current value
Return values
SDB_OKOperation Success
OthersOperation Fail
INT32 sdbSeqGetNextValue ( sdbSequenceHandle  sHandle,
INT64 *  value 
)

Get the next value of sequence.

Parameters
[in]sHandleThe sequence handle
[out]valueThe next value
Return values
SDB_OKOperation Success
OthersOperation Fail
INT32 sdbSeqRestart ( sdbSequenceHandle  sHandle,
const INT64  startValue 
)

Restart sequence from the given value.

Parameters
[in]sHandleThe sequence handle
[in]startValueThe star value.
Return values
SDB_OKOperation Success
OthersOperation Fail
INT32 sdbSeqSetAttributes ( sdbSequenceHandle  sHandle,
const bson *  options 
)

Alter the specified sequence.

Parameters
[in]sHandleThe sequence handle
[in]optionsoptions The options of sequence to be changed, e.g. { "CurrentValue": 4096 }.
 CurrentValue   : The current value of sequence
 StartValue     : The start value of sequence
 MinValue       : The minimum value of sequence
 MaxValue       : The maxmun value of sequence
 Increment      : The increment value of sequence
 CacheSize      : The cache size of sequence
 AcquireSize    : The acquire size of sequence
 Cycled         : The cycled flag of sequence
Return values
SDB_OKOperation Success
OthersOperation Fail
INT32 sdbSeqSetCurrentValue ( sdbSequenceHandle  sHandle,
const INT64  value 
)

Set the current value to sequence.

Parameters
[in]sHandleThe sequence handle
[in]valueThe expected current value
Return values
SDB_OKOperation Success
OthersOperation Fail
void sdbSetConnectionInterruptFunc ( sdbConnectionHandle  cHandle,
socketInterruptFunc  func 
)

Set the callback function for connection interruption.

Parameters
[in]cHandleThe handle of connection.
[in]funcThe function that check the app is interrupt or not
Return values
void
INT32 sdbSetErrorOnReplyCallback ( ERROR_ON_REPLY_FUNC  func)

Set the callback function when reply message if error from server.

Parameters
[in]funcThe callback function when called on reply error
INT32 sdbSetPDLevel ( sdbConnectionHandle  cHandle,
INT32  pdLevel,
bson *  options 
)

Set the node's diagnostic level.

Parameters
[in]cHandleThe database connection handle
[in]pdLevelDiagnostic level, value:[0~5]
[in]optionsThe control options:(Only take effect in coordinate nodes) GroupID:INT32, GroupName:String, NodeID:INT32, HostName:String, svcname:String, ...
Return values
SDB_OKOperation Success
OthersOperation Fail
INT32 sdbSetSessionAttr ( sdbConnectionHandle  cHandle,
bson *  options 
)

Set the attributes of the current session.

Parameters
[in]cHandleThe connection handle
[in]optionsThe options for setting session attributes. Can not be NULL. While it's a empty options, the local session attributes cache will be cleanup. Please reference here for more detail.
Return values
SDB_OKOperation Success
OthersOperation Fail
INT32 sdbSplitCLAsync ( sdbCollectionHandle  cHandle,
const CHAR *  pSourceRG,
const CHAR *  pTargetRG,
const bson *  pSplitCondition,
const bson *  pSplitEndCondition,
SINT64 *  taskID 
)

Split the specified collection from source replica group to target by range.

Parameters
[in]cHandleThe collection handle
[in]pSourceRGThe source replica group name
[in]pTargetRGThe target replica group name
[in]pSplitConditionThe split condition
[in]splitEndConditionThe split end condition or null eg:If we create a collection with the option {ShardingKey:{"age":1},ShardingType:"Hash",Partition:2^10}, we can fill {age:30} as the splitCondition, and fill {age:60} as the splitEndCondition. when split, the target replica group will get the records whose age's hash value are in [30,60). If splitEndCondition is null, they are in [30,max).
[out]taskIDThe id of current task
Return values
SDB_OKOperation Success
OthersOperation Fail
INT32 sdbSplitCLByPercentAsync ( sdbCollectionHandle  cHandle,
const CHAR *  pSourceRG,
const CHAR *  pTargetRG,
FLOAT64  percent,
SINT64 *  taskID 
)

Split the specified collection from source replica group to target by percent.

Parameters
[in]cHandleThe collection handle
[in]pSourceRGThe source replica group name
[in]pTargetRGThe target replica group name
[in]percentThe split percent, Range:(0.0, 100.0]
[out]taskIDThe id of current task
Return values
SDB_OKOperation Success
OthersOperation Fail
INT32 sdbSplitCollection ( sdbCollectionHandle  cHandle,
const CHAR *  pSourceRG,
const CHAR *  pTargetRG,
const bson *  pSplitCondition,
const bson *  pSplitEndCondition 
)

Split the specified collection from source replica group to target by range.

Parameters
[in]cHandleThe collection handle
[in]pSourceRGThe source replica group name
[in]pTargetRGThe target replica group name
[in]pSplitConditionThe split condition
[in]splitEndConditionThe split end condition or null eg:If we create a collection with the option {ShardingKey:{"age":1},ShardingType:"Hash",Partition:2^10}, we can fill {age:30} as the splitCondition, and fill {age:60} as the splitEndCondition. when split, the target replica group will get the records whose age's hash value are in [30,60). If splitEndCondition is null, they are in [30,max).
Return values
SDB_OKOperation Success
OthersOperation Fail
INT32 sdbSplitCollectionByPercent ( sdbCollectionHandle  cHandle,
const CHAR *  pSourceRG,
const CHAR *  pTargetRG,
FLOAT64  percent 
)

Split the specified collection from source replica group to target by percent.

Parameters
[in]cHandleThe collection handle
[in]pSourceRGThe source replica group name
[in]pTargetRGThe target replica group name
[in]percentThe split percent, Range:(0.0, 100.0]
Return values
SDB_OKOperation Success
OthersOperation Fail
INT32 sdbStartNode ( sdbNodeHandle  cHandle)

Start up the specified node.

Parameters
[in]cHandleThe node handle
Return values
SDB_OKOperation Success
OthersOperation Fail
INT32 sdbStartReplicaGroup ( sdbReplicaGroupHandle  cHandle)

Start and activate the specified replica group.

Parameters
[in]cHandleThe replica group handle
Return values
SDB_OKOperation Success
OthersOperation Fail
INT32 sdbStopNode ( sdbNodeHandle  cHandle)

Stop the specified node.

Parameters
[in]cHandleThe node handle
Return values
SDB_OKOperation Success
OthersOperation Fail
INT32 sdbStopReplicaGroup ( sdbReplicaGroupHandle  cHandle)

Stop the specified replica group.

Parameters
[in]cHandleThe replica group handle
Return values
SDB_OKOperation Success
OthersOperation Fail
INT32 sdbSyncDB ( sdbConnectionHandle  cHandle,
bson *  options 
)

sync database which are specified

Parameters
[in]cHandleThe database connection handle
[in]optionsThe control options:
Deep: (INT32) Flush with deep mode or not. 1 in default.
      0 for non-deep mode,1 for deep mode,-1 means use the configuration with server
Block: (Bool) Flush with block mode or not. false in default.
CollectionSpace: (String) Specify the collectionspace to sync.
                 If not set, will sync all the collectionspaces and logs,
                 otherwise, will only sync the collectionspace specified.
Some of other options are as below:(only take effect in coordinate nodes,
               please visit the official website to search "sync" or
               "Location Elements" for more detail.)
GroupID:INT32,
GroupName:String,
NodeID:INT32,
HostName:String,
svcname:String,
...
Return values
SDB_OKOperation Success
OthersOperation Fail
INT32 sdbTraceResume ( sdbConnectionHandle  cHandle)

Resume trace.

Parameters
[in]cHandleThe connection handle
Return values
SDB_OKOperation Success
OthersOperation Fail
INT32 sdbTraceStart ( sdbConnectionHandle  cHandle,
UINT32  traceBufferSize,
CHAR *  component,
CHAR *  breakPoint,
UINT32 *  tids,
UINT32  nTids 
)

Start trace with given trace buffer size and component list.

Parameters
[in]cHandleThe connection handle
[in]traceBufferSizeThe size for trace buffer on bytes
[in]componentThe trace component list as below, NULL for all components, separated by comma (,)
auth   : Authentication
bps    : BufferPool Services
cat    : Catalog Services
cls    : Cluster Services
dps    : Data Protection Services
mig    : Migration Services
msg    : Messaging Services
net    : Network Services
oss    : Operating System Services
pd     : Problem Determination
rtn    : RunTime
sql    : SQL Parser
tools  : Tools
bar    : Backup And Recovery
client : Client
coord  : Coord Services
dms    : Data Management Services
ixm    : Index Management Services
mon    : Monitoring Services
mth    : Methods Services
opt    : Optimizer
pmd    : Process Model
rest   : RESTful Services
spt    : Scripting
util   : Utilities
[in]breakpointThe functions need to break, separated by comma (,)
[in]tidsThe array of target threads.
[in]nTidsThe length of the array of target threads.
Return values
SDB_OKOperation Success
OthersOperation Fail
INT32 sdbTraceStatus ( sdbConnectionHandle  cHandle,
sdbCursorHandle handle 
)

Get the current status for trace.

Parameters
[in]cHandleThe connection handle
[out]handleThe cursor handle of current query
Return values
SDB_OKOperation Success
OthersOperation Fail
INT32 sdbTraceStop ( sdbConnectionHandle  cHandle,
const CHAR *  pDumpFileName 
)

Stop trace and dump into file.

Parameters
[in]cHandleThe connection handle
[in]pDumpFileNameThe file to dump, NULL for stop only
Return values
SDB_OKOperation Success
OthersOperation Fail
INT32 sdbTransactionBegin ( sdbConnectionHandle  cHandle)

Transaction begin.

Parameters
[in]cHandleThe database connection handle
Return values
SDB_OKOperation Success
OthersOperation Fail
INT32 sdbTransactionCommit ( sdbConnectionHandle  cHandle)

Transaction commit.

Parameters
[in]cHandleThe database connection handle
Return values
SDB_OKOperation Success
OthersOperation Fail
INT32 sdbTransactionRollback ( sdbConnectionHandle  cHandle)

Transaction rollback.

Parameters
[in]cHandleThe database connection handle
Return values
SDB_OKOperation Success
OthersOperation Fail
INT32 sdbTruncateCollection ( sdbConnectionHandle  cHandle,
const CHAR *  fullName 
)

truncate the collection

Parameters
[in]cHandleThe handle of connection.
[in]fullNameThe full name of collection to be truncated, eg: foo.bar.
Return values
SDB_OKOperation Success
OthersOperation Fail
INT32 sdbTruncateLob ( sdbCollectionHandle  cHandle,
const bson_oid_t *  oid,
INT64  length 
)

truncate lob

Parameters
[in]cHandleThe handle of collection
[in]oidThe large object id
[in]lengthThe truncate length
Return values
SDB_OKOperation Success
OthersOperation Fail
INT32 sdbUnloadCollectionSpace ( sdbConnectionHandle  cHandle,
const CHAR *  csName,
bson *  options 
)

Unload the specified collection space from database.

Parameters
[in]cHandleThe database connection handle
[in]csNameThe specified collection space name
[in]optionsThe control options:(Only take effect in coordinate nodes) GroupID:INT32, GroupName:String, NodeID:INT32, HostName:String, svcname:String, ...
Return values
SDB_OKOperation Success
OthersOperation Fail
INT32 sdbUpdate ( sdbCollectionHandle  cHandle,
bson *  rule,
bson *  condition,
bson *  hint 
)

Update the matching documents in current collection.

Parameters
[in]cHandleThe collection handle
[in]ruleThe updating rule, cannot be null
[in]conditionThe matching rule, update all the documents if this parameter is null
[in]hintSpecified the index used to scan data. e.g. {"":"ageIndex"} means using index "ageIndex" to scan data(index scan); {"":null} means table scan. when hint is null, database automatically match the optimal index to scan data
Return values
SDB_OKOperation Success
OthersOperation Fail
Note
It won't work to update the "ShardingKey" field, but the other fields take effect
INT32 sdbUpdate1 ( sdbCollectionHandle  cHandle,
bson *  rule,
bson *  condition,
bson *  hint,
INT32  flag 
)

Update the matching documents in current collection.

Parameters
[in]cHandleThe collection handle
[in]ruleThe updating rule, cannot be null
[in]conditionThe matching rule, update all the documents if this parameter is null
[in]hintSpecified the index used to scan data. e.g. {"":"ageIndex"} means using index "ageIndex" to scan data(index scan); {"":null} means table scan. when hint is null, database automatically match the optimal index to scan data
[in]flagThe update flag, default to be 0. Please see the definition of follow flags for more detail.
Return values
SDB_OKOperation Success
OthersOperation Fail
Note
When flag is set to 0, it won't work to update the "ShardingKey" field, but the other fields take effect
INT32 sdbUpdate2 ( sdbCollectionHandle  cHandle,
bson *  rule,
bson *  condition,
bson *  hint,
INT32  flag,
bson *  pResult 
)

Update the matching documents in current collection.

Parameters
[in]cHandleThe collection handle
[in]ruleThe updating rule, cannot be null
[in]conditionThe matching rule, update all the documents if this parameter is null
[in]hintSpecified the index used to scan data. e.g. {"":"ageIndex"} means using index "ageIndex" to scan data(index scan); {"":null} means table scan. when hint is null, database automatically match the optimal index to scan data
[in]flagThe update flag, default to be 0. Please see the definition of follow flags for more detail.
[out]pResultThe result of updating. Can be NULL or a bson:
  • NULL: when this argument is NULL.
  • bson: an empty bson on error, or a bson whose contains the update details on success, as follows:

    UpdatedNum: The number of records successfully updated, including records that matched but did not change data. ModifiedNum: The number of records successfully updated with data changes. InsertedNum: The number of records successfully inserted.

Return values
SDB_OKOperation Success
OthersOperation Fail
Note
When flag is set to 0, it won't work to update the "ShardingKey" field, but the other fields take effect
INT32 sdbUpdateConfig ( sdbConnectionHandle  cHandle,
bson *  configs,
bson *  options 
)

Force the node to update configs online.

Parameters
[in]cHandleThe database connection handle
[in]configsthe specific configuration parameters to update
[in]optionsThe control options:(Only take effect in coordinate nodes) GroupID:INT32, GroupName:String, NodeID:INT32, HostName:String, svcname:String, ...
Return values
SDB_OKOperation Success
OthersOperation Fail
INT32 sdbUpsert ( sdbCollectionHandle  cHandle,
bson *  rule,
bson *  condition,
bson *  hint 
)

Update the matching documents in current collection, insert if no matching.

Parameters
[in]cHandleThe collection handle
[in]ruleThe updating rule, cannot be null
[in]conditionThe matching rule, update all the documents if this parameter is null
[in]hintSpecified the index used to scan data. e.g. {"":"ageIndex"} means using index "ageIndex" to scan data(index scan); {"":null} means table scan. when hint is null, database automatically match the optimal index to scan data
Return values
SDB_OKOperation Success
OthersOperation Fail
Note
It won't work to upsert the "ShardingKey" field, but the other fields take effect
INT32 sdbUpsert1 ( sdbCollectionHandle  cHandle,
bson *  rule,
bson *  condition,
bson *  hint,
bson *  setOnInsert 
)

Update the matching documents in current collection, insert if no matching.

Parameters
[in]cHandleThe collection handle
[in]ruleThe updating rule, cannot be null
[in]conditionThe matching rule, update all the documents if this parameter is null
[in]hintSpecified the index used to scan data. e.g. {"":"ageIndex"} means using index "ageIndex" to scan data(index scan); {"":null} means table scan. when hint is null, database automatically match the optimal index to scan data
[in]setOnInsertThe setOnInsert assigns the specified values to the fields when insert
Return values
SDB_OKOperation Success
OthersOperation Fail
Note
It won't work to upsert the "ShardingKey" field, but the other fields take effect
INT32 sdbUpsert2 ( sdbCollectionHandle  cHandle,
bson *  rule,
bson *  condition,
bson *  hint,
bson *  setOnInsert,
INT32  flag 
)

Update the matching documents in current collection, insert if no matching.

Parameters
[in]cHandleThe collection handle
[in]ruleThe updating rule, cannot be null
[in]conditionThe matching rule, update all the documents if this parameter is null
[in]hintSpecified the index used to scan data. e.g. {"":"ageIndex"} means using index "ageIndex" to scan data(index scan); {"":null} means table scan. when hint is null, database automatically match the optimal index to scan data
[in]setOnInsertThe setOnInsert assigns the specified values to the fields when insert
[in]flagThe update flag, default to be 0. Please see the definition of follow flags for more detail.
Return values
SDB_OKOperation Success
OthersOperation Fail
Note
When flag is set to 0, it won't work to update the "ShardingKey" field, but the other fields take effect
INT32 sdbUpsert3 ( sdbCollectionHandle  cHandle,
bson *  rule,
bson *  condition,
bson *  hint,
bson *  setOnInsert,
INT32  flag,
bson *  pResult 
)

Update the matching documents in current collection, insert if no matching.

Parameters
[in]cHandleThe collection handle
[in]ruleThe updating rule, cannot be null
[in]conditionThe matching rule, update all the records if this parameter is null
[in]hintSpecified the index used to scan data. e.g. {"":"ageIndex"} means using index "ageIndex" to scan data(index scan); {"":null} means table scan. when hint is null, database automatically match the optimal index to scan data
[in]setOnInsertThe setOnInsert assigns the specified values to the fields when insert
[in]flagThe update flag, default to be 0. Please see the definition of follow flags for more detail.
[out]pResultThe result of upserting. Can be NULL or a bson:
  • NULL: when this argument is NULL.
  • bson: an empty bson on error, or a bson whose contains the upsert details on success, as follows:

    UpdatedNum: The number of records successfully updated, including records that matched but did not change data. ModifiedNum: The number of records successfully updated with data changes. InsertedNum: The number of records successfully inserted.

Return values
SDB_OKOperation Success
OthersOperation Fail
Note
When flag is set to 0, it won't work to update the "ShardingKey" field, but the other fields take effect
INT32 sdbWaitTasks ( sdbConnectionHandle  cHandle,
const SINT64 *  taskIDs,
SINT32  num 
)

Wait the tasks to finish.

Parameters
[in]cHandleThe connection handle
[in]taskIDsThe array of task id
[in]numThe number of task id
Return values
SDB_OKOperation Success
OthersOperation Fail
INT32 sdbWriteLob ( sdbLobHandle  lobHandle,
const CHAR *  buf,
UINT32  len 
)

write lob

Parameters
[in]lobHandleThe large object handle
[in]bufThe buf of write
[in]lenThe length of write
Return values
SDB_OKOperation Success
OthersOperation Fail