28 #if defined (SDB_ENGINE) || defined (SDB_CLIENT)
29 #include "../bson/bson.h"
30 #include "../util/fromjson.hpp"
32 #include "bson/bson.hpp"
33 #include "fromjson.hpp"
41 #define RELEASE_INNER_HANDLE( handle ) \
51 #define DLLEXPORT SDB_EXPORT
54 #define SDB_PAGESIZE_4K 4096
56 #define SDB_PAGESIZE_8K 8192
58 #define SDB_PAGESIZE_16K 16384
60 #define SDB_PAGESIZE_32K 32768
62 #define SDB_PAGESIZE_64K 65536
64 #define SDB_PAGESIZE_DEFAULT 0
68 #define FLG_INSERT_CONTONDUP 0x00000001
70 #define FLG_INSERT_RETURNNUM 0x00000002
72 #define FLG_INSERT_REPLACEONDUP 0x00000004
74 #define FLG_INSERT_UPDATEONDUP 0x00000008
78 #define FLG_INSERT_CONTONDUP_ID 0x00000020
81 #define FLG_INSERT_REPLACEONDUP_ID 0x00000040
83 #define FLG_INSERT_RETURN_OID 0x10000000
90 #define SDB_CLIENT_SOCKET_TIMEOUT_DFT 10000
93 #define sdbReplicaNode sdbNode
96 #define QUERY_FORCE_HINT 0x00000080
98 #define QUERY_PARALLED 0x00000100
100 #define QUERY_WITH_RETURNDATA 0x00000200
102 #define QUERY_PREPARE_MORE 0x00004000
104 #define QUERY_KEEP_SHARDINGKEY_IN_UPDATE 0x00008000
109 #define QUERY_FOR_UPDATE 0x00010000
114 #define QUERY_FOR_SHARE 0x00040000
118 #define UPDATE_KEEP_SHARDINGKEY QUERY_KEEP_SHARDINGKEY_IN_UPDATE
120 #define UPDATE_ONE 0x00000002
122 #define UPDATE_RETURNNUM 0x00000004
125 #define FLG_DELETE_ONE 0x00000002
127 #define FLG_DELETE_RETURNNUM 0x00000004
129 #define SDB_INDEX_SORT_BUFFER_DEFAULT_SIZE 64
159 const static bson::BSONObj _sdbStaticObject ;
160 const static bson::OID _sdbStaticOid ;
161 const static std::vector<INT32> _sdbStaticVec ;
162 const static std::vector<UINT32> _sdbStaticUINT32Vec ;
164 class _sdbCollection ;
174 const CHAR *pDescription,
175 const CHAR *pDetail ) ;
183 class DLLEXPORT _sdbCursor
186 _sdbCursor (
const _sdbCursor& other ) ;
187 _sdbCursor& operator=(
const _sdbCursor& ) ;
190 virtual ~_sdbCursor () {}
191 virtual INT32 next ( bson::BSONObj &obj, BOOLEAN getOwned = TRUE ) = 0 ;
192 virtual INT32 current ( bson::BSONObj &obj, BOOLEAN getOwned = TRUE ) = 0 ;
193 virtual INT32 close () = 0 ;
194 virtual INT32 advance (
const bson::BSONObj &option,
195 bson::BSONObj *pResult = NULL ) = 0 ;
250 INT32 next ( bson::BSONObj &obj, BOOLEAN getOwned = TRUE )
254 return SDB_NOT_CONNECTED ;
256 return pCursor->
next ( obj, getOwned ) ;
275 INT32 current ( bson::BSONObj &obj, BOOLEAN getOwned = TRUE )
279 return SDB_NOT_CONNECTED ;
281 return pCursor->current ( obj, getOwned ) ;
291 INT32 advance (
const bson::BSONObj &option, bson::BSONObj *pResult = NULL )
295 return SDB_NOT_CONNECTED ;
297 return pCursor->advance( option, pResult ) ;
311 return pCursor->close () ;
315 class DLLEXPORT _sdbCollection
318 _sdbCollection (
const _sdbCollection& other ) ;
319 _sdbCollection& operator=(
const _sdbCollection& ) ;
322 virtual ~_sdbCollection () {}
325 virtual INT32 getCount ( SINT64 &count,
326 const bson::BSONObj &condition = _sdbStaticObject,
327 const bson::BSONObj &hint = _sdbStaticObject ) = 0 ;
332 virtual INT32 insert (
const bson::BSONObj &obj, bson::OID *
id = NULL ) = 0 ;
333 virtual INT32 insert (
const bson::BSONObj &obj,
335 bson::BSONObj *pResult = NULL ) = 0 ;
336 virtual INT32 insert (
const bson::BSONObj &obj,
337 const bson::BSONObj &hint,
339 bson::BSONObj *pResult = NULL ) = 0 ;
340 virtual INT32 insert ( std::vector<bson::BSONObj> &objs,
342 bson::BSONObj *pResult = NULL ) = 0 ;
343 virtual INT32 insert ( std::vector<bson::BSONObj> &objs,
344 const bson::BSONObj &hint,
346 bson::BSONObj *pResult = NULL ) = 0 ;
347 virtual INT32 insert (
const bson::BSONObj objs[],
350 bson::BSONObj *pResult = NULL ) = 0 ;
351 virtual INT32 bulkInsert ( SINT32 flags,
352 std::vector<bson::BSONObj> &obj
361 virtual INT32 update (
const bson::BSONObj &rule,
362 const bson::BSONObj &condition = _sdbStaticObject,
363 const bson::BSONObj &hint = _sdbStaticObject,
365 bson::BSONObj *pResult = NULL
377 virtual INT32 upsert (
const bson::BSONObj &rule,
378 const bson::BSONObj &condition = _sdbStaticObject,
379 const bson::BSONObj &hint = _sdbStaticObject,
380 const bson::BSONObj &setOnInsert = _sdbStaticObject,
382 bson::BSONObj *pResult = NULL
391 virtual INT32 del (
const bson::BSONObj &condition = _sdbStaticObject,
392 const bson::BSONObj &hint = _sdbStaticObject,
394 bson::BSONObj *pResult = NULL
404 virtual INT32 query ( _sdbCursor **cursor,
405 const bson::BSONObj &condition = _sdbStaticObject,
406 const bson::BSONObj &selected = _sdbStaticObject,
407 const bson::BSONObj &orderBy = _sdbStaticObject,
408 const bson::BSONObj &hint = _sdbStaticObject,
410 INT64 numToReturn = -1,
414 virtual INT32 query ( sdbCursor &cursor,
415 const bson::BSONObj &condition = _sdbStaticObject,
416 const bson::BSONObj &selected = _sdbStaticObject,
417 const bson::BSONObj &orderBy = _sdbStaticObject,
418 const bson::BSONObj &hint = _sdbStaticObject,
420 INT64 numToReturn = -1,
424 virtual INT32 queryOne( bson::BSONObj &obj,
425 const bson::BSONObj &condition = _sdbStaticObject,
426 const bson::BSONObj &selected = _sdbStaticObject,
427 const bson::BSONObj &orderBy = _sdbStaticObject,
428 const bson::BSONObj &hint = _sdbStaticObject,
430 INT32 flags = 0 ) = 0 ;
442 virtual INT32 queryAndUpdate ( _sdbCursor **cursor,
443 const bson::BSONObj &update,
444 const bson::BSONObj &condition = _sdbStaticObject,
445 const bson::BSONObj &selected = _sdbStaticObject,
446 const bson::BSONObj &orderBy = _sdbStaticObject,
447 const bson::BSONObj &hint = _sdbStaticObject,
449 INT64 numToReturn = -1,
451 BOOLEAN returnNew = FALSE
462 virtual INT32 queryAndRemove ( _sdbCursor **cursor,
463 const bson::BSONObj &condition = _sdbStaticObject,
464 const bson::BSONObj &selected = _sdbStaticObject,
465 const bson::BSONObj &orderBy = _sdbStaticObject,
466 const bson::BSONObj &hint = _sdbStaticObject,
468 INT64 numToReturn = -1,
479 virtual INT32 createIndex (
const bson::BSONObj &indexDef,
483 INT32 sortBufferSize ) = 0 ;
484 virtual INT32 createIndex (
const bson::BSONObj &indexDef,
486 const bson::BSONObj &indexAttr = _sdbStaticObject,
487 const bson::BSONObj &option = _sdbStaticObject
489 virtual INT32 createIndexAsync ( SINT64 &taskID,
490 const bson::BSONObj &indexDef,
492 const bson::BSONObj &indexAttr = _sdbStaticObject,
493 const bson::BSONObj &option = _sdbStaticObject
495 virtual INT32 snapshotIndexes ( _sdbCursor **cursor,
496 const bson::BSONObj &condition = _sdbStaticObject,
497 const bson::BSONObj &selector = _sdbStaticObject,
498 const bson::BSONObj &orderby = _sdbStaticObject,
499 const bson::BSONObj &hint = _sdbStaticObject,
501 INT64 numToReturn = -1 ) = 0 ;
502 virtual INT32 getIndexes ( _sdbCursor **cursor,
503 const CHAR *pName ) = 0 ;
504 virtual INT32 getIndexes ( sdbCursor &cursor,
505 const CHAR *pIndexName ) = 0 ;
506 virtual INT32 getIndexes ( std::vector<bson::BSONObj> &infos ) = 0 ;
507 virtual INT32 getIndex (
const CHAR *pIndexName, bson::BSONObj &info ) = 0 ;
508 virtual INT32 dropIndex (
const CHAR *pIndexName ) = 0 ;
509 virtual INT32 dropIndexAsync ( SINT64 &taskID,
510 const CHAR *pIndexName ) = 0 ;
511 virtual INT32 copyIndex (
const CHAR *subClFullName,
512 const CHAR *pIndexName ) = 0 ;
513 virtual INT32 copyIndexAsync ( SINT64 &taskID,
514 const CHAR *subClFullName,
515 const CHAR *pIndexName ) = 0 ;
516 virtual INT32 create () = 0 ;
517 virtual INT32 drop () = 0 ;
518 virtual const CHAR *getCollectionName () = 0 ;
519 virtual const CHAR *getCSName () = 0 ;
520 virtual const CHAR *getFullName () = 0 ;
521 virtual INT32 split (
const CHAR *pSourceGroupName,
522 const CHAR *pTargetGroupName,
523 const bson::BSONObj &splitConditon,
524 const bson::BSONObj &splitEndCondition = _sdbStaticObject) = 0 ;
525 virtual INT32 split (
const CHAR *pSourceGroupName,
526 const CHAR *pTargetGroupName,
527 FLOAT64 percent ) = 0 ;
528 virtual INT32 splitAsync ( SINT64 &taskID,
529 const CHAR *pSourceGroupName,
530 const CHAR *pTargetGroupName,
531 const bson::BSONObj &splitCondition,
532 const bson::BSONObj &splitEndCondition = _sdbStaticObject) = 0 ;
533 virtual INT32 splitAsync (
const CHAR *pSourceGroupName,
534 const CHAR *pTargetGroupName,
536 SINT64 &taskID ) = 0 ;
537 virtual INT32 aggregate ( _sdbCursor **cursor,
538 std::vector<bson::BSONObj> &obj
540 virtual INT32 aggregate ( sdbCursor &cursor,
541 std::vector<bson::BSONObj> &obj
543 virtual INT32 getQueryMeta ( _sdbCursor **cursor,
544 const bson::BSONObj &condition = _sdbStaticObject,
545 const bson::BSONObj &orderBy = _sdbStaticObject,
546 const bson::BSONObj &hint = _sdbStaticObject,
548 INT64 numToReturn = -1
550 virtual INT32 getQueryMeta ( sdbCursor &cursor,
551 const bson::BSONObj &condition = _sdbStaticObject,
552 const bson::BSONObj &orderBy = _sdbStaticObject,
553 const bson::BSONObj &hint = _sdbStaticObject,
555 INT64 numToReturn = -1
557 virtual INT32 attachCollection (
const CHAR *subClFullName,
558 const bson::BSONObj &options) = 0 ;
559 virtual INT32 detachCollection (
const CHAR *subClFullName) = 0 ;
561 virtual INT32 alterCollection (
const bson::BSONObj &options ) = 0 ;
563 virtual INT32 explain ( sdbCursor &cursor,
564 const bson::BSONObj &condition = _sdbStaticObject,
565 const bson::BSONObj &select = _sdbStaticObject,
566 const bson::BSONObj &orderBy = _sdbStaticObject,
567 const bson::BSONObj &hint = _sdbStaticObject,
569 INT64 numToReturn = -1,
571 const bson::BSONObj &options = _sdbStaticObject ) = 0 ;
573 virtual INT32 explain ( _sdbCursor **cursor,
574 const bson::BSONObj &condition = _sdbStaticObject,
575 const bson::BSONObj &select = _sdbStaticObject,
576 const bson::BSONObj &orderBy = _sdbStaticObject,
577 const bson::BSONObj &hint = _sdbStaticObject,
579 INT64 numToReturn = -1,
581 const bson::BSONObj &options = _sdbStaticObject ) = 0 ;
583 virtual INT32 createLob( sdbLob &lob,
const bson::OID *oid = NULL ) = 0 ;
585 virtual INT32 removeLob(
const bson::OID &oid ) = 0 ;
587 virtual INT32 truncateLob(
const bson::OID &oid, INT64 length ) = 0 ;
589 virtual INT32 openLob( sdbLob &lob,
const bson::OID &oid,
592 virtual INT32 openLob( sdbLob &lob,
const bson::OID &oid,
595 virtual INT32 listLobs( sdbCursor &cursor,
596 const bson::BSONObj &condition = _sdbStaticObject,
597 const bson::BSONObj &selected = _sdbStaticObject,
598 const bson::BSONObj &orderBy = _sdbStaticObject,
599 const bson::BSONObj &hint = _sdbStaticObject,
601 INT64 numToReturn = -1 ) = 0 ;
603 virtual INT32 listLobs( _sdbCursor **cursor,
604 const bson::BSONObj &condition = _sdbStaticObject,
605 const bson::BSONObj &selected = _sdbStaticObject,
606 const bson::BSONObj &orderBy = _sdbStaticObject,
607 const bson::BSONObj &hint = _sdbStaticObject,
609 INT64 numToReturn = -1 ) = 0 ;
611 virtual INT32 createLobID( bson::OID &oid,
const CHAR *pTimeStamp = NULL ) = 0 ;
613 virtual INT32 listLobPieces(
615 const bson::BSONObj &condition = _sdbStaticObject,
616 const bson::BSONObj &selected = _sdbStaticObject,
617 const bson::BSONObj &orderBy = _sdbStaticObject,
618 const bson::BSONObj &hint = _sdbStaticObject,
620 INT64 numToReturn = -1 ) = 0 ;
622 virtual INT32 listLobPieces(
624 const bson::BSONObj &condition = _sdbStaticObject,
625 const bson::BSONObj &selected = _sdbStaticObject,
626 const bson::BSONObj &orderBy = _sdbStaticObject,
627 const bson::BSONObj &hint = _sdbStaticObject,
629 INT64 numToReturn = -1 ) = 0 ;
632 virtual INT32 truncate(
const bson::BSONObj &options = _sdbStaticObject ) = 0 ;
635 virtual INT32 createIdIndex(
const bson::BSONObj &options = _sdbStaticObject ) = 0 ;
637 virtual INT32 dropIdIndex() = 0 ;
639 virtual INT32 createAutoIncrement(
const bson::BSONObj &options ) = 0;
641 virtual INT32 createAutoIncrement(
const std::vector<bson::BSONObj> &options ) = 0;
643 virtual INT32 dropAutoIncrement(
const CHAR *fieldName ) = 0;
645 virtual INT32 dropAutoIncrement(
const std::vector<const CHAR*> &fieldNames ) = 0;
647 virtual INT32 pop (
const bson::BSONObj &option = _sdbStaticObject ) = 0 ;
649 virtual INT32 enableSharding (
const bson::BSONObj &options ) = 0 ;
651 virtual INT32 disableSharding () = 0 ;
653 virtual INT32 enableCompression (
const bson::BSONObj &options = _sdbStaticObject ) = 0 ;
655 virtual INT32 disableCompression () = 0 ;
657 virtual INT32 setAttributes (
const bson::BSONObj &options ) = 0 ;
659 virtual INT32 getDetail ( _sdbCursor **cursor ) = 0 ;
661 virtual INT32 getDetail ( sdbCursor &cursor ) = 0 ;
663 virtual INT32 getCollectionStat ( bson::BSONObj &result ) = 0 ;
665 virtual INT32 getIndexStat (
const CHAR *pIndexName,
666 bson::BSONObj &result,
667 BOOLEAN detail = FALSE ) = 0 ;
669 virtual void setVersion( INT32 clVersion ) = 0;
670 virtual INT32 getVersion() = 0;
732 INT32 getCount ( SINT64 &count,
733 const bson::BSONObj &condition = _sdbStaticObject,
734 const bson::BSONObj &hint = _sdbStaticObject )
738 return SDB_NOT_CONNECTED ;
740 return pCollection->
getCount ( count, condition, hint ) ;
760 INT32 split (
const CHAR *pSourceGroupName,
761 const CHAR *pTargetGroupName,
762 const bson::BSONObj &splitCondition,
763 const bson::BSONObj &splitEndCondition = _sdbStaticObject)
767 return SDB_NOT_CONNECTED ;
769 return pCollection->split ( pSourceGroupName,
786 INT32 split (
const CHAR *pSourceGroupName,
787 const CHAR *pTargetGroupName,
792 return SDB_NOT_CONNECTED ;
794 return pCollection->split ( pSourceGroupName,
818 INT32 splitAsync ( SINT64 &taskID,
819 const CHAR *pSourceGroupName,
820 const CHAR *pTargetGroupName,
821 const bson::BSONObj &splitCondition,
822 const bson::BSONObj &splitEndCondition = _sdbStaticObject )
826 return SDB_NOT_CONNECTED ;
828 return pCollection->splitAsync ( taskID,
832 splitEndCondition ) ;
848 INT32 splitAsync (
const CHAR *pSourceGroupName,
849 const CHAR *pTargetGroupName,
855 return SDB_NOT_CONNECTED ;
857 return pCollection->splitAsync ( pSourceGroupName,
889 INT32 alterCollection (
const bson::BSONObj &options )
893 return SDB_NOT_CONNECTED ;
895 return pCollection->alterCollection ( options ) ;
920 INT32 insert (
const bson::BSONObj &obj, bson::OID *pId = NULL )
924 return SDB_NOT_CONNECTED ;
926 return pCollection->insert ( obj, pId ) ;
975 INT32 insert (
const bson::BSONObj &obj,
977 bson::BSONObj *pResult = NULL )
981 return SDB_NOT_CONNECTED ;
983 return pCollection->insert ( obj, flags, pResult ) ;
1042 INT32 insert (
const bson::BSONObj &obj,
1043 const bson::BSONObj &hint,
1045 bson::BSONObj *pResult = NULL )
1049 return SDB_NOT_CONNECTED ;
1051 return pCollection->insert ( obj, hint, flags, pResult ) ;
1103 INT32 insert ( std::vector<bson::BSONObj> &objs,
1105 bson::BSONObj *pResult = NULL )
1109 return SDB_NOT_CONNECTED ;
1111 return pCollection->insert( objs, flags, pResult ) ;
1168 INT32 insert ( std::vector<bson::BSONObj> &objs,
1169 const bson::BSONObj &hint,
1171 bson::BSONObj *pResult = NULL )
1175 return SDB_NOT_CONNECTED ;
1177 return pCollection->insert( objs, hint, flags, pResult ) ;
1231 INT32 insert (
const bson::BSONObj objs[],
1234 bson::BSONObj *pResult = NULL )
1238 return SDB_NOT_CONNECTED ;
1240 return pCollection->insert ( objs, size, flags, pResult ) ;
1270 INT32 bulkInsert ( SINT32 flags,
1271 std::vector<bson::BSONObj> &objs )
1275 return SDB_NOT_CONNECTED ;
1277 return pCollection->bulkInsert ( flags, objs ) ;
1312 INT32 update (
const bson::BSONObj &rule,
1313 const bson::BSONObj &condition = _sdbStaticObject,
1314 const bson::BSONObj &hint = _sdbStaticObject,
1316 bson::BSONObj *pResult = NULL
1321 return SDB_NOT_CONNECTED ;
1323 return pCollection->update ( rule, condition, hint, flag, pResult ) ;
1359 INT32 upsert (
const bson::BSONObj &rule,
1360 const bson::BSONObj &condition = _sdbStaticObject,
1361 const bson::BSONObj &hint = _sdbStaticObject,
1362 const bson::BSONObj &setOnInsert = _sdbStaticObject,
1364 bson::BSONObj *pResult = NULL
1369 return SDB_NOT_CONNECTED ;
1371 return pCollection->upsert ( rule, condition, hint, setOnInsert,
1396 INT32 del (
const bson::BSONObj &condition = _sdbStaticObject,
1397 const bson::BSONObj &hint = _sdbStaticObject,
1399 bson::BSONObj *pResult = NULL
1404 return SDB_NOT_CONNECTED ;
1406 return pCollection->del ( condition, hint, flag, pResult ) ;
1439 INT32 query ( _sdbCursor **cursor,
1440 const bson::BSONObj &condition = _sdbStaticObject,
1441 const bson::BSONObj &selected = _sdbStaticObject,
1442 const bson::BSONObj &orderBy = _sdbStaticObject,
1443 const bson::BSONObj &hint = _sdbStaticObject,
1444 INT64 numToSkip = 0,
1445 INT64 numToReturn = -1,
1451 return SDB_NOT_CONNECTED ;
1453 return pCollection->query ( cursor, condition, selected, orderBy,
1454 hint, numToSkip, numToReturn, flags ) ;
1488 const bson::BSONObj &condition = _sdbStaticObject,
1489 const bson::BSONObj &selected = _sdbStaticObject,
1490 const bson::BSONObj &orderBy = _sdbStaticObject,
1491 const bson::BSONObj &hint = _sdbStaticObject,
1492 INT64 numToSkip = 0,
1493 INT64 numToReturn = -1,
1499 return SDB_NOT_CONNECTED ;
1502 return pCollection->query ( cursor, condition, selected, orderBy,
1503 hint, numToSkip, numToReturn, flags ) ;
1534 INT32 queryOne( bson::BSONObj &obj,
1535 const bson::BSONObj &condition = _sdbStaticObject,
1536 const bson::BSONObj &selected = _sdbStaticObject,
1537 const bson::BSONObj &orderBy = _sdbStaticObject,
1538 const bson::BSONObj &hint = _sdbStaticObject,
1539 INT64 numToSkip = 0,
1544 return SDB_NOT_CONNECTED ;
1546 return pCollection->queryOne( obj, condition, selected, orderBy,
1547 hint, numToSkip, flag ) ;
1586 const bson::BSONObj &update,
1587 const bson::BSONObj &condition = _sdbStaticObject,
1588 const bson::BSONObj &selected = _sdbStaticObject,
1589 const bson::BSONObj &orderBy = _sdbStaticObject,
1590 const bson::BSONObj &hint = _sdbStaticObject,
1591 INT64 numToSkip = 0,
1592 INT64 numToReturn = -1,
1594 BOOLEAN returnNew = FALSE
1599 return SDB_NOT_CONNECTED ;
1602 return pCollection->queryAndUpdate( &cursor.
pCursor , update, condition,
1603 selected, orderBy, hint,
1604 numToSkip, numToReturn, flag, returnNew ) ;
1638 const bson::BSONObj &condition = _sdbStaticObject,
1639 const bson::BSONObj &selected = _sdbStaticObject,
1640 const bson::BSONObj &orderBy = _sdbStaticObject,
1641 const bson::BSONObj &hint = _sdbStaticObject,
1642 INT64 numToSkip = 0,
1643 INT64 numToReturn = -1,
1649 return SDB_NOT_CONNECTED ;
1652 return pCollection->queryAndRemove( &cursor.
pCursor , condition,
1653 selected, orderBy, hint,
1654 numToSkip, numToReturn, flag ) ;
1673 INT32 createIndex (
const bson::BSONObj &indexDef,
1674 const CHAR *pIndexName,
1677 INT32 sortBufferSize =
1678 SDB_INDEX_SORT_BUFFER_DEFAULT_SIZE )
1682 return SDB_NOT_CONNECTED ;
1684 return pCollection->createIndex ( indexDef, pIndexName, isUnique,
1685 isEnforced, sortBufferSize ) ;
1714 INT32 createIndex (
const bson::BSONObj &indexDef,
1715 const CHAR *pIndexName,
1716 const bson::BSONObj &indexAttr = _sdbStaticObject,
1717 const bson::BSONObj &option = _sdbStaticObject )
1720 return SDB_NOT_CONNECTED ;
1721 return pCollection->createIndex ( indexDef, pIndexName,
1722 indexAttr, option ) ;
1748 INT32 createIndexAsync ( SINT64 &taskID,
1749 const bson::BSONObj &indexDef,
1750 const CHAR *pIndexName,
1751 const bson::BSONObj &indexAttr = _sdbStaticObject,
1752 const bson::BSONObj &option = _sdbStaticObject )
1756 return SDB_NOT_CONNECTED ;
1758 return pCollection->createIndexAsync ( taskID, indexDef, pIndexName,
1759 indexAttr, option ) ;
1780 INT32 snapshotIndexes ( _sdbCursor **cursor,
1781 const bson::BSONObj &condition = _sdbStaticObject,
1782 const bson::BSONObj &selector = _sdbStaticObject,
1783 const bson::BSONObj &orderby = _sdbStaticObject,
1784 const bson::BSONObj &hint = _sdbStaticObject,
1785 INT64 numToSkip = 0,
1786 INT64 numToReturn = -1 )
1790 return SDB_NOT_CONNECTED ;
1792 return pCollection->snapshotIndexes ( cursor, condition,
1793 selector, orderby, hint,
1794 numToSkip, numToReturn ) ;
1805 INT32 getIndexes ( _sdbCursor **cursor,
1806 const CHAR *pIndexName )
1810 return SDB_NOT_CONNECTED ;
1812 return pCollection->getIndexes ( cursor, pIndexName ) ;
1825 const CHAR *pIndexName )
1829 return SDB_NOT_CONNECTED ;
1832 return pCollection->getIndexes ( cursor, pIndexName ) ;
1841 INT32 getIndexes ( std::vector<bson::BSONObj> &infos )
1845 return SDB_NOT_CONNECTED ;
1847 return pCollection->getIndexes ( infos ) ;
1857 INT32 getIndex (
const CHAR *pIndexName, bson::BSONObj &info )
1861 return SDB_NOT_CONNECTED ;
1863 return pCollection->getIndex ( pIndexName, info ) ;
1872 INT32 dropIndex (
const CHAR *pIndexName )
1876 return SDB_NOT_CONNECTED ;
1878 return pCollection->dropIndex ( pIndexName ) ;
1889 INT32 dropIndexAsync ( SINT64 &taskID,
const CHAR *pIndexName )
1892 return SDB_NOT_CONNECTED ;
1893 return pCollection->dropIndexAsync ( taskID, pIndexName ) ;
1904 INT32 copyIndex (
const CHAR *subClFullName,
const CHAR *pIndexName )
1907 return SDB_NOT_CONNECTED ;
1908 return pCollection->copyIndex ( subClFullName, pIndexName ) ;
1921 INT32 copyIndexAsync ( SINT64 &taskID,
const CHAR *subClFullName,
1922 const CHAR *pIndexName )
1925 return SDB_NOT_CONNECTED ;
1926 return pCollection->copyIndexAsync ( taskID, subClFullName,
1940 return SDB_NOT_CONNECTED ;
1942 return pCollection->create () ;
1955 return SDB_NOT_CONNECTED ;
1957 return pCollection->drop () ;
1964 const CHAR *getCollectionName ()
1970 return pCollection->getCollectionName () ;
1977 const CHAR *getCSName ()
1983 return pCollection->getCSName () ;
1990 const CHAR *getFullName ()
1996 return pCollection->getFullName () ;
2008 INT32 aggregate ( _sdbCursor **cursor,
2009 std::vector<bson::BSONObj> &obj
2014 return SDB_NOT_CONNECTED ;
2016 return pCollection->aggregate ( cursor, obj ) ;
2029 std::vector<bson::BSONObj> &obj
2034 return SDB_NOT_CONNECTED ;
2037 return pCollection->aggregate ( cursor, obj ) ;
2059 INT32 getQueryMeta ( _sdbCursor **cursor,
2060 const bson::BSONObj &condition = _sdbStaticObject,
2061 const bson::BSONObj &orderBy = _sdbStaticObject,
2062 const bson::BSONObj &hint = _sdbStaticObject,
2063 INT64 numToSkip = 0,
2064 INT64 numToReturn = -1 )
2068 return SDB_NOT_CONNECTED ;
2070 return pCollection->getQueryMeta ( cursor, condition, orderBy,
2071 hint, numToSkip, numToReturn ) ;
2095 const bson::BSONObj &condition = _sdbStaticObject,
2096 const bson::BSONObj &orderBy = _sdbStaticObject,
2097 const bson::BSONObj &hint = _sdbStaticObject,
2098 INT64 numToSkip = 0,
2099 INT64 numToReturn = -1 )
2103 return SDB_NOT_CONNECTED ;
2106 return pCollection->getQueryMeta ( cursor, condition, orderBy,
2107 hint, numToSkip, numToReturn ) ;
2123 INT32 attachCollection (
const CHAR *subClFullName,
2124 const bson::BSONObj &options )
2128 return SDB_NOT_CONNECTED ;
2130 return pCollection->attachCollection ( subClFullName, options ) ;
2139 INT32 detachCollection (
const CHAR *subClFullName )
2143 return SDB_NOT_CONNECTED ;
2145 return pCollection->detachCollection ( subClFullName ) ;
2184 const bson::BSONObj &condition = _sdbStaticObject,
2185 const bson::BSONObj &select = _sdbStaticObject,
2186 const bson::BSONObj &orderBy = _sdbStaticObject,
2187 const bson::BSONObj &hint = _sdbStaticObject,
2188 INT64 numToSkip = 0,
2189 INT64 numToReturn = -1,
2191 const bson::BSONObj &options = _sdbStaticObject )
2195 return SDB_NOT_CONNECTED ;
2198 return pCollection->explain( cursor, condition, select, orderBy, hint,
2199 numToSkip, numToReturn, flag, options ) ;
2202 INT32 explain ( _sdbCursor **cursor,
2203 const bson::BSONObj &condition = _sdbStaticObject,
2204 const bson::BSONObj &select = _sdbStaticObject,
2205 const bson::BSONObj &orderBy = _sdbStaticObject,
2206 const bson::BSONObj &hint = _sdbStaticObject,
2207 INT64 numToSkip = 0,
2208 INT64 numToReturn = -1,
2210 const bson::BSONObj &options = _sdbStaticObject )
2214 return SDB_NOT_CONNECTED ;
2216 return pCollection->explain( cursor, condition, select, orderBy, hint,
2217 numToSkip, numToReturn, flag, options ) ;
2228 INT32 createLob(
sdbLob &lob,
const bson::OID *oid = NULL )
2232 return SDB_NOT_CONNECTED ;
2234 return pCollection->createLob( lob, oid ) ;
2243 INT32 removeLob(
const bson::OID &oid )
2247 return SDB_NOT_CONNECTED ;
2249 return pCollection->removeLob( oid ) ;
2259 INT32 truncateLob(
const bson::OID &oid, INT64 length )
2263 return SDB_NOT_CONNECTED ;
2265 return pCollection->truncateLob( oid, length ) ;
2277 INT32 openLob(
sdbLob &lob,
const bson::OID &oid,
2282 return SDB_NOT_CONNECTED ;
2284 return pCollection->openLob( lob, oid, mode ) ;
2296 INT32 openLob(
sdbLob &lob,
const bson::OID &oid, INT32 mode )
2300 return SDB_NOT_CONNECTED ;
2302 return pCollection->openLob( lob, oid, mode ) ;
2323 const bson::BSONObj &condition = _sdbStaticObject,
2324 const bson::BSONObj &selected = _sdbStaticObject,
2325 const bson::BSONObj &orderBy = _sdbStaticObject,
2326 const bson::BSONObj &hint = _sdbStaticObject,
2327 INT64 numToSkip = 0,
2328 INT64 numToReturn = -1 )
2332 return SDB_NOT_CONNECTED ;
2335 return pCollection->listLobs( cursor, condition, selected, orderBy,
2336 hint, numToSkip, numToReturn ) ;
2339 INT32 listLobs( _sdbCursor **cursor,
2340 const bson::BSONObj &condition = _sdbStaticObject,
2341 const bson::BSONObj &selected = _sdbStaticObject,
2342 const bson::BSONObj &orderBy = _sdbStaticObject,
2343 const bson::BSONObj &hint = _sdbStaticObject,
2344 INT64 numToSkip = 0,
2345 INT64 numToReturn = -1 )
2349 return SDB_NOT_CONNECTED ;
2351 return pCollection->listLobs( cursor, condition, selected, orderBy,
2352 hint, numToSkip, numToReturn ) ;
2363 INT32 createLobID( bson::OID &oid,
const CHAR *pTimeStamp = NULL )
2367 return SDB_NOT_CONNECTED ;
2369 return pCollection->createLobID( oid, pTimeStamp ) ;
2379 INT32 truncate(
const bson::BSONObj &options = _sdbStaticObject )
2383 return SDB_NOT_CONNECTED ;
2385 return pCollection->truncate( options ) ;
2397 INT32 createIdIndex(
const bson::BSONObj &options = _sdbStaticObject )
2401 return SDB_NOT_CONNECTED ;
2403 return pCollection->createIdIndex( options ) ;
2416 return SDB_NOT_CONNECTED ;
2418 return pCollection->dropIdIndex() ;
2438 INT32 createAutoIncrement (
const bson::BSONObj &options )
2442 return SDB_NOT_CONNECTED ;
2444 return pCollection->createAutoIncrement( options ) ;
2453 INT32 createAutoIncrement (
const std::vector<bson::BSONObj> &options )
2457 return SDB_NOT_CONNECTED ;
2459 return pCollection->createAutoIncrement( options ) ;
2468 INT32 dropAutoIncrement (
const CHAR * fieldName )
2472 return SDB_NOT_CONNECTED ;
2474 return pCollection->dropAutoIncrement( fieldName ) ;
2483 INT32 dropAutoIncrement (
const std::vector<const CHAR*> &fieldNames )
2487 return SDB_NOT_CONNECTED ;
2489 return pCollection->dropAutoIncrement( fieldNames ) ;
2505 INT32 enableSharding (
const bson::BSONObj & options = _sdbStaticObject )
2509 return SDB_NOT_CONNECTED ;
2511 return pCollection->enableSharding( options ) ;
2519 INT32 disableSharding ()
2523 return SDB_NOT_CONNECTED ;
2525 return pCollection->disableSharding() ;
2536 INT32 enableCompression (
const bson::BSONObj & options = _sdbStaticObject )
2540 return SDB_NOT_CONNECTED ;
2542 return pCollection->enableCompression( options ) ;
2550 INT32 disableCompression ()
2554 return SDB_NOT_CONNECTED ;
2556 return pCollection->disableCompression() ;
2579 INT32 setAttributes (
const bson::BSONObj &options )
2583 return SDB_NOT_CONNECTED ;
2585 return pCollection->setAttributes( options ) ;
2597 INT32 pop (
const bson::BSONObj &option = _sdbStaticObject )
2601 return SDB_NOT_CONNECTED ;
2603 return pCollection->pop( option ) ;
2606 INT32 listLobPieces( _sdbCursor **cursor,
2607 const bson::BSONObj &condition = _sdbStaticObject,
2608 const bson::BSONObj &selected = _sdbStaticObject,
2609 const bson::BSONObj &orderBy = _sdbStaticObject,
2610 const bson::BSONObj &hint = _sdbStaticObject,
2611 INT64 numToSkip = 0,
2612 INT64 numToReturn = -1 )
2616 return SDB_NOT_CONNECTED ;
2618 return pCollection->listLobPieces( cursor, condition, selected,
2619 orderBy, hint, numToSkip,
2636 INT32 listLobPieces( sdbCursor &cursor,
2637 const bson::BSONObj &condition = _sdbStaticObject,
2638 const bson::BSONObj &selected = _sdbStaticObject,
2639 const bson::BSONObj &orderBy = _sdbStaticObject,
2640 const bson::BSONObj &hint = _sdbStaticObject,
2641 INT64 numToSkip = 0,
2642 INT64 numToReturn = -1 )
2646 return SDB_NOT_CONNECTED ;
2649 return pCollection->listLobPieces( cursor, condition, selected,
2650 orderBy, hint, numToSkip,
2660 INT32 getDetail ( _sdbCursor **cursor )
2664 return SDB_NOT_CONNECTED ;
2666 return pCollection->getDetail ( cursor ) ;
2679 return SDB_NOT_CONNECTED ;
2681 return pCollection->getDetail( cursor ) ;
2690 INT32 getCollectionStat( bson::BSONObj &result )
2694 return SDB_NOT_CONNECTED ;
2696 return pCollection->getCollectionStat( result ) ;
2708 INT32 getIndexStat(
const CHAR *pIndexName, bson::BSONObj &result,
2709 BOOLEAN detail = FALSE )
2713 return SDB_NOT_CONNECTED ;
2715 return pCollection->getIndexStat( pIndexName, result, detail ) ;
2722 void setVersion( INT32 clVersion )
2724 pCollection->setVersion( clVersion ) ;
2732 return pCollection->getVersion() ;
2752 class DLLEXPORT _sdbNode
2755 _sdbNode (
const _sdbNode& other ) ;
2756 _sdbNode& operator=(
const _sdbNode& ) ;
2759 virtual ~_sdbNode () {}
2761 virtual INT32 connect ( _sdb **dbConn ) = 0 ;
2762 virtual INT32 connect (
sdb &dbConn ) = 0 ;
2768 virtual const CHAR *getHostName () = 0 ;
2771 virtual const CHAR *getServiceName () = 0 ;
2774 virtual const CHAR *getNodeName () = 0 ;
2777 virtual INT32 getNodeID( INT32 &nodeID )
const = 0 ;
2780 virtual INT32 stop () = 0 ;
2783 virtual INT32 start () = 0 ;
2839 INT32 connect ( _sdb **dbConn )
2843 return SDB_NOT_CONNECTED ;
2845 return pNode->connect ( dbConn ) ;
2859 return SDB_NOT_CONNECTED ;
2864 return pNode->connect ( dbConn ) ;
2877 return SDB_NODE_UNKNOWN ;
2879 return pNode->getStatus () ;
2886 const CHAR *getHostName ()
2892 return pNode->getHostName () ;
2899 const CHAR *getServiceName ()
2905 return pNode->getServiceName () ;
2912 const CHAR *getNodeName ()
2918 return pNode->getNodeName () ;
2925 INT32 getNodeID( INT32 &nodeID )
const
2929 return SDB_NOT_CONNECTED ;
2931 return pNode->getNodeID( nodeID ) ;
2943 return SDB_NOT_CONNECTED ;
2945 return pNode->stop () ;
2957 return SDB_NOT_CONNECTED ;
2959 return pNode->start () ;
2971 class DLLEXPORT _sdbReplicaGroup
2974 _sdbReplicaGroup (
const _sdbReplicaGroup& other ) ;
2975 _sdbReplicaGroup& operator=(
const _sdbReplicaGroup& ) ;
2977 _sdbReplicaGroup () {}
2978 virtual ~_sdbReplicaGroup () {}
2980 virtual INT32 getNodeNum (
sdbNodeStatus status, INT32 *num ) = 0 ;
2983 virtual INT32 getDetail ( bson::BSONObj &result ) = 0 ;
2986 virtual INT32 getMaster ( _sdbNode **node ) = 0 ;
2987 virtual INT32 getMaster ( sdbNode &node ) = 0 ;
2990 virtual INT32 getSlave ( _sdbNode **node,
2991 const vector<INT32>& positions = _sdbStaticVec ) = 0 ;
2992 virtual INT32 getSlave ( sdbNode &node,
2993 const vector<INT32>& positions = _sdbStaticVec ) = 0 ;
2996 virtual INT32 getNode (
const CHAR *pNodeName,
2997 _sdbNode **node ) = 0 ;
2998 virtual INT32 getNode (
const CHAR *pNodeName,
2999 sdbNode &node ) = 0 ;
3002 virtual INT32 getNode (
const CHAR *pHostName,
3003 const CHAR *pServiceName,
3004 _sdbNode **node ) = 0 ;
3005 virtual INT32 getNode (
const CHAR *pHostName,
3006 const CHAR *pServiceName,
3007 sdbNode &node ) = 0 ;
3010 virtual INT32 createNode (
const CHAR *pHostName,
3011 const CHAR *pServiceName,
3012 const CHAR *pDatabasePath,
3013 std::map<std::string,std::string> &config )= 0;
3015 virtual INT32 createNode (
const CHAR *pHostName,
3016 const CHAR *pServiceName,
3017 const CHAR *pDatabasePath,
3018 const bson::BSONObj &options = _sdbStaticObject )= 0;
3021 virtual INT32 removeNode (
const CHAR *pHostName,
3022 const CHAR *pServiceName,
3023 const bson::BSONObj &configure = _sdbStaticObject ) = 0 ;
3025 virtual INT32 stop () = 0 ;
3028 virtual INT32 start () = 0 ;
3031 virtual const CHAR *getName () = 0 ;
3034 virtual BOOLEAN isCatalog () = 0 ;
3037 virtual INT32 attachNode(
const CHAR *pHostName,
3038 const CHAR *pSvcName,
3039 const bson::BSONObj &options ) = 0 ;
3042 virtual INT32 detachNode(
const CHAR *pHostName,
3043 const CHAR *pSvcName,
3044 const bson::BSONObj &options ) = 0 ;
3047 virtual INT32 reelect(
const bson::BSONObj &options = _sdbStaticObject ) = 0 ;
3072 pReplicaGroup = NULL ;
3080 if ( pReplicaGroup )
3082 delete pReplicaGroup ;
3102 if ( !pReplicaGroup )
3104 return SDB_NOT_CONNECTED ;
3106 return pReplicaGroup->
getNodeNum ( status, num ) ;
3115 INT32 getDetail ( bson::BSONObj &result )
3117 if ( !pReplicaGroup )
3119 return SDB_NOT_CONNECTED ;
3121 return pReplicaGroup->getDetail ( result ) ;
3130 INT32 getMaster ( _sdbNode **node )
3132 if ( !pReplicaGroup )
3134 return SDB_NOT_CONNECTED ;
3136 return pReplicaGroup->getMaster ( node ) ;
3147 if ( !pReplicaGroup )
3149 return SDB_NOT_CONNECTED ;
3152 return pReplicaGroup->getMaster ( node ) ;
3163 INT32 getSlave ( _sdbNode **node,
3164 const vector<INT32>& positions = _sdbStaticVec )
3166 if ( !pReplicaGroup )
3168 return SDB_NOT_CONNECTED ;
3170 return pReplicaGroup->getSlave ( node, positions ) ;
3182 const vector<INT32>& positions = _sdbStaticVec )
3184 if ( !pReplicaGroup )
3186 return SDB_NOT_CONNECTED ;
3189 return pReplicaGroup->getSlave ( node, positions ) ;
3200 INT32 getNode (
const CHAR *pNodeName,
3203 if ( !pReplicaGroup )
3205 return SDB_NOT_CONNECTED ;
3207 return pReplicaGroup->getNode ( pNodeName, node ) ;
3218 INT32 getNode (
const CHAR *pNodeName,
3221 if ( !pReplicaGroup )
3223 return SDB_NOT_CONNECTED ;
3226 return pReplicaGroup->getNode ( pNodeName, node ) ;
3229 INT32 getNode (
const CHAR *pHostName,
3230 const CHAR *pServiceName,
3233 if ( !pReplicaGroup )
3235 return SDB_NOT_CONNECTED ;
3237 return pReplicaGroup->getNode ( pHostName, pServiceName, node ) ;
3250 INT32 getNode (
const CHAR *pHostName,
3251 const CHAR *pServiceName,
3254 if ( !pReplicaGroup )
3256 return SDB_NOT_CONNECTED ;
3259 return pReplicaGroup->getNode ( pHostName, pServiceName, node ) ;
3275 INT32 createNode (
const CHAR *pHostName,
3276 const CHAR *pServiceName,
3277 const CHAR *pDatabasePath,
3278 std::map<std::string,std::string> &config )
3280 if ( !pReplicaGroup )
3282 return SDB_NOT_CONNECTED ;
3284 return pReplicaGroup->createNode ( pHostName, pServiceName,
3285 pDatabasePath, config ) ;
3300 INT32 createNode (
const CHAR *pHostName,
3301 const CHAR *pServiceName,
3302 const CHAR *pDatabasePath,
3303 const bson::BSONObj &options = _sdbStaticObject )
3305 if ( !pReplicaGroup )
3307 return SDB_NOT_CONNECTED ;
3309 return pReplicaGroup->createNode ( pHostName, pServiceName,
3310 pDatabasePath, options ) ;
3323 INT32 removeNode (
const CHAR *pHostName,
3324 const CHAR *pServiceName,
3325 const bson::BSONObj &configure = _sdbStaticObject )
3327 if ( !pReplicaGroup )
3329 return SDB_NOT_CONNECTED ;
3331 return pReplicaGroup->removeNode ( pHostName, pServiceName,
3341 if ( !pReplicaGroup )
3343 return SDB_NOT_CONNECTED ;
3345 return pReplicaGroup->stop () ;
3355 if ( !pReplicaGroup )
3357 return SDB_NOT_CONNECTED ;
3359 return pReplicaGroup->start () ;
3366 const CHAR *getName ()
3368 if ( !pReplicaGroup )
3372 return pReplicaGroup->getName() ;
3380 BOOLEAN isCatalog ()
3382 if ( !pReplicaGroup )
3386 return pReplicaGroup->isCatalog() ;
3403 INT32 attachNode(
const CHAR *pHostName,
3404 const CHAR *pSvcName,
3405 const bson::BSONObj &options )
3407 if ( !pReplicaGroup )
3409 return SDB_NOT_CONNECTED ;
3411 return pReplicaGroup->attachNode( pHostName, pSvcName, options ) ;
3429 INT32 detachNode(
const CHAR *pHostName,
3430 const CHAR *pSvcName,
3431 const bson::BSONObj &options )
3433 if ( !pReplicaGroup )
3435 return SDB_NOT_CONNECTED ;
3437 return pReplicaGroup->detachNode( pHostName, pSvcName, options ) ;
3448 INT32 reelect(
const bson::BSONObj &options = _sdbStaticObject )
3450 if( !pReplicaGroup )
3452 return SDB_NOT_CONNECTED ;
3454 return pReplicaGroup->reelect( options ) ;
3458 class DLLEXPORT _sdbCollectionSpace
3461 _sdbCollectionSpace (
const _sdbCollectionSpace& other ) ;
3462 _sdbCollectionSpace& operator=(
const _sdbCollectionSpace& ) ;
3464 _sdbCollectionSpace () {}
3465 virtual ~_sdbCollectionSpace () {}
3467 virtual INT32 getCollection (
const CHAR *pCollectionName,
3468 _sdbCollection **collection,
3469 BOOLEAN checkExist = TRUE ) = 0 ;
3471 virtual INT32 getCollection (
const CHAR *pCollectionName,
3472 sdbCollection &collection,
3473 BOOLEAN checkExist = TRUE ) = 0 ;
3476 virtual INT32 createCollection (
const CHAR *pCollection,
3477 const bson::BSONObj &options,
3478 _sdbCollection **collection ) = 0 ;
3480 virtual INT32 createCollection (
const CHAR *pCollection,
3481 const bson::BSONObj &options,
3482 sdbCollection &collection ) = 0 ;
3485 virtual INT32 createCollection (
const CHAR *pCollection,
3486 _sdbCollection **collection ) = 0 ;
3488 virtual INT32 createCollection (
const CHAR *pCollection,
3489 sdbCollection &collection ) = 0 ;
3492 virtual INT32 dropCollection(
const CHAR *pCollection,
3493 const bson::BSONObj &options ) = 0 ;
3495 virtual INT32 listCollections ( _sdbCursor **cursor ) = 0 ;
3497 virtual INT32 listCollections ( sdbCursor &cursor ) = 0 ;
3500 virtual INT32 create () = 0 ;
3502 virtual INT32 drop () = 0 ;
3505 virtual const CHAR *getCSName () = 0 ;
3508 virtual INT32 renameCollection(
const CHAR* oldName,
const CHAR* newName,
3509 const bson::BSONObj &options = _sdbStaticObject ) = 0 ;
3511 virtual INT32 alterCollectionSpace (
const bson::BSONObj & options ) = 0 ;
3513 virtual INT32 setDomain (
const bson::BSONObj & options ) = 0 ;
3515 virtual INT32 getDomainName ( CHAR *result, INT32 resultLen ) = 0 ;
3517 virtual INT32 removeDomain () = 0 ;
3519 virtual INT32 enableCapped () = 0 ;
3521 virtual INT32 disableCapped () = 0 ;
3523 virtual INT32 setAttributes (
const bson::BSONObj & options ) = 0 ;
3557 pCollectionSpace = NULL ;
3565 if ( pCollectionSpace )
3567 delete pCollectionSpace ;
3571 INT32 getCollection (
const CHAR *pCollectionName,
3572 _sdbCollection **collection,
3573 BOOLEAN checkExist = TRUE )
3575 if ( !pCollectionSpace )
3577 return SDB_NOT_CONNECTED ;
3579 return pCollectionSpace->getCollection ( pCollectionName,
3580 collection, checkExist ) ;
3593 INT32 getCollection (
const CHAR *pCollectionName,
3595 BOOLEAN checkExist = TRUE )
3597 if ( !pCollectionSpace )
3599 return SDB_NOT_CONNECTED ;
3602 return pCollectionSpace->getCollection ( pCollectionName,
3607 INT32 createCollection (
const CHAR *pCollection,
3608 const bson::BSONObj &options,
3609 _sdbCollection **collection )
3611 if ( !pCollectionSpace )
3613 return SDB_NOT_CONNECTED ;
3615 return pCollectionSpace->createCollection ( pCollection,
3657 INT32 createCollection (
const CHAR *pCollection,
3658 const bson::BSONObj &options,
3661 if ( !pCollectionSpace )
3663 return SDB_NOT_CONNECTED ;
3666 return pCollectionSpace->createCollection ( pCollection,
3671 INT32 createCollection (
const CHAR *pCollection,
3672 _sdbCollection **collection )
3674 if ( !pCollectionSpace )
3676 return SDB_NOT_CONNECTED ;
3678 return pCollectionSpace->createCollection ( pCollection,
3691 INT32 createCollection (
const CHAR *pCollection,
3694 if ( !pCollectionSpace )
3696 return SDB_NOT_CONNECTED ;
3699 return pCollectionSpace->createCollection ( pCollection,
3712 INT32 dropCollection(
const CHAR *pCollection,
3713 const bson::BSONObj &options = _sdbStaticObject )
3715 if ( !pCollectionSpace )
3717 return SDB_NOT_CONNECTED ;
3719 return pCollectionSpace->dropCollection( pCollection, options ) ;
3728 INT32 listCollections ( _sdbCursor **cursor )
3730 if ( !pCollectionSpace )
3732 return SDB_NOT_CONNECTED ;
3734 return pCollectionSpace->listCollections( cursor ) ;
3745 if ( !pCollectionSpace )
3747 return SDB_NOT_CONNECTED ;
3750 return pCollectionSpace->listCollections( cursor ) ;
3761 if ( !pCollectionSpace )
3763 return SDB_NOT_CONNECTED ;
3765 return pCollectionSpace->create () ;
3776 if ( !pCollectionSpace )
3778 return SDB_NOT_CONNECTED ;
3780 return pCollectionSpace->drop () ;
3787 const CHAR *getCSName ()
3789 if ( !pCollectionSpace )
3793 return pCollectionSpace->getCSName () ;
3806 INT32 renameCollection(
const CHAR* oldName,
const CHAR* newName,
3807 const bson::BSONObj &options = _sdbStaticObject )
3809 if( !pCollectionSpace )
3811 return SDB_NOT_CONNECTED ;
3813 return pCollectionSpace->renameCollection( oldName, newName, options ) ;
3827 INT32 alterCollectionSpace (
const bson::BSONObj & options )
3829 if ( NULL == pCollectionSpace )
3831 return SDB_NOT_CONNECTED ;
3833 return pCollectionSpace->alterCollectionSpace( options ) ;
3845 INT32 setDomain (
const bson::BSONObj & options )
3847 if ( NULL == pCollectionSpace )
3849 return SDB_NOT_CONNECTED ;
3851 return pCollectionSpace->setDomain( options ) ;
3861 INT32 getDomainName ( CHAR *result, INT32 resultLen )
3863 if ( !pCollectionSpace )
3865 return SDB_NOT_CONNECTED ;
3867 return pCollectionSpace->getDomainName( result, resultLen ) ;
3875 INT32 removeDomain ()
3877 if ( NULL == pCollectionSpace )
3879 return SDB_NOT_CONNECTED ;
3881 return pCollectionSpace->removeDomain() ;
3889 INT32 enableCapped ()
3891 if ( NULL == pCollectionSpace )
3893 return SDB_NOT_CONNECTED ;
3895 return pCollectionSpace->enableCapped() ;
3903 INT32 disableCapped ()
3905 if ( NULL == pCollectionSpace )
3907 return SDB_NOT_CONNECTED ;
3909 return pCollectionSpace->disableCapped() ;
3923 INT32 setAttributes (
const bson::BSONObj & options )
3925 if ( NULL == pCollectionSpace )
3927 return SDB_NOT_CONNECTED ;
3929 return pCollectionSpace->setAttributes( options ) ;
3933 class DLLEXPORT _sdbDomain
3936 _sdbDomain (
const _sdbDomain& other ) ;
3937 _sdbDomain& operator= (
const _sdbDomain& ) ;
3940 virtual ~_sdbDomain () {}
3942 virtual const CHAR* getName () = 0 ;
3944 virtual INT32 alterDomain (
const bson::BSONObj &options = _sdbStaticObject ) = 0 ;
3946 virtual INT32 listCollectionSpacesInDomain ( _sdbCursor **cursor ) = 0 ;
3948 virtual INT32 listCollectionSpacesInDomain ( sdbCursor &cursor ) = 0 ;
3950 virtual INT32 listCollectionsInDomain ( _sdbCursor **cursor ) = 0 ;
3952 virtual INT32 listCollectionsInDomain ( sdbCursor &cursor ) = 0 ;
3954 virtual INT32 listReplicaGroupInDomain( _sdbCursor **cursor ) = 0 ;
3956 virtual INT32 listReplicaGroupInDomain( sdbCursor &cursor ) = 0 ;
3958 virtual INT32 addGroups (
const bson::BSONObj & options ) = 0 ;
3960 virtual INT32 setGroups (
const bson::BSONObj & options ) = 0 ;
3962 virtual INT32 removeGroups (
const bson::BSONObj & options ) = 0 ;
3964 virtual INT32 setAttributes (
const bson::BSONObj & options ) = 0 ;
4005 const CHAR *getName ()
4031 INT32 alterDomain (
const bson::BSONObj &options )
4035 return SDB_NOT_CONNECTED ;
4037 return pDomain->alterDomain ( options ) ;
4050 INT32 addGroups (
const bson::BSONObj & options )
4052 if ( NULL == pDomain )
4054 return SDB_NOT_CONNECTED ;
4056 return pDomain->addGroups( options ) ;
4071 INT32 setGroups (
const bson::BSONObj & options )
4073 if ( NULL == pDomain )
4075 return SDB_NOT_CONNECTED ;
4077 return pDomain->setGroups( options ) ;
4091 INT32 removeGroups (
const bson::BSONObj & options )
4093 if ( NULL == pDomain )
4095 return SDB_NOT_CONNECTED ;
4097 return pDomain->removeGroups( options ) ;
4117 INT32 setAttributes (
const bson::BSONObj &options )
4121 return SDB_NOT_CONNECTED ;
4123 return pDomain->setAttributes( options ) ;
4137 return SDB_NOT_CONNECTED ;
4140 return pDomain->listCollectionSpacesInDomain ( cursor ) ;
4143 INT32 listCollectionSpacesInDomain ( _sdbCursor **cursor )
4147 return SDB_NOT_CONNECTED ;
4149 return pDomain->listCollectionSpacesInDomain ( cursor ) ;
4163 return SDB_NOT_CONNECTED ;
4166 return pDomain->listCollectionsInDomain ( cursor ) ;
4176 INT32 listCollectionsInDomain ( _sdbCursor **cursor )
4180 return SDB_NOT_CONNECTED ;
4182 return pDomain->listCollectionsInDomain ( cursor ) ;
4185 INT32 listReplicaGroupInDomain( _sdbCursor **cursor )
4189 return SDB_NOT_CONNECTED ;
4191 return pDomain->listReplicaGroupInDomain( cursor ) ;
4204 return SDB_NOT_CONNECTED ;
4207 return pDomain->listReplicaGroupInDomain( cursor ) ;
4211 class DLLEXPORT _sdbDataCenter
4214 _sdbDataCenter (
const _sdbDataCenter& other ) ;
4215 _sdbDataCenter& operator= (
const _sdbDataCenter& ) ;
4218 _sdbDataCenter () {}
4219 virtual ~_sdbDataCenter () {}
4222 virtual const CHAR *getName () = 0 ;
4223 virtual INT32 getDetail( bson::BSONObj &retInfo ) = 0 ;
4224 virtual INT32 activateDC() = 0 ;
4225 virtual INT32 deactivateDC() = 0 ;
4226 virtual INT32 enableReadOnly( BOOLEAN isReadOnly ) = 0 ;
4227 virtual INT32 createImage(
const CHAR *pCataAddrList ) = 0 ;
4228 virtual INT32 removeImage() = 0 ;
4229 virtual INT32 enableImage() = 0 ;
4230 virtual INT32 disableImage() = 0 ;
4231 virtual INT32 attachGroups(
const bson::BSONObj &info ) = 0 ;
4232 virtual INT32 detachGroups(
const bson::BSONObj &info ) = 0 ;
4239 class DLLEXPORT sdbDataCenter
4242 sdbDataCenter (
const sdbDataCenter& ) ;
4243 sdbDataCenter& operator= (
const sdbDataCenter& ) ;
4253 _sdbDataCenter *pDC ;
4258 sdbDataCenter() { pDC = NULL ; }
4277 const CHAR *getName ()
4283 return pDC->getName() ;
4292 INT32 getDetail( bson::BSONObj &retInfo )
4296 return SDB_NOT_CONNECTED ;
4298 return pDC->getDetail( retInfo ) ;
4310 return SDB_NOT_CONNECTED ;
4312 return pDC->activateDC() ;
4320 INT32 deactivateDC()
4324 return SDB_NOT_CONNECTED ;
4326 return pDC->deactivateDC() ;
4335 INT32 enableReadOnly( BOOLEAN isReadOnly )
4339 return SDB_NOT_CONNECTED ;
4341 return pDC->enableReadOnly( isReadOnly ) ;
4351 INT32 createImage(
const CHAR *pCataAddrList )
4355 return SDB_NOT_CONNECTED ;
4357 return pDC->createImage( pCataAddrList ) ;
4369 return SDB_NOT_CONNECTED ;
4371 return pDC->removeImage() ;
4383 return SDB_NOT_CONNECTED ;
4385 return pDC->enableImage() ;
4393 INT32 disableImage()
4397 return SDB_NOT_CONNECTED ;
4399 return pDC->disableImage() ;
4408 INT32 attachGroups(
const bson::BSONObj &info )
4412 return SDB_NOT_CONNECTED ;
4414 return pDC->attachGroups( info ) ;
4423 INT32 detachGroups(
const bson::BSONObj &info )
4427 return SDB_NOT_CONNECTED ;
4429 return pDC->detachGroups( info ) ;
4434 class DLLEXPORT _sdbRecycleBin
4437 _sdbRecycleBin (
const _sdbRecycleBin& other ) ;
4438 _sdbRecycleBin& operator= (
const _sdbRecycleBin& ) ;
4441 _sdbRecycleBin () {}
4442 virtual ~_sdbRecycleBin () {}
4445 virtual INT32 getDetail( bson::BSONObj &retInfo ) = 0 ;
4446 virtual INT32 enable() = 0 ;
4447 virtual INT32 disable() = 0 ;
4448 virtual INT32 setAttributes(
const bson::BSONObj &options ) = 0 ;
4449 virtual INT32 alter(
const bson::BSONObj &options ) = 0 ;
4450 virtual INT32 returnItem(
const CHAR *recycleName,
4451 const bson::BSONObj &options = _sdbStaticObject,
4452 bson::BSONObj *result = NULL ) = 0 ;
4453 virtual INT32 returnItemToName(
const CHAR *recycleName,
4454 const CHAR *returnName,
4455 const bson::BSONObj &options = _sdbStaticObject,
4456 bson::BSONObj *result = NULL ) = 0 ;
4457 virtual INT32 dropItem(
const CHAR *recycleName,
4458 const bson::BSONObj &options = _sdbStaticObject ) = 0 ;
4459 virtual INT32 dropAll(
const bson::BSONObj &options = _sdbStaticObject ) = 0 ;
4460 virtual INT32 list( _sdbCursor **cursor,
4461 const bson::BSONObj &condition = _sdbStaticObject,
4462 const bson::BSONObj &selector = _sdbStaticObject,
4463 const bson::BSONObj &orderBy = _sdbStaticObject,
4464 const bson::BSONObj &hint = _sdbStaticObject,
4465 INT64 numToSkip = 0,
4466 INT64 numToReturn = -1 ) = 0 ;
4467 virtual INT32 list( sdbCursor &cursor,
4468 const bson::BSONObj &condition = _sdbStaticObject,
4469 const bson::BSONObj &selector = _sdbStaticObject,
4470 const bson::BSONObj &orderBy = _sdbStaticObject,
4471 const bson::BSONObj &hint = _sdbStaticObject,
4472 INT64 numToSkip = 0,
4473 INT64 numToReturn = -1 ) = 0 ;
4474 virtual INT32 snapshot( _sdbCursor **cursor,
4475 const bson::BSONObj &condition = _sdbStaticObject,
4476 const bson::BSONObj &selector = _sdbStaticObject,
4477 const bson::BSONObj &orderBy = _sdbStaticObject,
4478 const bson::BSONObj &hint = _sdbStaticObject,
4479 INT64 numToSkip = 0,
4480 INT64 numToReturn = -1 ) = 0 ;
4481 virtual INT32 snapshot( sdbCursor &cursor,
4482 const bson::BSONObj &condition = _sdbStaticObject,
4483 const bson::BSONObj &selector = _sdbStaticObject,
4484 const bson::BSONObj &orderBy = _sdbStaticObject,
4485 const bson::BSONObj &hint = _sdbStaticObject,
4486 INT64 numToSkip = 0,
4487 INT64 numToReturn = -1 ) = 0 ;
4488 virtual INT32 getCount( INT64 &count,
4489 const bson::BSONObj &condition = _sdbStaticObject ) = 0 ;
4495 class DLLEXPORT sdbRecycleBin
4498 sdbRecycleBin(
const sdbRecycleBin & ) ;
4499 sdbRecycleBin &operator =(
const sdbRecycleBin & ) ;
4509 _sdbRecycleBin *pRecycleBin ;
4514 sdbRecycleBin() { pRecycleBin = NULL ; }
4523 delete pRecycleBin ;
4535 INT32 getDetail( bson::BSONObj &retInfo )
4537 if ( NULL == pRecycleBin )
4539 return SDB_NOT_CONNECTED ;
4541 return pRecycleBin->getDetail( retInfo ) ;
4551 if ( NULL == pRecycleBin )
4553 return SDB_NOT_CONNECTED ;
4555 return pRecycleBin->enable() ;
4565 if ( NULL == pRecycleBin )
4567 return SDB_NOT_CONNECTED ;
4569 return pRecycleBin->disable() ;
4585 INT32 setAttributes(
const bson::BSONObj &options )
4587 if ( NULL == pRecycleBin )
4589 return SDB_NOT_CONNECTED ;
4591 return pRecycleBin->setAttributes( options ) ;
4607 INT32 alter(
const bson::BSONObj &options )
4609 if ( NULL == pRecycleBin )
4611 return SDB_NOT_CONNECTED ;
4613 return pRecycleBin->alter( options ) ;
4626 INT32 returnItem(
const CHAR *recycleName,
4627 const bson::BSONObj &options = _sdbStaticObject,
4628 bson::BSONObj *result = NULL )
4630 if ( NULL == pRecycleBin )
4632 return SDB_NOT_CONNECTED ;
4634 return pRecycleBin->returnItem( recycleName, options, result ) ;
4649 INT32 returnItemToName(
const CHAR *recycleName,
4650 const CHAR *returnName,
4651 const bson::BSONObj &options = _sdbStaticObject,
4652 bson::BSONObj *result = NULL )
4654 if ( NULL == pRecycleBin )
4656 return SDB_NOT_CONNECTED ;
4658 return pRecycleBin->returnItemToName( recycleName,
4671 INT32 dropItem(
const CHAR *recycleName,
4672 const bson::BSONObj &options = _sdbStaticObject )
4674 if ( NULL == pRecycleBin )
4676 return SDB_NOT_CONNECTED ;
4678 return pRecycleBin->dropItem( recycleName, options ) ;
4687 INT32 dropAll(
const bson::BSONObj &options = _sdbStaticObject )
4689 if ( NULL == pRecycleBin )
4691 return SDB_NOT_CONNECTED ;
4693 return pRecycleBin->dropAll( options ) ;
4715 INT32 list( _sdbCursor **cursor,
4716 const bson::BSONObj &condition = _sdbStaticObject,
4717 const bson::BSONObj &selector = _sdbStaticObject,
4718 const bson::BSONObj &orderBy = _sdbStaticObject,
4719 const bson::BSONObj &hint = _sdbStaticObject,
4720 INT64 numToSkip = 0,
4721 INT64 numToReturn = -1 )
4723 if ( NULL == pRecycleBin )
4725 return SDB_NOT_CONNECTED ;
4727 return pRecycleBin->list( cursor,
4755 INT32 list( sdbCursor &cursor,
4756 const bson::BSONObj &condition = _sdbStaticObject,
4757 const bson::BSONObj &selector = _sdbStaticObject,
4758 const bson::BSONObj &orderBy = _sdbStaticObject,
4759 const bson::BSONObj &hint = _sdbStaticObject,
4760 INT64 numToSkip = 0,
4761 INT64 numToReturn = -1 )
4763 if ( NULL == pRecycleBin )
4765 return SDB_NOT_CONNECTED ;
4767 return pRecycleBin->list( cursor,
4795 INT32 snapshot( _sdbCursor **cursor,
4796 const bson::BSONObj &condition = _sdbStaticObject,
4797 const bson::BSONObj &selector = _sdbStaticObject,
4798 const bson::BSONObj &orderBy = _sdbStaticObject,
4799 const bson::BSONObj &hint = _sdbStaticObject,
4800 INT64 numToSkip = 0,
4801 INT64 numToReturn = -1 )
4803 if ( NULL == pRecycleBin )
4805 return SDB_NOT_CONNECTED ;
4807 return pRecycleBin->snapshot( cursor,
4835 INT32 snapshot( sdbCursor &cursor,
4836 const bson::BSONObj &condition = _sdbStaticObject,
4837 const bson::BSONObj &selector = _sdbStaticObject,
4838 const bson::BSONObj &orderBy = _sdbStaticObject,
4839 const bson::BSONObj &hint = _sdbStaticObject,
4840 INT64 numToSkip = 0,
4841 INT64 numToReturn = -1 )
4843 if ( NULL == pRecycleBin )
4845 return SDB_NOT_CONNECTED ;
4847 return pRecycleBin->snapshot( cursor,
4864 INT32 getCount( INT64 &count,
4865 const bson::BSONObj &condition = _sdbStaticObject )
4867 if ( NULL == pRecycleBin )
4869 return SDB_NOT_CONNECTED ;
4871 return pRecycleBin->getCount( count, condition ) ;
4875 class DLLEXPORT _sdbLob
4878 _sdbLob (
const _sdbLob& other ) ;
4879 _sdbLob& operator= (
const _sdbLob& ) ;
4884 virtual ~_sdbLob () {}
4886 virtual INT32 close () = 0 ;
4888 virtual INT32 read ( UINT32 len, CHAR *buf, UINT32 *read ) = 0 ;
4890 virtual INT32 write (
const CHAR *buf, UINT32 len ) = 0 ;
4892 virtual INT32 seek ( SINT64 size,
SDB_LOB_SEEK whence ) = 0 ;
4894 virtual INT32 lock( INT64 offset, INT64 length ) = 0 ;
4896 virtual INT32 lockAndSeek( INT64 offset, INT64 length ) = 0 ;
4898 virtual INT32 isClosed( BOOLEAN &flag ) = 0 ;
4900 virtual INT32 getOid( bson::OID &oid ) = 0 ;
4902 virtual INT32 getSize( SINT64 *size ) = 0 ;
4904 virtual INT32 getCreateTime ( UINT64 *millis ) = 0 ;
4906 virtual BOOLEAN isClosed() = 0 ;
4908 virtual bson::OID getOid() = 0 ;
4910 virtual SINT64 getSize() = 0 ;
4912 virtual UINT64 getCreateTime () = 0 ;
4914 virtual UINT64 getModificationTime() = 0 ;
4916 virtual INT32 getPiecesInfoNum() = 0 ;
4918 virtual bson::BSONArray getPiecesInfo() = 0 ;
4920 virtual BOOLEAN isEof() = 0 ;
4922 virtual INT32 getRunTimeDetail( bson::BSONObj &detail ) = 0 ;
4971 return pLob->
close() ;
4982 INT32 read ( UINT32 len, CHAR *buf, UINT32 *read )
4986 return SDB_NOT_CONNECTED ;
4988 return pLob->read( len, buf, read ) ;
4998 INT32 write (
const CHAR *buf, UINT32 len )
5002 return SDB_NOT_CONNECTED ;
5004 return pLob->write( buf, len ) ;
5018 return SDB_NOT_CONNECTED ;
5020 return pLob->seek( size, whence ) ;
5030 INT32 lock ( INT64 offset, INT64 length )
5034 return SDB_NOT_CONNECTED ;
5036 return pLob->lock( offset, length ) ;
5046 INT32 lockAndSeek ( INT64 offset, INT64 length )
5050 return SDB_NOT_CONNECTED ;
5052 return pLob->lockAndSeek( offset, length ) ;
5062 INT32 isClosed( BOOLEAN &flag )
5066 return SDB_NOT_CONNECTED ;
5068 return pLob->isClosed ( flag ) ;
5081 return pLob->isClosed () ;
5091 INT32 getOid ( bson::OID &oid )
5095 return SDB_NOT_CONNECTED ;
5097 return pLob->getOid( oid ) ;
5110 return pLob->getOid() ;
5120 INT32 getSize ( SINT64 *size )
5124 return SDB_NOT_CONNECTED ;
5126 return pLob->getSize( size ) ;
5139 return pLob->getSize();
5149 INT32 getCreateTime ( UINT64 *millis )
5153 return SDB_NOT_CONNECTED ;
5155 return pLob->getCreateTime( millis ) ;
5162 UINT64 getCreateTime ()
5168 return pLob->getCreateTime() ;
5175 UINT64 getModificationTime ()
5181 return pLob->getModificationTime() ;
5188 INT32 getPiecesInfoNum()
5194 return pLob->getPiecesInfoNum() ;
5201 bson::BSONArray getPiecesInfo()
5205 return bson::BSONArray() ;
5207 return pLob->getPiecesInfo() ;
5220 return pLob->isEof() ;
5228 INT32 getRunTimeDetail( bson::BSONObj &detail )
5234 return pLob->getRunTimeDetail( detail ) ;
5239 class DLLEXPORT _sdbSequence
5242 _sdbSequence (
const _sdbSequence& other ) ;
5243 _sdbSequence& operator=(
const _sdbSequence& ) ;
5246 virtual ~_sdbSequence () {}
5248 virtual INT32 setAttributes (
const bson::BSONObj &options ) = 0 ;
5250 virtual INT32 getNextValue ( INT64 &value ) = 0 ;
5252 virtual INT32 getCurrentValue ( INT64 &value ) = 0 ;
5254 virtual INT32 setCurrentValue (
const INT64 value ) = 0 ;
5256 virtual INT32 fetch(
const INT32 fetchNum,
5259 INT32 &Increment ) = 0 ;
5261 virtual INT32 restart(
const INT64 startValue ) = 0 ;
5326 INT32 setAttributes (
const bson::BSONObj & options )
5328 if ( NULL == pSequence )
5330 return SDB_NOT_CONNECTED ;
5341 INT32 getNextValue( INT64 &value )
5343 if ( NULL == pSequence )
5345 return SDB_NOT_CONNECTED ;
5347 return pSequence->getNextValue( value ) ;
5356 INT32 getCurrentValue( INT64 &value )
5358 if ( NULL == pSequence )
5360 return SDB_NOT_CONNECTED ;
5362 return pSequence->getCurrentValue( value ) ;
5371 INT32 setCurrentValue(
const INT64 value )
5373 if ( NULL == pSequence )
5375 return SDB_NOT_CONNECTED ;
5377 return pSequence->setCurrentValue( value ) ;
5390 INT32 fetch(
const INT32 fetchNum, INT64 &nextValue,
5391 INT32 &returnNum, INT32 &increment )
5393 if ( NULL == pSequence )
5395 return SDB_NOT_CONNECTED ;
5397 return pSequence->fetch( fetchNum, nextValue, returnNum, increment ) ;
5406 INT32 restart(
const INT64 startValue )
5408 if ( NULL == pSequence )
5410 return SDB_NOT_CONNECTED ;
5412 return pSequence->restart( startValue ) ;
5416 class DLLEXPORT _sdbDataSource
5419 _sdbDataSource(
const _sdbDataSource& other ) ;
5420 _sdbDataSource& operator=(
const _sdbDataSource& ) ;
5423 virtual ~_sdbDataSource() {}
5425 virtual INT32 alterDataSource(
const bson::BSONObj &options = _sdbStaticObject ) = 0 ;
5426 virtual const CHAR *getName() = 0 ;
5438 _sdbDataSource *pDataSource ;
5442 pDataSource = NULL ;
5449 delete pDataSource ;
5493 INT32 alterDataSource(
const bson::BSONObj &options )
5497 return SDB_NOT_CONNECTED ;
5506 const CHAR *getName()
5512 return pDataSource->getName() ;
5516 class DLLEXPORT _sdb
5519 _sdb (
const _sdb& other ) ;
5520 _sdb& operator=(
const _sdb& ) ;
5524 virtual INT32 connect (
const CHAR *pHostName,
5527 virtual INT32 connect (
const CHAR *pHostName,
5529 const CHAR *pUsrName,
5530 const CHAR *pPasswd ) = 0 ;
5531 virtual INT32 connect (
const CHAR *pHostName,
5532 const CHAR *pServiceName ) = 0 ;
5533 virtual INT32 connect (
const CHAR *pHostName,
5534 const CHAR *pServiceName,
5535 const CHAR *pUsrName,
5536 const CHAR *pPasswd ) = 0 ;
5537 virtual INT32 connect (
const CHAR **pConnAddrs,
5539 const CHAR *pUsrName,
5540 const CHAR *pPasswd ) = 0 ;
5541 virtual INT32 connect (
const CHAR **pConnAddrs,
5543 const CHAR *pUsrName,
5545 const CHAR *pCipherFile ) = 0 ;
5547 virtual void disconnect () = 0 ;
5549 virtual UINT64 getDbStartTime() = 0 ;
5551 virtual const CHAR *getAddress() = 0 ;
5553 virtual void getVersion( UINT8 &version, UINT8 &subVersion,
5554 UINT8 &fixVersion ) = 0 ;
5556 virtual INT32 createUsr(
const CHAR *pUsrName,
5557 const CHAR *pPasswd,
5558 const bson::BSONObj &options = _sdbStaticObject
5561 virtual INT32 removeUsr(
const CHAR *pUsrName,
5562 const CHAR *pPasswd ) = 0 ;
5564 virtual INT32 alterUsr(
const CHAR *pUsrName,
5565 const CHAR *pAction,
5566 const bson::BSONObj &options ) = 0 ;
5568 virtual INT32 changeUsrPasswd(
const CHAR *pUsrName,
5569 const CHAR *pOldPasswd,
5570 const CHAR *pNewPasswd ) = 0 ;
5572 virtual INT32 getSnapshot ( _sdbCursor **cursor,
5574 const bson::BSONObj &condition = _sdbStaticObject,
5575 const bson::BSONObj &selector = _sdbStaticObject,
5576 const bson::BSONObj &orderBy = _sdbStaticObject,
5577 const bson::BSONObj &hint = _sdbStaticObject,
5578 INT64 numToSkip = 0,
5579 INT64 numToReturn = -1
5582 virtual INT32 getSnapshot ( sdbCursor &cursor,
5584 const bson::BSONObj &condition = _sdbStaticObject,
5585 const bson::BSONObj &selector = _sdbStaticObject,
5586 const bson::BSONObj &orderBy = _sdbStaticObject,
5587 const bson::BSONObj &hint = _sdbStaticObject,
5588 INT64 numToSkip = 0,
5589 INT64 numToReturn = -1
5592 virtual INT32 resetSnapshot (
const bson::BSONObj &options = _sdbStaticObject ) = 0 ;
5594 virtual INT32 getList ( _sdbCursor **cursor,
5596 const bson::BSONObj &condition = _sdbStaticObject,
5597 const bson::BSONObj &selector = _sdbStaticObject,
5598 const bson::BSONObj &orderBy = _sdbStaticObject,
5599 const bson::BSONObj &hint = _sdbStaticObject,
5600 INT64 numToSkip = 0,
5601 INT64 numToReturn = -1
5603 virtual INT32 getList ( sdbCursor &cursor,
5605 const bson::BSONObj &condition = _sdbStaticObject,
5606 const bson::BSONObj &selector = _sdbStaticObject,
5607 const bson::BSONObj &orderBy = _sdbStaticObject,
5608 const bson::BSONObj &hint = _sdbStaticObject,
5609 INT64 numToSkip = 0,
5610 INT64 numToReturn = -1
5613 virtual INT32 getCollection (
const CHAR *pCollectionFullName,
5614 _sdbCollection **collection,
5615 BOOLEAN checkExist = TRUE
5618 virtual INT32 getCollection (
const CHAR *pCollectionFullName,
5619 sdbCollection &collection,
5620 BOOLEAN checkExist = TRUE
5623 virtual INT32 getCollectionSpace (
const CHAR *pCollectionSpaceName,
5624 _sdbCollectionSpace **cs,
5625 BOOLEAN checkExist = TRUE
5628 virtual INT32 getCollectionSpace (
const CHAR *pCollectionSpaceName,
5629 sdbCollectionSpace &cs,
5630 BOOLEAN checkExist = TRUE
5633 virtual INT32 createCollectionSpace (
const CHAR *pCollectionSpaceName,
5635 _sdbCollectionSpace **cs
5638 virtual INT32 createCollectionSpace (
const CHAR *pCollectionSpaceName,
5640 sdbCollectionSpace &cs
5643 virtual INT32 createCollectionSpace (
const CHAR *pCollectionSpaceName,
5644 const bson::BSONObj &options,
5645 _sdbCollectionSpace **cs
5648 virtual INT32 createCollectionSpace (
const CHAR *pCollectionSpaceName,
5649 const bson::BSONObj &options,
5650 sdbCollectionSpace &cs
5653 virtual INT32 dropCollectionSpace (
5654 const CHAR *pCollectionSpaceName,
5655 const bson::BSONObj &options = _sdbStaticObject
5658 virtual INT32 listCollectionSpaces ( _sdbCursor **result ) = 0 ;
5660 virtual INT32 listCollectionSpaces ( sdbCursor &result ) = 0 ;
5663 virtual INT32 listCollections ( _sdbCursor **result ) = 0 ;
5665 virtual INT32 listCollections ( sdbCursor &result ) = 0 ;
5668 virtual INT32 listReplicaGroups ( _sdbCursor **result ) = 0 ;
5670 virtual INT32 listReplicaGroups ( sdbCursor &result ) = 0 ;
5672 virtual INT32 getReplicaGroup (
const CHAR *pName,
5673 _sdbReplicaGroup **result ) = 0 ;
5675 virtual INT32 getReplicaGroup (
const CHAR *pName,
5676 sdbReplicaGroup &result ) = 0 ;
5678 virtual INT32 getReplicaGroup ( INT32
id,
5679 _sdbReplicaGroup **result ) = 0 ;
5681 virtual INT32 getReplicaGroup ( INT32
id,
5682 sdbReplicaGroup &result ) = 0 ;
5684 virtual INT32 createReplicaGroup (
const CHAR *pName,
5685 _sdbReplicaGroup **replicaGroup ) = 0 ;
5687 virtual INT32 createReplicaGroup (
const CHAR *pName,
5688 sdbReplicaGroup &replicaGroup ) = 0 ;
5690 virtual INT32 removeReplicaGroup (
const CHAR *pName ) = 0 ;
5692 virtual INT32 createReplicaCataGroup (
const CHAR *pHostName,
5693 const CHAR *pServiceName,
5694 const CHAR *pDatabasePath,
5695 const bson::BSONObj &configure ) =0 ;
5697 virtual INT32 activateReplicaGroup (
const CHAR *pName,
5698 _sdbReplicaGroup **replicaGroup ) = 0 ;
5699 virtual INT32 activateReplicaGroup (
const CHAR *pName,
5700 sdbReplicaGroup &replicaGroup ) = 0 ;
5702 virtual INT32 execUpdate(
const CHAR *sql,
5703 bson::BSONObj *pResult = NULL ) = 0 ;
5705 virtual INT32 exec(
const CHAR *sql,
5706 _sdbCursor **result ) = 0 ;
5708 virtual INT32 exec(
const CHAR *sql,
5709 sdbCursor &result ) = 0 ;
5711 virtual INT32 transactionBegin() = 0 ;
5713 virtual INT32 transactionCommit(
const bson::BSONObj &hint = _sdbStaticObject ) = 0 ;
5715 virtual INT32 transactionRollback() = 0 ;
5717 virtual INT32 flushConfigure(
const bson::BSONObj &options ) = 0 ;
5719 virtual INT32 crtJSProcedure (
const CHAR *code ) = 0 ;
5720 virtual INT32 rmProcedure(
const CHAR *spName ) = 0 ;
5721 virtual INT32 listProcedures( _sdbCursor **cursor,
const bson::BSONObj &condition ) = 0 ;
5722 virtual INT32 listProcedures( sdbCursor &cursor,
const bson::BSONObj &condition ) = 0 ;
5723 virtual INT32 evalJS(
const CHAR *code,
5725 _sdbCursor **cursor,
5726 bson::BSONObj &errmsg ) = 0 ;
5727 virtual INT32 evalJS(
const CHAR *code,
5730 bson::BSONObj &errmsg ) = 0 ;
5733 virtual INT32 backup (
const bson::BSONObj &options) = 0 ;
5734 virtual INT32 listBackup ( _sdbCursor **cursor,
5735 const bson::BSONObj &options,
5736 const bson::BSONObj &condition = _sdbStaticObject,
5737 const bson::BSONObj &selector = _sdbStaticObject,
5738 const bson::BSONObj &orderBy = _sdbStaticObject) = 0 ;
5739 virtual INT32 listBackup ( sdbCursor &cursor,
5740 const bson::BSONObj &options,
5741 const bson::BSONObj &condition = _sdbStaticObject,
5742 const bson::BSONObj &selector = _sdbStaticObject,
5743 const bson::BSONObj &orderBy = _sdbStaticObject) = 0 ;
5744 virtual INT32 removeBackup (
const bson::BSONObj &options ) = 0 ;
5747 virtual INT32 listTasks ( _sdbCursor **cursor,
5748 const bson::BSONObj &condition = _sdbStaticObject,
5749 const bson::BSONObj &selector = _sdbStaticObject,
5750 const bson::BSONObj &orderBy = _sdbStaticObject,
5751 const bson::BSONObj &hint = _sdbStaticObject) = 0 ;
5754 virtual INT32 listTasks ( sdbCursor &cursor,
5755 const bson::BSONObj &condition = _sdbStaticObject,
5756 const bson::BSONObj &selector = _sdbStaticObject,
5757 const bson::BSONObj &orderBy = _sdbStaticObject,
5758 const bson::BSONObj &hint = _sdbStaticObject) = 0 ;
5760 virtual INT32 waitTasks (
const SINT64 *taskIDs,
5763 virtual INT32 cancelTask ( SINT64 taskID,
5764 BOOLEAN isAsync ) = 0 ;
5766 virtual INT32 setSessionAttr (
const bson::BSONObj &options =
5767 _sdbStaticObject ) = 0 ;
5769 virtual INT32 getSessionAttr ( bson::BSONObj &result,
5770 BOOLEAN useCache = TRUE ) = 0 ;
5773 virtual INT32 closeAllCursors () = 0 ;
5776 virtual INT32 interrupt() = 0 ;
5777 virtual INT32 interruptOperation() = 0 ;
5780 virtual INT32 isValid( BOOLEAN *result ) = 0 ;
5781 virtual BOOLEAN isValid() = 0 ;
5783 virtual BOOLEAN isClosed() = 0 ;
5786 virtual INT32 createDomain (
const CHAR *pDomainName,
5787 const bson::BSONObj &options,
5788 _sdbDomain **domain ) = 0 ;
5790 virtual INT32 createDomain (
const CHAR *pDomainName,
5791 const bson::BSONObj &options,
5792 sdbDomain &domain ) = 0 ;
5794 virtual INT32 dropDomain (
const CHAR *pDomainName ) = 0 ;
5796 virtual INT32 getDomain (
const CHAR *pDomainName,
5797 _sdbDomain **domain ) = 0 ;
5799 virtual INT32 getDomain (
const CHAR *pDomainName,
5800 sdbDomain &domain ) = 0 ;
5802 virtual INT32 listDomains ( _sdbCursor **cursor,
5803 const bson::BSONObj &condition = _sdbStaticObject,
5804 const bson::BSONObj &selector = _sdbStaticObject,
5805 const bson::BSONObj &orderBy = _sdbStaticObject,
5806 const bson::BSONObj &hint = _sdbStaticObject
5809 virtual INT32 listDomains ( sdbCursor &cursor,
5810 const bson::BSONObj &condition = _sdbStaticObject,
5811 const bson::BSONObj &selector = _sdbStaticObject,
5812 const bson::BSONObj &orderBy = _sdbStaticObject,
5813 const bson::BSONObj &hint = _sdbStaticObject
5815 virtual INT32 getDC( _sdbDataCenter **dc ) = 0 ;
5816 virtual INT32 getDC( sdbDataCenter &dc ) = 0 ;
5818 virtual INT32 getRecycleBin( _sdbRecycleBin **recycleBin ) = 0 ;
5819 virtual INT32 getRecycleBin( sdbRecycleBin &recycleBin ) = 0 ;
5821 static _sdb *getObj ( BOOLEAN useSSL = FALSE ) ;
5824 virtual UINT64 getLastAliveTime()
const = 0 ;
5826 virtual INT32 syncDB(
5827 const bson::BSONObj &options = _sdbStaticObject ) = 0 ;
5829 virtual INT32 analyze(
5830 const bson::BSONObj &options = _sdbStaticObject ) = 0 ;
5832 virtual INT32 forceSession(
5834 const bson::BSONObj &options = _sdbStaticObject ) = 0 ;
5836 virtual INT32 forceStepUp(
5837 const bson::BSONObj &options = _sdbStaticObject ) = 0 ;
5839 virtual INT32 invalidateCache(
5840 const bson::BSONObj &options = _sdbStaticObject ) = 0 ;
5842 virtual INT32 reloadConfig(
5843 const bson::BSONObj &options = _sdbStaticObject ) = 0 ;
5845 virtual INT32 updateConfig (
const bson::BSONObj &configs = _sdbStaticObject,
5846 const bson::BSONObj &options = _sdbStaticObject ) = 0 ;
5848 virtual INT32 deleteConfig (
const bson::BSONObj &configs = _sdbStaticObject,
5849 const bson::BSONObj &options = _sdbStaticObject ) = 0 ;
5851 virtual INT32 setPDLevel( INT32 level,
5852 const bson::BSONObj &options = _sdbStaticObject ) = 0 ;
5854 virtual INT32 msg(
const CHAR* msg ) = 0 ;
5856 virtual INT32 loadCS(
const CHAR* csName,
5857 const bson::BSONObj &options = _sdbStaticObject ) = 0 ;
5859 virtual INT32 unloadCS(
const CHAR* csName,
5860 const bson::BSONObj &options = _sdbStaticObject ) = 0 ;
5862 virtual INT32 traceStart( UINT32 traceBufferSize,
5863 const CHAR* component = NULL,
5864 const CHAR* breakpoint = NULL,
5865 const vector<UINT32> &tidVec = _sdbStaticUINT32Vec ) = 0 ;
5867 virtual INT32 traceStart( UINT32 traceBufferSize,
5868 const bson::BSONObj &options = _sdbStaticObject ) = 0 ;
5870 virtual INT32 traceStop(
const CHAR* dumpFileName ) = 0 ;
5872 virtual INT32 traceResume() = 0 ;
5874 virtual INT32 traceStatus( _sdbCursor** cursor ) = 0 ;
5876 virtual INT32 traceStatus( sdbCursor& cursor ) = 0 ;
5879 virtual INT32 renameCollectionSpace(
const CHAR* oldName,
5880 const CHAR* newName,
5881 const bson::BSONObj &options = _sdbStaticObject ) = 0 ;
5883 virtual INT32 getLastErrorObj( bson::BSONObj &result ) = 0 ;
5884 virtual void cleanLastErrorObj() = 0 ;
5886 virtual INT32 getLastResultObj( bson::BSONObj &result,
5887 BOOLEAN getOwned = FALSE )
const = 0 ;
5890 virtual INT32 createSequence(
const CHAR *pSequenceName,
5891 const bson::BSONObj &options,
5892 _sdbSequence **sequence ) = 0 ;
5894 virtual INT32 createSequence(
const CHAR *pSequenceName,
5895 const bson::BSONObj &options,
5896 sdbSequence &sequence ) = 0 ;
5898 virtual INT32 createSequence(
const CHAR *pSequenceName,
5899 sdbSequence &sequence ) = 0 ;
5902 virtual INT32 getSequence(
const CHAR *pSequenceName,
5903 _sdbSequence **sequence ) = 0 ;
5905 virtual INT32 getSequence(
const CHAR *pSequenceName,
5906 sdbSequence &sequence ) = 0 ;
5908 virtual INT32 renameSequence(
const CHAR *pOldName,
5909 const CHAR *pNewName ) = 0 ;
5911 virtual INT32 dropSequence(
const CHAR *pSequenceName ) = 0 ;
5913 virtual INT32 createDataSource( _sdbDataSource **dataSource,
5914 const CHAR *pDataSourceName,
5915 const CHAR *addresses,
5916 const CHAR *user = NULL,
5917 const CHAR *password = NULL,
5918 const CHAR *type = NULL,
5919 const bson::BSONObj *options = NULL
5922 virtual INT32 dropDataSource(
const CHAR *pDataSourceName ) = 0 ;
5924 virtual INT32 getDataSource(
const CHAR *pDataSourceName,
5925 _sdbDataSource **dataSource ) = 0 ;
5927 virtual INT32 listDataSources( _sdbCursor** cursor,
5928 const bson::BSONObj &condition = _sdbStaticObject,
5929 const bson::BSONObj &selector = _sdbStaticObject,
5930 const bson::BSONObj &orderBy = _sdbStaticObject,
5931 const bson::BSONObj &hint = _sdbStaticObject ) = 0 ;
5935 typedef class _sdb _sdb ;
5942 sdb (
const sdb& other ) ;
5943 sdb& operator=(
const sdb& ) ;
5957 sdb ( BOOLEAN useSSL = FALSE ) :
5958 pSDB ( _sdb::getObj( useSSL ) )
5982 INT32 connect (
const CHAR *pHostName,
5988 return SDB_NOT_CONNECTED ;
5990 return pSDB->
connect ( pHostName, port ) ;
6006 INT32 connect (
const CHAR *pHostName,
6008 const CHAR *pUsrName,
6014 return SDB_NOT_CONNECTED ;
6016 return pSDB->connect ( pHostName, port,
6017 pUsrName, pPasswd ) ;
6029 INT32 connect (
const CHAR *pHostName,
6030 const CHAR *pServiceName
6035 return SDB_NOT_CONNECTED ;
6037 return pSDB->connect ( pHostName, pServiceName ) ;
6053 INT32 connect (
const CHAR *pHostName,
6054 const CHAR *pServiceName,
6055 const CHAR *pUsrName,
6056 const CHAR *pPasswd )
6060 return SDB_NOT_CONNECTED ;
6062 return pSDB->connect ( pHostName, pServiceName,
6063 pUsrName, pPasswd ) ;
6079 INT32 connect (
const CHAR **pConnAddrs,
6081 const CHAR *pUsrName,
6082 const CHAR *pPasswd )
6086 return SDB_NOT_CONNECTED ;
6088 return pSDB->connect ( pConnAddrs, arrSize,
6089 pUsrName, pPasswd ) ;
6107 INT32 connect (
const CHAR **pConnAddrs,
6109 const CHAR *pUsrName,
6111 const CHAR *pCipherFile )
6115 return SDB_NOT_CONNECTED ;
6117 return pSDB->connect ( pConnAddrs, arrSize,
6118 pUsrName, pToken, pCipherFile ) ;
6125 UINT64 getDbStartTime ()
6131 return pSDB->getDbStartTime() ;
6138 const CHAR *getAddress ()
6144 return pSDB->getAddress () ;
6157 void getVersion ( UINT8 &version, UINT8 &subVersion, UINT8 &fixVersion )
6163 pSDB->getVersion( version, subVersion, fixVersion ) ;
6194 INT32 createUsr(
const CHAR *pUsrName,
6195 const CHAR *pPasswd,
6196 const bson::BSONObj &options = _sdbStaticObject )
6200 return SDB_NOT_CONNECTED ;
6202 return pSDB->createUsr( pUsrName, pPasswd, options ) ;
6213 INT32 removeUsr(
const CHAR *pUsrName,
6214 const CHAR *pPasswd )
6218 return SDB_NOT_CONNECTED ;
6220 return pSDB->removeUsr( pUsrName, pPasswd ) ;
6235 INT32 alterUsr(
const CHAR *pUsrName,
6236 const CHAR *pAction,
6237 const bson::BSONObj &options )
6241 return SDB_NOT_CONNECTED ;
6243 return pSDB->alterUsr( pUsrName, pAction, options ) ;
6256 INT32 changeUsrPasswd(
const CHAR *pUsrName,
6257 const CHAR *pOldPasswd,
6258 const CHAR *pNewPasswd )
6262 return SDB_NOT_CONNECTED ;
6264 return pSDB->changeUsrPasswd( pUsrName, pOldPasswd, pNewPasswd ) ;
6276 pSDB->disconnect () ;
6322 const bson::BSONObj &condition = _sdbStaticObject,
6323 const bson::BSONObj &selector = _sdbStaticObject,
6324 const bson::BSONObj &orderBy = _sdbStaticObject,
6325 const bson::BSONObj &hint = _sdbStaticObject,
6326 INT64 numToSkip = 0,
6327 INT64 numToReturn = -1 )
6331 return SDB_NOT_CONNECTED ;
6334 return pSDB->getSnapshot ( cursor, snapType, condition,
6335 selector, orderBy, hint,
6336 numToSkip, numToReturn ) ;
6381 INT32 getSnapshot ( _sdbCursor **cursor,
6383 const bson::BSONObj &condition = _sdbStaticObject,
6384 const bson::BSONObj &selector = _sdbStaticObject,
6385 const bson::BSONObj &orderBy = _sdbStaticObject,
6386 const bson::BSONObj &hint = _sdbStaticObject,
6387 INT64 numToSkip = 0,
6388 INT64 numToReturn = -1 )
6392 return SDB_NOT_CONNECTED ;
6394 return pSDB->getSnapshot ( cursor, snapType, condition,
6395 selector, orderBy, hint,
6396 numToSkip, numToReturn ) ;
6421 INT32 resetSnapshot (
const bson::BSONObj &options = _sdbStaticObject )
6425 return SDB_NOT_CONNECTED ;
6427 return pSDB->resetSnapshot ( options ) ;
6430 INT32 getList ( _sdbCursor **cursor,
6432 const bson::BSONObj &condition = _sdbStaticObject,
6433 const bson::BSONObj &selector = _sdbStaticObject,
6434 const bson::BSONObj &orderBy = _sdbStaticObject,
6435 const bson::BSONObj &hint = _sdbStaticObject,
6436 INT64 numToSkip = 0,
6437 INT64 numToReturn = -1
6442 return SDB_NOT_CONNECTED ;
6444 return pSDB->getList ( cursor, listType,
6445 condition, selector, orderBy, hint,
6446 numToSkip, numToReturn ) ;
6493 const bson::BSONObj &condition = _sdbStaticObject,
6494 const bson::BSONObj &selector = _sdbStaticObject,
6495 const bson::BSONObj &orderBy = _sdbStaticObject,
6496 const bson::BSONObj &hint = _sdbStaticObject,
6497 INT64 numToSkip = 0,
6498 INT64 numToReturn = -1
6503 return SDB_NOT_CONNECTED ;
6506 return pSDB->getList ( cursor, listType,
6507 condition, selector, orderBy, hint,
6508 numToSkip, numToReturn ) ;
6511 INT32 getCollection (
const CHAR *pCollectionFullName,
6512 _sdbCollection **collection,
6513 BOOLEAN checkExist = TRUE
6518 return SDB_NOT_CONNECTED ;
6520 return pSDB->getCollection ( pCollectionFullName,
6521 collection, checkExist ) ;
6534 INT32 getCollection (
const CHAR *pCollectionFullName,
6536 BOOLEAN checkExist = TRUE
6541 return SDB_NOT_CONNECTED ;
6544 return pSDB->getCollection ( pCollectionFullName,
6549 INT32 getCollectionSpace (
const CHAR *pCollectionSpaceName,
6550 _sdbCollectionSpace **cs,
6551 BOOLEAN checkExist = TRUE
6556 return SDB_NOT_CONNECTED ;
6558 return pSDB->getCollectionSpace ( pCollectionSpaceName,
6572 INT32 getCollectionSpace (
const CHAR *pCollectionSpaceName,
6574 BOOLEAN checkExist = TRUE
6579 return SDB_NOT_CONNECTED ;
6582 return pSDB->getCollectionSpace ( pCollectionSpaceName,
6586 INT32 createCollectionSpace (
const CHAR *pCollectionSpaceName,
6588 _sdbCollectionSpace **cs
6593 return SDB_NOT_CONNECTED ;
6595 return pSDB->createCollectionSpace ( pCollectionSpaceName,
6618 INT32 createCollectionSpace (
const CHAR *pCollectionSpaceName,
6625 return SDB_NOT_CONNECTED ;
6628 return pSDB->createCollectionSpace ( pCollectionSpaceName,
6632 INT32 createCollectionSpace (
const CHAR *pCollectionSpaceName,
6633 const bson::BSONObj &options,
6634 _sdbCollectionSpace **cs
6639 return SDB_NOT_CONNECTED ;
6641 return pSDB->createCollectionSpace ( pCollectionSpaceName,
6662 INT32 createCollectionSpace (
const CHAR *pCollectionSpaceName,
6663 const bson::BSONObj &options,
6669 return SDB_NOT_CONNECTED ;
6672 return pSDB->createCollectionSpace ( pCollectionSpaceName,
6684 INT32 dropCollectionSpace (
6685 const CHAR *pCollectionSpaceName,
6686 const bson::BSONObj &options = _sdbStaticObject )
6690 return SDB_NOT_CONNECTED ;
6693 return pSDB->dropCollectionSpace ( pCollectionSpaceName, options ) ;
6696 INT32 listCollectionSpaces ( _sdbCursor **result )
6700 return SDB_NOT_CONNECTED ;
6702 return pSDB->listCollectionSpaces ( result ) ;
6715 return SDB_NOT_CONNECTED ;
6718 return pSDB->listCollectionSpaces ( cursor ) ;
6727 INT32 listCollections ( _sdbCursor **result )
6731 return SDB_NOT_CONNECTED ;
6733 return pSDB->listCollections ( result ) ;
6746 return SDB_NOT_CONNECTED ;
6749 return pSDB->listCollections ( cursor ) ;
6758 INT32 listReplicaGroups ( _sdbCursor **result )
6762 return SDB_NOT_CONNECTED ;
6764 return pSDB->listReplicaGroups ( result ) ;
6778 return SDB_NOT_CONNECTED ;
6781 return pSDB->listReplicaGroups ( cursor ) ;
6791 INT32 getReplicaGroup (
const CHAR *pName, _sdbReplicaGroup **result )
6795 return SDB_NOT_CONNECTED ;
6797 return pSDB->getReplicaGroup ( pName, result ) ;
6812 return SDB_NOT_CONNECTED ;
6815 return pSDB->getReplicaGroup ( pName, group ) ;
6825 INT32 getReplicaGroup ( INT32
id, _sdbReplicaGroup **result )
6829 return SDB_NOT_CONNECTED ;
6831 return pSDB->getReplicaGroup (
id, result ) ;
6845 return SDB_NOT_CONNECTED ;
6848 return pSDB->getReplicaGroup (
id, group ) ;
6858 INT32 createReplicaGroup (
const CHAR *pName, _sdbReplicaGroup **replicaGroup )
6862 return SDB_NOT_CONNECTED ;
6864 return pSDB->createReplicaGroup ( pName, replicaGroup ) ;
6878 return SDB_NOT_CONNECTED ;
6881 return pSDB->createReplicaGroup ( pName, group ) ;
6890 INT32 removeReplicaGroup (
const CHAR *pName )
6894 return SDB_NOT_CONNECTED ;
6896 return pSDB->removeReplicaGroup ( pName ) ;
6911 INT32 createReplicaCataGroup (
const CHAR *pHostName,
6912 const CHAR *pServiceName,
6913 const CHAR *pDatabasePath,
6914 const bson::BSONObj &configure )
6918 return SDB_NOT_CONNECTED ;
6920 return pSDB->createReplicaCataGroup ( pHostName, pServiceName,
6921 pDatabasePath, configure ) ;
6924 INT32 activateReplicaGroup (
const CHAR *pName, _sdbReplicaGroup **replicaGroup )
6928 return SDB_NOT_CONNECTED ;
6930 return pSDB->activateReplicaGroup ( pName, replicaGroup ) ;
6944 return SDB_NOT_CONNECTED ;
6947 return pSDB->activateReplicaGroup ( pName, replicaGroup ) ;
6957 INT32 execUpdate(
const CHAR *sql, bson::BSONObj *pResult = NULL )
6961 return SDB_NOT_CONNECTED ;
6963 return pSDB->execUpdate( sql, pResult ) ;
6974 INT32 exec(
const CHAR *sql,
6975 _sdbCursor **result )
6979 return SDB_NOT_CONNECTED ;
6981 return pSDB->exec( sql, result ) ;
6992 INT32 exec(
const CHAR *sql,
6997 return SDB_NOT_CONNECTED ;
7000 return pSDB->exec( sql, cursor ) ;
7008 INT32 transactionBegin()
7012 return SDB_NOT_CONNECTED ;
7014 return pSDB->transactionBegin() ;
7024 INT32 transactionCommit(
const bson::BSONObj &hint = _sdbStaticObject )
7028 return SDB_NOT_CONNECTED ;
7030 return pSDB->transactionCommit( hint ) ;
7038 INT32 transactionRollback()
7042 return SDB_NOT_CONNECTED ;
7044 return pSDB->transactionRollback() ;
7055 INT32 flushConfigure(
const bson::BSONObj &options )
7059 return SDB_NOT_CONNECTED ;
7061 return pSDB->flushConfigure( options ) ;
7070 INT32 crtJSProcedure (
const CHAR *code )
7074 return SDB_NOT_CONNECTED ;
7076 return pSDB->crtJSProcedure( code ) ;
7085 INT32 rmProcedure(
const CHAR *spName )
7089 return SDB_NOT_CONNECTED ;
7091 return pSDB->rmProcedure( spName ) ;
7094 INT32 listProcedures( _sdbCursor **cursor,
const bson::BSONObj &condition )
7098 return SDB_NOT_CONNECTED ;
7100 return pSDB->listProcedures( cursor, condition ) ;
7110 INT32 listProcedures(
sdbCursor &cursor,
const bson::BSONObj &condition )
7114 return SDB_NOT_CONNECTED ;
7117 return pSDB->listProcedures( cursor, condition ) ;
7120 INT32 evalJS(
const CHAR *code,
7122 _sdbCursor **cursor,
7123 bson::BSONObj &errmsg )
7127 return SDB_NOT_CONNECTED ;
7129 return pSDB->evalJS( code, type, cursor, errmsg ) ;
7146 bson::BSONObj &errmsg )
7150 return SDB_NOT_CONNECTED ;
7153 return pSDB->evalJS( code, type, cursor, errmsg ) ;
7175 INT32 backupOffline (
const bson::BSONObj &options)
7177 return backup( options ) ;
7198 INT32 backup (
const bson::BSONObj &options)
7202 return SDB_NOT_CONNECTED ;
7204 return pSDB->backup( options ) ;
7208 INT32 listBackup ( _sdbCursor **cursor,
7209 const bson::BSONObj &options,
7210 const bson::BSONObj &condition = _sdbStaticObject,
7211 const bson::BSONObj &selector = _sdbStaticObject,
7212 const bson::BSONObj &orderBy = _sdbStaticObject)
7216 return SDB_NOT_CONNECTED ;
7218 return pSDB->listBackup( cursor, options, condition, selector, orderBy ) ;
7244 const bson::BSONObj &options,
7245 const bson::BSONObj &condition = _sdbStaticObject,
7246 const bson::BSONObj &selector = _sdbStaticObject,
7247 const bson::BSONObj &orderBy = _sdbStaticObject)
7251 return SDB_NOT_CONNECTED ;
7254 return pSDB->listBackup( cursor, options, condition, selector, orderBy ) ;
7271 INT32 removeBackup (
const bson::BSONObj &options)
7275 return SDB_NOT_CONNECTED ;
7277 return pSDB->removeBackup( options ) ;
7280 INT32 listTasks ( _sdbCursor **cursor,
7281 const bson::BSONObj &condition = _sdbStaticObject,
7282 const bson::BSONObj &selector = _sdbStaticObject,
7283 const bson::BSONObj &orderBy = _sdbStaticObject,
7284 const bson::BSONObj &hint = _sdbStaticObject)
7288 return SDB_NOT_CONNECTED ;
7290 return pSDB->listTasks ( cursor,
7314 const bson::BSONObj &condition = _sdbStaticObject,
7315 const bson::BSONObj &selector = _sdbStaticObject,
7316 const bson::BSONObj &orderBy = _sdbStaticObject,
7317 const bson::BSONObj &hint = _sdbStaticObject)
7321 return SDB_NOT_CONNECTED ;
7324 return pSDB->listTasks ( cursor,
7339 INT32 waitTasks (
const SINT64 *taskIDs,
7344 return SDB_NOT_CONNECTED ;
7346 return pSDB->waitTasks ( taskIDs,
7359 INT32 cancelTask ( SINT64 taskID,
7364 return SDB_NOT_CONNECTED ;
7366 return pSDB->cancelTask ( taskID,
7380 INT32 setSessionAttr (
const bson::BSONObj &options = _sdbStaticObject )
7384 return SDB_NOT_CONNECTED ;
7386 return pSDB->setSessionAttr ( options ) ;
7397 INT32 getSessionAttr ( bson::BSONObj & result,
7398 BOOLEAN useCache = TRUE )
7402 return SDB_NOT_CONNECTED ;
7404 return pSDB->getSessionAttr( result, useCache ) ;
7413 INT32 closeAllCursors ()
7415 return interrupt() ;
7428 return SDB_NOT_CONNECTED ;
7430 return pSDB->interrupt () ;
7441 INT32 interruptOperation()
7445 return SDB_NOT_CONNECTED ;
7447 return pSDB->interruptOperation () ;
7457 INT32 isValid ( BOOLEAN *result )
7461 return SDB_NOT_CONNECTED ;
7463 return pSDB->isValid ( result ) ;
7476 return pSDB->isValid () ;
7489 return pSDB->isClosed() ;
7510 INT32 createDomain (
const CHAR *pDomainName,
7511 const bson::BSONObj &options,
7516 return SDB_NOT_CONNECTED ;
7519 return pSDB->createDomain ( pDomainName, options, domain ) ;
7522 INT32 createDomain (
const CHAR *pDomainName,
7523 const bson::BSONObj &options,
7524 _sdbDomain **domain )
7528 return SDB_NOT_CONNECTED ;
7530 return pSDB->createDomain ( pDomainName, options, domain ) ;
7539 INT32 dropDomain (
const CHAR *pDomainName )
7543 return SDB_NOT_CONNECTED ;
7545 return pSDB->dropDomain ( pDomainName ) ;
7548 INT32 getDomain (
const CHAR *pDomainName,
7549 _sdbDomain **domain )
7553 return SDB_NOT_CONNECTED ;
7555 return pSDB->getDomain ( pDomainName, domain ) ;
7566 INT32 getDomain (
const CHAR *pDomainName,
7571 return SDB_NOT_CONNECTED ;
7574 return pSDB->getDomain ( pDomainName, domain ) ;
7577 INT32 listDomains ( _sdbCursor **cursor,
7578 const bson::BSONObj &condition = _sdbStaticObject,
7579 const bson::BSONObj &selector = _sdbStaticObject,
7580 const bson::BSONObj &orderBy = _sdbStaticObject,
7581 const bson::BSONObj &hint = _sdbStaticObject )
7585 return SDB_NOT_CONNECTED ;
7587 return pSDB->listDomains ( cursor, condition, selector, orderBy, hint ) ;
7608 const bson::BSONObj &condition = _sdbStaticObject,
7609 const bson::BSONObj &selector = _sdbStaticObject,
7610 const bson::BSONObj &orderBy = _sdbStaticObject,
7611 const bson::BSONObj &hint = _sdbStaticObject )
7615 return SDB_NOT_CONNECTED ;
7618 return pSDB->listDomains ( cursor, condition, selector, orderBy, hint ) ;
7626 INT32 getDC( sdbDataCenter &dc )
7630 return SDB_NOT_CONNECTED ;
7633 return pSDB->getDC ( dc ) ;
7641 INT32 getDC( _sdbDataCenter **dc )
7645 return SDB_NOT_CONNECTED ;
7647 return pSDB->getDC ( dc ) ;
7655 INT32 getRecycleBin( sdbRecycleBin &recycleBin )
7659 return SDB_NOT_CONNECTED ;
7662 return pSDB->getRecycleBin( recycleBin ) ;
7670 INT32 getRecycleBin( _sdbRecycleBin **recycleBin )
7674 return SDB_NOT_CONNECTED ;
7676 return pSDB->getRecycleBin( recycleBin ) ;
7708 INT32 syncDB(
const bson::BSONObj &options = _sdbStaticObject )
7712 return SDB_NOT_CONNECTED ;
7714 return pSDB->syncDB ( options ) ;
7743 INT32 analyze (
const bson::BSONObj &options = _sdbStaticObject )
7747 return SDB_NOT_CONNECTED ;
7749 return pSDB->analyze ( options ) ;
7767 INT32 forceSession( SINT64 sessionID,
7768 const bson::BSONObj &options = _sdbStaticObject )
7772 return SDB_NOT_CONNECTED ;
7774 return pSDB->forceSession( sessionID, options ) ;
7791 INT32 forceStepUp(
const bson::BSONObj &options = _sdbStaticObject )
7795 return SDB_NOT_CONNECTED ;
7797 return pSDB->forceStepUp( options ) ;
7812 INT32 invalidateCache(
const bson::BSONObj &options = _sdbStaticObject )
7816 return SDB_NOT_CONNECTED ;
7818 return pSDB->invalidateCache( options ) ;
7834 INT32 reloadConfig(
const bson::BSONObj &options = _sdbStaticObject )
7838 return SDB_NOT_CONNECTED ;
7840 return pSDB->reloadConfig( options ) ;
7859 INT32 updateConfig(
const bson::BSONObj &configs = _sdbStaticObject,
7860 const bson::BSONObj &options = _sdbStaticObject )
7864 return SDB_NOT_CONNECTED ;
7866 return pSDB->updateConfig( configs, options ) ;
7885 INT32 deleteConfig(
const bson::BSONObj &configs = _sdbStaticObject,
7886 const bson::BSONObj &options = _sdbStaticObject )
7890 return SDB_NOT_CONNECTED ;
7892 return pSDB->deleteConfig( configs, options ) ;
7917 INT32 setPDLevel( INT32 level,
7918 const bson::BSONObj &options = _sdbStaticObject )
7922 return SDB_NOT_CONNECTED ;
7924 return pSDB->setPDLevel( level, options ) ;
7927 INT32 msg(
const CHAR* msg )
7931 return SDB_NOT_CONNECTED ;
7933 return pSDB->msg( msg ) ;
7951 INT32 loadCS(
const CHAR* csName,
7952 const bson::BSONObj &options = _sdbStaticObject )
7956 return SDB_NOT_CONNECTED ;
7958 return pSDB->loadCS( csName, options ) ;
7976 INT32 unloadCS(
const CHAR* csName,
7977 const bson::BSONObj &options = _sdbStaticObject )
7981 return SDB_NOT_CONNECTED ;
7983 return pSDB->unloadCS( csName, options ) ;
7998 INT32 traceStart( UINT32 traceBufferSize,
7999 const CHAR* component = NULL,
8000 const CHAR* breakpoint = NULL,
8001 const vector<UINT32> &tidVec = _sdbStaticUINT32Vec )
8005 return SDB_NOT_CONNECTED ;
8007 return pSDB->traceStart( traceBufferSize, component,
8008 breakpoint, tidVec ) ;
8030 INT32 traceStart( UINT32 traceBufferSize,
8031 const bson::BSONObj &options )
8035 return SDB_NOT_CONNECTED ;
8037 return pSDB->traceStart( traceBufferSize, options ) ;
8048 INT32 traceStop(
const CHAR* dumpFileName )
8052 return SDB_NOT_CONNECTED ;
8054 return pSDB->traceStop( dumpFileName ) ;
8066 return SDB_NOT_CONNECTED ;
8068 return pSDB->traceResume() ;
8081 return SDB_NOT_CONNECTED ;
8084 return pSDB->traceStatus( cursor ) ;
8087 INT32 traceStatus( _sdbCursor** cursor )
8091 return SDB_NOT_CONNECTED ;
8093 return pSDB->traceStatus( cursor ) ;
8106 INT32 renameCollectionSpace(
const CHAR* oldName,
8107 const CHAR* newName,
8108 const bson::BSONObj &options = _sdbStaticObject )
8112 return SDB_NOT_CONNECTED ;
8114 return pSDB->renameCollectionSpace( oldName, newName, options ) ;
8128 INT32 getLastErrorObj( bson::BSONObj &errObj )
8132 return SDB_NOT_CONNECTED ;
8134 return pSDB->getLastErrorObj( errObj ) ;
8140 void cleanLastErrorObj()
8146 return pSDB->cleanLastErrorObj() ;
8159 INT32 getLastResultObj( bson::BSONObj &result,
8160 BOOLEAN getOwned = FALSE )
const
8164 return SDB_NOT_CONNECTED ;
8166 return pSDB->getLastResultObj( result, getOwned ) ;
8188 INT32 createSequence(
const CHAR *pSequenceName,
8189 const bson::BSONObj &options,
8190 _sdbSequence **sequence )
8194 return SDB_NOT_CONNECTED ;
8196 return pSDB->createSequence( pSequenceName, options, sequence ) ;
8218 INT32 createSequence(
const CHAR *pSequenceName,
8219 const bson::BSONObj &options,
8224 return SDB_NOT_CONNECTED ;
8226 return pSDB->createSequence( pSequenceName, options, sequence ) ;
8237 INT32 createSequence(
const CHAR *pSequenceName,
8242 return SDB_NOT_CONNECTED ;
8244 return pSDB->createSequence( pSequenceName, sequence ) ;
8255 INT32 getSequence(
const CHAR *pSequenceName,
8256 _sdbSequence **sequence )
8260 return SDB_NOT_CONNECTED ;
8262 return pSDB->getSequence( pSequenceName, sequence ) ;
8273 INT32 getSequence(
const CHAR *pSequenceName,
8278 return SDB_NOT_CONNECTED ;
8280 return pSDB->getSequence( pSequenceName, sequence ) ;
8290 INT32 renameSequence(
const CHAR *pOldName,
const CHAR *pNewName )
8294 return SDB_NOT_CONNECTED ;
8296 return pSDB->renameSequence( pOldName, pNewName ) ;
8305 INT32 dropSequence(
const CHAR *pSequenceName )
8309 return SDB_NOT_CONNECTED ;
8311 return pSDB->dropSequence( pSequenceName ) ;
8363 const CHAR *pDataSourceName,
8364 const CHAR *addresses,
8365 const CHAR *user = NULL,
8366 const CHAR *password = NULL,
8367 const CHAR *type = NULL,
8368 const bson::BSONObj *options = NULL )
8372 return SDB_NOT_CONNECTED ;
8375 return pSDB->createDataSource( &dataSource.pDataSource, pDataSourceName, addresses,
8376 user, password, type, options ) ;
8385 INT32 dropDataSource(
const CHAR *pDataSourceName )
8389 return SDB_NOT_CONNECTED ;
8391 return pSDB->dropDataSource( pDataSourceName ) ;
8402 INT32 getDataSource(
const CHAR *pDataSourceName,
8407 return SDB_NOT_CONNECTED ;
8410 return pSDB->getDataSource( pDataSourceName, &dataSource.pDataSource ) ;
8428 const bson::BSONObj &condition = _sdbStaticObject,
8429 const bson::BSONObj &selector = _sdbStaticObject,
8430 const bson::BSONObj &orderBy = _sdbStaticObject,
8431 const bson::BSONObj &hint = _sdbStaticObject )
8435 return SDB_NOT_CONNECTED ;
8438 return pSDB->listDataSources( &cursor.
pCursor, condition, selector, orderBy, hint ) ;