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.
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 | 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 | 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 | 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 | 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 | sdbDelete (sdbCollectionHandle cHandle, bson *condition, bson *hint) |
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 | 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. | |
C Client Driver.
#define FLG_INSERT_CONTONDUP 0x00000001 |
The flag represent whether insert continue(no errors were reported) when hitting index key duplicate error
#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_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 released until the transaction is committed or rollback. 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 have 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 diffent part of the data.
#define QUERY_PREPARE_MORE 0x00004000 |
Enable prepare more data when query
#define QUERY_WITH_RETURNDATA 0x00000200 |
In general, query won't return data until cursor gets from database, when add 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 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
typedef sdbNodeHandle sdbReplicaNodeHandle |
sdbReplicaNodeHandle will be deprecated in version 2.x, use sdbNodeHandle instead of it.
typedef ossValuePtr sdbSequenceHandle |
sequoiadb sequence handle
enum _SDB_LOB_OPEN_MODE |
enum _SDB_LOB_SEEK |
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
[in] | config | The configuration struct, see detail of sdbClientConf |
SDB_OK | open cache strategy Success |
Others | Fail |
INT32 sdbAggregate | ( | sdbCollectionHandle | cHandle, |
bson ** | obj, | ||
SINT32 | num, | ||
sdbCursorHandle * | handle | ||
) |
Execute aggregate operation in specified collection.
[in] | cHandle | The collection handle |
[in] | obj | The array of bson objects |
[in] | num | The number of inserted bson objects |
[out] | handle | The cursor handle of result |
SDB_OK | Operation Success |
Others | Operation Fail INT32 rc = 0 ;
INT32 i = 0 ;
sdbCollectionHandle cl ;
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.
[in] | cHandle | The colleciton handle |
[in] | options | The 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}]} |
SDB_OK | Operation Success |
Others | Operation Fail |
INT32 sdbAlterCollectionSpace | ( | sdbCSHandle | cHandle, |
bson * | options | ||
) |
Alter the specified collection space.
[in] | cHandle | The collection space handle |
[in] | options | The 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 |
SDB_OK | Operation Success |
Others | Operation Fail |
INT32 sdbAlterDomain | ( | sdbDomainHandle | cHandle, |
const bson * | options | ||
) |
alter the current domain.
[in] | cHandle | The domain handle |
[in] | options | The 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" } |
SDB_OK | Operation Success |
Others | Operation Fail |
INT32 sdbAnalyze | ( | sdbConnectionHandle | cHandle, |
bson * | options | ||
) |
Analyze collection or index to collect statistics information.
[in] | cHandle | The database connection handle |
[in] | options | The 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, ... |
SDB_OK | Operation Success |
Others | Operation Fail |
INT32 sdbAttachCollection | ( | sdbCollectionHandle | cHandle, |
const CHAR * | subClFullName, | ||
bson * | options | ||
) |
Attach the specified collection.
[in] | cHandle | The collection handle |
[in] | subClFullName | The name of the subcollection |
[in] | options | The low boudary and up boudary eg: {"LowBound":{a:1},"UpBound":{a:100}} |
SDB_OK | Operation Success |
Others | Operation Fail |
INT32 sdbAttachNode | ( | sdbReplicaGroupHandle | cHandle, |
const CHAR * | hostName, | ||
const CHAR * | serviceName, | ||
const bson * | options | ||
) |
attach a node to the group.
[in] | cHandle | The handle of group. |
[in] | hostName | The host name of node. |
[in] | serviceName | The service name of node. |
[in] | options | The options of attach. Can not be null or empty. Can be the follow options:
|
SDB_OK | Operation Success |
Others | Operation Fail |
INT32 sdbBackup | ( | sdbConnectionHandle | cHandle, |
bson * | options | ||
) |
Backup database.
[in] | cHandle | The connection handle |
[in] | options | Contains 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 |
SDB_OK | Operation Success |
Others | Operation Fail |
INT32 sdbBackupOffline | ( | sdbConnectionHandle | cHandle, |
bson * | options | ||
) |
Backup database.
[in] | cHandle | The connection handle |
[in] | options | Contains 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 |
SDB_OK | Operation Success |
Others | Operation Fail |
INT32 sdbBulkInsert | ( | sdbCollectionHandle | cHandle, |
SINT32 | flags, | ||
bson ** | objs, | ||
SINT32 | num | ||
) |
Insert a bulk of bson objects into current collection.
[in] | cHandle | The collection handle. |
[in] | flags | The flag to control the behavior of inserting. The value of flags default to be 0, and it can choose the follow values:
|
[in] | objs | The array of bson objects to be inserted, cannot be null. |
[in] | num | The number of inserted bson objects. |
SDB_OK | Operation Success. |
Others | Operation 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.
[in] | cHandle | The collection handle. |
[in] | flags | The flag to control the behavior of inserting. The value of flags default to be 0, and it can choose the follow values:
|
[in] | objs | The array of bson objects to be inserted, cannot be null. |
[in] | num | The number of inserted bson objects. |
[out] | pResult | The result of inserting. Can be NULL or a bson:
|
SDB_OK | Operation Success. |
Others | Operation Fail. |
INT32 sdbCancelTask | ( | sdbConnectionHandle | cHandle, |
SINT64 | taskID, | ||
BOOLEAN | isAsync | ||
) |
Cancel the specified task.
[in] | cHandle | The connection handle |
[in] | taskID | The task id |
[in] | isAsync | The operation "cancel task" is async or not, "true" for async, "false" for sync. Default sync. |
SDB_OK | Operation Success |
Others | Operation Fail |
void sdbCleanLastErrorObj | ( | sdbConnectionHandle | cHandle | ) |
Clean the last error object(returned by engine) of current connection.
[in] | cHandle | The handle of current connection. |
INT32 sdbCLGetDetail | ( | sdbCollectionHandle | cHandle, |
sdbCursorHandle * | handle | ||
) |
Get the detail of the collection.
[in] | cHandle | The collection handle |
[out] | handle | Return the all the info of current collection. |
SDB_OK | Operation Success |
Others | Operation Fail |
INT32 sdbCLGetIndexStat | ( | sdbCollectionHandle | cHandle, |
const CHAR * | pIndexName, | ||
bson * | result | ||
) |
Get the statistics of the index.
[in] | cHandle | The collection handle |
[in] | pIndexName | The name of index |
[out] | result | The statistics of index |
SDB_OK | Operation Success |
Others | Operation 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.
[in] | cHandle | The database connection handle |
SDB_OK | Operation Success |
Others | Operation Fail |
INT32 sdbCloseCursor | ( | sdbCursorHandle | cHandle | ) |
Close the cursor's connection to database, we can't use this handle to get data again.
[in] | cHandle | The cursor handle |
SDB_OK | Operation Success |
Others | Operation Fail |
INT32 sdbCloseLob | ( | sdbLobHandle * | lobHandle | ) |
close lob
[in] | lobHandle | The large object handle |
SDB_OK | Operation Success |
Others | Operation Fail |
INT32 sdbCLSetAttributes | ( | sdbCollectionHandle | cHandle, |
const bson * | options | ||
) |
Alter the specified collection.
[in] | cHandle | The collection handle |
[in] | options | The 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}]} |
SDB_OK | Operation Success |
Others | Operation Fail |
INT32 sdbConnect | ( | const CHAR * | pHostName, |
const CHAR * | pServiceName, | ||
const CHAR * | pUsrName, | ||
const CHAR * | pPasswd, | ||
sdbConnectionHandle * | handle | ||
) |
Connect to database.
[in] | pHostName | The Host Name or IP Address of Database Server |
[in] | pServiceName | The Service Name or Port of Database Server |
[in] | pUsrName | The User's Name of the account |
[in] | pPasswd | The Password of the account |
[out] | handle | The database connection handle, when fail to connect, *handle == SDB_INVALID_HANDLE and error code is return |
SDB_OK | Connection Success |
Others | Connection 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.
[in] | pConnAddrs | The array of the coord's address |
[in] | arrSize | The size of the array |
[in] | pUsrName | The User's Name of the account |
[in] | pPasswd | The Password of the account |
[out] | handle | The database connection handle |
SDB_OK | Connection Success |
Others | Connection Fail |
INT32 sdbCreateAutoIncrement | ( | sdbCollectionHandle | cHandle, |
const bson * | options | ||
) |
Create an autoincrement field on collection.
[in] | cHandle | The collection handle. |
[in] | options | The 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 |
SDB_OK | Operation Success |
Others | Operation 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.
[in] | cHandle | The collection space handle |
[in] | pCollectionName | The collection name |
[out] | handle | The collection handle, when fail to create collection, *handle == -1 and error code is return |
SDB_OK | Operation Success |
Others | Operation Fail |
INT32 sdbCreateCollection1 | ( | sdbCSHandle | cHandle, |
const CHAR * | pCollectionName, | ||
bson * | options, | ||
sdbCollectionHandle * | handle | ||
) |
Create the specified collection in current collection space.
[in] | cHandle | The collection space handle |
[in] | pCollectionName | The collection name |
[in] | options | The options for creating collection or NULL for not specified any options. Please reference here for more detail. |
[out] | handle | The collection handle when fail to create collection, *handle == -1 and error code is return |
SDB_OK | Operation Success |
Others | Operation Fail |
INT32 sdbCreateCollectionSpace | ( | sdbConnectionHandle | cHandle, |
const CHAR * | pCollectionSpaceName, | ||
INT32 | iPageSize, | ||
sdbCSHandle * | handle | ||
) |
Create the specified collection space.
[in] | cHandle | The database connection handle |
[in] | pCollectionSpaceName | The name of collection space |
[in] | iPageSize | The Page Size as below SDB_PAGESIZE_4K SDB_PAGESIZE_8K SDB_PAGESIZE_16K SDB_PAGESIZE_32K SDB_PAGESIZE_64K SDB_PAGESIZE_DEFAULT |
[out] | handle | The collection space handle when fail to create collection space, *handle == -1 and error code is return |
SDB_OK | Operation Success |
Others | Operation Fail |
INT32 sdbCreateCollectionSpaceV2 | ( | sdbConnectionHandle | cHandle, |
const CHAR * | pCollectionSpaceName, | ||
bson * | options, | ||
sdbCSHandle * | handle | ||
) |
Create the specified collection space.
[in] | cHandle | The database connection handle |
[in] | pCollectionSpaceName | The name of collection space |
[in] | options | The 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] | handle | The collection space handle when fail to create collection space, *handle == -1 and error code is return |
SDB_OK | Operation Success |
Others | Operation Fail |
INT32 sdbCreateDomain | ( | sdbConnectionHandle | cHandle, |
const CHAR * | pDomainName, | ||
bson * | options, | ||
sdbDomainHandle * | handle | ||
) |
Create a domain.
[in] | cHandle | The database connection handle |
[in] | pDomainName | The name of the domain |
[in] | options | The 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] | handle | The domain handle |
SDB_OK | Operation Success |
Others | Operation Fail |
INT32 sdbCreateIdIndex | ( | sdbCollectionHandle | cHandle, |
const bson * | args | ||
) |
Create $id index in collection.
[in] | cHandle | The collection handle. |
[in] | args | The 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. |
SDB_OK | Operation Success |
Others | Operation Fail |
INT32 sdbCreateIndex | ( | sdbCollectionHandle | cHandle, |
bson * | indexDef, | ||
const CHAR * | pIndexName, | ||
BOOLEAN | isUnique, | ||
BOOLEAN | isEnforced | ||
) |
Create the index in current collection.
[in] | cHandle | The collection handle |
[in] | indexDef | The bson structure of index element, e.g. {name:1, age:-1} |
[in] | pIndexName | The index name |
[in] | isUnique | Whether the index elements are unique or not |
[in] | isEnforced | Whether the index is enforced unique This element is meaningful when isUnique is set to true |
SDB_OK | Operation Success |
Others | Operation Fail |
INT32 sdbCreateIndex1 | ( | sdbCollectionHandle | cHandle, |
bson * | indexDef, | ||
const CHAR * | pIndexName, | ||
BOOLEAN | isUnique, | ||
BOOLEAN | isEnforced, | ||
INT32 | sortBufferSize | ||
) |
Create the index in current collection.
[in] | cHandle | The collection handle |
[in] | indexDef | The bson structure of index element, e.g. {name:1, age:-1} |
[in] | pIndexName | The index name |
[in] | isUnique | Whether the index elements are unique or not |
[in] | isEnforced | Whether the index is enforced unique This element is meaningful when isUnique is set to true |
[in] | sortBufferSize | The size of sort buffer used when creating index, the unit is MB, zero means don't use sort buffer |
SDB_OK | Operation Success |
Others | Operation Fail |
INT32 sdbCreateIndex2 | ( | sdbCollectionHandle | cHandle, |
bson * | indexDef, | ||
const CHAR * | pIndexName, | ||
bson * | options | ||
) |
Create the index in current collection.
[in] | cHandle | The collection handle |
[in] | indexDef | The bson structure of index element, e.g. {name:1, age:-1} |
[in] | pIndexName | The index name |
[in] | options | The 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 |
SDB_OK | Operation Success |
Others | Operation Fail |
INT32 sdbCreateLobID | ( | sdbCollectionHandle | cHandle, |
bson_oid_t * | oid | ||
) |
create a large object id.
[in] | cHandle | The collection handle |
[out] | oid | The large object id |
SDB_OK | Operation Success |
Others | Operation Fail |
INT32 sdbCreateLobID1 | ( | sdbCollectionHandle | cHandle, |
const CHAR * | pTimeStamp, | ||
bson_oid_t * | oid | ||
) |
create a large object id.
[in] | cHandle | The collection handle |
[in] | pTimestamp | Point of Timestamp(format:YYYY-MM-DD-HH.mm.ss). if Timestamp is NULL the Timestamp will be generated by server |
[out] | oid | The large object id |
SDB_OK | Operation Success |
Others | Operation Fail |
INT32 sdbCreateNode | ( | sdbReplicaGroupHandle | cHandle, |
const CHAR * | pHostName, | ||
const CHAR * | pServiceName, | ||
const CHAR * | pDatabasePath, | ||
bson * | configure | ||
) |
Create node in a given replica group.
[in] | cHandle | The replica group handle |
[in] | pHostName | The hostname for the node |
[in] | pServiceName | The servicename for the node |
[in] | pDatabasePath | The database path for the node |
[in] | configure | The configurations for the node |
SDB_OK | Operation Success |
Others | Operation Fail |
INT32 sdbCreateReplicaCataGroup | ( | sdbConnectionHandle | cHandle, |
const CHAR * | pHostName, | ||
const CHAR * | pServiceName, | ||
const CHAR * | pDatabasePath, | ||
bson * | configure | ||
) |
Create a catalog replica group.
[in] | cHandle | The database connection handle |
[in] | pHostName | The hostname for the catalog replica group |
[in] | pServiceName | The servicename for the catalog replica group |
[in] | pDatabasePath | The path for the catalog replica group |
[in] | configure | The configurations for the catalog replica group |
SDB_OK | Operation Success |
Others | Operation Fail |
INT32 sdbCreateReplicaGroup | ( | sdbConnectionHandle | cHandle, |
const CHAR * | pRGName, | ||
sdbReplicaGroupHandle * | handle | ||
) |
Create the specified replica group.
[in] | cHandle | The database connection handle |
[in] | pRGName | The name of the replica group |
[out] | handle | The replica group handle |
SDB_OK | Operation Success |
Others | Operation Fail |
INT32 sdbCreateSequence | ( | sdbConnectionHandle | cHandle, |
const CHAR * | pSequenceName, | ||
const bson * | options, | ||
sdbSequenceHandle * | sHandle | ||
) |
Create the specified sequence.
[in] | cHandle | The database connection handle |
[in] | pSequenceName | The name of sequence |
[in] | options | The 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] | sHandle | The sequence handle when fail to create sequence, *handle == -1 and error code is return |
SDB_OK | Operation Success |
Others | Operation Fail |
INT32 sdbCreateUsr | ( | sdbConnectionHandle | cHandle, |
const CHAR * | pUsrName, | ||
const CHAR * | pPasswd | ||
) |
Create an account.
[in] | cHandle | The database connection handle |
[in] | pUsrName | The User's Name of the account |
[in] | pPasswd | The Password of the account |
SDB_OK | Connection Success |
Others | Connection Fail |
INT32 sdbCrtJSProcedure | ( | sdbConnectionHandle | cHandle, |
const CHAR * | code | ||
) |
create a store procedure.
[in] | cHandle | The collection space space handle |
[in] | code | The code of store procedures |
SDB_OK | Operation Success |
Others | Operation Fail |
INT32 sdbCSDisableCapped | ( | sdbCSHandle | cHandle | ) |
Alter the specified collection space to disable capped.
[in] | cHandle | The collection space handle |
SDB_OK | Operation Success |
Others | Operation Fail |
INT32 sdbCSEnableCapped | ( | sdbCSHandle | cHandle | ) |
Alter the specified collection space to enable capped.
SDB_OK | Operation Success |
Others | Operation Fail |
INT32 sdbCSRemoveDomain | ( | sdbCSHandle | cHandle | ) |
Alter the specified collection space to remove domain.
[in] | cHandle | The collection space handle |
SDB_OK | Operation Success |
Others | Operation Fail |
INT32 sdbCSSetAttributes | ( | sdbCSHandle | cHandle, |
bson * | options | ||
) |
Alter the specified collection space.
[in] | cHandle | The collection space handle |
[in] | options | The 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 |
SDB_OK | Operation Success |
Others | Operation Fail |
INT32 sdbCSSetDomain | ( | sdbCSHandle | cHandle, |
bson * | options | ||
) |
Alter the specified collection space to set domain.
[in] | cHandle | The collection space handle |
[in] | options | The options of collection space to be changed. Domain : The domain which the collection space belongs to |
SDB_OK | Operation Success |
Others | Operation Fail |
INT32 sdbCurrent | ( | sdbCursorHandle | cHandle, |
bson * | obj | ||
) |
Return the current document of cursor, and don't move.
[in] | cHandle | The cursor handle |
[out] | obj | The return bson object |
SDB_OK | Operation Success |
Others | Operation Fail |
INT32 sdbDelete | ( | sdbCollectionHandle | cHandle, |
bson * | condition, | ||
bson * | hint | ||
) |
Delete the matching documents in current collection, never rollback if failed.
[in] | cHandle | The collection handle |
[in] | condition | The matching rule, delete all the documents if null |
[in] | hint | Specified 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 |
SDB_OK | Operation Success |
Others | Operation Fail |
INT32 sdbDeleteConfig | ( | sdbConnectionHandle | cHandle, |
bson * | configs, | ||
bson * | options | ||
) |
Force the node to delete configs online.
[in] | cHandle | The database connection handle |
[in] | configs | the specific configuration parameters to delete |
[in] | options | The control options:(Only take effect in coordinate nodes) GroupID:INT32, GroupName:String, NodeID:INT32, HostName:String, svcname:String, ... |
SDB_OK | Operation Success |
Others | Operation Fail |
INT32 sdbDetachCollection | ( | sdbCollectionHandle | cHandle, |
const CHAR * | subClFullName | ||
) |
Detach the specified collection.
[in] | cHandle | The collection handle |
[in] | subClFullName | The name of the subcollection |
SDB_OK | Operation Success |
Others | Operation Fail |
INT32 sdbDetachNode | ( | sdbReplicaGroupHandle | cHandle, |
const CHAR * | hostName, | ||
const CHAR * | serviceName, | ||
const bson * | options | ||
) |
detach a node from the group
[in] | cHandle | The handle of group. |
[in] | hostName | The host name of node. |
[in] | serviceName | The service name of node. |
[in] | options | The options of detach. Can not be null or empty. Can be the follow options:
|
SDB_OK | Operation Success |
Others | Operation Fail |
INT32 sdbDisableCompression | ( | sdbCollectionHandle | cHandle | ) |
Disable compression of collection.
[in] | cHandle | The collection handle |
SDB_OK | Operation Success |
Others | Operation Fail |
INT32 sdbDisableSharding | ( | sdbCollectionHandle | cHandle | ) |
Disable sharding of collection.
[in] | cHandle | The collection handle |
SDB_OK | Operation Success |
Others | Operation Fail |
void sdbDisconnect | ( | sdbConnectionHandle | handle | ) |
Disconnect to database.
[in] | handle | The database connection handle |
INT32 sdbDomainAddGroups | ( | sdbDomainHandle | cHandle, |
const bson * | options | ||
) |
alter the current domain.
[in] | cHandle | The domain handle |
[in] | options | The 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". |
SDB_OK | Operation Success |
Others | Operation Fail |
INT32 sdbDomainRemoveGroups | ( | sdbDomainHandle | cHandle, |
const bson * | options | ||
) |
alter the current domain to remove groups.
[in] | cHandle | The domain handle |
[in] | options | The 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. |
SDB_OK | Operation Success |
Others | Operation Fail |
INT32 sdbDomainSetAttributes | ( | sdbDomainHandle | cHandle, |
const bson * | options | ||
) |
alter the current domain.
[in] | cHandle | The domain handle |
[in] | options | The 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" } |
SDB_OK | Operation Success |
Others | Operation Fail |
INT32 sdbDomainSetGroups | ( | sdbDomainHandle | cHandle, |
const bson * | options | ||
) |
alter the current domain to set groups.
[in] | cHandle | The domain handle |
[in] | options | The 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. |
SDB_OK | Operation Success |
Others | Operation Fail |
INT32 sdbDropAutoIncrement | ( | sdbCollectionHandle | cHandle, |
const bson * | options | ||
) |
Drop an autoincrement field on collection.
[in] | cHandle | The collection handle. |
[in] | options | The name of autoincrement field. e.g. { Field: "a" } Field : The name of autoincrement field |
SDB_OK | Operation Success |
Others | Operation Fail |
INT32 sdbDropCollection | ( | sdbCSHandle | cHandle, |
const CHAR * | pCollectionName | ||
) |
Drop the specified collection in current collection space.
[in] | cHandle | The collection space handle |
[in] | pCollectionName | The collection name |
SDB_OK | Operation Success |
Others | Operation Fail |
INT32 sdbDropCollectionSpace | ( | sdbConnectionHandle | cHandle, |
const CHAR * | pCollectionSpaceName | ||
) |
Drop the specified collection space.
[in] | cHandle | The database connection handle |
[in] | pCollectionSpaceName | The name of collection space |
SDB_OK | Operation Success |
Others | Operation Fail |
INT32 sdbDropDomain | ( | sdbConnectionHandle | cHandle, |
const CHAR * | pDomainName | ||
) |
Drop a domain.
[in] | cHandle | The database connection handle |
[in] | pDomainName | The name of the domain |
SDB_OK | Operation Success |
Others | Operation Fail |
INT32 sdbDropIdIndex | ( | sdbCollectionHandle | cHandle | ) |
Drop $id index in collection.
[in] | cHandle | The collection handle |
SDB_OK | Operation Success |
Others | Operation Fail |
INT32 sdbDropIndex | ( | sdbCollectionHandle | cHandle, |
const CHAR * | pIndexName | ||
) |
Drop the index in current collection.
[in] | cHandle | The collection handle |
[in] | pIndexName | The index name |
SDB_OK | Operation Success |
Others | Operation Fail |
INT32 sdbDropSequence | ( | sdbConnectionHandle | cHandle, |
const CHAR * | pSequenceName | ||
) |
Drop the specified sequence.
[in] | cHandle | The database connection handle |
[in] | pSequenceName | The name of sequence |
SDB_OK | Operation Success |
Others | Operation Fail |
INT32 sdbEnableCompression | ( | sdbCollectionHandle | cHandle, |
const bson * | args | ||
) |
Enable compression of collection.
[in] | cHandle | The collection handle. |
[in] | args | The arguments of compression. e.g. { ShardingKey: { a: 1 } } CompressionType : The type of compression, "snappy" or "lzw" |
SDB_OK | Operation Success |
Others | Operation Fail |
INT32 sdbEnableSharding | ( | sdbCollectionHandle | cHandle, |
const bson * | args | ||
) |
Enable sharding of collection.
[in] | cHandle | The collection handle. |
[in] | args | The 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 |
SDB_OK | Operation Success |
Others | Operation 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.
[in] | cHandle | The collection space space handle |
[in] | code | The code to eval |
[out] | type | The type of value |
[out] | handle | The cursor handle of current eval |
[out] | errmsg | The errmsg from eval |
SDB_OK | Operation Success |
Others | Operation Fail |
INT32 sdbExec | ( | sdbConnectionHandle | cHandle, |
const CHAR * | sql, | ||
sdbCursorHandle * | result | ||
) |
Executing SQL command.
[in] | cHandle | The database connection handle |
[in] | sql | The SQL command. |
[out] | result | The return cursor handle of matching documents. |
SDB_OK | Operation Success |
Others | Operation Fail |
INT32 sdbExecUpdate | ( | sdbConnectionHandle | cHandle, |
const CHAR * | sql | ||
) |
Executing SQL command for updating.
[in] | cHandle | The database connection handle |
[in] | sql | The SQL command. |
SDB_OK | Operation Success |
Others | Operation 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
[in] | cHandle | The collection handle |
[in] | condition | The matching rule, return all the documents if null |
[in] | select | The selective rule, return the whole document if null |
[in] | orderBy | The ordered rule, never sort if null |
[in] | hint | Specified 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] | flag | The 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] | numToSkip | Skip the first numToSkip documents, never skip if this parameter is 0 |
[in] | numToReturn | Only return numToReturn documents, return all if this parameter is -1 |
[in] | options | the 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] | handle | The cursor handle of current query |
SDB_OK | Operation Success |
Others | Operation Fail |
INT32 sdbFlushConfigure | ( | sdbConnectionHandle | cHandle, |
bson * | options | ||
) |
flush the options to configure file.
[in] | cHandle | The connection handle |
[in] | options | The 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. |
SDB_OK | Operation Success |
Others | Operation Fail |
INT32 sdbForceSession | ( | sdbConnectionHandle | cHandle, |
SINT64 | sessionID, | ||
bson * | options | ||
) |
interrupte the session.
[in] | cHandle | The connection handle |
[in] | sessionID | The id of the session which we want to inerrupt |
[in] | options | The location information, such as NodeID, HostName and svcname |
SDB_OK | Operation Success |
Others | Operation Fail |
INT32 sdbForceStepUp | ( | sdbConnectionHandle | cHandle, |
const bson * | options | ||
) |
[in] | cHandle | The connection handle |
[in] | options | The options of step up |
SDB_OK | Operation Success |
Others | Operation Fail |
INT32 sdbGetCLFullName | ( | sdbCollectionHandle | cHandle, |
CHAR * | pBuffer, | ||
INT32 | size | ||
) |
Get the specified collection full name.
[in] | cHandle | The collection handle |
[in] | pBuffer | The buffer for output cl full name |
[in] | size | The size of the buffer |
SDB_OK | Operation Success |
Others | Operation Fail |
INT32 sdbGetCLName | ( | sdbCollectionHandle | cHandle, |
CHAR * | pCLName, | ||
INT32 | size | ||
) |
Get the specified collection name.
[in] | cHandle | The collection handle |
[in] | pBuffer | The buffer for output cl name |
[in] | size | The size of the buffer |
SDB_OK | Operation Success |
Others | Operation Fail |
INT32 sdbGetCollection | ( | sdbConnectionHandle | cHandle, |
const CHAR * | pCollectionFullName, | ||
sdbCollectionHandle * | handle | ||
) |
Get the specified collection.
[in] | cHandle | The database connection handle |
[in] | pCollectionFullName | The full name of collection |
[out] | handle | The collection handle |
SDB_OK | Operation Success |
Others | Operation Fail |
INT32 sdbGetCollection1 | ( | sdbCSHandle | cHandle, |
const CHAR * | pCollectionName, | ||
sdbCollectionHandle * | handle | ||
) |
Get the specified collection of current collection space.
Get the specified collection.
[in] | cHandle | The collection space handle |
[in] | pCollectionName | The collection name |
[out] | handle | The collection handle |
SDB_OK | Operation Success |
Others | Operation Fail |
[in] | cHandle | The database connection handle |
[in] | pCollectionName | The name of collection |
[out] | handle | The collection handle |
SDB_OK | Operation Success |
Others | Operation Fail |
INT32 sdbGetCollectionSpace | ( | sdbConnectionHandle | cHandle, |
const CHAR * | pCollectionSpaceName, | ||
sdbCSHandle * | handle | ||
) |
Get the specified collection space.
[in] | cHandle | The database connection handle |
[in] | pCollectionSpaceName | The name of collection space |
[out] | handle | The collection space handle |
SDB_OK | Operation Success |
Others | Operation Fail |
INT32 sdbGetCount | ( | sdbCollectionHandle | cHandle, |
bson * | condition, | ||
SINT64 * | count | ||
) |
Get the count of documents in specified collection.
[in] | cHandle | The collection handle |
[in] | condition | The matching rule, return the count of all documents if this parameter is null |
[out] | count | The count of matching documents |
SDB_OK | Operation Success |
Others | Operation Fail |
INT32 sdbGetCount1 | ( | sdbCollectionHandle | cHandle, |
bson * | condition, | ||
bson * | hint, | ||
SINT64 * | count | ||
) |
Get the count of documents in specified collection.
[in] | cHandle | The collection handle |
[in] | condition | The matching rule, return the count of all documents if this parameter is null |
[in] | hint | Specified 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] | count | The count of matching documents |
SDB_OK | Operation Success |
Others | Operation Fail |
INT32 sdbGetCSName | ( | sdbCSHandle | cHandle, |
CHAR * | pCSName, | ||
INT32 | size | ||
) |
Get the specified collection space name.
[in] | cHandle | The collection space handle |
[in] | pBuffer | The buffer for output cs name |
[in] | size | The size of the buffer |
SDB_OK | Operation Success |
Others | Operation 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.
[in] | cHandle | The connection handle |
[in] | condition | The matching rule, return all the documents if null |
[in] | select | The selective rule, return the whole document if null |
[in] | orderBy | The ordered rule, never sort if null |
[in] | hint | The hint, The collection full name eg: {"Collection":"foo.bar"} while "foo.bar" is the full name of current collection |
[in] | numToSkip | Skip the first numToSkip documents, never skip if this parameter is 0 |
[in] | numToReturn | Only return numToReturn documents, return all if this parameter is -1 |
[out] | handle | The cursor handle of current query |
SDB_OK | Operation Success |
Others | Operation Fail |
INT32 sdbGetDomain | ( | sdbConnectionHandle | cHandle, |
const CHAR * | pDomainName, | ||
sdbDomainHandle * | handle | ||
) |
Get a domain.
[in] | cHandle | The database connection handle |
[in] | pDomainName | The name of the domain |
[out] | handle | The domain handle |
SDB_OK | Operation Success |
Others | Operation Fail |
INT32 sdbGetIndex | ( | sdbCollectionHandle | cHandle, |
const CHAR * | pIndexName, | ||
bson * | info | ||
) |
Get the information of the specified index in current collection.
[in] | cHandle | The collection handle. |
[in] | pIndexName | The index name, returns all of the indexes if this parameter is null |
[out] | info | The information of index. |
SDB_OK | Operation Success |
Others | Operation Fail |
INT32 sdbGetIndexes | ( | sdbCollectionHandle | cHandle, |
const CHAR * | pIndexName, | ||
sdbCursorHandle * | handle | ||
) |
Get all of or one of the indexes in current collection.
[in] | cHandle | The collection handle |
[in] | pIndexName | The index name, returns all of the indexes if this parameter is null |
[out] | handle | The cursor handle of returns |
SDB_OK | Operation Success |
Others | Operation Fail |
INT32 sdbGetIndexInfo | ( | sdbCollectionHandle | cHandle, |
sdbCursorHandle * | handle | ||
) |
Get the information of all the indexes in current collection.
[in] | cHandle | The collection handle. |
[out] | handle | The cursor of the information of indexes. |
SDB_OK | Operation Success |
Others | Operation 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.
[in] | cHandle | The handle of current connection. |
[out] | errObj | The return error bson object. Please reference here for more detail. |
SDB_OK | Get error object Success. |
SDB_DMS_EOC | There is no error object. |
Others | Get error object Fail. |
INT32 sdbGetList | ( | sdbConnectionHandle | cHandle, |
INT32 | listType, | ||
bson * | condition, | ||
bson * | selector, | ||
bson * | orderBy, | ||
sdbCursorHandle * | handle | ||
) |
Get the specified list.
[in] | cHandle | The collection handle |
[in] | listType | The 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] | condition | The matching rule, match all the documents if null |
[in] | select | The selective rule, return the whole document if null |
[in] | orderBy | The ordered rule, never sort if null |
[out] | handle | The cursor handle of current query |
SDB_OK | Operation Success |
Others | Operation 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.
[in] | cHandle | The collection handle |
[in] | listType | The 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] | condition | The matching rule, match all the documents if null |
[in] | select | The selective rule, return the whole document if null |
[in] | orderBy | The ordered rule, never sort if null |
[in] | hint | The options provided for specific list type. Reserved. |
[in] | numToSkip | Skip the first numToSkip documents. |
[in] | numToReturn | Only return numToReturn documents. -1 means return all matched results. |
[out] | handle | The cursor handle of current query |
SDB_OK | Operation Success |
Others | Operation Fail |
INT32 sdbGetLobCreateTime | ( | sdbLobHandle | lobHandle, |
UINT64 * | millis | ||
) |
get lob's create time
[in] | lobHandle | The large object handle |
[out] | millis | The create time in milliseconds of lob |
SDB_OK | Operation Success |
Others | Operation Fail |
INT32 sdbGetLobId | ( | sdbLobHandle | lobHandle, |
bson_oid_t * | oid | ||
) |
use a lobHandle to get a large object id.
[in] | cHandle | The lob handle |
[out] | oid | The large object id |
SDB_OK | Operation Success |
Others | Operation Fail |
INT32 sdbGetLobModificationTime | ( | sdbLobHandle | lobHandle, |
UINT64 * | millis | ||
) |
get lob's last modification time
[in] | lobHandle | The large object handle |
[out] | millis | The modification time in milliseconds of lob |
SDB_OK | Operation Success |
Others | Operation Fail |
INT32 sdbGetLobSize | ( | sdbLobHandle | lobHandle, |
SINT64 * | size | ||
) |
get the lob's size
[in] | lobHandle | The large object handle |
[out] | size | The size of lob |
SDB_OK | Operation Success |
Others | Operation 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.
[in] | cHandle | The node handle |
[out] | ppHostName | The hostname for the node |
[out] | ppServiceName | The servicename for the node |
[out] | ppNodeName | The name for the node |
[out] | pNodeID | The id for the node |
SDB_OK | Operation Success |
Others | Operation Fail |
INT32 sdbGetNodeByHost | ( | sdbReplicaGroupHandle | cHandle, |
const CHAR * | pHostName, | ||
const CHAR * | pServiceName, | ||
sdbNodeHandle * | handle | ||
) |
Get the node from the specified replica group.
[in] | cHandle | The replica group handle |
[in] | pHostName | The host of node |
[in] | pServiceName | The service name of the node |
[out] | handle | The node handle, when fail to get node, *handle == -1, and error code is return |
SDB_OK | Operation Success |
Others | Operation Fail |
INT32 sdbGetNodeByName | ( | sdbReplicaGroupHandle | cHandle, |
const CHAR * | pNodeName, | ||
sdbNodeHandle * | handle | ||
) |
Get the node from the specified replica group.
[in] | cHandle | The replica group handle |
[in] | pNodeName | The name of the node, with the format of "hostname:port". |
[out] | handle | The node handle, when fail to get node, *handle == -1, and error code is return |
SDB_OK | Operation Success |
Others | Operation Fail |
INT32 sdbGetNodeMaster | ( | sdbReplicaGroupHandle | cHandle, |
sdbNodeHandle * | handle | ||
) |
Get the master node of the specified replica group.
[in] | cHandle | The replica group handle |
[out] | handle | The master node handle |
SDB_OK | Operation Success |
Others | Operation Fail |
INT32 sdbGetNodeSlave | ( | sdbReplicaGroupHandle | cHandle, |
sdbNodeHandle * | handle | ||
) |
Get one of slave node of the specified replica group, if no slave exists then get master.
[in] | cHandle | The replica group handle |
[out] | handle | The slave node handle |
SDB_OK | Operation Success |
Others | Operation 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.
[in] | cHandle | The replica group handle |
[in] | positionsArray | The array of node's position, the array elements can be 1-7. |
[in] | positionsCount | The amount of node's position. |
[out] | handle | The slave node handle |
SDB_OK | Operation Success |
Others | Operation Fail |
INT32 sdbGetPasswdByCipherFile | ( | const CHAR * | pUsrName, |
const CHAR * | pToken, | ||
const CHAR * | pCipherFile, | ||
CHAR * | pUser, | ||
CHAR * | pPasswd | ||
) |
get user password by decrypting the cipherfile
[in] | pUsrName | The User's Name in the cipherfile |
[in] | pToken | The Password encryption token |
[in] | pCipherFile | The Cipherfile location, default ./passwd |
[out] | pUser | a buffer to hold usrName without @ and following text, this user name is used for database connection |
[out] | pPasswd | a buffer to hold decrypted Password |
SDB_OK | Retrieval Success |
Others | Retrieval 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.
[in] | condition | The matching rule, return all the documents if null |
[in] | orderBy | The ordered rule, never sort if null |
[in] | hint | Specified 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] | numToSkip | Skip the first numToSkip documents, never skip if this parameter is 0 |
[in] | numToReturn | Only return numToReturn documents, return all if this parameter is -1 |
[out] | handle | The handle of query result |
SDB_OK | Operation Success |
Others | Operation Fail |
INT32 sdbGetReplicaGroup | ( | sdbConnectionHandle | cHandle, |
const CHAR * | pRGName, | ||
sdbReplicaGroupHandle * | handle | ||
) |
Get the specified replica group.
[in] | cHandle | The database connection handle |
[in] | pRGName | The name of replica group |
[out] | handle | The replica group handle |
SDB_OK | Operation Success |
Others | Operation Fail |
INT32 sdbGetReplicaGroup1 | ( | sdbConnectionHandle | cHandle, |
UINT32 | id, | ||
sdbReplicaGroupHandle * | handle | ||
) |
Get the specified replica group.
[in] | cHandle | The database connection handle |
[in] | id | The id of the replica group |
[out] | handle | The replica group handle |
SDB_OK | Operation Success |
Others | Operation Fail |
INT32 sdbGetReplicaGroupName | ( | sdbReplicaGroupHandle | cHandle, |
CHAR ** | ppRGName | ||
) |
Get the specified replica group's name.
[in] | cHandle | The replica group handle |
[out] | ppRGName | The replica group name |
SDB_OK | Operation Success |
Others | Operation Fail |
INT32 sdbGetRGName | ( | sdbReplicaGroupHandle | cHandle, |
CHAR * | pBuffer, | ||
INT32 | size | ||
) |
Get the specified replica group's name.
[in] | cHandle | The replica group handle |
[in] | pBuffer | The buffer for output replica group name |
[in] | size | the size of the buffer |
SDB_OK | Operation Success |
Others | Operation Fail |
INT32 sdbGetRunTimeDetail | ( | sdbLobHandle | lobHandle, |
bson * | detail | ||
) |
Get the run time detail information of lob.
SDB_OK | Operation Success |
Others | Operation Fail |
INT32 sdbGetSequence | ( | sdbConnectionHandle | cHandle, |
const CHAR * | pSequenceName, | ||
sdbSequenceHandle * | sHandle | ||
) |
Get the named sequence.
[in] | cHandle | The database connection handle |
[in] | pSequenceName | The name of sequence |
[out] | sHandle | The sequence handle |
SDB_OK | Operation Success |
Others | Operation Fail |
INT32 sdbGetSessionAttr | ( | sdbConnectionHandle | cHandle, |
bson * | result | ||
) |
Get the attributes of the current session from the local cache if possible.
[in] | cHandle | The connection handle. |
[out] | result | The return bson object. |
SDB_OK | Operation Success |
Others | Operation Fail |
INT32 sdbGetSessionAttrEx | ( | sdbConnectionHandle | cHandle, |
BOOLEAN | useCache, | ||
bson * | result | ||
) |
Get the attributes of the current session.
[in] | cHandle | The connection handle. |
[in] | useCache | Whether to use cache in local. |
[out] | result | The return bson object. |
SDB_OK | Operation Success |
Others | Operation Fail |
INT32 sdbGetSnapshot | ( | sdbConnectionHandle | cHandle, |
INT32 | snapType, | ||
bson * | condition, | ||
bson * | selector, | ||
bson * | orderBy, | ||
sdbCursorHandle * | handle | ||
) |
Get the snapshot.
[in] | cHandle | The connection handle |
[in] | snapType | The 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 |
[in] | condition | The matching rule, match all the documents if null |
[in] | select | The selective rule, return the whole document if null |
[in] | orderBy | The ordered rule, never sort if null |
[out] | handle | The cursor handle of current query |
SDB_OK | Operation Success |
Others | Operation Fail |
INT32 sdbGetSnapshot1 | ( | sdbConnectionHandle | cHandle, |
INT32 | snapType, | ||
bson * | condition, | ||
bson * | selector, | ||
bson * | orderBy, | ||
bson * | hint, | ||
INT64 | numToSkip, | ||
INT64 | numToReturn, | ||
sdbCursorHandle * | handle | ||
) |
Get the snapshot.
[in] | cHandle | The connection handle |
[in] | snapType | The 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 |
[in] | condition | The matching rule, match all the documents if null |
[in] | select | The selective rule, return the whole document if null |
[in] | orderBy | The ordered rule, never sort if null |
[in] | hint | The options provided for specific snapshot type. format:{ '$Options': { <options> } } |
[in] | numToSkip | Skip the first numToSkip documents, default is 0 |
[in] | numToReturn | Only return numToReturn documents, default is -1 for returning all results |
[out] | handle | The cursor handle of current query |
SDB_OK | Operation Success |
Others | Operation Fail |
INT32 sdbInsert | ( | sdbCollectionHandle | cHandle, |
bson * | obj | ||
) |
Insert a bson object into current collection.
[in] | cHandle | The collection handle. |
[in] | obj | The bson object to be inserted, cannot be null. |
SDB_OK | Operation Success. |
Others | Operation Fail. |
INT32 sdbInsert1 | ( | sdbCollectionHandle | cHandle, |
bson * | obj, | ||
bson_iterator * | pId | ||
) |
Insert a bson object into current collection.
[in] | cHandle | The collection handle. |
[in] | obj | The bson object to be inserted, cannot be null. |
[out] | pId | The object id of inserted bson object. Can be the follow value:
|
SDB_OK | Operation Success. |
Others | Operation Fail. |
INT32 sdbInsert2 | ( | sdbCollectionHandle | cHandle, |
bson * | obj, | ||
INT32 | flags, | ||
bson * | pResullt | ||
) |
Insert a bson object into current collection.
[in] | cHandle | The collection handle. |
[in] | obj | The bson object to be inserted, cannot be null. |
[in] | flags | The flag to control the behavior of inserting. The value of flags default to be 0, and it can choose the follow values:
|
[out] | pResult | The result of inserting. Can be NULL or a bson:
|
SDB_OK | Operation Success. |
Others | Operation 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.
[in] | cHandle | The database connection handle |
SDB_OK | Operation Success |
Others | Operation 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.
[in] | cHandle | The database connection handle |
SDB_OK | Operation Success |
Others | Operation Fail |
INT32 sdbInvalidateCache | ( | sdbConnectionHandle | cHandle, |
bson * | options | ||
) |
invalidate cache on specified nodes.
[in] | cHandle | The connection handle |
[in] | options | The 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: |
SDB_OK | Operation Success |
Others | Operation Fail |
BOOLEAN sdbIsClosed | ( | sdbConnectionHandle | cHandle | ) |
Judge whether the connection is closed or not.
[in] | cHandle | the connection handle. |
TRUE | for connection is closed while FALSE for not. |
BOOLEAN sdbIsReplicaGroupCatalog | ( | sdbReplicaGroupHandle | cHandle | ) |
Test whether the specified replica group is catalog.
[in] | cHandle | The replica group handle |
TRUE | The replica group is catalog |
FALSE | The replica group is not catalog |
BOOLEAN sdbIsValid | ( | sdbConnectionHandle | cHandle | ) |
Judge whether the connection is valid.
[in] | cHandle | the connection handle. |
TRUE | for connection is valid while FALSE for not. |
INT32 sdbListBackup | ( | sdbConnectionHandle | cHandle, |
bson * | options, | ||
bson * | condition, | ||
bson * | selector, | ||
bson * | orderBy, | ||
sdbCursorHandle * | handle | ||
) |
List the backups.
[in] | cHandle | The connection handle |
[in] | options | Contains 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] | condition | The matching rule, return all the documents if null |
[in] | selector | The selective rule, return the whole document if null |
[in] | orderBy | The ordered rule, never sort if null |
[out] | handle | The cusor handle of result |
SDB_OK | Operation Success |
Others | Operation Fail |
INT32 sdbListCollections | ( | sdbConnectionHandle | cHandle, |
sdbCursorHandle * | handle | ||
) |
List all collection of current database(not include temporary collection of temporary collection space)
[in] | cHandle | The database connection handle |
[out] | handle | The cursor handle of all collection names |
SDB_OK | Operation Success |
Others | Operation Fail |
INT32 sdbListCollectionsInDomain | ( | sdbDomainHandle | cHandle, |
sdbCursorHandle * | cursor | ||
) |
list the collections in domain.
[in] | cHandle | The domain handle |
[out] | handle | The cusor handle of result |
SDB_OK | Operation Success |
Others | Operation Fail |
INT32 sdbListCollectionSpaces | ( | sdbConnectionHandle | cHandle, |
sdbCursorHandle * | handle | ||
) |
List all collection space of current database(include temporary collection space)
[in] | cHandle | The database connection handle |
[out] | handle | The cursor handle of all collection space names |
SDB_OK | Operation Success |
Others | Operation Fail |
INT32 sdbListCollectionSpacesInDomain | ( | sdbDomainHandle | cHandle, |
sdbCursorHandle * | cursor | ||
) |
list the collection spaces in domain.
[in] | cHandle | The domain handle |
[out] | handle | The cusor handle of result |
SDB_OK | Operation Success |
Others | Operation Fail |
INT32 sdbListDomains | ( | sdbConnectionHandle | cHandle, |
bson * | condition, | ||
bson * | selector, | ||
bson * | orderBy, | ||
sdbCursorHandle * | handle | ||
) |
List the domains.
[in] | cHandle | The connection handle |
[in] | condition | The matching rule, return all the documents if null |
[in] | selector | The selective rule, return the whole document if null |
[in] | orderBy | The ordered rule, never sort if null |
[in] | hint | Specified 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] | handle | The cusor handle of result |
SDB_OK | Operation Success |
Others | Operation Fail |
INT32 sdbListGroupsInDomain | ( | sdbDomainHandle | cHandle, |
sdbCursorHandle * | cursor | ||
) |
list the groups in domain.
[in] | cHandle | The domain handle |
[out] | handle | The cusor handle of result |
SDB_OK | Operation Success |
Others | Operation Fail |
INT32 sdbListLobPieces | ( | sdbCollectionHandle | cHandle, |
sdbCursorHandle * | cursor | ||
) |
list all the pieces in the lob
[in] | cHandle | The collection handle |
[out] | cursor | The cursor handle of current query |
SDB_OK | Operation Success |
Others | Operation 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
[in] | cHandle | The collection handle |
[in] | condition | The matching rule, return all the lob if not provided |
[in] | selected | The selective rule, return the whole infomation if not provided |
[in] | orderBy | The ordered rule, result set is unordered if not provided |
[in] | hint | Specified options. e.g. {"ListPieces": 1} means get the detail piece info of lobs; |
[in] | numToSkip | Skip the first numToSkip lob, default is 0 |
[in] | numToReturn | Only return numToReturn lob, default is -1 for returning all results |
[out] | cursor | The cursor handle of current query |
SDB_OK | Operation Success |
Others | Operation Fail |
INT32 sdbListLobs | ( | sdbCollectionHandle | cHandle, |
sdbCursorHandle * | cursor | ||
) |
list all the lobs' meta data in current collection
[in] | cHandle | The collection handle |
[out] | cursor | The cursor handle of current query |
SDB_OK | Operation Success |
Others | Operation 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
[in] | cHandle | The collection handle |
[in] | condition | The matching rule, return all the lob if not provided |
[in] | selected | The selective rule, return the whole infomation if not provided |
[in] | orderBy | The ordered rule, result set is unordered if not provided |
[in] | hint | Specified options. e.g. {"ListPieces": 1} means get the detail piece info of lobs; |
[in] | numToSkip | Skip the first numToSkip lob, default is 0 |
[in] | numToReturn | Only return numToReturn lob, default is -1 for returning all results |
[out] | cursor | The cursor handle of current query |
SDB_OK | Operation Success |
Others | Operation Fail |
INT32 sdbListProcedures | ( | sdbConnectionHandle | cHandle, |
bson * | condition, | ||
sdbCursorHandle * | handle | ||
) |
List store procedures.
[in] | cHandle | The collection space space handle |
[in] | condition | The condition of list |
[out] | handle | The cursor handle |
SDB_OK | Operation Success |
Others | Operation Fail |
INT32 sdbListReplicaGroups | ( | sdbConnectionHandle | cHandle, |
sdbCursorHandle * | handle | ||
) |
List all the replica groups of current database.
[in] | cHandle | The database connection handle |
[out] | handle | The cursor handle of all replica groups |
SDB_OK | Operation Success |
Others | Operation Fail |
INT32 sdbListSequences | ( | sdbConnectionHandle | cHandle, |
sdbCursorHandle * | handle | ||
) |
List all sequences of current database.
[in] | cHandle | The database connection handle |
[out] | handle | The cursor handle of all sequences names |
SDB_OK | Operation Success |
Others | Operation Fail |
INT32 sdbListTasks | ( | sdbConnectionHandle | cHandle, |
bson * | condition, | ||
bson * | selector, | ||
bson * | orderBy, | ||
bson * | hint, | ||
sdbCursorHandle * | handle | ||
) |
List the tasks.
[in] | cHandle | The connection handle |
[in] | condition | The matching rule, return all the documents if null |
[in] | selector | The selective rule, return the whole document if null |
[in] | orderBy | The ordered rule, never sort if null |
[in] | hint | Specified 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] | handle | The cusor handle of result |
SDB_OK | Operation Success |
Others | Operation Fail |
INT32 sdbLoadCollectionSpace | ( | sdbConnectionHandle | cHandle, |
const CHAR * | csName, | ||
bson * | options | ||
) |
Load the specified collection space to database from file.
[in] | cHandle | The database connection handle |
[in] | csName | The specified collection space name |
[in] | options | The control options:(Only take effect in coordinate nodes) GroupID:INT32, GroupName:String, NodeID:INT32, HostName:String, svcname:String, ... |
SDB_OK | Operation Success |
Others | Operation Fail |
BOOLEAN sdbLobIsEof | ( | sdbLobHandle | lobHandle | ) |
Check whether current offset has reached to the max size of current lob.
[in] | lobHandle | The large object handle |
Return | true 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
[in] | lobHandle | The large object handle |
[in] | offset | The lock start position |
[in] | length | The lock length, -1 means lock to the end of lob |
SDB_OK | Operation Success |
Others | Operation Fail |
INT32 sdbLockLob | ( | sdbLobHandle | lobHandle, |
INT64 | offset, | ||
INT64 | length | ||
) |
lock LOB section for write mode
[in] | lobHandle | The large object handle |
[in] | offset | The lock start position |
[in] | length | The lock length, -1 means lock to the end of lob |
SDB_OK | Operation Success |
Others | Operation Fail |
INT32 sdbNext | ( | sdbCursorHandle | cHandle, |
bson * | obj | ||
) |
Return the next document of current cursor, and move forward.
[in] | cHandle | The cursor handle |
[out] | obj | The return bson object |
SDB_OK | Operation Success |
Others | Operation 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.
[in] | cHandle | The collection handle |
[in] | oid | The large object id, if mode is SDB_LOB_CREATEONLY, the oid can be NULL |
[in] | mode | The open mode: SDB_LOB_CREATEONLY,SDB_LOB_READ,SDB_LOB_WRITE,SDB_LOB_SHAREREAD, SDB_LOB_WRITE | SDB_LOB_SHAREREAD |
[out] | lobHandle | The handle of object |
SDB_OK | Operation Success |
Others | Operation 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.
[in] | cHandle | The collection handle |
[in] | condition | The matching rule, return all the documents if null |
[in] | select | The selective rule, return the whole document if null |
[in] | orderBy | The ordered rule, never sort if null |
[in] | hint | Specified 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] | numToSkip | Skip the first numToSkip documents, never skip if this parameter is 0 |
[in] | numToReturn | Only return numToReturn documents, return all if this parameter is -1 |
[out] | handle | The cursor handle of current query |
SDB_OK | Operation Success |
Others | Operation 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.
[in] | cHandle | The collection handle |
[in] | condition | The matching rule, return all the documents if null |
[in] | select | The selective rule, return the whole document if null |
[in] | orderBy | The ordered rule, never sort if null |
[in] | hint | Specified 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] | numToSkip | Skip the first numToSkip documents, never skip if this parameter is 0 |
[in] | numToReturn | Only return numToReturn documents, return all if this parameter is -1 |
[in] | flag | The 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] | handle | The cursor handle of current query |
SDB_OK | Operation Success |
Others | Operation 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.
[in] | cHandle | The collection handle |
[in] | condition | The matching rule, return all the documents if null |
[in] | select | The selective rule, return the whole document if null |
[in] | orderBy | The ordered rule, never sort if null |
[in] | hint | Specified 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] | numToSkip | Skip the first numToSkip documents, never skip if this parameter is 0 |
[in] | numToReturn | Only return numToReturn documents, return all if this parameter is -1 |
[in] | flag | The 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] | handle | The cursor handle of current query |
SDB_OK | Operation Success |
Others | Operation 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.
[in] | cHandle | The collection handle |
[in] | condition | The matching rule, return all the documents if null |
[in] | select | The selective rule, return the whole document if null |
[in] | orderBy | The ordered rule, never sort if null |
[in] | hint | Specified 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] | update | The update rule, can't be null |
[in] | numToSkip | Skip the first numToSkip documents, never skip if this parameter is 0 |
[in] | numToReturn | Only return numToReturn documents, return all if this parameter is -1 |
[in] | flag | The 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] | returnNew | When TRUE, returns the updated document rather than the original |
[out] | handle | The cursor handle of current query |
SDB_OK | Operation Success |
Others | Operation Fail |
INT32 sdbReadLob | ( | sdbLobHandle | lobHandle, |
UINT32 | len, | ||
CHAR * | buf, | ||
UINT32 * | read | ||
) |
read lob
[in] | lobHandle | The large object handle |
[in] | len | The length want to read |
[out] | buf | Put the data into buf |
[out] | read | The length of read |
SDB_OK | Operation Success |
Others | Operation Fail |
INT32 sdbReelect | ( | sdbReplicaGroupHandle | cHandle, |
const bson * | options | ||
) |
[in] | cHandle | The replica group handle |
[in] | options | The options of reelection. Please reference here for more detail. |
SDB_OK | Operation Success |
Others | Operation Fail |
void sdbReleaseCollection | ( | sdbCollectionHandle | cHandle | ) |
Release collection handle, the cursor handle of this collection will still available.
[in] | cHandle | The collection handle |
void sdbReleaseConnection | ( | sdbConnectionHandle | cHandle | ) |
Release the database connection handle.
[in] | cHandle | The database connection handle |
void sdbReleaseCS | ( | sdbCSHandle | cHandle | ) |
Release the collection space handle, the collecion and cursor handle of this collection space will still available.
[in] | cHandle | The collection space handle |
void sdbReleaseCursor | ( | sdbCursorHandle | cHandle | ) |
Release the cursor handle.
[in] | cHandle | The cursor handle |
void sdbReleaseDomain | ( | sdbDomainHandle | cHandle | ) |
Release the domain handle.
[in] | cHandle | the domain handle |
void sdbReleaseNode | ( | sdbNodeHandle | cHandle | ) |
Release the node handle.
[in] | cHandle | The node handle |
void sdbReleaseReplicaGroup | ( | sdbReplicaGroupHandle | cHandle | ) |
Release the replica group handle.
[in] | cHandle | The replica group handle |
void sdbReleaseSequence | ( | sdbSequenceHandle | sHandle | ) |
Release the sequence handle.
[in] | sHandle | The sequence handle |
INT32 sdbReloadConfig | ( | sdbConnectionHandle | cHandle, |
bson * | options | ||
) |
Force the node to reload configs online.
[in] | cHandle | The database connection handle |
[in] | options | The control options:(Only take effect in coordinate nodes) GroupID:INT32, GroupName:String, NodeID:INT32, HostName:String, svcname:String, ... |
SDB_OK | Operation Success |
Others | Operation Fail |
INT32 sdbRemoveBackup | ( | sdbConnectionHandle | cHandle, |
bson * | options | ||
) |
Remove the backups.
[in] | cHandle | The connection handle |
[in] | options | Contains 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. |
SDB_OK | Operation Success |
Others | Operation Fail |
INT32 sdbRemoveLob | ( | sdbCollectionHandle | cHandle, |
const bson_oid_t * | oid | ||
) |
remove lob
[in] | cHandle | The handle of collection |
[in] | oid | The large object id |
SDB_OK | Operation Success |
Others | Operation Fail |
INT32 sdbRemoveNode | ( | sdbReplicaGroupHandle | cHandle, |
const CHAR * | pHostName, | ||
const CHAR * | pServiceName, | ||
bson * | configure | ||
) |
remove node in a given replica group
[in] | cHandle | The replica group handle |
[in] | pHostName | The hostname for the node |
[in] | pServiceName | The servicename for the node |
[in] | configure | The configurations for the node |
SDB_OK | Operation Success |
Others | Operation Fail |
INT32 sdbRemoveReplicaGroup | ( | sdbConnectionHandle | cHandle, |
const CHAR * | pRGName | ||
) |
Remove the specified replica group.
[in] | cHandle | The database connection handle |
[in] | pRGName | The name of the replica group |
SDB_OK | Operation Success |
Others | Operation Fail |
INT32 sdbRemoveUsr | ( | sdbConnectionHandle | cHandle, |
const CHAR * | pUsrName, | ||
const CHAR * | pPasswd | ||
) |
Delete an account.
[in] | cHandle | The database connection handle |
[in] | pUsrName | The User's Name of the account |
[in] | pPasswd | The Password of the account |
SDB_OK | Connection Success |
Others | Connection Fail |
INT32 sdbRenameCollection | ( | sdbCSHandle | cHandle, |
const CHAR * | pOldName, | ||
const CHAR * | pNewName, | ||
bson * | options | ||
) |
Rename collection name.
[in] | cHandle | The collection space handle |
[in] | pOldName | The old collection short name |
[in] | pNewName | The new collection short name |
[in] | options | Reserved |
SDB_OK | Operation Success |
Others | Operation Fail |
INT32 sdbRenameCollectionSpace | ( | sdbConnectionHandle | cHandle, |
const CHAR * | pOldName, | ||
const CHAR * | pNewName, | ||
bson * | options | ||
) |
Rename the collectionspace name.
[in] | cHandle | The database connection handle |
[in] | pOldName | The old collection space name |
[in] | pNewName | The new collection space name |
[in] | options | Reserved |
SDB_OK | Operation Success |
Others | Operation Fail |
INT32 sdbRenameSequence | ( | sdbConnectionHandle | cHandle, |
const CHAR * | pOldName, | ||
const CHAR * | pNewName | ||
) |
Rename sequence.
[in] | cHandle | The database connection handle |
[in] | pOldName | The old sequence name |
[in] | pNewName | The new sequence name |
SDB_OK | Operation Success |
Others | Operation Fail |
INT32 sdbResetSnapshot | ( | sdbConnectionHandle | cHandle, |
bson * | options | ||
) |
Reset the snapshot.
[in] | cHandle | The connection handle |
[in] | options | The 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, ... |
SDB_OK | Operation Success |
Others | Operation Fail |
INT32 sdbRmProcedure | ( | sdbConnectionHandle | cHandle, |
const CHAR * | spName | ||
) |
remove a store procedure.
[in] | cHandle | The collection space space handle |
[in] | spName | The name of store procedure |
SDB_OK | Operation Success |
Others | Operation Fail |
INT32 sdbSecureConnect | ( | const CHAR * | pHostName, |
const CHAR * | pServiceName, | ||
const CHAR * | pUsrName, | ||
const CHAR * | pPasswd, | ||
sdbConnectionHandle * | handle | ||
) |
Connect to database with SSL.
[in] | pHostName | The Host Name or IP Address of Database Server |
[in] | pServiceName | The Service Name or Port of Database Server |
[in] | pUsrName | The User's Name of the account |
[in] | pPasswd | The Password of the account |
[out] | handle | The database connection handle, when fail to connect, *handle == SDB_INVALID_HANDLE and error code is return |
SDB_OK | Connection Success |
Others | Connection 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.
[in] | pConnAddrs | The array of the coord's address |
[in] | arrSize | The size of the array |
[in] | pUsrName | The User's Name of the account |
[in] | pPasswd | The Password of the account |
[out] | handle | The database connection handle |
SDB_OK | Connection Success |
Others | Connection Fail |
INT32 sdbSeekLob | ( | sdbLobHandle | lobHandle, |
SINT64 | size, | ||
SDB_LOB_SEEK | whence | ||
) |
seek the place to read or write
[in] | lobHandle | The large object handle |
[in] | size | The size of seek |
[in] | whence | The whence of seek |
SDB_OK | Operation Success |
Others | Operation Fail |
INT32 sdbSeqFetch | ( | sdbSequenceHandle | sHandle, |
const INT32 | fetchNum, | ||
INT64 * | nextValue, | ||
INT32 * | returnNum, | ||
INT32 * | increment | ||
) |
Fetch a bulk of continuous values.
[in] | sHandle | The sequence handle |
[in] | fetchNum | The number of values to be fetched. |
[out] | nextValue | The next value and also the first returned value. |
[out] | returnNum | The number of values returned. |
[out] | increment | Increment of values. |
SDB_OK | Operation Success |
Others | Operation Fail |
INT32 sdbSeqGetCurrentValue | ( | sdbSequenceHandle | sHandle, |
INT64 * | value | ||
) |
Get the current value of sequence.
[in] | sHandle | The sequence handle |
[out] | value | The current value |
SDB_OK | Operation Success |
Others | Operation Fail |
INT32 sdbSeqGetNextValue | ( | sdbSequenceHandle | sHandle, |
INT64 * | value | ||
) |
Get the next value of sequence.
[in] | sHandle | The sequence handle |
[out] | value | The next value |
SDB_OK | Operation Success |
Others | Operation Fail |
INT32 sdbSeqRestart | ( | sdbSequenceHandle | sHandle, |
const INT64 | startValue | ||
) |
Restart sequence from the given value.
[in] | sHandle | The sequence handle |
[in] | startValue | The star value. |
SDB_OK | Operation Success |
Others | Operation Fail |
INT32 sdbSeqSetAttributes | ( | sdbSequenceHandle | sHandle, |
const bson * | options | ||
) |
Alter the specified sequence.
[in] | sHandle | The sequence handle |
[in] | options | options 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 |
SDB_OK | Operation Success |
Others | Operation Fail |
INT32 sdbSeqSetCurrentValue | ( | sdbSequenceHandle | sHandle, |
const INT64 | value | ||
) |
Set the current value to sequence.
[in] | sHandle | The sequence handle |
[in] | value | The expected current value |
SDB_OK | Operation Success |
Others | Operation Fail |
void sdbSetConnectionInterruptFunc | ( | sdbConnectionHandle | cHandle, |
socketInterruptFunc | func | ||
) |
Set the callback function for connection interruption.
[in] | cHandle | The handle of connection. |
[in] | func | The function that check the app is interrupt or not |
void |
INT32 sdbSetErrorOnReplyCallback | ( | ERROR_ON_REPLY_FUNC | func | ) |
Set the callback function when reply message if error from server.
[in] | func | The callback function when called on reply error |
INT32 sdbSetPDLevel | ( | sdbConnectionHandle | cHandle, |
INT32 | pdLevel, | ||
bson * | options | ||
) |
Set the node's diagnostic level.
[in] | cHandle | The database connection handle |
[in] | pdLevel | Diagnostic level, value:[0~5] |
[in] | options | The control options:(Only take effect in coordinate nodes) GroupID:INT32, GroupName:String, NodeID:INT32, HostName:String, svcname:String, ... |
SDB_OK | Operation Success |
Others | Operation Fail |
INT32 sdbSetSessionAttr | ( | sdbConnectionHandle | cHandle, |
bson * | options | ||
) |
Set the attributes of the current session.
[in] | cHandle | The connection handle |
[in] | options | The 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. |
SDB_OK | Operation Success |
Others | Operation 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.
[in] | cHandle | The collection handle |
[in] | pSourceRG | The source replica group name |
[in] | pTargetRG | The target replica group name |
[in] | pSplitCondition | The split condition |
[in] | splitEndCondition | The 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] | taskID | The id of current task |
SDB_OK | Operation Success |
Others | Operation 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.
[in] | cHandle | The collection handle |
[in] | pSourceRG | The source replica group name |
[in] | pTargetRG | The target replica group name |
[in] | percent | The split percent, Range:(0.0, 100.0] |
[out] | taskID | The id of current task |
SDB_OK | Operation Success |
Others | Operation 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.
[in] | cHandle | The collection handle |
[in] | pSourceRG | The source replica group name |
[in] | pTargetRG | The target replica group name |
[in] | pSplitCondition | The split condition |
[in] | splitEndCondition | The 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). |
SDB_OK | Operation Success |
Others | Operation 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.
[in] | cHandle | The collection handle |
[in] | pSourceRG | The source replica group name |
[in] | pTargetRG | The target replica group name |
[in] | percent | The split percent, Range:(0.0, 100.0] |
SDB_OK | Operation Success |
Others | Operation Fail |
INT32 sdbStartNode | ( | sdbNodeHandle | cHandle | ) |
Start up the specified node.
[in] | cHandle | The node handle |
SDB_OK | Operation Success |
Others | Operation Fail |
INT32 sdbStartReplicaGroup | ( | sdbReplicaGroupHandle | cHandle | ) |
Start and activate the specified replica group.
[in] | cHandle | The replica group handle |
SDB_OK | Operation Success |
Others | Operation Fail |
INT32 sdbStopNode | ( | sdbNodeHandle | cHandle | ) |
Stop the specified node.
[in] | cHandle | The node handle |
SDB_OK | Operation Success |
Others | Operation Fail |
INT32 sdbStopReplicaGroup | ( | sdbReplicaGroupHandle | cHandle | ) |
Stop the specified replica group.
[in] | cHandle | The replica group handle |
SDB_OK | Operation Success |
Others | Operation Fail |
INT32 sdbSyncDB | ( | sdbConnectionHandle | cHandle, |
bson * | options | ||
) |
sync database which are specified
[in] | cHandle | The database connection handle |
[in] | options | The 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, ... |
SDB_OK | Operation Success |
Others | Operation Fail |
INT32 sdbTraceResume | ( | sdbConnectionHandle | cHandle | ) |
Resume trace.
[in] | cHandle | The connection handle |
SDB_OK | Operation Success |
Others | Operation 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.
[in] | cHandle | The connection handle |
[in] | traceBufferSize | The size for trace buffer on bytes |
[in] | component | The 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] | breakpoint | The functions need to break, separated by comma (,) |
[in] | tids | The array of target threads. |
[in] | nTids | The length of the array of target threads. |
SDB_OK | Operation Success |
Others | Operation Fail |
INT32 sdbTraceStatus | ( | sdbConnectionHandle | cHandle, |
sdbCursorHandle * | handle | ||
) |
Get the current status for trace.
[in] | cHandle | The connection handle |
[out] | handle | The cursor handle of current query |
SDB_OK | Operation Success |
Others | Operation Fail |
INT32 sdbTraceStop | ( | sdbConnectionHandle | cHandle, |
const CHAR * | pDumpFileName | ||
) |
Stop trace and dump into file.
[in] | cHandle | The connection handle |
[in] | pDumpFileName | The file to dump, NULL for stop only |
SDB_OK | Operation Success |
Others | Operation Fail |
INT32 sdbTransactionBegin | ( | sdbConnectionHandle | cHandle | ) |
Transaction begin.
[in] | cHandle | The database connection handle |
SDB_OK | Operation Success |
Others | Operation Fail |
INT32 sdbTransactionCommit | ( | sdbConnectionHandle | cHandle | ) |
Transaction commit.
[in] | cHandle | The database connection handle |
SDB_OK | Operation Success |
Others | Operation Fail |
INT32 sdbTransactionRollback | ( | sdbConnectionHandle | cHandle | ) |
Transaction rollback.
[in] | cHandle | The database connection handle |
SDB_OK | Operation Success |
Others | Operation Fail |
INT32 sdbTruncateCollection | ( | sdbConnectionHandle | cHandle, |
const CHAR * | fullName | ||
) |
truncate the collection
[in] | cHandle | The handle of connection. |
[in] | fullName | The full name of collection to be truncated, eg: foo.bar. |
SDB_OK | Operation Success |
Others | Operation Fail |
INT32 sdbTruncateLob | ( | sdbCollectionHandle | cHandle, |
const bson_oid_t * | oid, | ||
INT64 | length | ||
) |
truncate lob
[in] | cHandle | The handle of collection |
[in] | oid | The large object id |
[in] | length | The truncate length |
SDB_OK | Operation Success |
Others | Operation Fail |
INT32 sdbUnloadCollectionSpace | ( | sdbConnectionHandle | cHandle, |
const CHAR * | csName, | ||
bson * | options | ||
) |
Unload the specified collection space from database.
[in] | cHandle | The database connection handle |
[in] | csName | The specified collection space name |
[in] | options | The control options:(Only take effect in coordinate nodes) GroupID:INT32, GroupName:String, NodeID:INT32, HostName:String, svcname:String, ... |
SDB_OK | Operation Success |
Others | Operation Fail |
INT32 sdbUpdate | ( | sdbCollectionHandle | cHandle, |
bson * | rule, | ||
bson * | condition, | ||
bson * | hint | ||
) |
Update the matching documents in current collection.
[in] | cHandle | The collection handle |
[in] | rule | The updating rule, cannot be null |
[in] | condition | The matching rule, update all the documents if this parameter is null |
[in] | hint | Specified 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 |
SDB_OK | Operation Success |
Others | Operation Fail |
INT32 sdbUpdate1 | ( | sdbCollectionHandle | cHandle, |
bson * | rule, | ||
bson * | condition, | ||
bson * | hint, | ||
INT32 | flag | ||
) |
Update the matching documents in current collection.
[in] | cHandle | The collection handle |
[in] | rule | The updating rule, cannot be null |
[in] | condition | The matching rule, update all the documents if this parameter is null |
[in] | hint | Specified 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] | flag | The update flag, default to be 0. Please see the definition of follow flags for more detail. |
SDB_OK | Operation Success |
Others | Operation Fail |
INT32 sdbUpdateConfig | ( | sdbConnectionHandle | cHandle, |
bson * | configs, | ||
bson * | options | ||
) |
Force the node to update configs online.
[in] | cHandle | The database connection handle |
[in] | configs | the specific configuration parameters to update |
[in] | options | The control options:(Only take effect in coordinate nodes) GroupID:INT32, GroupName:String, NodeID:INT32, HostName:String, svcname:String, ... |
SDB_OK | Operation Success |
Others | Operation Fail |
INT32 sdbUpsert | ( | sdbCollectionHandle | cHandle, |
bson * | rule, | ||
bson * | condition, | ||
bson * | hint | ||
) |
Update the matching documents in current collection, insert if no matching.
[in] | cHandle | The collection handle |
[in] | rule | The updating rule, cannot be null |
[in] | condition | The matching rule, update all the documents if this parameter is null |
[in] | hint | Specified 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 |
SDB_OK | Operation Success |
Others | Operation Fail |
INT32 sdbUpsert1 | ( | sdbCollectionHandle | cHandle, |
bson * | rule, | ||
bson * | condition, | ||
bson * | hint, | ||
bson * | setOnInsert | ||
) |
Update the matching documents in current collection, insert if no matching.
[in] | cHandle | The collection handle |
[in] | rule | The updating rule, cannot be null |
[in] | condition | The matching rule, update all the documents if this parameter is null |
[in] | hint | Specified 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] | setOnInsert | The setOnInsert assigns the specified values to the fileds when insert |
SDB_OK | Operation Success |
Others | Operation Fail |
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.
[in] | cHandle | The collection handle |
[in] | rule | The updating rule, cannot be null |
[in] | condition | The matching rule, update all the documents if this parameter is null |
[in] | hint | Specified 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] | setOnInsert | The setOnInsert assigns the specified values to the fileds when insert |
[in] | flag | The update flag, default to be 0. Please see the definition of follow flags for more detail. |
SDB_OK | Operation Success |
Others | Operation Fail |
INT32 sdbWaitTasks | ( | sdbConnectionHandle | cHandle, |
const SINT64 * | taskIDs, | ||
SINT32 | num | ||
) |
Wait the tasks to finish.
[in] | cHandle | The connection handle |
[in] | taskIDs | The array of task id |
[in] | num | The number of task id |
SDB_OK | Operation Success |
Others | Operation Fail |
INT32 sdbWriteLob | ( | sdbLobHandle | lobHandle, |
const CHAR * | buf, | ||
UINT32 | len | ||
) |
write lob
[in] | lobHandle | The large object handle |
[in] | buf | The buf of write |
[in] | len | The length of write |
SDB_OK | Operation Success |
Others | Operation Fail |