25 #include "bson/bson.h"
32 #define SDB_PAGESIZE_4K 4096
33 #define SDB_PAGESIZE_8K 8192
34 #define SDB_PAGESIZE_16K 16384
35 #define SDB_PAGESIZE_32K 32768
36 #define SDB_PAGESIZE_64K 65536
38 #define SDB_PAGESIZE_DEFAULT 0
56 #define SDB_INVALID_HANDLE ((ossValuePtr) 0)
57 typedef ossValuePtr sdbConnectionHandle ;
58 typedef ossValuePtr sdbCSHandle ;
59 typedef ossValuePtr sdbCollectionHandle ;
60 typedef ossValuePtr sdbCursorHandle ;
61 typedef ossValuePtr sdbReplicaGroupHandle ;
62 typedef ossValuePtr sdbNodeHandle ;
63 typedef ossValuePtr sdbDomainHandle ;
64 typedef ossValuePtr sdbLobHandle ;
65 typedef ossValuePtr sdbDCHandle ;
71 const CHAR *pDescription,
72 const CHAR *pDetail ) ;
84 #define sdbCreateReplicaNode sdbCreateNode
86 #define sdbRemoveReplicaNode sdbRemoveNode
88 #define sdbGetReplicaNodeMaster sdbGetNodeMaster
90 #define sdbGetReplicaNodeSlave sdbGetNodeSlave
92 #define sdbGetReplicaNodeByName sdbGetNodeByName
94 #define sdbGetReplicaNodeByHost sdbGetNodeByHost
96 #define sdbGetReplicaNodeSddr sdbGetNodeAddr
98 #define sdbStartReplicaNode sdbStartNode
100 #define sdbStopReplicaNode sdbStopNode
102 #define sdbReleaseReplicaNode sdbReleaseNode
105 #define QUERY_FORCE_HINT 0x00000080
107 #define QUERY_PARALLED 0x00000100
109 #define QUERY_WITH_RETURNDATA 0x00000200
111 #define QUERY_PREPARE_MORE 0x00004000
113 #define QUERY_KEEP_SHARDINGKEY_IN_UPDATE 0x00008000
119 #define QUERY_FOR_UPDATE 0x00010000
123 #define FLG_INSERT_CONTONDUP 0x00000001
127 #define FLG_INSERT_REPLACEONDUP 0x00000004
129 #define FLG_INSERT_RETURN_OID 0x10000000
132 #define UPDATE_KEEP_SHARDINGKEY QUERY_KEEP_SHARDINGKEY_IN_UPDATE
164 const CHAR *pCipherFile,
165 CHAR *pUser, CHAR *pPasswd ) ;
181 SDB_EXPORT INT32
sdbConnect (
const CHAR *pHostName,
const CHAR *pServiceName,
182 const CHAR *pUsrName,
const CHAR *pPasswd ,
183 sdbConnectionHandle *handle ) ;
197 SDB_EXPORT INT32
sdbConnect1 (
const CHAR **pConnAddrs, INT32 arrSize,
198 const CHAR *pUsrName,
const CHAR *pPasswd ,
199 sdbConnectionHandle *handle ) ;
215 SDB_EXPORT INT32
sdbSecureConnect (
const CHAR *pHostName,
const CHAR *pServiceName,
216 const CHAR *pUsrName,
const CHAR *pPasswd ,
217 sdbConnectionHandle *handle ) ;
232 const CHAR *pUsrName,
const CHAR *pPasswd ,
233 sdbConnectionHandle *handle ) ;
239 SDB_EXPORT
void sdbDisconnect ( sdbConnectionHandle handle ) ;
250 SDB_EXPORT INT32
sdbCreateUsr( sdbConnectionHandle cHandle,
const CHAR *pUsrName,
251 const CHAR *pPasswd ) ;
262 SDB_EXPORT INT32
sdbRemoveUsr( sdbConnectionHandle cHandle,
const CHAR *pUsrName,
263 const CHAR *pPasswd ) ;
320 sdbCursorHandle *handle );
349 sdbCursorHandle *handle ) ;
390 sdbCursorHandle *handle ) ;
441 sdbCursorHandle *handle ) ;
512 SDB_EXPORT INT32
sdbTraceStart ( sdbConnectionHandle cHandle,
513 UINT32 traceBufferSize,
534 SDB_EXPORT INT32
sdbTraceStop ( sdbConnectionHandle cHandle,
535 const CHAR *pDumpFileName ) ;
546 sdbCursorHandle *handle ) ;
583 SDB_EXPORT INT32
sdbGetList ( sdbConnectionHandle cHandle,
588 sdbCursorHandle *handle ) ;
633 SDB_EXPORT INT32
sdbGetList1( sdbConnectionHandle cHandle,
641 sdbCursorHandle *handle ) ;
654 const CHAR *pCollectionFullName,
655 sdbCollectionHandle *handle ) ;
668 const CHAR *pCollectionSpaceName,
669 sdbCSHandle *handle ) ;
683 sdbReplicaGroupHandle *handle ) ;
697 sdbReplicaGroupHandle *handle ) ;
720 SDB_EXPORT INT32
sdbGetRGName ( sdbReplicaGroupHandle cHandle,
721 CHAR *pBuffer, INT32 size ) ;
753 const CHAR *pCollectionSpaceName,
755 sdbCSHandle *handle ) ;
775 const CHAR *pCollectionSpaceName,
777 sdbCSHandle *handle ) ;
788 const CHAR *pCollectionSpaceName ) ;
802 sdbReplicaGroupHandle *handle ) ;
813 const CHAR *pRGName ) ;
832 sdbNodeHandle *handle ) ;
844 sdbNodeHandle *handle ) ;
861 const INT32 *positionsArray,
862 INT32 positionsCount,
863 sdbNodeHandle *handle ) ;
878 const CHAR *pNodeName,
879 sdbNodeHandle *handle ) ;
895 const CHAR *pHostName,
896 const CHAR *pServiceName,
897 sdbNodeHandle *handle ) ;
914 const CHAR **ppHostName,
915 const CHAR **ppServiceName,
916 const CHAR **ppNodeName,
925 SDB_EXPORT INT32
sdbStartNode ( sdbNodeHandle cHandle ) ;
933 SDB_EXPORT INT32
sdbStopNode ( sdbNodeHandle cHandle ) ;
958 const CHAR *pHostName,
959 const CHAR *pServiceName,
960 const CHAR *pDatabasePath,
977 SDB_EXPORT INT32
sdbCreateNode ( sdbReplicaGroupHandle cHandle,
978 const CHAR *pHostName,
979 const CHAR *pServiceName,
980 const CHAR *pDatabasePath,
995 SDB_EXPORT INT32
sdbRemoveNode ( sdbReplicaGroupHandle cHandle,
996 const CHAR *pHostName,
997 const CHAR *pServiceName,
1009 sdbCursorHandle *handle ) ;
1020 sdbCursorHandle *handle ) ;
1032 sdbCursorHandle *handle ) ;
1043 sdbCursorHandle *handle ) ;
1079 const CHAR *code ) ;
1090 const CHAR *spName ) ;
1105 sdbCursorHandle *handle ) ;
1123 SDB_EXPORT INT32
sdbEvalJS( sdbConnectionHandle cHandle,
1126 sdbCursorHandle *handle,
1140 const CHAR *pCollectionName,
1141 sdbCollectionHandle *handle ) ;
1157 const CHAR *pCollectionName,
1158 sdbCollectionHandle *handle ) ;
1177 const CHAR *pCollectionName,
1179 sdbCollectionHandle *handle ) ;
1215 const CHAR *pCollectionName ) ;
1227 CHAR *pBuffer, INT32 size ) ;
1242 const CHAR *pOldName,
1243 const CHAR *pNewName,
1324 SDB_EXPORT INT32
sdbGetCLName ( sdbCollectionHandle cHandle,
1325 CHAR *pBuffer, INT32 size ) ;
1337 CHAR *pBuffer, INT32 size ) ;
1358 const CHAR *pSourceRG,
1359 const CHAR *pTargetRG,
1360 const bson *pSplitCondition,
1361 const bson *pSplitEndCondition ) ;
1384 const CHAR *pSourceRG,
1385 const CHAR *pTargetRG,
1386 const bson *pSplitCondition,
1387 const bson *pSplitEndCondition,
1403 const CHAR *pSourceRG,
1404 const CHAR *pTargetRG,
1422 const CHAR *pSourceRG,
1423 const CHAR *pTargetRG,
1444 const CHAR *pIndexName,
1446 BOOLEAN isEnforced ) ;
1468 const CHAR *pIndexName,
1471 INT32 sortBufferSize ) ;
1495 const CHAR *pIndexName,
1509 SDB_EXPORT INT32
sdbGetIndexes ( sdbCollectionHandle cHandle,
1510 const CHAR *pIndexName,
1511 sdbCursorHandle *handle ) ;
1523 SDB_EXPORT INT32
sdbGetIndex ( sdbCollectionHandle cHandle,
1524 const CHAR *pIndexName,
1537 sdbCursorHandle *handle ) ;
1548 SDB_EXPORT INT32
sdbDropIndex ( sdbCollectionHandle cHandle,
1549 const CHAR *pIndexName ) ;
1561 SDB_EXPORT INT32
sdbGetCount ( sdbCollectionHandle cHandle,
1581 SDB_EXPORT INT32
sdbGetCount1 ( sdbCollectionHandle cHandle,
1594 SDB_EXPORT INT32
sdbInsert ( sdbCollectionHandle cHandle,
1615 SDB_EXPORT INT32
sdbInsert1 ( sdbCollectionHandle cHandle,
1616 bson *obj, bson_iterator *pId ) ;
1662 SDB_EXPORT INT32
sdbInsert2 ( sdbCollectionHandle cHandle,
1663 bson *obj, INT32 flags, bson *pResult ) ;
1721 SDB_EXPORT INT32
sdbBulkInsert ( sdbCollectionHandle cHandle,
1722 SINT32 flags, bson **objs, SINT32 num ) ;
1770 SINT32 flags, bson **objs,
1790 SDB_EXPORT INT32
sdbUpdate ( sdbCollectionHandle cHandle,
1817 SDB_EXPORT INT32
sdbUpdate1 ( sdbCollectionHandle cHandle,
1839 SDB_EXPORT INT32
sdbUpsert ( sdbCollectionHandle cHandle,
1862 SDB_EXPORT INT32
sdbUpsert1 ( sdbCollectionHandle cHandle,
1866 bson *setOnInsert ) ;
1892 SDB_EXPORT INT32
sdbUpsert2 ( sdbCollectionHandle cHandle,
1912 SDB_EXPORT INT32
sdbDelete ( sdbCollectionHandle cHandle,
1947 SDB_EXPORT INT32
sdbQuery1 ( sdbCollectionHandle cHandle,
1955 sdbCursorHandle *handle ) ;
1981 SDB_EXPORT INT32
sdbQuery ( sdbCollectionHandle cHandle,
1988 sdbCursorHandle *handle ) ;
2036 sdbCursorHandle *handle ) ;
2077 sdbCursorHandle *handle ) ;
2115 SDB_EXPORT INT32
sdbExplain ( sdbCollectionHandle cHandle,
2124 sdbCursorHandle *handle ) ;
2134 SDB_EXPORT INT32
sdbNext ( sdbCursorHandle cHandle,
2145 SDB_EXPORT INT32
sdbCurrent ( sdbCursorHandle cHandle,
2195 SDB_EXPORT INT32
sdbInterrupt ( sdbConnectionHandle cHandle ) ;
2219 SDB_EXPORT INT32
sdbExec( sdbConnectionHandle cHandle,
2221 sdbCursorHandle *result );
2231 SDB_EXPORT INT32
sdbExecUpdate( sdbConnectionHandle cHandle,
2304 SDB_EXPORT
void sdbReleaseDC ( sdbDCHandle cHandle ) ;
2349 SDB_EXPORT INT32
sdbAggregate ( sdbCollectionHandle cHandle,
2350 bson **obj, SINT32 num,
2351 sdbCursorHandle *handle ) ;
2365 const CHAR *subClFullName,
2377 const CHAR *subClFullName) ;
2422 SDB_EXPORT INT32
sdbBackup ( sdbConnectionHandle cHandle, bson *options) ;
2448 SDB_EXPORT INT32
sdbListBackup ( sdbConnectionHandle cHandle,
2453 sdbCursorHandle *handle ) ;
2493 SDB_EXPORT INT32
sdbListTasks ( sdbConnectionHandle cHandle,
2498 sdbCursorHandle *handle ) ;
2510 SDB_EXPORT INT32
sdbWaitTasks ( sdbConnectionHandle cHandle,
2511 const SINT64 *taskIDs,
2525 SDB_EXPORT INT32
sdbCancelTask ( sdbConnectionHandle cHandle,
2574 SDB_EXPORT BOOLEAN
sdbIsClosed( sdbConnectionHandle cHandle ) ;
2581 SDB_EXPORT BOOLEAN
sdbIsValid( sdbConnectionHandle cHandle ) ;
2583 SDB_EXPORT INT32 _sdbMsg ( sdbConnectionHandle cHandle,
const CHAR *msg ) ;
2606 const CHAR *pDomainName,
2608 sdbDomainHandle *handle ) ;
2618 SDB_EXPORT INT32
sdbDropDomain ( sdbConnectionHandle cHandle,
2619 const CHAR *pDomainName ) ;
2631 SDB_EXPORT INT32
sdbGetDomain ( sdbConnectionHandle cHandle,
2632 const CHAR *pDomainName,
2633 sdbDomainHandle *handle ) ;
2657 sdbCursorHandle *handle ) ;
2679 const bson *options ) ;
2694 const bson * options ) ;
2710 const bson * options ) ;
2727 const bson * options ) ;
2749 const bson * options ) ;
2760 sdbCursorHandle *cursor ) ;
2771 sdbCursorHandle *cursor ) ;
2782 sdbCursorHandle *cursor ) ;
2828 SDB_EXPORT INT32 sdbCreateLobID( sdbCollectionHandle cHandle,
2844 SDB_EXPORT INT32 sdbCreateLobID1( sdbCollectionHandle cHandle,
2845 const CHAR *pTimeStamp,
2855 SDB_EXPORT INT32
sdbGetLobId( sdbLobHandle lobHandle,
2869 SDB_EXPORT INT32
sdbOpenLob( sdbCollectionHandle cHandle,
2870 const bson_oid_t *oid,
2872 sdbLobHandle *lobHandle ) ;
2884 SDB_EXPORT INT32
sdbWriteLob( sdbLobHandle lobHandle,
2898 SDB_EXPORT INT32
sdbLockLob( sdbLobHandle lobHandle,
2928 SDB_EXPORT INT32
sdbReadLob( sdbLobHandle lobHandle,
2939 SDB_EXPORT INT32
sdbCloseLob( sdbLobHandle *lobHandle ) ;
2949 SDB_EXPORT INT32
sdbRemoveLob( sdbCollectionHandle cHandle,
2950 const bson_oid_t *oid ) ;
2962 const bson_oid_t *oid, INT64 length ) ;
3003 SDB_EXPORT BOOLEAN
sdbLobIsEof( sdbLobHandle lobHandle ) ;
3016 SDB_EXPORT INT32
sdbSeekLob( sdbLobHandle lobHandle,
3018 SDB_LOB_SEEK whence ) ;
3028 SDB_EXPORT INT32
sdbListLobs( sdbCollectionHandle cHandle,
3029 sdbCursorHandle *cursor) ;
3048 SDB_EXPORT INT32 sdbListLobs1( sdbCollectionHandle cHandle,
3055 sdbCursorHandle *cursor) ;
3067 sdbCursorHandle *cursor ) ;
3098 sdbCursorHandle *cursor ) ;
3110 SDB_EXPORT INT32
sdbReelect( sdbReplicaGroupHandle cHandle,
3111 const bson *options ) ;
3121 const bson *options ) ;
3132 const CHAR *fullName ) ;
3153 SDB_EXPORT INT32
sdbDetachNode( sdbReplicaGroupHandle cHandle,
3154 const CHAR *hostName,
3155 const CHAR *serviceName,
3156 const bson *options ) ;
3175 SDB_EXPORT INT32
sdbAttachNode( sdbReplicaGroupHandle cHandle,
3176 const CHAR *hostName,
3177 const CHAR *serviceName,
3178 const bson *options ) ;
3191 const bson *args ) ;
3215 const bson * args ) ;
3235 const bson * args ) ;
3263 const bson * options ) ;
3275 const bson * options ) ;
3298 const bson *options ) ;
3309 sdbCursorHandle *handle ) ;
3321 SDB_EXPORT INT32 sdbPop( sdbCollectionHandle cHandle, bson *options ) ;
3331 SDB_EXPORT INT32 sdbGetDCName( sdbDCHandle cHandle, CHAR *pBuffer, INT32 size ) ;
3340 SDB_EXPORT INT32 sdbGetDC( sdbConnectionHandle cHandle, sdbDCHandle *handle ) ;
3349 SDB_EXPORT INT32 sdbGetDCDetail( sdbDCHandle cHandle, bson *retInfo ) ;
3357 SDB_EXPORT INT32 sdbActivateDC( sdbDCHandle cHandle ) ;
3365 SDB_EXPORT INT32 sdbDeactivateDC( sdbDCHandle cHandle ) ;
3374 SDB_EXPORT INT32 sdbEnableReadOnly( sdbDCHandle cHandle, BOOLEAN isReadOnly ) ;
3384 SDB_EXPORT INT32 sdbCreateImage( sdbDCHandle cHandle,
const CHAR *pCataAddrList ) ;
3392 SDB_EXPORT INT32 sdbRemoveImage( sdbDCHandle cHandle ) ;
3400 SDB_EXPORT INT32 sdbEnableImage( sdbDCHandle cHandle ) ;
3408 SDB_EXPORT INT32 sdbDisableImage( sdbDCHandle cHandle ) ;
3442 SDB_EXPORT INT32 sdbAttachGroups( sdbDCHandle cHandle, bson *info ) ;
3451 SDB_EXPORT INT32 sdbDetachGroups( sdbDCHandle cHandle, bson *info ) ;
3476 SDB_EXPORT INT32
sdbSyncDB( sdbConnectionHandle cHandle,
3535 SDB_EXPORT INT32
sdbSetPDLevel( sdbConnectionHandle cHandle,
3572 bson *configs, bson *options ) ;
3590 bson *configs, bson *options ) ;
3605 const CHAR *pOldName,
3606 const CHAR *pNewName,
3617 sdbConnectionHandle cHandle,
3647 SDB_EXPORT INT32
sdbAnalyze( sdbConnectionHandle cHandle,