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_RETURN_OID 0x10000000
81 #define SDB_CLIENT_SOCKET_TIMEOUT_DFT 10000
84 #define sdbReplicaNode sdbNode
87 #define QUERY_FORCE_HINT 0x00000080
89 #define QUERY_PARALLED 0x00000100
91 #define QUERY_WITH_RETURNDATA 0x00000200
93 #define QUERY_PREPARE_MORE 0x00004000
95 #define QUERY_KEEP_SHARDINGKEY_IN_UPDATE 0x00008000
100 #define QUERY_FOR_UPDATE 0x00010000
105 #define QUERY_FOR_SHARE 0x00040000
109 #define UPDATE_KEEP_SHARDINGKEY QUERY_KEEP_SHARDINGKEY_IN_UPDATE
111 #define UPDATE_ONE 0x00000002
113 #define UPDATE_RETURNNUM 0x00000004
116 #define FLG_DELETE_ONE 0x00000002
118 #define FLG_DELETE_RETURNNUM 0x00000004
120 #define SDB_INDEX_SORT_BUFFER_DEFAULT_SIZE 64
150 const static bson::BSONObj _sdbStaticObject ;
151 const static bson::OID _sdbStaticOid ;
152 const static std::vector<INT32> _sdbStaticVec ;
153 const static std::vector<UINT32> _sdbStaticUINT32Vec ;
155 class _sdbCollection ;
165 const CHAR *pDescription,
166 const CHAR *pDetail ) ;
174 class DLLEXPORT _sdbCursor
177 _sdbCursor (
const _sdbCursor& other ) ;
178 _sdbCursor& operator=(
const _sdbCursor& ) ;
181 virtual ~_sdbCursor () {}
182 virtual INT32 next ( bson::BSONObj &obj, BOOLEAN getOwned = TRUE ) = 0 ;
183 virtual INT32 current ( bson::BSONObj &obj, BOOLEAN getOwned = TRUE ) = 0 ;
184 virtual INT32 close () = 0 ;
185 virtual INT32 advance (
const bson::BSONObj &option,
186 bson::BSONObj *pResult = NULL ) = 0 ;
241 INT32 next ( bson::BSONObj &obj, BOOLEAN getOwned = TRUE )
245 return SDB_NOT_CONNECTED ;
247 return pCursor->
next ( obj, getOwned ) ;
266 INT32 current ( bson::BSONObj &obj, BOOLEAN getOwned = TRUE )
270 return SDB_NOT_CONNECTED ;
272 return pCursor->current ( obj, getOwned ) ;
282 INT32 advance (
const bson::BSONObj &option, bson::BSONObj *pResult = NULL )
286 return SDB_NOT_CONNECTED ;
288 return pCursor->advance( option, pResult ) ;
302 return pCursor->close () ;
306 class DLLEXPORT _sdbCollection
309 _sdbCollection (
const _sdbCollection& other ) ;
310 _sdbCollection& operator=(
const _sdbCollection& ) ;
313 virtual ~_sdbCollection () {}
316 virtual INT32 getCount ( SINT64 &count,
317 const bson::BSONObj &condition = _sdbStaticObject,
318 const bson::BSONObj &hint = _sdbStaticObject ) = 0 ;
323 virtual INT32 insert (
const bson::BSONObj &obj, bson::OID *
id = NULL ) = 0 ;
324 virtual INT32 insert (
const bson::BSONObj &obj,
326 bson::BSONObj *pResult = NULL ) = 0 ;
327 virtual INT32 insert (
const bson::BSONObj &obj,
328 const bson::BSONObj &hint,
330 bson::BSONObj *pResult = NULL ) = 0 ;
331 virtual INT32 insert ( std::vector<bson::BSONObj> &objs,
333 bson::BSONObj *pResult = NULL ) = 0 ;
334 virtual INT32 insert ( std::vector<bson::BSONObj> &objs,
335 const bson::BSONObj &hint,
337 bson::BSONObj *pResult = NULL ) = 0 ;
338 virtual INT32 insert (
const bson::BSONObj objs[],
341 bson::BSONObj *pResult = NULL ) = 0 ;
342 virtual INT32 bulkInsert ( SINT32 flags,
343 std::vector<bson::BSONObj> &obj
352 virtual INT32 update (
const bson::BSONObj &rule,
353 const bson::BSONObj &condition = _sdbStaticObject,
354 const bson::BSONObj &hint = _sdbStaticObject,
356 bson::BSONObj *pResult = NULL
368 virtual INT32 upsert (
const bson::BSONObj &rule,
369 const bson::BSONObj &condition = _sdbStaticObject,
370 const bson::BSONObj &hint = _sdbStaticObject,
371 const bson::BSONObj &setOnInsert = _sdbStaticObject,
373 bson::BSONObj *pResult = NULL
382 virtual INT32 del (
const bson::BSONObj &condition = _sdbStaticObject,
383 const bson::BSONObj &hint = _sdbStaticObject,
385 bson::BSONObj *pResult = NULL
395 virtual INT32 query ( _sdbCursor **cursor,
396 const bson::BSONObj &condition = _sdbStaticObject,
397 const bson::BSONObj &selected = _sdbStaticObject,
398 const bson::BSONObj &orderBy = _sdbStaticObject,
399 const bson::BSONObj &hint = _sdbStaticObject,
401 INT64 numToReturn = -1,
405 virtual INT32 query ( sdbCursor &cursor,
406 const bson::BSONObj &condition = _sdbStaticObject,
407 const bson::BSONObj &selected = _sdbStaticObject,
408 const bson::BSONObj &orderBy = _sdbStaticObject,
409 const bson::BSONObj &hint = _sdbStaticObject,
411 INT64 numToReturn = -1,
415 virtual INT32 queryOne( bson::BSONObj &obj,
416 const bson::BSONObj &condition = _sdbStaticObject,
417 const bson::BSONObj &selected = _sdbStaticObject,
418 const bson::BSONObj &orderBy = _sdbStaticObject,
419 const bson::BSONObj &hint = _sdbStaticObject,
421 INT32 flags = 0 ) = 0 ;
433 virtual INT32 queryAndUpdate ( _sdbCursor **cursor,
434 const bson::BSONObj &update,
435 const bson::BSONObj &condition = _sdbStaticObject,
436 const bson::BSONObj &selected = _sdbStaticObject,
437 const bson::BSONObj &orderBy = _sdbStaticObject,
438 const bson::BSONObj &hint = _sdbStaticObject,
440 INT64 numToReturn = -1,
442 BOOLEAN returnNew = FALSE
453 virtual INT32 queryAndRemove ( _sdbCursor **cursor,
454 const bson::BSONObj &condition = _sdbStaticObject,
455 const bson::BSONObj &selected = _sdbStaticObject,
456 const bson::BSONObj &orderBy = _sdbStaticObject,
457 const bson::BSONObj &hint = _sdbStaticObject,
459 INT64 numToReturn = -1,
470 virtual INT32 createIndex (
const bson::BSONObj &indexDef,
474 INT32 sortBufferSize ) = 0 ;
475 virtual INT32 createIndex (
const bson::BSONObj &indexDef,
477 const bson::BSONObj &indexAttr = _sdbStaticObject,
478 const bson::BSONObj &option = _sdbStaticObject
480 virtual INT32 createIndexAsync ( SINT64 &taskID,
481 const bson::BSONObj &indexDef,
483 const bson::BSONObj &indexAttr = _sdbStaticObject,
484 const bson::BSONObj &option = _sdbStaticObject
486 virtual INT32 snapshotIndexes ( _sdbCursor **cursor,
487 const bson::BSONObj &condition = _sdbStaticObject,
488 const bson::BSONObj &selector = _sdbStaticObject,
489 const bson::BSONObj &orderby = _sdbStaticObject,
490 const bson::BSONObj &hint = _sdbStaticObject,
492 INT64 numToReturn = -1 ) = 0 ;
493 virtual INT32 getIndexes ( _sdbCursor **cursor,
494 const CHAR *pName ) = 0 ;
495 virtual INT32 getIndexes ( sdbCursor &cursor,
496 const CHAR *pIndexName ) = 0 ;
497 virtual INT32 getIndexes ( std::vector<bson::BSONObj> &infos ) = 0 ;
498 virtual INT32 getIndex (
const CHAR *pIndexName, bson::BSONObj &info ) = 0 ;
499 virtual INT32 dropIndex (
const CHAR *pIndexName ) = 0 ;
500 virtual INT32 dropIndexAsync ( SINT64 &taskID,
501 const CHAR *pIndexName ) = 0 ;
502 virtual INT32 copyIndex (
const CHAR *subClFullName,
503 const CHAR *pIndexName ) = 0 ;
504 virtual INT32 copyIndexAsync ( SINT64 &taskID,
505 const CHAR *subClFullName,
506 const CHAR *pIndexName ) = 0 ;
507 virtual INT32 create () = 0 ;
508 virtual INT32 drop () = 0 ;
509 virtual const CHAR *getCollectionName () = 0 ;
510 virtual const CHAR *getCSName () = 0 ;
511 virtual const CHAR *getFullName () = 0 ;
512 virtual INT32 split (
const CHAR *pSourceGroupName,
513 const CHAR *pTargetGroupName,
514 const bson::BSONObj &splitConditon,
515 const bson::BSONObj &splitEndCondition = _sdbStaticObject) = 0 ;
516 virtual INT32 split (
const CHAR *pSourceGroupName,
517 const CHAR *pTargetGroupName,
518 FLOAT64 percent ) = 0 ;
519 virtual INT32 splitAsync ( SINT64 &taskID,
520 const CHAR *pSourceGroupName,
521 const CHAR *pTargetGroupName,
522 const bson::BSONObj &splitCondition,
523 const bson::BSONObj &splitEndCondition = _sdbStaticObject) = 0 ;
524 virtual INT32 splitAsync (
const CHAR *pSourceGroupName,
525 const CHAR *pTargetGroupName,
527 SINT64 &taskID ) = 0 ;
528 virtual INT32 aggregate ( _sdbCursor **cursor,
529 std::vector<bson::BSONObj> &obj
531 virtual INT32 aggregate ( sdbCursor &cursor,
532 std::vector<bson::BSONObj> &obj
534 virtual INT32 getQueryMeta ( _sdbCursor **cursor,
535 const bson::BSONObj &condition = _sdbStaticObject,
536 const bson::BSONObj &orderBy = _sdbStaticObject,
537 const bson::BSONObj &hint = _sdbStaticObject,
539 INT64 numToReturn = -1
541 virtual INT32 getQueryMeta ( sdbCursor &cursor,
542 const bson::BSONObj &condition = _sdbStaticObject,
543 const bson::BSONObj &orderBy = _sdbStaticObject,
544 const bson::BSONObj &hint = _sdbStaticObject,
546 INT64 numToReturn = -1
548 virtual INT32 attachCollection (
const CHAR *subClFullName,
549 const bson::BSONObj &options) = 0 ;
550 virtual INT32 detachCollection (
const CHAR *subClFullName) = 0 ;
552 virtual INT32 alterCollection (
const bson::BSONObj &options ) = 0 ;
554 virtual INT32 explain ( sdbCursor &cursor,
555 const bson::BSONObj &condition = _sdbStaticObject,
556 const bson::BSONObj &select = _sdbStaticObject,
557 const bson::BSONObj &orderBy = _sdbStaticObject,
558 const bson::BSONObj &hint = _sdbStaticObject,
560 INT64 numToReturn = -1,
562 const bson::BSONObj &options = _sdbStaticObject ) = 0 ;
564 virtual INT32 explain ( _sdbCursor **cursor,
565 const bson::BSONObj &condition = _sdbStaticObject,
566 const bson::BSONObj &select = _sdbStaticObject,
567 const bson::BSONObj &orderBy = _sdbStaticObject,
568 const bson::BSONObj &hint = _sdbStaticObject,
570 INT64 numToReturn = -1,
572 const bson::BSONObj &options = _sdbStaticObject ) = 0 ;
574 virtual INT32 createLob( sdbLob &lob,
const bson::OID *oid = NULL ) = 0 ;
576 virtual INT32 removeLob(
const bson::OID &oid ) = 0 ;
578 virtual INT32 truncateLob(
const bson::OID &oid, INT64 length ) = 0 ;
580 virtual INT32 openLob( sdbLob &lob,
const bson::OID &oid,
583 virtual INT32 openLob( sdbLob &lob,
const bson::OID &oid,
586 virtual INT32 listLobs( sdbCursor &cursor,
587 const bson::BSONObj &condition = _sdbStaticObject,
588 const bson::BSONObj &selected = _sdbStaticObject,
589 const bson::BSONObj &orderBy = _sdbStaticObject,
590 const bson::BSONObj &hint = _sdbStaticObject,
592 INT64 numToReturn = -1 ) = 0 ;
594 virtual INT32 listLobs( _sdbCursor **cursor,
595 const bson::BSONObj &condition = _sdbStaticObject,
596 const bson::BSONObj &selected = _sdbStaticObject,
597 const bson::BSONObj &orderBy = _sdbStaticObject,
598 const bson::BSONObj &hint = _sdbStaticObject,
600 INT64 numToReturn = -1 ) = 0 ;
602 virtual INT32 createLobID( bson::OID &oid,
const CHAR *pTimeStamp = NULL ) = 0 ;
604 virtual INT32 listLobPieces(
606 const bson::BSONObj &condition = _sdbStaticObject,
607 const bson::BSONObj &selected = _sdbStaticObject,
608 const bson::BSONObj &orderBy = _sdbStaticObject,
609 const bson::BSONObj &hint = _sdbStaticObject,
611 INT64 numToReturn = -1 ) = 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 ;
623 virtual INT32 truncate(
const bson::BSONObj &options = _sdbStaticObject ) = 0 ;
626 virtual INT32 createIdIndex(
const bson::BSONObj &options = _sdbStaticObject ) = 0 ;
628 virtual INT32 dropIdIndex() = 0 ;
630 virtual INT32 createAutoIncrement(
const bson::BSONObj &options ) = 0;
632 virtual INT32 createAutoIncrement(
const std::vector<bson::BSONObj> &options ) = 0;
634 virtual INT32 dropAutoIncrement(
const CHAR *fieldName ) = 0;
636 virtual INT32 dropAutoIncrement(
const std::vector<const CHAR*> &fieldNames ) = 0;
638 virtual INT32 pop (
const bson::BSONObj &option = _sdbStaticObject ) = 0 ;
640 virtual INT32 enableSharding (
const bson::BSONObj &options ) = 0 ;
642 virtual INT32 disableSharding () = 0 ;
644 virtual INT32 enableCompression (
const bson::BSONObj &options = _sdbStaticObject ) = 0 ;
646 virtual INT32 disableCompression () = 0 ;
648 virtual INT32 setAttributes (
const bson::BSONObj &options ) = 0 ;
650 virtual INT32 getDetail ( _sdbCursor **cursor ) = 0 ;
652 virtual INT32 getDetail ( sdbCursor &cursor ) = 0 ;
654 virtual INT32 getIndexStat (
const CHAR *pIndexName, bson::BSONObj &result ) = 0 ;
656 virtual void setVersion( INT32 clVersion ) = 0;
657 virtual INT32 getVersion() = 0;
719 INT32 getCount ( SINT64 &count,
720 const bson::BSONObj &condition = _sdbStaticObject,
721 const bson::BSONObj &hint = _sdbStaticObject )
725 return SDB_NOT_CONNECTED ;
727 return pCollection->
getCount ( count, condition, hint ) ;
747 INT32 split (
const CHAR *pSourceGroupName,
748 const CHAR *pTargetGroupName,
749 const bson::BSONObj &splitCondition,
750 const bson::BSONObj &splitEndCondition = _sdbStaticObject)
754 return SDB_NOT_CONNECTED ;
756 return pCollection->split ( pSourceGroupName,
773 INT32 split (
const CHAR *pSourceGroupName,
774 const CHAR *pTargetGroupName,
779 return SDB_NOT_CONNECTED ;
781 return pCollection->split ( pSourceGroupName,
805 INT32 splitAsync ( SINT64 &taskID,
806 const CHAR *pSourceGroupName,
807 const CHAR *pTargetGroupName,
808 const bson::BSONObj &splitCondition,
809 const bson::BSONObj &splitEndCondition = _sdbStaticObject )
813 return SDB_NOT_CONNECTED ;
815 return pCollection->splitAsync ( taskID,
819 splitEndCondition ) ;
835 INT32 splitAsync (
const CHAR *pSourceGroupName,
836 const CHAR *pTargetGroupName,
842 return SDB_NOT_CONNECTED ;
844 return pCollection->splitAsync ( pSourceGroupName,
869 INT32 alterCollection (
const bson::BSONObj &options )
873 return SDB_NOT_CONNECTED ;
875 return pCollection->alterCollection ( options ) ;
900 INT32 insert (
const bson::BSONObj &obj, bson::OID *pId = NULL )
904 return SDB_NOT_CONNECTED ;
906 return pCollection->insert ( obj, pId ) ;
953 INT32 insert (
const bson::BSONObj &obj,
955 bson::BSONObj *pResult = NULL )
959 return SDB_NOT_CONNECTED ;
961 return pCollection->insert ( obj, flags, pResult ) ;
1011 INT32 insert (
const bson::BSONObj &obj,
1012 const bson::BSONObj &hint,
1014 bson::BSONObj *pResult = NULL )
1018 return SDB_NOT_CONNECTED ;
1020 return pCollection->insert ( obj, hint, flags, pResult ) ;
1070 INT32 insert ( std::vector<bson::BSONObj> &objs,
1072 bson::BSONObj *pResult = NULL )
1076 return SDB_NOT_CONNECTED ;
1078 return pCollection->insert( objs, flags, pResult ) ;
1131 INT32 insert ( std::vector<bson::BSONObj> &objs,
1132 const bson::BSONObj &hint,
1134 bson::BSONObj *pResult = NULL )
1138 return SDB_NOT_CONNECTED ;
1140 return pCollection->insert( objs, hint, flags, pResult ) ;
1192 INT32 insert (
const bson::BSONObj objs[],
1195 bson::BSONObj *pResult = NULL )
1199 return SDB_NOT_CONNECTED ;
1201 return pCollection->insert ( objs, size, flags, pResult ) ;
1231 INT32 bulkInsert ( SINT32 flags,
1232 std::vector<bson::BSONObj> &objs )
1236 return SDB_NOT_CONNECTED ;
1238 return pCollection->bulkInsert ( flags, objs ) ;
1273 INT32 update (
const bson::BSONObj &rule,
1274 const bson::BSONObj &condition = _sdbStaticObject,
1275 const bson::BSONObj &hint = _sdbStaticObject,
1277 bson::BSONObj *pResult = NULL
1282 return SDB_NOT_CONNECTED ;
1284 return pCollection->update ( rule, condition, hint, flag, pResult ) ;
1320 INT32 upsert (
const bson::BSONObj &rule,
1321 const bson::BSONObj &condition = _sdbStaticObject,
1322 const bson::BSONObj &hint = _sdbStaticObject,
1323 const bson::BSONObj &setOnInsert = _sdbStaticObject,
1325 bson::BSONObj *pResult = NULL
1330 return SDB_NOT_CONNECTED ;
1332 return pCollection->upsert ( rule, condition, hint, setOnInsert,
1357 INT32 del (
const bson::BSONObj &condition = _sdbStaticObject,
1358 const bson::BSONObj &hint = _sdbStaticObject,
1360 bson::BSONObj *pResult = NULL
1365 return SDB_NOT_CONNECTED ;
1367 return pCollection->del ( condition, hint, flag, pResult ) ;
1400 INT32 query ( _sdbCursor **cursor,
1401 const bson::BSONObj &condition = _sdbStaticObject,
1402 const bson::BSONObj &selected = _sdbStaticObject,
1403 const bson::BSONObj &orderBy = _sdbStaticObject,
1404 const bson::BSONObj &hint = _sdbStaticObject,
1405 INT64 numToSkip = 0,
1406 INT64 numToReturn = -1,
1412 return SDB_NOT_CONNECTED ;
1414 return pCollection->query ( cursor, condition, selected, orderBy,
1415 hint, numToSkip, numToReturn, flags ) ;
1449 const bson::BSONObj &condition = _sdbStaticObject,
1450 const bson::BSONObj &selected = _sdbStaticObject,
1451 const bson::BSONObj &orderBy = _sdbStaticObject,
1452 const bson::BSONObj &hint = _sdbStaticObject,
1453 INT64 numToSkip = 0,
1454 INT64 numToReturn = -1,
1460 return SDB_NOT_CONNECTED ;
1463 return pCollection->query ( cursor, condition, selected, orderBy,
1464 hint, numToSkip, numToReturn, flags ) ;
1495 INT32 queryOne( bson::BSONObj &obj,
1496 const bson::BSONObj &condition = _sdbStaticObject,
1497 const bson::BSONObj &selected = _sdbStaticObject,
1498 const bson::BSONObj &orderBy = _sdbStaticObject,
1499 const bson::BSONObj &hint = _sdbStaticObject,
1500 INT64 numToSkip = 0,
1505 return SDB_NOT_CONNECTED ;
1507 return pCollection->queryOne( obj, condition, selected, orderBy,
1508 hint, numToSkip, flag ) ;
1547 const bson::BSONObj &update,
1548 const bson::BSONObj &condition = _sdbStaticObject,
1549 const bson::BSONObj &selected = _sdbStaticObject,
1550 const bson::BSONObj &orderBy = _sdbStaticObject,
1551 const bson::BSONObj &hint = _sdbStaticObject,
1552 INT64 numToSkip = 0,
1553 INT64 numToReturn = -1,
1555 BOOLEAN returnNew = FALSE
1560 return SDB_NOT_CONNECTED ;
1563 return pCollection->queryAndUpdate( &cursor.
pCursor , update, condition,
1564 selected, orderBy, hint,
1565 numToSkip, numToReturn, flag, returnNew ) ;
1599 const bson::BSONObj &condition = _sdbStaticObject,
1600 const bson::BSONObj &selected = _sdbStaticObject,
1601 const bson::BSONObj &orderBy = _sdbStaticObject,
1602 const bson::BSONObj &hint = _sdbStaticObject,
1603 INT64 numToSkip = 0,
1604 INT64 numToReturn = -1,
1610 return SDB_NOT_CONNECTED ;
1613 return pCollection->queryAndRemove( &cursor.
pCursor , condition,
1614 selected, orderBy, hint,
1615 numToSkip, numToReturn, flag ) ;
1634 INT32 createIndex (
const bson::BSONObj &indexDef,
1635 const CHAR *pIndexName,
1638 INT32 sortBufferSize =
1639 SDB_INDEX_SORT_BUFFER_DEFAULT_SIZE )
1643 return SDB_NOT_CONNECTED ;
1645 return pCollection->createIndex ( indexDef, pIndexName, isUnique,
1646 isEnforced, sortBufferSize ) ;
1675 INT32 createIndex (
const bson::BSONObj &indexDef,
1676 const CHAR *pIndexName,
1677 const bson::BSONObj &indexAttr = _sdbStaticObject,
1678 const bson::BSONObj &option = _sdbStaticObject )
1681 return SDB_NOT_CONNECTED ;
1682 return pCollection->createIndex ( indexDef, pIndexName,
1683 indexAttr, option ) ;
1709 INT32 createIndexAsync ( SINT64 &taskID,
1710 const bson::BSONObj &indexDef,
1711 const CHAR *pIndexName,
1712 const bson::BSONObj &indexAttr = _sdbStaticObject,
1713 const bson::BSONObj &option = _sdbStaticObject )
1717 return SDB_NOT_CONNECTED ;
1719 return pCollection->createIndexAsync ( taskID, indexDef, pIndexName,
1720 indexAttr, option ) ;
1741 INT32 snapshotIndexes ( _sdbCursor **cursor,
1742 const bson::BSONObj &condition = _sdbStaticObject,
1743 const bson::BSONObj &selector = _sdbStaticObject,
1744 const bson::BSONObj &orderby = _sdbStaticObject,
1745 const bson::BSONObj &hint = _sdbStaticObject,
1746 INT64 numToSkip = 0,
1747 INT64 numToReturn = -1 )
1751 return SDB_NOT_CONNECTED ;
1753 return pCollection->snapshotIndexes ( cursor, condition,
1754 selector, orderby, hint,
1755 numToSkip, numToReturn ) ;
1766 INT32 getIndexes ( _sdbCursor **cursor,
1767 const CHAR *pIndexName )
1771 return SDB_NOT_CONNECTED ;
1773 return pCollection->getIndexes ( cursor, pIndexName ) ;
1786 const CHAR *pIndexName )
1790 return SDB_NOT_CONNECTED ;
1793 return pCollection->getIndexes ( cursor, pIndexName ) ;
1802 INT32 getIndexes ( std::vector<bson::BSONObj> &infos )
1806 return SDB_NOT_CONNECTED ;
1808 return pCollection->getIndexes ( infos ) ;
1818 INT32 getIndex (
const CHAR *pIndexName, bson::BSONObj &info )
1822 return SDB_NOT_CONNECTED ;
1824 return pCollection->getIndex ( pIndexName, info ) ;
1833 INT32 dropIndex (
const CHAR *pIndexName )
1837 return SDB_NOT_CONNECTED ;
1839 return pCollection->dropIndex ( pIndexName ) ;
1850 INT32 dropIndexAsync ( SINT64 &taskID,
const CHAR *pIndexName )
1853 return SDB_NOT_CONNECTED ;
1854 return pCollection->dropIndexAsync ( taskID, pIndexName ) ;
1865 INT32 copyIndex (
const CHAR *subClFullName,
const CHAR *pIndexName )
1868 return SDB_NOT_CONNECTED ;
1869 return pCollection->copyIndex ( subClFullName, pIndexName ) ;
1882 INT32 copyIndexAsync ( SINT64 &taskID,
const CHAR *subClFullName,
1883 const CHAR *pIndexName )
1886 return SDB_NOT_CONNECTED ;
1887 return pCollection->copyIndexAsync ( taskID, subClFullName,
1901 return SDB_NOT_CONNECTED ;
1903 return pCollection->create () ;
1916 return SDB_NOT_CONNECTED ;
1918 return pCollection->drop () ;
1925 const CHAR *getCollectionName ()
1931 return pCollection->getCollectionName () ;
1938 const CHAR *getCSName ()
1944 return pCollection->getCSName () ;
1951 const CHAR *getFullName ()
1957 return pCollection->getFullName () ;
1969 INT32 aggregate ( _sdbCursor **cursor,
1970 std::vector<bson::BSONObj> &obj
1975 return SDB_NOT_CONNECTED ;
1977 return pCollection->aggregate ( cursor, obj ) ;
1990 std::vector<bson::BSONObj> &obj
1995 return SDB_NOT_CONNECTED ;
1998 return pCollection->aggregate ( cursor, obj ) ;
2020 INT32 getQueryMeta ( _sdbCursor **cursor,
2021 const bson::BSONObj &condition = _sdbStaticObject,
2022 const bson::BSONObj &orderBy = _sdbStaticObject,
2023 const bson::BSONObj &hint = _sdbStaticObject,
2024 INT64 numToSkip = 0,
2025 INT64 numToReturn = -1 )
2029 return SDB_NOT_CONNECTED ;
2031 return pCollection->getQueryMeta ( cursor, condition, orderBy,
2032 hint, numToSkip, numToReturn ) ;
2056 const bson::BSONObj &condition = _sdbStaticObject,
2057 const bson::BSONObj &orderBy = _sdbStaticObject,
2058 const bson::BSONObj &hint = _sdbStaticObject,
2059 INT64 numToSkip = 0,
2060 INT64 numToReturn = -1 )
2064 return SDB_NOT_CONNECTED ;
2067 return pCollection->getQueryMeta ( cursor, condition, orderBy,
2068 hint, numToSkip, numToReturn ) ;
2084 INT32 attachCollection (
const CHAR *subClFullName,
2085 const bson::BSONObj &options )
2089 return SDB_NOT_CONNECTED ;
2091 return pCollection->attachCollection ( subClFullName, options ) ;
2100 INT32 detachCollection (
const CHAR *subClFullName )
2104 return SDB_NOT_CONNECTED ;
2106 return pCollection->detachCollection ( subClFullName ) ;
2145 const bson::BSONObj &condition = _sdbStaticObject,
2146 const bson::BSONObj &select = _sdbStaticObject,
2147 const bson::BSONObj &orderBy = _sdbStaticObject,
2148 const bson::BSONObj &hint = _sdbStaticObject,
2149 INT64 numToSkip = 0,
2150 INT64 numToReturn = -1,
2152 const bson::BSONObj &options = _sdbStaticObject )
2156 return SDB_NOT_CONNECTED ;
2159 return pCollection->explain( cursor, condition, select, orderBy, hint,
2160 numToSkip, numToReturn, flag, options ) ;
2163 INT32 explain ( _sdbCursor **cursor,
2164 const bson::BSONObj &condition = _sdbStaticObject,
2165 const bson::BSONObj &select = _sdbStaticObject,
2166 const bson::BSONObj &orderBy = _sdbStaticObject,
2167 const bson::BSONObj &hint = _sdbStaticObject,
2168 INT64 numToSkip = 0,
2169 INT64 numToReturn = -1,
2171 const bson::BSONObj &options = _sdbStaticObject )
2175 return SDB_NOT_CONNECTED ;
2177 return pCollection->explain( cursor, condition, select, orderBy, hint,
2178 numToSkip, numToReturn, flag, options ) ;
2189 INT32 createLob(
sdbLob &lob,
const bson::OID *oid = NULL )
2193 return SDB_NOT_CONNECTED ;
2195 return pCollection->createLob( lob, oid ) ;
2204 INT32 removeLob(
const bson::OID &oid )
2208 return SDB_NOT_CONNECTED ;
2210 return pCollection->removeLob( oid ) ;
2220 INT32 truncateLob(
const bson::OID &oid, INT64 length )
2224 return SDB_NOT_CONNECTED ;
2226 return pCollection->truncateLob( oid, length ) ;
2238 INT32 openLob(
sdbLob &lob,
const bson::OID &oid,
2243 return SDB_NOT_CONNECTED ;
2245 return pCollection->openLob( lob, oid, mode ) ;
2257 INT32 openLob(
sdbLob &lob,
const bson::OID &oid, INT32 mode )
2261 return SDB_NOT_CONNECTED ;
2263 return pCollection->openLob( lob, oid, mode ) ;
2284 const bson::BSONObj &condition = _sdbStaticObject,
2285 const bson::BSONObj &selected = _sdbStaticObject,
2286 const bson::BSONObj &orderBy = _sdbStaticObject,
2287 const bson::BSONObj &hint = _sdbStaticObject,
2288 INT64 numToSkip = 0,
2289 INT64 numToReturn = -1 )
2293 return SDB_NOT_CONNECTED ;
2296 return pCollection->listLobs( cursor, condition, selected, orderBy,
2297 hint, numToSkip, numToReturn ) ;
2300 INT32 listLobs( _sdbCursor **cursor,
2301 const bson::BSONObj &condition = _sdbStaticObject,
2302 const bson::BSONObj &selected = _sdbStaticObject,
2303 const bson::BSONObj &orderBy = _sdbStaticObject,
2304 const bson::BSONObj &hint = _sdbStaticObject,
2305 INT64 numToSkip = 0,
2306 INT64 numToReturn = -1 )
2310 return SDB_NOT_CONNECTED ;
2312 return pCollection->listLobs( cursor, condition, selected, orderBy,
2313 hint, numToSkip, numToReturn ) ;
2324 INT32 createLobID( bson::OID &oid,
const CHAR *pTimeStamp = NULL )
2328 return SDB_NOT_CONNECTED ;
2330 return pCollection->createLobID( oid, pTimeStamp ) ;
2340 INT32 truncate(
const bson::BSONObj &options = _sdbStaticObject )
2344 return SDB_NOT_CONNECTED ;
2346 return pCollection->truncate( options ) ;
2358 INT32 createIdIndex(
const bson::BSONObj &options = _sdbStaticObject )
2362 return SDB_NOT_CONNECTED ;
2364 return pCollection->createIdIndex( options ) ;
2377 return SDB_NOT_CONNECTED ;
2379 return pCollection->dropIdIndex() ;
2399 INT32 createAutoIncrement (
const bson::BSONObj &options )
2403 return SDB_NOT_CONNECTED ;
2405 return pCollection->createAutoIncrement( options ) ;
2414 INT32 createAutoIncrement (
const std::vector<bson::BSONObj> &options )
2418 return SDB_NOT_CONNECTED ;
2420 return pCollection->createAutoIncrement( options ) ;
2429 INT32 dropAutoIncrement (
const CHAR * fieldName )
2433 return SDB_NOT_CONNECTED ;
2435 return pCollection->dropAutoIncrement( fieldName ) ;
2444 INT32 dropAutoIncrement (
const std::vector<const CHAR*> &fieldNames )
2448 return SDB_NOT_CONNECTED ;
2450 return pCollection->dropAutoIncrement( fieldNames ) ;
2466 INT32 enableSharding (
const bson::BSONObj & options = _sdbStaticObject )
2470 return SDB_NOT_CONNECTED ;
2472 return pCollection->enableSharding( options ) ;
2480 INT32 disableSharding ()
2484 return SDB_NOT_CONNECTED ;
2486 return pCollection->disableSharding() ;
2497 INT32 enableCompression (
const bson::BSONObj & options = _sdbStaticObject )
2501 return SDB_NOT_CONNECTED ;
2503 return pCollection->enableCompression( options ) ;
2511 INT32 disableCompression ()
2515 return SDB_NOT_CONNECTED ;
2517 return pCollection->disableCompression() ;
2540 INT32 setAttributes (
const bson::BSONObj &options )
2544 return SDB_NOT_CONNECTED ;
2546 return pCollection->setAttributes( options ) ;
2558 INT32 pop (
const bson::BSONObj &option = _sdbStaticObject )
2562 return SDB_NOT_CONNECTED ;
2564 return pCollection->pop( option ) ;
2567 INT32 listLobPieces( _sdbCursor **cursor,
2568 const bson::BSONObj &condition = _sdbStaticObject,
2569 const bson::BSONObj &selected = _sdbStaticObject,
2570 const bson::BSONObj &orderBy = _sdbStaticObject,
2571 const bson::BSONObj &hint = _sdbStaticObject,
2572 INT64 numToSkip = 0,
2573 INT64 numToReturn = -1 )
2577 return SDB_NOT_CONNECTED ;
2579 return pCollection->listLobPieces( cursor, condition, selected,
2580 orderBy, hint, numToSkip,
2597 INT32 listLobPieces( sdbCursor &cursor,
2598 const bson::BSONObj &condition = _sdbStaticObject,
2599 const bson::BSONObj &selected = _sdbStaticObject,
2600 const bson::BSONObj &orderBy = _sdbStaticObject,
2601 const bson::BSONObj &hint = _sdbStaticObject,
2602 INT64 numToSkip = 0,
2603 INT64 numToReturn = -1 )
2607 return SDB_NOT_CONNECTED ;
2610 return pCollection->listLobPieces( cursor, condition, selected,
2611 orderBy, hint, numToSkip,
2621 INT32 getDetail ( _sdbCursor **cursor )
2625 return SDB_NOT_CONNECTED ;
2627 return pCollection->getDetail ( cursor ) ;
2640 return SDB_NOT_CONNECTED ;
2642 return pCollection->getDetail( cursor ) ;
2652 INT32 getIndexStat(
const CHAR *pIndexName, bson::BSONObj &result )
2656 return SDB_NOT_CONNECTED ;
2658 return pCollection->getIndexStat( pIndexName, result ) ;
2665 void setVersion( INT32 clVersion )
2667 pCollection->setVersion( clVersion ) ;
2675 return pCollection->getVersion() ;
2695 class DLLEXPORT _sdbNode
2698 _sdbNode (
const _sdbNode& other ) ;
2699 _sdbNode& operator=(
const _sdbNode& ) ;
2702 virtual ~_sdbNode () {}
2704 virtual INT32 connect ( _sdb **dbConn ) = 0 ;
2705 virtual INT32 connect (
sdb &dbConn ) = 0 ;
2711 virtual const CHAR *getHostName () = 0 ;
2714 virtual const CHAR *getServiceName () = 0 ;
2717 virtual const CHAR *getNodeName () = 0 ;
2720 virtual INT32 getNodeID( INT32 &nodeID )
const = 0 ;
2723 virtual INT32 stop () = 0 ;
2726 virtual INT32 start () = 0 ;
2782 INT32 connect ( _sdb **dbConn )
2786 return SDB_NOT_CONNECTED ;
2788 return pNode->connect ( dbConn ) ;
2802 return SDB_NOT_CONNECTED ;
2807 return pNode->connect ( dbConn ) ;
2820 return SDB_NODE_UNKNOWN ;
2822 return pNode->getStatus () ;
2829 const CHAR *getHostName ()
2835 return pNode->getHostName () ;
2842 const CHAR *getServiceName ()
2848 return pNode->getServiceName () ;
2855 const CHAR *getNodeName ()
2861 return pNode->getNodeName () ;
2868 INT32 getNodeID( INT32 &nodeID )
const
2872 return SDB_NOT_CONNECTED ;
2874 return pNode->getNodeID( nodeID ) ;
2886 return SDB_NOT_CONNECTED ;
2888 return pNode->stop () ;
2900 return SDB_NOT_CONNECTED ;
2902 return pNode->start () ;
2914 class DLLEXPORT _sdbReplicaGroup
2917 _sdbReplicaGroup (
const _sdbReplicaGroup& other ) ;
2918 _sdbReplicaGroup& operator=(
const _sdbReplicaGroup& ) ;
2920 _sdbReplicaGroup () {}
2921 virtual ~_sdbReplicaGroup () {}
2923 virtual INT32 getNodeNum (
sdbNodeStatus status, INT32 *num ) = 0 ;
2926 virtual INT32 getDetail ( bson::BSONObj &result ) = 0 ;
2929 virtual INT32 getMaster ( _sdbNode **node ) = 0 ;
2930 virtual INT32 getMaster ( sdbNode &node ) = 0 ;
2933 virtual INT32 getSlave ( _sdbNode **node,
2934 const vector<INT32>& positions = _sdbStaticVec ) = 0 ;
2935 virtual INT32 getSlave ( sdbNode &node,
2936 const vector<INT32>& positions = _sdbStaticVec ) = 0 ;
2939 virtual INT32 getNode (
const CHAR *pNodeName,
2940 _sdbNode **node ) = 0 ;
2941 virtual INT32 getNode (
const CHAR *pNodeName,
2942 sdbNode &node ) = 0 ;
2945 virtual INT32 getNode (
const CHAR *pHostName,
2946 const CHAR *pServiceName,
2947 _sdbNode **node ) = 0 ;
2948 virtual INT32 getNode (
const CHAR *pHostName,
2949 const CHAR *pServiceName,
2950 sdbNode &node ) = 0 ;
2953 virtual INT32 createNode (
const CHAR *pHostName,
2954 const CHAR *pServiceName,
2955 const CHAR *pDatabasePath,
2956 std::map<std::string,std::string> &config )= 0;
2958 virtual INT32 createNode (
const CHAR *pHostName,
2959 const CHAR *pServiceName,
2960 const CHAR *pDatabasePath,
2961 const bson::BSONObj &options = _sdbStaticObject )= 0;
2964 virtual INT32 removeNode (
const CHAR *pHostName,
2965 const CHAR *pServiceName,
2966 const bson::BSONObj &configure = _sdbStaticObject ) = 0 ;
2968 virtual INT32 stop () = 0 ;
2971 virtual INT32 start () = 0 ;
2974 virtual const CHAR *getName () = 0 ;
2977 virtual BOOLEAN isCatalog () = 0 ;
2980 virtual INT32 attachNode(
const CHAR *pHostName,
2981 const CHAR *pSvcName,
2982 const bson::BSONObj &options ) = 0 ;
2985 virtual INT32 detachNode(
const CHAR *pHostName,
2986 const CHAR *pSvcName,
2987 const bson::BSONObj &options ) = 0 ;
2990 virtual INT32 reelect(
const bson::BSONObj &options = _sdbStaticObject ) = 0 ;
3015 pReplicaGroup = NULL ;
3023 if ( pReplicaGroup )
3025 delete pReplicaGroup ;
3045 if ( !pReplicaGroup )
3047 return SDB_NOT_CONNECTED ;
3049 return pReplicaGroup->
getNodeNum ( status, num ) ;
3058 INT32 getDetail ( bson::BSONObj &result )
3060 if ( !pReplicaGroup )
3062 return SDB_NOT_CONNECTED ;
3064 return pReplicaGroup->getDetail ( result ) ;
3073 INT32 getMaster ( _sdbNode **node )
3075 if ( !pReplicaGroup )
3077 return SDB_NOT_CONNECTED ;
3079 return pReplicaGroup->getMaster ( node ) ;
3090 if ( !pReplicaGroup )
3092 return SDB_NOT_CONNECTED ;
3095 return pReplicaGroup->getMaster ( node ) ;
3106 INT32 getSlave ( _sdbNode **node,
3107 const vector<INT32>& positions = _sdbStaticVec )
3109 if ( !pReplicaGroup )
3111 return SDB_NOT_CONNECTED ;
3113 return pReplicaGroup->getSlave ( node, positions ) ;
3125 const vector<INT32>& positions = _sdbStaticVec )
3127 if ( !pReplicaGroup )
3129 return SDB_NOT_CONNECTED ;
3132 return pReplicaGroup->getSlave ( node, positions ) ;
3143 INT32 getNode (
const CHAR *pNodeName,
3146 if ( !pReplicaGroup )
3148 return SDB_NOT_CONNECTED ;
3150 return pReplicaGroup->getNode ( pNodeName, node ) ;
3161 INT32 getNode (
const CHAR *pNodeName,
3164 if ( !pReplicaGroup )
3166 return SDB_NOT_CONNECTED ;
3169 return pReplicaGroup->getNode ( pNodeName, node ) ;
3172 INT32 getNode (
const CHAR *pHostName,
3173 const CHAR *pServiceName,
3176 if ( !pReplicaGroup )
3178 return SDB_NOT_CONNECTED ;
3180 return pReplicaGroup->getNode ( pHostName, pServiceName, node ) ;
3193 INT32 getNode (
const CHAR *pHostName,
3194 const CHAR *pServiceName,
3197 if ( !pReplicaGroup )
3199 return SDB_NOT_CONNECTED ;
3202 return pReplicaGroup->getNode ( pHostName, pServiceName, node ) ;
3218 INT32 createNode (
const CHAR *pHostName,
3219 const CHAR *pServiceName,
3220 const CHAR *pDatabasePath,
3221 std::map<std::string,std::string> &config )
3223 if ( !pReplicaGroup )
3225 return SDB_NOT_CONNECTED ;
3227 return pReplicaGroup->createNode ( pHostName, pServiceName,
3228 pDatabasePath, config ) ;
3243 INT32 createNode (
const CHAR *pHostName,
3244 const CHAR *pServiceName,
3245 const CHAR *pDatabasePath,
3246 const bson::BSONObj &options = _sdbStaticObject )
3248 if ( !pReplicaGroup )
3250 return SDB_NOT_CONNECTED ;
3252 return pReplicaGroup->createNode ( pHostName, pServiceName,
3253 pDatabasePath, options ) ;
3266 INT32 removeNode (
const CHAR *pHostName,
3267 const CHAR *pServiceName,
3268 const bson::BSONObj &configure = _sdbStaticObject )
3270 if ( !pReplicaGroup )
3272 return SDB_NOT_CONNECTED ;
3274 return pReplicaGroup->removeNode ( pHostName, pServiceName,
3284 if ( !pReplicaGroup )
3286 return SDB_NOT_CONNECTED ;
3288 return pReplicaGroup->stop () ;
3298 if ( !pReplicaGroup )
3300 return SDB_NOT_CONNECTED ;
3302 return pReplicaGroup->start () ;
3309 const CHAR *getName ()
3311 if ( !pReplicaGroup )
3315 return pReplicaGroup->getName() ;
3323 BOOLEAN isCatalog ()
3325 if ( !pReplicaGroup )
3329 return pReplicaGroup->isCatalog() ;
3346 INT32 attachNode(
const CHAR *pHostName,
3347 const CHAR *pSvcName,
3348 const bson::BSONObj &options )
3350 if ( !pReplicaGroup )
3352 return SDB_NOT_CONNECTED ;
3354 return pReplicaGroup->attachNode( pHostName, pSvcName, options ) ;
3372 INT32 detachNode(
const CHAR *pHostName,
3373 const CHAR *pSvcName,
3374 const bson::BSONObj &options )
3376 if ( !pReplicaGroup )
3378 return SDB_NOT_CONNECTED ;
3380 return pReplicaGroup->detachNode( pHostName, pSvcName, options ) ;
3391 INT32 reelect(
const bson::BSONObj &options = _sdbStaticObject )
3393 if( !pReplicaGroup )
3395 return SDB_NOT_CONNECTED ;
3397 return pReplicaGroup->reelect( options ) ;
3401 class DLLEXPORT _sdbCollectionSpace
3404 _sdbCollectionSpace (
const _sdbCollectionSpace& other ) ;
3405 _sdbCollectionSpace& operator=(
const _sdbCollectionSpace& ) ;
3407 _sdbCollectionSpace () {}
3408 virtual ~_sdbCollectionSpace () {}
3410 virtual INT32 getCollection (
const CHAR *pCollectionName,
3411 _sdbCollection **collection,
3412 BOOLEAN checkExist = TRUE ) = 0 ;
3414 virtual INT32 getCollection (
const CHAR *pCollectionName,
3415 sdbCollection &collection,
3416 BOOLEAN checkExist = TRUE ) = 0 ;
3419 virtual INT32 createCollection (
const CHAR *pCollection,
3420 const bson::BSONObj &options,
3421 _sdbCollection **collection ) = 0 ;
3423 virtual INT32 createCollection (
const CHAR *pCollection,
3424 const bson::BSONObj &options,
3425 sdbCollection &collection ) = 0 ;
3428 virtual INT32 createCollection (
const CHAR *pCollection,
3429 _sdbCollection **collection ) = 0 ;
3431 virtual INT32 createCollection (
const CHAR *pCollection,
3432 sdbCollection &collection ) = 0 ;
3435 virtual INT32 dropCollection(
const CHAR *pCollection,
3436 const bson::BSONObj &options ) = 0 ;
3438 virtual INT32 listCollections ( _sdbCursor **cursor ) = 0 ;
3440 virtual INT32 listCollections ( sdbCursor &cursor ) = 0 ;
3443 virtual INT32 create () = 0 ;
3445 virtual INT32 drop () = 0 ;
3448 virtual const CHAR *getCSName () = 0 ;
3451 virtual INT32 renameCollection(
const CHAR* oldName,
const CHAR* newName,
3452 const bson::BSONObj &options = _sdbStaticObject ) = 0 ;
3454 virtual INT32 alterCollectionSpace (
const bson::BSONObj & options ) = 0 ;
3456 virtual INT32 setDomain (
const bson::BSONObj & options ) = 0 ;
3458 virtual INT32 getDomainName ( CHAR *result, INT32 resultLen ) = 0 ;
3460 virtual INT32 removeDomain () = 0 ;
3462 virtual INT32 enableCapped () = 0 ;
3464 virtual INT32 disableCapped () = 0 ;
3466 virtual INT32 setAttributes (
const bson::BSONObj & options ) = 0 ;
3500 pCollectionSpace = NULL ;
3508 if ( pCollectionSpace )
3510 delete pCollectionSpace ;
3514 INT32 getCollection (
const CHAR *pCollectionName,
3515 _sdbCollection **collection,
3516 BOOLEAN checkExist = TRUE )
3518 if ( !pCollectionSpace )
3520 return SDB_NOT_CONNECTED ;
3522 return pCollectionSpace->getCollection ( pCollectionName,
3523 collection, checkExist ) ;
3536 INT32 getCollection (
const CHAR *pCollectionName,
3538 BOOLEAN checkExist = TRUE )
3540 if ( !pCollectionSpace )
3542 return SDB_NOT_CONNECTED ;
3545 return pCollectionSpace->getCollection ( pCollectionName,
3550 INT32 createCollection (
const CHAR *pCollection,
3551 const bson::BSONObj &options,
3552 _sdbCollection **collection )
3554 if ( !pCollectionSpace )
3556 return SDB_NOT_CONNECTED ;
3558 return pCollectionSpace->createCollection ( pCollection,
3575 INT32 createCollection (
const CHAR *pCollection,
3576 const bson::BSONObj &options,
3579 if ( !pCollectionSpace )
3581 return SDB_NOT_CONNECTED ;
3584 return pCollectionSpace->createCollection ( pCollection,
3589 INT32 createCollection (
const CHAR *pCollection,
3590 _sdbCollection **collection )
3592 if ( !pCollectionSpace )
3594 return SDB_NOT_CONNECTED ;
3596 return pCollectionSpace->createCollection ( pCollection,
3609 INT32 createCollection (
const CHAR *pCollection,
3612 if ( !pCollectionSpace )
3614 return SDB_NOT_CONNECTED ;
3617 return pCollectionSpace->createCollection ( pCollection,
3630 INT32 dropCollection(
const CHAR *pCollection,
3631 const bson::BSONObj &options = _sdbStaticObject )
3633 if ( !pCollectionSpace )
3635 return SDB_NOT_CONNECTED ;
3637 return pCollectionSpace->dropCollection( pCollection, options ) ;
3646 INT32 listCollections ( _sdbCursor **cursor )
3648 if ( !pCollectionSpace )
3650 return SDB_NOT_CONNECTED ;
3652 return pCollectionSpace->listCollections( cursor ) ;
3663 if ( !pCollectionSpace )
3665 return SDB_NOT_CONNECTED ;
3668 return pCollectionSpace->listCollections( cursor ) ;
3679 if ( !pCollectionSpace )
3681 return SDB_NOT_CONNECTED ;
3683 return pCollectionSpace->create () ;
3694 if ( !pCollectionSpace )
3696 return SDB_NOT_CONNECTED ;
3698 return pCollectionSpace->drop () ;
3705 const CHAR *getCSName ()
3707 if ( !pCollectionSpace )
3711 return pCollectionSpace->getCSName () ;
3724 INT32 renameCollection(
const CHAR* oldName,
const CHAR* newName,
3725 const bson::BSONObj &options = _sdbStaticObject )
3727 if( !pCollectionSpace )
3729 return SDB_NOT_CONNECTED ;
3731 return pCollectionSpace->renameCollection( oldName, newName, options ) ;
3745 INT32 alterCollectionSpace (
const bson::BSONObj & options )
3747 if ( NULL == pCollectionSpace )
3749 return SDB_NOT_CONNECTED ;
3751 return pCollectionSpace->alterCollectionSpace( options ) ;
3763 INT32 setDomain (
const bson::BSONObj & options )
3765 if ( NULL == pCollectionSpace )
3767 return SDB_NOT_CONNECTED ;
3769 return pCollectionSpace->setDomain( options ) ;
3779 INT32 getDomainName ( CHAR *result, INT32 resultLen )
3781 if ( !pCollectionSpace )
3783 return SDB_NOT_CONNECTED ;
3785 return pCollectionSpace->getDomainName( result, resultLen ) ;
3793 INT32 removeDomain ()
3795 if ( NULL == pCollectionSpace )
3797 return SDB_NOT_CONNECTED ;
3799 return pCollectionSpace->removeDomain() ;
3807 INT32 enableCapped ()
3809 if ( NULL == pCollectionSpace )
3811 return SDB_NOT_CONNECTED ;
3813 return pCollectionSpace->enableCapped() ;
3821 INT32 disableCapped ()
3823 if ( NULL == pCollectionSpace )
3825 return SDB_NOT_CONNECTED ;
3827 return pCollectionSpace->disableCapped() ;
3841 INT32 setAttributes (
const bson::BSONObj & options )
3843 if ( NULL == pCollectionSpace )
3845 return SDB_NOT_CONNECTED ;
3847 return pCollectionSpace->setAttributes( options ) ;
3851 class DLLEXPORT _sdbDomain
3854 _sdbDomain (
const _sdbDomain& other ) ;
3855 _sdbDomain& operator= (
const _sdbDomain& ) ;
3858 virtual ~_sdbDomain () {}
3860 virtual const CHAR* getName () = 0 ;
3862 virtual INT32 alterDomain (
const bson::BSONObj &options = _sdbStaticObject ) = 0 ;
3864 virtual INT32 listCollectionSpacesInDomain ( _sdbCursor **cursor ) = 0 ;
3866 virtual INT32 listCollectionSpacesInDomain ( sdbCursor &cursor ) = 0 ;
3868 virtual INT32 listCollectionsInDomain ( _sdbCursor **cursor ) = 0 ;
3870 virtual INT32 listCollectionsInDomain ( sdbCursor &cursor ) = 0 ;
3872 virtual INT32 listReplicaGroupInDomain( _sdbCursor **cursor ) = 0 ;
3874 virtual INT32 listReplicaGroupInDomain( sdbCursor &cursor ) = 0 ;
3876 virtual INT32 addGroups (
const bson::BSONObj & options ) = 0 ;
3878 virtual INT32 setGroups (
const bson::BSONObj & options ) = 0 ;
3880 virtual INT32 removeGroups (
const bson::BSONObj & options ) = 0 ;
3882 virtual INT32 setAttributes (
const bson::BSONObj & options ) = 0 ;
3923 const CHAR *getName ()
3949 INT32 alterDomain (
const bson::BSONObj &options )
3953 return SDB_NOT_CONNECTED ;
3955 return pDomain->alterDomain ( options ) ;
3968 INT32 addGroups (
const bson::BSONObj & options )
3970 if ( NULL == pDomain )
3972 return SDB_NOT_CONNECTED ;
3974 return pDomain->addGroups( options ) ;
3989 INT32 setGroups (
const bson::BSONObj & options )
3991 if ( NULL == pDomain )
3993 return SDB_NOT_CONNECTED ;
3995 return pDomain->setGroups( options ) ;
4009 INT32 removeGroups (
const bson::BSONObj & options )
4011 if ( NULL == pDomain )
4013 return SDB_NOT_CONNECTED ;
4015 return pDomain->removeGroups( options ) ;
4035 INT32 setAttributes (
const bson::BSONObj &options )
4039 return SDB_NOT_CONNECTED ;
4041 return pDomain->setAttributes( options ) ;
4055 return SDB_NOT_CONNECTED ;
4058 return pDomain->listCollectionSpacesInDomain ( cursor ) ;
4061 INT32 listCollectionSpacesInDomain ( _sdbCursor **cursor )
4065 return SDB_NOT_CONNECTED ;
4067 return pDomain->listCollectionSpacesInDomain ( cursor ) ;
4081 return SDB_NOT_CONNECTED ;
4084 return pDomain->listCollectionsInDomain ( cursor ) ;
4094 INT32 listCollectionsInDomain ( _sdbCursor **cursor )
4098 return SDB_NOT_CONNECTED ;
4100 return pDomain->listCollectionsInDomain ( cursor ) ;
4103 INT32 listReplicaGroupInDomain( _sdbCursor **cursor )
4107 return SDB_NOT_CONNECTED ;
4109 return pDomain->listReplicaGroupInDomain( cursor ) ;
4122 return SDB_NOT_CONNECTED ;
4125 return pDomain->listReplicaGroupInDomain( cursor ) ;
4129 class DLLEXPORT _sdbDataCenter
4132 _sdbDataCenter (
const _sdbDataCenter& other ) ;
4133 _sdbDataCenter& operator= (
const _sdbDataCenter& ) ;
4136 _sdbDataCenter () {}
4137 virtual ~_sdbDataCenter () {}
4140 virtual const CHAR *getName () = 0 ;
4141 virtual INT32 getDetail( bson::BSONObj &retInfo ) = 0 ;
4142 virtual INT32 activateDC() = 0 ;
4143 virtual INT32 deactivateDC() = 0 ;
4144 virtual INT32 enableReadOnly( BOOLEAN isReadOnly ) = 0 ;
4145 virtual INT32 createImage(
const CHAR *pCataAddrList ) = 0 ;
4146 virtual INT32 removeImage() = 0 ;
4147 virtual INT32 enableImage() = 0 ;
4148 virtual INT32 disableImage() = 0 ;
4149 virtual INT32 attachGroups(
const bson::BSONObj &info ) = 0 ;
4150 virtual INT32 detachGroups(
const bson::BSONObj &info ) = 0 ;
4157 class DLLEXPORT sdbDataCenter
4160 sdbDataCenter (
const sdbDataCenter& ) ;
4161 sdbDataCenter& operator= (
const sdbDataCenter& ) ;
4171 _sdbDataCenter *pDC ;
4176 sdbDataCenter() { pDC = NULL ; }
4195 const CHAR *getName ()
4201 return pDC->getName() ;
4210 INT32 getDetail( bson::BSONObj &retInfo )
4214 return SDB_NOT_CONNECTED ;
4216 return pDC->getDetail( retInfo ) ;
4228 return SDB_NOT_CONNECTED ;
4230 return pDC->activateDC() ;
4238 INT32 deactivateDC()
4242 return SDB_NOT_CONNECTED ;
4244 return pDC->deactivateDC() ;
4253 INT32 enableReadOnly( BOOLEAN isReadOnly )
4257 return SDB_NOT_CONNECTED ;
4259 return pDC->enableReadOnly( isReadOnly ) ;
4269 INT32 createImage(
const CHAR *pCataAddrList )
4273 return SDB_NOT_CONNECTED ;
4275 return pDC->createImage( pCataAddrList ) ;
4287 return SDB_NOT_CONNECTED ;
4289 return pDC->removeImage() ;
4301 return SDB_NOT_CONNECTED ;
4303 return pDC->enableImage() ;
4311 INT32 disableImage()
4315 return SDB_NOT_CONNECTED ;
4317 return pDC->disableImage() ;
4326 INT32 attachGroups(
const bson::BSONObj &info )
4330 return SDB_NOT_CONNECTED ;
4332 return pDC->attachGroups( info ) ;
4341 INT32 detachGroups(
const bson::BSONObj &info )
4345 return SDB_NOT_CONNECTED ;
4347 return pDC->detachGroups( info ) ;
4352 class DLLEXPORT _sdbRecycleBin
4355 _sdbRecycleBin (
const _sdbRecycleBin& other ) ;
4356 _sdbRecycleBin& operator= (
const _sdbRecycleBin& ) ;
4359 _sdbRecycleBin () {}
4360 virtual ~_sdbRecycleBin () {}
4363 virtual INT32 getDetail( bson::BSONObj &retInfo ) = 0 ;
4364 virtual INT32 enable() = 0 ;
4365 virtual INT32 disable() = 0 ;
4366 virtual INT32 setAttributes(
const bson::BSONObj &options ) = 0 ;
4367 virtual INT32 alter(
const bson::BSONObj &options ) = 0 ;
4368 virtual INT32 returnItem(
const CHAR *recycleName,
4369 const bson::BSONObj &options = _sdbStaticObject,
4370 bson::BSONObj *result = NULL ) = 0 ;
4371 virtual INT32 returnItemToName(
const CHAR *recycleName,
4372 const CHAR *returnName,
4373 const bson::BSONObj &options = _sdbStaticObject,
4374 bson::BSONObj *result = NULL ) = 0 ;
4375 virtual INT32 dropItem(
const CHAR *recycleName,
4376 const bson::BSONObj &options = _sdbStaticObject ) = 0 ;
4377 virtual INT32 dropAll(
const bson::BSONObj &options = _sdbStaticObject ) = 0 ;
4378 virtual INT32 list( _sdbCursor **cursor,
4379 const bson::BSONObj &condition = _sdbStaticObject,
4380 const bson::BSONObj &selector = _sdbStaticObject,
4381 const bson::BSONObj &orderBy = _sdbStaticObject,
4382 const bson::BSONObj &hint = _sdbStaticObject,
4383 INT64 numToSkip = 0,
4384 INT64 numToReturn = -1 ) = 0 ;
4385 virtual INT32 list( sdbCursor &cursor,
4386 const bson::BSONObj &condition = _sdbStaticObject,
4387 const bson::BSONObj &selector = _sdbStaticObject,
4388 const bson::BSONObj &orderBy = _sdbStaticObject,
4389 const bson::BSONObj &hint = _sdbStaticObject,
4390 INT64 numToSkip = 0,
4391 INT64 numToReturn = -1 ) = 0 ;
4392 virtual INT32 snapshot( _sdbCursor **cursor,
4393 const bson::BSONObj &condition = _sdbStaticObject,
4394 const bson::BSONObj &selector = _sdbStaticObject,
4395 const bson::BSONObj &orderBy = _sdbStaticObject,
4396 const bson::BSONObj &hint = _sdbStaticObject,
4397 INT64 numToSkip = 0,
4398 INT64 numToReturn = -1 ) = 0 ;
4399 virtual INT32 snapshot( sdbCursor &cursor,
4400 const bson::BSONObj &condition = _sdbStaticObject,
4401 const bson::BSONObj &selector = _sdbStaticObject,
4402 const bson::BSONObj &orderBy = _sdbStaticObject,
4403 const bson::BSONObj &hint = _sdbStaticObject,
4404 INT64 numToSkip = 0,
4405 INT64 numToReturn = -1 ) = 0 ;
4406 virtual INT32 getCount( INT64 &count,
4407 const bson::BSONObj &condition = _sdbStaticObject ) = 0 ;
4413 class DLLEXPORT sdbRecycleBin
4416 sdbRecycleBin(
const sdbRecycleBin & ) ;
4417 sdbRecycleBin &operator =(
const sdbRecycleBin & ) ;
4427 _sdbRecycleBin *pRecycleBin ;
4432 sdbRecycleBin() { pRecycleBin = NULL ; }
4441 delete pRecycleBin ;
4453 INT32 getDetail( bson::BSONObj &retInfo )
4455 if ( NULL == pRecycleBin )
4457 return SDB_NOT_CONNECTED ;
4459 return pRecycleBin->getDetail( retInfo ) ;
4469 if ( NULL == pRecycleBin )
4471 return SDB_NOT_CONNECTED ;
4473 return pRecycleBin->enable() ;
4483 if ( NULL == pRecycleBin )
4485 return SDB_NOT_CONNECTED ;
4487 return pRecycleBin->disable() ;
4503 INT32 setAttributes(
const bson::BSONObj &options )
4505 if ( NULL == pRecycleBin )
4507 return SDB_NOT_CONNECTED ;
4509 return pRecycleBin->setAttributes( options ) ;
4525 INT32 alter(
const bson::BSONObj &options )
4527 if ( NULL == pRecycleBin )
4529 return SDB_NOT_CONNECTED ;
4531 return pRecycleBin->alter( options ) ;
4544 INT32 returnItem(
const CHAR *recycleName,
4545 const bson::BSONObj &options = _sdbStaticObject,
4546 bson::BSONObj *result = NULL )
4548 if ( NULL == pRecycleBin )
4550 return SDB_NOT_CONNECTED ;
4552 return pRecycleBin->returnItem( recycleName, options, result ) ;
4567 INT32 returnItemToName(
const CHAR *recycleName,
4568 const CHAR *returnName,
4569 const bson::BSONObj &options = _sdbStaticObject,
4570 bson::BSONObj *result = NULL )
4572 if ( NULL == pRecycleBin )
4574 return SDB_NOT_CONNECTED ;
4576 return pRecycleBin->returnItemToName( recycleName,
4589 INT32 dropItem(
const CHAR *recycleName,
4590 const bson::BSONObj &options = _sdbStaticObject )
4592 if ( NULL == pRecycleBin )
4594 return SDB_NOT_CONNECTED ;
4596 return pRecycleBin->dropItem( recycleName, options ) ;
4605 INT32 dropAll(
const bson::BSONObj &options = _sdbStaticObject )
4607 if ( NULL == pRecycleBin )
4609 return SDB_NOT_CONNECTED ;
4611 return pRecycleBin->dropAll( options ) ;
4633 INT32 list( _sdbCursor **cursor,
4634 const bson::BSONObj &condition = _sdbStaticObject,
4635 const bson::BSONObj &selector = _sdbStaticObject,
4636 const bson::BSONObj &orderBy = _sdbStaticObject,
4637 const bson::BSONObj &hint = _sdbStaticObject,
4638 INT64 numToSkip = 0,
4639 INT64 numToReturn = -1 )
4641 if ( NULL == pRecycleBin )
4643 return SDB_NOT_CONNECTED ;
4645 return pRecycleBin->list( cursor,
4673 INT32 list( sdbCursor &cursor,
4674 const bson::BSONObj &condition = _sdbStaticObject,
4675 const bson::BSONObj &selector = _sdbStaticObject,
4676 const bson::BSONObj &orderBy = _sdbStaticObject,
4677 const bson::BSONObj &hint = _sdbStaticObject,
4678 INT64 numToSkip = 0,
4679 INT64 numToReturn = -1 )
4681 if ( NULL == pRecycleBin )
4683 return SDB_NOT_CONNECTED ;
4685 return pRecycleBin->list( cursor,
4713 INT32 snapshot( _sdbCursor **cursor,
4714 const bson::BSONObj &condition = _sdbStaticObject,
4715 const bson::BSONObj &selector = _sdbStaticObject,
4716 const bson::BSONObj &orderBy = _sdbStaticObject,
4717 const bson::BSONObj &hint = _sdbStaticObject,
4718 INT64 numToSkip = 0,
4719 INT64 numToReturn = -1 )
4721 if ( NULL == pRecycleBin )
4723 return SDB_NOT_CONNECTED ;
4725 return pRecycleBin->snapshot( cursor,
4753 INT32 snapshot( sdbCursor &cursor,
4754 const bson::BSONObj &condition = _sdbStaticObject,
4755 const bson::BSONObj &selector = _sdbStaticObject,
4756 const bson::BSONObj &orderBy = _sdbStaticObject,
4757 const bson::BSONObj &hint = _sdbStaticObject,
4758 INT64 numToSkip = 0,
4759 INT64 numToReturn = -1 )
4761 if ( NULL == pRecycleBin )
4763 return SDB_NOT_CONNECTED ;
4765 return pRecycleBin->snapshot( cursor,
4782 INT32 getCount( INT64 &count,
4783 const bson::BSONObj &condition = _sdbStaticObject )
4785 if ( NULL == pRecycleBin )
4787 return SDB_NOT_CONNECTED ;
4789 return pRecycleBin->getCount( count, condition ) ;
4793 class DLLEXPORT _sdbLob
4796 _sdbLob (
const _sdbLob& other ) ;
4797 _sdbLob& operator= (
const _sdbLob& ) ;
4802 virtual ~_sdbLob () {}
4804 virtual INT32 close () = 0 ;
4806 virtual INT32 read ( UINT32 len, CHAR *buf, UINT32 *read ) = 0 ;
4808 virtual INT32 write (
const CHAR *buf, UINT32 len ) = 0 ;
4810 virtual INT32 seek ( SINT64 size,
SDB_LOB_SEEK whence ) = 0 ;
4812 virtual INT32 lock( INT64 offset, INT64 length ) = 0 ;
4814 virtual INT32 lockAndSeek( INT64 offset, INT64 length ) = 0 ;
4816 virtual INT32 isClosed( BOOLEAN &flag ) = 0 ;
4818 virtual INT32 getOid( bson::OID &oid ) = 0 ;
4820 virtual INT32 getSize( SINT64 *size ) = 0 ;
4822 virtual INT32 getCreateTime ( UINT64 *millis ) = 0 ;
4824 virtual BOOLEAN isClosed() = 0 ;
4826 virtual bson::OID getOid() = 0 ;
4828 virtual SINT64 getSize() = 0 ;
4830 virtual UINT64 getCreateTime () = 0 ;
4832 virtual UINT64 getModificationTime() = 0 ;
4834 virtual INT32 getPiecesInfoNum() = 0 ;
4836 virtual bson::BSONArray getPiecesInfo() = 0 ;
4838 virtual BOOLEAN isEof() = 0 ;
4840 virtual INT32 getRunTimeDetail( bson::BSONObj &detail ) = 0 ;
4889 return pLob->
close() ;
4900 INT32 read ( UINT32 len, CHAR *buf, UINT32 *read )
4904 return SDB_NOT_CONNECTED ;
4906 return pLob->read( len, buf, read ) ;
4916 INT32 write (
const CHAR *buf, UINT32 len )
4920 return SDB_NOT_CONNECTED ;
4922 return pLob->write( buf, len ) ;
4936 return SDB_NOT_CONNECTED ;
4938 return pLob->seek( size, whence ) ;
4948 INT32 lock ( INT64 offset, INT64 length )
4952 return SDB_NOT_CONNECTED ;
4954 return pLob->lock( offset, length ) ;
4964 INT32 lockAndSeek ( INT64 offset, INT64 length )
4968 return SDB_NOT_CONNECTED ;
4970 return pLob->lockAndSeek( offset, length ) ;
4980 INT32 isClosed( BOOLEAN &flag )
4984 return SDB_NOT_CONNECTED ;
4986 return pLob->isClosed ( flag ) ;
4999 return pLob->isClosed () ;
5009 INT32 getOid ( bson::OID &oid )
5013 return SDB_NOT_CONNECTED ;
5015 return pLob->getOid( oid ) ;
5028 return pLob->getOid() ;
5038 INT32 getSize ( SINT64 *size )
5042 return SDB_NOT_CONNECTED ;
5044 return pLob->getSize( size ) ;
5057 return pLob->getSize();
5067 INT32 getCreateTime ( UINT64 *millis )
5071 return SDB_NOT_CONNECTED ;
5073 return pLob->getCreateTime( millis ) ;
5080 UINT64 getCreateTime ()
5086 return pLob->getCreateTime() ;
5093 UINT64 getModificationTime ()
5099 return pLob->getModificationTime() ;
5106 INT32 getPiecesInfoNum()
5112 return pLob->getPiecesInfoNum() ;
5119 bson::BSONArray getPiecesInfo()
5123 return bson::BSONArray() ;
5125 return pLob->getPiecesInfo() ;
5138 return pLob->isEof() ;
5146 INT32 getRunTimeDetail( bson::BSONObj &detail )
5152 return pLob->getRunTimeDetail( detail ) ;
5157 class DLLEXPORT _sdbSequence
5160 _sdbSequence (
const _sdbSequence& other ) ;
5161 _sdbSequence& operator=(
const _sdbSequence& ) ;
5164 virtual ~_sdbSequence () {}
5166 virtual INT32 setAttributes (
const bson::BSONObj &options ) = 0 ;
5168 virtual INT32 getNextValue ( INT64 &value ) = 0 ;
5170 virtual INT32 getCurrentValue ( INT64 &value ) = 0 ;
5172 virtual INT32 setCurrentValue (
const INT64 value ) = 0 ;
5174 virtual INT32 fetch(
const INT32 fetchNum,
5177 INT32 &Increment ) = 0 ;
5179 virtual INT32 restart(
const INT64 startValue ) = 0 ;
5244 INT32 setAttributes (
const bson::BSONObj & options )
5246 if ( NULL == pSequence )
5248 return SDB_NOT_CONNECTED ;
5259 INT32 getNextValue( INT64 &value )
5261 if ( NULL == pSequence )
5263 return SDB_NOT_CONNECTED ;
5265 return pSequence->getNextValue( value ) ;
5274 INT32 getCurrentValue( INT64 &value )
5276 if ( NULL == pSequence )
5278 return SDB_NOT_CONNECTED ;
5280 return pSequence->getCurrentValue( value ) ;
5289 INT32 setCurrentValue(
const INT64 value )
5291 if ( NULL == pSequence )
5293 return SDB_NOT_CONNECTED ;
5295 return pSequence->setCurrentValue( value ) ;
5308 INT32 fetch(
const INT32 fetchNum, INT64 &nextValue,
5309 INT32 &returnNum, INT32 &increment )
5311 if ( NULL == pSequence )
5313 return SDB_NOT_CONNECTED ;
5315 return pSequence->fetch( fetchNum, nextValue, returnNum, increment ) ;
5324 INT32 restart(
const INT64 startValue )
5326 if ( NULL == pSequence )
5328 return SDB_NOT_CONNECTED ;
5330 return pSequence->restart( startValue ) ;
5334 class DLLEXPORT _sdbDataSource
5337 _sdbDataSource(
const _sdbDataSource& other ) ;
5338 _sdbDataSource& operator=(
const _sdbDataSource& ) ;
5341 virtual ~_sdbDataSource() {}
5343 virtual INT32 alterDataSource(
const bson::BSONObj &options = _sdbStaticObject ) = 0 ;
5344 virtual const CHAR *getName() = 0 ;
5356 _sdbDataSource *pDataSource ;
5360 pDataSource = NULL ;
5367 delete pDataSource ;
5411 INT32 alterDataSource(
const bson::BSONObj &options )
5415 return SDB_NOT_CONNECTED ;
5424 const CHAR *getName()
5430 return pDataSource->getName() ;
5434 class DLLEXPORT _sdb
5437 _sdb (
const _sdb& other ) ;
5438 _sdb& operator=(
const _sdb& ) ;
5442 virtual INT32 connect (
const CHAR *pHostName,
5445 virtual INT32 connect (
const CHAR *pHostName,
5447 const CHAR *pUsrName,
5448 const CHAR *pPasswd ) = 0 ;
5449 virtual INT32 connect (
const CHAR *pHostName,
5450 const CHAR *pServiceName ) = 0 ;
5451 virtual INT32 connect (
const CHAR *pHostName,
5452 const CHAR *pServiceName,
5453 const CHAR *pUsrName,
5454 const CHAR *pPasswd ) = 0 ;
5455 virtual INT32 connect (
const CHAR **pConnAddrs,
5457 const CHAR *pUsrName,
5458 const CHAR *pPasswd ) = 0 ;
5459 virtual INT32 connect (
const CHAR **pConnAddrs,
5461 const CHAR *pUsrName,
5463 const CHAR *pCipherFile ) = 0 ;
5465 virtual void disconnect () = 0 ;
5467 virtual UINT64 getDbStartTime() = 0 ;
5469 virtual const CHAR *getAddress() = 0 ;
5471 virtual void getVersion( UINT8 &version, UINT8 &subVersion,
5472 UINT8 &fixVersion ) = 0 ;
5474 virtual INT32 createUsr(
const CHAR *pUsrName,
5475 const CHAR *pPasswd,
5476 const bson::BSONObj &options = _sdbStaticObject
5479 virtual INT32 removeUsr(
const CHAR *pUsrName,
5480 const CHAR *pPasswd ) = 0 ;
5482 virtual INT32 alterUsr(
const CHAR *pUsrName,
5483 const CHAR *pAction,
5484 const bson::BSONObj &options ) = 0 ;
5486 virtual INT32 changeUsrPasswd(
const CHAR *pUsrName,
5487 const CHAR *pOldPasswd,
5488 const CHAR *pNewPasswd ) = 0 ;
5490 virtual INT32 getSnapshot ( _sdbCursor **cursor,
5492 const bson::BSONObj &condition = _sdbStaticObject,
5493 const bson::BSONObj &selector = _sdbStaticObject,
5494 const bson::BSONObj &orderBy = _sdbStaticObject,
5495 const bson::BSONObj &hint = _sdbStaticObject,
5496 INT64 numToSkip = 0,
5497 INT64 numToReturn = -1
5500 virtual INT32 getSnapshot ( sdbCursor &cursor,
5502 const bson::BSONObj &condition = _sdbStaticObject,
5503 const bson::BSONObj &selector = _sdbStaticObject,
5504 const bson::BSONObj &orderBy = _sdbStaticObject,
5505 const bson::BSONObj &hint = _sdbStaticObject,
5506 INT64 numToSkip = 0,
5507 INT64 numToReturn = -1
5510 virtual INT32 resetSnapshot (
const bson::BSONObj &options = _sdbStaticObject ) = 0 ;
5512 virtual INT32 getList ( _sdbCursor **cursor,
5514 const bson::BSONObj &condition = _sdbStaticObject,
5515 const bson::BSONObj &selector = _sdbStaticObject,
5516 const bson::BSONObj &orderBy = _sdbStaticObject,
5517 const bson::BSONObj &hint = _sdbStaticObject,
5518 INT64 numToSkip = 0,
5519 INT64 numToReturn = -1
5521 virtual INT32 getList ( sdbCursor &cursor,
5523 const bson::BSONObj &condition = _sdbStaticObject,
5524 const bson::BSONObj &selector = _sdbStaticObject,
5525 const bson::BSONObj &orderBy = _sdbStaticObject,
5526 const bson::BSONObj &hint = _sdbStaticObject,
5527 INT64 numToSkip = 0,
5528 INT64 numToReturn = -1
5531 virtual INT32 getCollection (
const CHAR *pCollectionFullName,
5532 _sdbCollection **collection,
5533 BOOLEAN checkExist = TRUE
5536 virtual INT32 getCollection (
const CHAR *pCollectionFullName,
5537 sdbCollection &collection,
5538 BOOLEAN checkExist = TRUE
5541 virtual INT32 getCollectionSpace (
const CHAR *pCollectionSpaceName,
5542 _sdbCollectionSpace **cs,
5543 BOOLEAN checkExist = TRUE
5546 virtual INT32 getCollectionSpace (
const CHAR *pCollectionSpaceName,
5547 sdbCollectionSpace &cs,
5548 BOOLEAN checkExist = TRUE
5551 virtual INT32 createCollectionSpace (
const CHAR *pCollectionSpaceName,
5553 _sdbCollectionSpace **cs
5556 virtual INT32 createCollectionSpace (
const CHAR *pCollectionSpaceName,
5558 sdbCollectionSpace &cs
5561 virtual INT32 createCollectionSpace (
const CHAR *pCollectionSpaceName,
5562 const bson::BSONObj &options,
5563 _sdbCollectionSpace **cs
5566 virtual INT32 createCollectionSpace (
const CHAR *pCollectionSpaceName,
5567 const bson::BSONObj &options,
5568 sdbCollectionSpace &cs
5571 virtual INT32 dropCollectionSpace (
5572 const CHAR *pCollectionSpaceName,
5573 const bson::BSONObj &options = _sdbStaticObject
5576 virtual INT32 listCollectionSpaces ( _sdbCursor **result ) = 0 ;
5578 virtual INT32 listCollectionSpaces ( sdbCursor &result ) = 0 ;
5581 virtual INT32 listCollections ( _sdbCursor **result ) = 0 ;
5583 virtual INT32 listCollections ( sdbCursor &result ) = 0 ;
5586 virtual INT32 listReplicaGroups ( _sdbCursor **result ) = 0 ;
5588 virtual INT32 listReplicaGroups ( sdbCursor &result ) = 0 ;
5590 virtual INT32 getReplicaGroup (
const CHAR *pName,
5591 _sdbReplicaGroup **result ) = 0 ;
5593 virtual INT32 getReplicaGroup (
const CHAR *pName,
5594 sdbReplicaGroup &result ) = 0 ;
5596 virtual INT32 getReplicaGroup ( INT32
id,
5597 _sdbReplicaGroup **result ) = 0 ;
5599 virtual INT32 getReplicaGroup ( INT32
id,
5600 sdbReplicaGroup &result ) = 0 ;
5602 virtual INT32 createReplicaGroup (
const CHAR *pName,
5603 _sdbReplicaGroup **replicaGroup ) = 0 ;
5605 virtual INT32 createReplicaGroup (
const CHAR *pName,
5606 sdbReplicaGroup &replicaGroup ) = 0 ;
5608 virtual INT32 removeReplicaGroup (
const CHAR *pName ) = 0 ;
5610 virtual INT32 createReplicaCataGroup (
const CHAR *pHostName,
5611 const CHAR *pServiceName,
5612 const CHAR *pDatabasePath,
5613 const bson::BSONObj &configure ) =0 ;
5615 virtual INT32 activateReplicaGroup (
const CHAR *pName,
5616 _sdbReplicaGroup **replicaGroup ) = 0 ;
5617 virtual INT32 activateReplicaGroup (
const CHAR *pName,
5618 sdbReplicaGroup &replicaGroup ) = 0 ;
5620 virtual INT32 execUpdate(
const CHAR *sql,
5621 bson::BSONObj *pResult = NULL ) = 0 ;
5623 virtual INT32 exec(
const CHAR *sql,
5624 _sdbCursor **result ) = 0 ;
5626 virtual INT32 exec(
const CHAR *sql,
5627 sdbCursor &result ) = 0 ;
5629 virtual INT32 transactionBegin() = 0 ;
5631 virtual INT32 transactionCommit(
const bson::BSONObj &hint = _sdbStaticObject ) = 0 ;
5633 virtual INT32 transactionRollback() = 0 ;
5635 virtual INT32 flushConfigure(
const bson::BSONObj &options ) = 0 ;
5637 virtual INT32 crtJSProcedure (
const CHAR *code ) = 0 ;
5638 virtual INT32 rmProcedure(
const CHAR *spName ) = 0 ;
5639 virtual INT32 listProcedures( _sdbCursor **cursor,
const bson::BSONObj &condition ) = 0 ;
5640 virtual INT32 listProcedures( sdbCursor &cursor,
const bson::BSONObj &condition ) = 0 ;
5641 virtual INT32 evalJS(
const CHAR *code,
5643 _sdbCursor **cursor,
5644 bson::BSONObj &errmsg ) = 0 ;
5645 virtual INT32 evalJS(
const CHAR *code,
5648 bson::BSONObj &errmsg ) = 0 ;
5651 virtual INT32 backup (
const bson::BSONObj &options) = 0 ;
5652 virtual INT32 listBackup ( _sdbCursor **cursor,
5653 const bson::BSONObj &options,
5654 const bson::BSONObj &condition = _sdbStaticObject,
5655 const bson::BSONObj &selector = _sdbStaticObject,
5656 const bson::BSONObj &orderBy = _sdbStaticObject) = 0 ;
5657 virtual INT32 listBackup ( sdbCursor &cursor,
5658 const bson::BSONObj &options,
5659 const bson::BSONObj &condition = _sdbStaticObject,
5660 const bson::BSONObj &selector = _sdbStaticObject,
5661 const bson::BSONObj &orderBy = _sdbStaticObject) = 0 ;
5662 virtual INT32 removeBackup (
const bson::BSONObj &options ) = 0 ;
5665 virtual INT32 listTasks ( _sdbCursor **cursor,
5666 const bson::BSONObj &condition = _sdbStaticObject,
5667 const bson::BSONObj &selector = _sdbStaticObject,
5668 const bson::BSONObj &orderBy = _sdbStaticObject,
5669 const bson::BSONObj &hint = _sdbStaticObject) = 0 ;
5672 virtual INT32 listTasks ( sdbCursor &cursor,
5673 const bson::BSONObj &condition = _sdbStaticObject,
5674 const bson::BSONObj &selector = _sdbStaticObject,
5675 const bson::BSONObj &orderBy = _sdbStaticObject,
5676 const bson::BSONObj &hint = _sdbStaticObject) = 0 ;
5678 virtual INT32 waitTasks (
const SINT64 *taskIDs,
5681 virtual INT32 cancelTask ( SINT64 taskID,
5682 BOOLEAN isAsync ) = 0 ;
5684 virtual INT32 setSessionAttr (
const bson::BSONObj &options =
5685 _sdbStaticObject ) = 0 ;
5687 virtual INT32 getSessionAttr ( bson::BSONObj &result,
5688 BOOLEAN useCache = TRUE ) = 0 ;
5691 virtual INT32 closeAllCursors () = 0 ;
5694 virtual INT32 interrupt() = 0 ;
5695 virtual INT32 interruptOperation() = 0 ;
5698 virtual INT32 isValid( BOOLEAN *result ) = 0 ;
5699 virtual BOOLEAN isValid() = 0 ;
5701 virtual BOOLEAN isClosed() = 0 ;
5704 virtual INT32 createDomain (
const CHAR *pDomainName,
5705 const bson::BSONObj &options,
5706 _sdbDomain **domain ) = 0 ;
5708 virtual INT32 createDomain (
const CHAR *pDomainName,
5709 const bson::BSONObj &options,
5710 sdbDomain &domain ) = 0 ;
5712 virtual INT32 dropDomain (
const CHAR *pDomainName ) = 0 ;
5714 virtual INT32 getDomain (
const CHAR *pDomainName,
5715 _sdbDomain **domain ) = 0 ;
5717 virtual INT32 getDomain (
const CHAR *pDomainName,
5718 sdbDomain &domain ) = 0 ;
5720 virtual INT32 listDomains ( _sdbCursor **cursor,
5721 const bson::BSONObj &condition = _sdbStaticObject,
5722 const bson::BSONObj &selector = _sdbStaticObject,
5723 const bson::BSONObj &orderBy = _sdbStaticObject,
5724 const bson::BSONObj &hint = _sdbStaticObject
5727 virtual INT32 listDomains ( sdbCursor &cursor,
5728 const bson::BSONObj &condition = _sdbStaticObject,
5729 const bson::BSONObj &selector = _sdbStaticObject,
5730 const bson::BSONObj &orderBy = _sdbStaticObject,
5731 const bson::BSONObj &hint = _sdbStaticObject
5733 virtual INT32 getDC( _sdbDataCenter **dc ) = 0 ;
5734 virtual INT32 getDC( sdbDataCenter &dc ) = 0 ;
5736 virtual INT32 getRecycleBin( _sdbRecycleBin **recycleBin ) = 0 ;
5737 virtual INT32 getRecycleBin( sdbRecycleBin &recycleBin ) = 0 ;
5739 static _sdb *getObj ( BOOLEAN useSSL = FALSE ) ;
5742 virtual UINT64 getLastAliveTime()
const = 0 ;
5744 virtual INT32 syncDB(
5745 const bson::BSONObj &options = _sdbStaticObject ) = 0 ;
5747 virtual INT32 analyze(
5748 const bson::BSONObj &options = _sdbStaticObject ) = 0 ;
5750 virtual INT32 forceSession(
5752 const bson::BSONObj &options = _sdbStaticObject ) = 0 ;
5754 virtual INT32 forceStepUp(
5755 const bson::BSONObj &options = _sdbStaticObject ) = 0 ;
5757 virtual INT32 invalidateCache(
5758 const bson::BSONObj &options = _sdbStaticObject ) = 0 ;
5760 virtual INT32 reloadConfig(
5761 const bson::BSONObj &options = _sdbStaticObject ) = 0 ;
5763 virtual INT32 updateConfig (
const bson::BSONObj &configs = _sdbStaticObject,
5764 const bson::BSONObj &options = _sdbStaticObject ) = 0 ;
5766 virtual INT32 deleteConfig (
const bson::BSONObj &configs = _sdbStaticObject,
5767 const bson::BSONObj &options = _sdbStaticObject ) = 0 ;
5769 virtual INT32 setPDLevel( INT32 level,
5770 const bson::BSONObj &options = _sdbStaticObject ) = 0 ;
5772 virtual INT32 msg(
const CHAR* msg ) = 0 ;
5774 virtual INT32 loadCS(
const CHAR* csName,
5775 const bson::BSONObj &options = _sdbStaticObject ) = 0 ;
5777 virtual INT32 unloadCS(
const CHAR* csName,
5778 const bson::BSONObj &options = _sdbStaticObject ) = 0 ;
5780 virtual INT32 traceStart( UINT32 traceBufferSize,
5781 const CHAR* component = NULL,
5782 const CHAR* breakpoint = NULL,
5783 const vector<UINT32> &tidVec = _sdbStaticUINT32Vec ) = 0 ;
5785 virtual INT32 traceStart( UINT32 traceBufferSize,
5786 const bson::BSONObj &options = _sdbStaticObject ) = 0 ;
5788 virtual INT32 traceStop(
const CHAR* dumpFileName ) = 0 ;
5790 virtual INT32 traceResume() = 0 ;
5792 virtual INT32 traceStatus( _sdbCursor** cursor ) = 0 ;
5794 virtual INT32 traceStatus( sdbCursor& cursor ) = 0 ;
5797 virtual INT32 renameCollectionSpace(
const CHAR* oldName,
5798 const CHAR* newName,
5799 const bson::BSONObj &options = _sdbStaticObject ) = 0 ;
5801 virtual INT32 getLastErrorObj( bson::BSONObj &result ) = 0 ;
5802 virtual void cleanLastErrorObj() = 0 ;
5804 virtual INT32 getLastResultObj( bson::BSONObj &result,
5805 BOOLEAN getOwned = FALSE )
const = 0 ;
5808 virtual INT32 createSequence(
const CHAR *pSequenceName,
5809 const bson::BSONObj &options,
5810 _sdbSequence **sequence ) = 0 ;
5812 virtual INT32 createSequence(
const CHAR *pSequenceName,
5813 const bson::BSONObj &options,
5814 sdbSequence &sequence ) = 0 ;
5816 virtual INT32 createSequence(
const CHAR *pSequenceName,
5817 sdbSequence &sequence ) = 0 ;
5820 virtual INT32 getSequence(
const CHAR *pSequenceName,
5821 _sdbSequence **sequence ) = 0 ;
5823 virtual INT32 getSequence(
const CHAR *pSequenceName,
5824 sdbSequence &sequence ) = 0 ;
5826 virtual INT32 renameSequence(
const CHAR *pOldName,
5827 const CHAR *pNewName ) = 0 ;
5829 virtual INT32 dropSequence(
const CHAR *pSequenceName ) = 0 ;
5831 virtual INT32 createDataSource( _sdbDataSource **dataSource,
5832 const CHAR *pDataSourceName,
5833 const CHAR *addresses,
5834 const CHAR *user = NULL,
5835 const CHAR *password = NULL,
5836 const CHAR *type = NULL,
5837 const bson::BSONObj *options = NULL
5840 virtual INT32 dropDataSource(
const CHAR *pDataSourceName ) = 0 ;
5842 virtual INT32 getDataSource(
const CHAR *pDataSourceName,
5843 _sdbDataSource **dataSource ) = 0 ;
5845 virtual INT32 listDataSources( _sdbCursor** cursor,
5846 const bson::BSONObj &condition = _sdbStaticObject,
5847 const bson::BSONObj &selector = _sdbStaticObject,
5848 const bson::BSONObj &orderBy = _sdbStaticObject,
5849 const bson::BSONObj &hint = _sdbStaticObject ) = 0 ;
5853 typedef class _sdb _sdb ;
5860 sdb (
const sdb& other ) ;
5861 sdb& operator=(
const sdb& ) ;
5875 sdb ( BOOLEAN useSSL = FALSE ) :
5876 pSDB ( _sdb::getObj( useSSL ) )
5900 INT32 connect (
const CHAR *pHostName,
5906 return SDB_NOT_CONNECTED ;
5908 return pSDB->
connect ( pHostName, port ) ;
5924 INT32 connect (
const CHAR *pHostName,
5926 const CHAR *pUsrName,
5932 return SDB_NOT_CONNECTED ;
5934 return pSDB->connect ( pHostName, port,
5935 pUsrName, pPasswd ) ;
5947 INT32 connect (
const CHAR *pHostName,
5948 const CHAR *pServiceName
5953 return SDB_NOT_CONNECTED ;
5955 return pSDB->connect ( pHostName, pServiceName ) ;
5971 INT32 connect (
const CHAR *pHostName,
5972 const CHAR *pServiceName,
5973 const CHAR *pUsrName,
5974 const CHAR *pPasswd )
5978 return SDB_NOT_CONNECTED ;
5980 return pSDB->connect ( pHostName, pServiceName,
5981 pUsrName, pPasswd ) ;
5997 INT32 connect (
const CHAR **pConnAddrs,
5999 const CHAR *pUsrName,
6000 const CHAR *pPasswd )
6004 return SDB_NOT_CONNECTED ;
6006 return pSDB->connect ( pConnAddrs, arrSize,
6007 pUsrName, pPasswd ) ;
6025 INT32 connect (
const CHAR **pConnAddrs,
6027 const CHAR *pUsrName,
6029 const CHAR *pCipherFile )
6033 return SDB_NOT_CONNECTED ;
6035 return pSDB->connect ( pConnAddrs, arrSize,
6036 pUsrName, pToken, pCipherFile ) ;
6043 UINT64 getDbStartTime ()
6049 return pSDB->getDbStartTime() ;
6056 const CHAR *getAddress ()
6062 return pSDB->getAddress () ;
6075 void getVersion ( UINT8 &version, UINT8 &subVersion, UINT8 &fixVersion )
6081 pSDB->getVersion( version, subVersion, fixVersion ) ;
6106 INT32 createUsr(
const CHAR *pUsrName,
6107 const CHAR *pPasswd,
6108 const bson::BSONObj &options = _sdbStaticObject )
6112 return SDB_NOT_CONNECTED ;
6114 return pSDB->createUsr( pUsrName, pPasswd, options ) ;
6125 INT32 removeUsr(
const CHAR *pUsrName,
6126 const CHAR *pPasswd )
6130 return SDB_NOT_CONNECTED ;
6132 return pSDB->removeUsr( pUsrName, pPasswd ) ;
6147 INT32 alterUsr(
const CHAR *pUsrName,
6148 const CHAR *pAction,
6149 const bson::BSONObj &options )
6153 return SDB_NOT_CONNECTED ;
6155 return pSDB->alterUsr( pUsrName, pAction, options ) ;
6168 INT32 changeUsrPasswd(
const CHAR *pUsrName,
6169 const CHAR *pOldPasswd,
6170 const CHAR *pNewPasswd )
6174 return SDB_NOT_CONNECTED ;
6176 return pSDB->changeUsrPasswd( pUsrName, pOldPasswd, pNewPasswd ) ;
6188 pSDB->disconnect () ;
6234 const bson::BSONObj &condition = _sdbStaticObject,
6235 const bson::BSONObj &selector = _sdbStaticObject,
6236 const bson::BSONObj &orderBy = _sdbStaticObject,
6237 const bson::BSONObj &hint = _sdbStaticObject,
6238 INT64 numToSkip = 0,
6239 INT64 numToReturn = -1 )
6243 return SDB_NOT_CONNECTED ;
6246 return pSDB->getSnapshot ( cursor, snapType, condition,
6247 selector, orderBy, hint,
6248 numToSkip, numToReturn ) ;
6293 INT32 getSnapshot ( _sdbCursor **cursor,
6295 const bson::BSONObj &condition = _sdbStaticObject,
6296 const bson::BSONObj &selector = _sdbStaticObject,
6297 const bson::BSONObj &orderBy = _sdbStaticObject,
6298 const bson::BSONObj &hint = _sdbStaticObject,
6299 INT64 numToSkip = 0,
6300 INT64 numToReturn = -1 )
6304 return SDB_NOT_CONNECTED ;
6306 return pSDB->getSnapshot ( cursor, snapType, condition,
6307 selector, orderBy, hint,
6308 numToSkip, numToReturn ) ;
6333 INT32 resetSnapshot (
const bson::BSONObj &options = _sdbStaticObject )
6337 return SDB_NOT_CONNECTED ;
6339 return pSDB->resetSnapshot ( options ) ;
6342 INT32 getList ( _sdbCursor **cursor,
6344 const bson::BSONObj &condition = _sdbStaticObject,
6345 const bson::BSONObj &selector = _sdbStaticObject,
6346 const bson::BSONObj &orderBy = _sdbStaticObject,
6347 const bson::BSONObj &hint = _sdbStaticObject,
6348 INT64 numToSkip = 0,
6349 INT64 numToReturn = -1
6354 return SDB_NOT_CONNECTED ;
6356 return pSDB->getList ( cursor, listType,
6357 condition, selector, orderBy, hint,
6358 numToSkip, numToReturn ) ;
6405 const bson::BSONObj &condition = _sdbStaticObject,
6406 const bson::BSONObj &selector = _sdbStaticObject,
6407 const bson::BSONObj &orderBy = _sdbStaticObject,
6408 const bson::BSONObj &hint = _sdbStaticObject,
6409 INT64 numToSkip = 0,
6410 INT64 numToReturn = -1
6415 return SDB_NOT_CONNECTED ;
6418 return pSDB->getList ( cursor, listType,
6419 condition, selector, orderBy, hint,
6420 numToSkip, numToReturn ) ;
6423 INT32 getCollection (
const CHAR *pCollectionFullName,
6424 _sdbCollection **collection,
6425 BOOLEAN checkExist = TRUE
6430 return SDB_NOT_CONNECTED ;
6432 return pSDB->getCollection ( pCollectionFullName,
6433 collection, checkExist ) ;
6446 INT32 getCollection (
const CHAR *pCollectionFullName,
6448 BOOLEAN checkExist = TRUE
6453 return SDB_NOT_CONNECTED ;
6456 return pSDB->getCollection ( pCollectionFullName,
6461 INT32 getCollectionSpace (
const CHAR *pCollectionSpaceName,
6462 _sdbCollectionSpace **cs,
6463 BOOLEAN checkExist = TRUE
6468 return SDB_NOT_CONNECTED ;
6470 return pSDB->getCollectionSpace ( pCollectionSpaceName,
6484 INT32 getCollectionSpace (
const CHAR *pCollectionSpaceName,
6486 BOOLEAN checkExist = TRUE
6491 return SDB_NOT_CONNECTED ;
6494 return pSDB->getCollectionSpace ( pCollectionSpaceName,
6498 INT32 createCollectionSpace (
const CHAR *pCollectionSpaceName,
6500 _sdbCollectionSpace **cs
6505 return SDB_NOT_CONNECTED ;
6507 return pSDB->createCollectionSpace ( pCollectionSpaceName,
6530 INT32 createCollectionSpace (
const CHAR *pCollectionSpaceName,
6537 return SDB_NOT_CONNECTED ;
6540 return pSDB->createCollectionSpace ( pCollectionSpaceName,
6544 INT32 createCollectionSpace (
const CHAR *pCollectionSpaceName,
6545 const bson::BSONObj &options,
6546 _sdbCollectionSpace **cs
6551 return SDB_NOT_CONNECTED ;
6553 return pSDB->createCollectionSpace ( pCollectionSpaceName,
6574 INT32 createCollectionSpace (
const CHAR *pCollectionSpaceName,
6575 const bson::BSONObj &options,
6581 return SDB_NOT_CONNECTED ;
6584 return pSDB->createCollectionSpace ( pCollectionSpaceName,
6596 INT32 dropCollectionSpace (
6597 const CHAR *pCollectionSpaceName,
6598 const bson::BSONObj &options = _sdbStaticObject )
6602 return SDB_NOT_CONNECTED ;
6605 return pSDB->dropCollectionSpace ( pCollectionSpaceName, options ) ;
6608 INT32 listCollectionSpaces ( _sdbCursor **result )
6612 return SDB_NOT_CONNECTED ;
6614 return pSDB->listCollectionSpaces ( result ) ;
6627 return SDB_NOT_CONNECTED ;
6630 return pSDB->listCollectionSpaces ( cursor ) ;
6639 INT32 listCollections ( _sdbCursor **result )
6643 return SDB_NOT_CONNECTED ;
6645 return pSDB->listCollections ( result ) ;
6658 return SDB_NOT_CONNECTED ;
6661 return pSDB->listCollections ( cursor ) ;
6670 INT32 listReplicaGroups ( _sdbCursor **result )
6674 return SDB_NOT_CONNECTED ;
6676 return pSDB->listReplicaGroups ( result ) ;
6690 return SDB_NOT_CONNECTED ;
6693 return pSDB->listReplicaGroups ( cursor ) ;
6703 INT32 getReplicaGroup (
const CHAR *pName, _sdbReplicaGroup **result )
6707 return SDB_NOT_CONNECTED ;
6709 return pSDB->getReplicaGroup ( pName, result ) ;
6724 return SDB_NOT_CONNECTED ;
6727 return pSDB->getReplicaGroup ( pName, group ) ;
6737 INT32 getReplicaGroup ( INT32
id, _sdbReplicaGroup **result )
6741 return SDB_NOT_CONNECTED ;
6743 return pSDB->getReplicaGroup (
id, result ) ;
6757 return SDB_NOT_CONNECTED ;
6760 return pSDB->getReplicaGroup (
id, group ) ;
6770 INT32 createReplicaGroup (
const CHAR *pName, _sdbReplicaGroup **replicaGroup )
6774 return SDB_NOT_CONNECTED ;
6776 return pSDB->createReplicaGroup ( pName, replicaGroup ) ;
6790 return SDB_NOT_CONNECTED ;
6793 return pSDB->createReplicaGroup ( pName, group ) ;
6802 INT32 removeReplicaGroup (
const CHAR *pName )
6806 return SDB_NOT_CONNECTED ;
6808 return pSDB->removeReplicaGroup ( pName ) ;
6823 INT32 createReplicaCataGroup (
const CHAR *pHostName,
6824 const CHAR *pServiceName,
6825 const CHAR *pDatabasePath,
6826 const bson::BSONObj &configure )
6830 return SDB_NOT_CONNECTED ;
6832 return pSDB->createReplicaCataGroup ( pHostName, pServiceName,
6833 pDatabasePath, configure ) ;
6836 INT32 activateReplicaGroup (
const CHAR *pName, _sdbReplicaGroup **replicaGroup )
6840 return SDB_NOT_CONNECTED ;
6842 return pSDB->activateReplicaGroup ( pName, replicaGroup ) ;
6856 return SDB_NOT_CONNECTED ;
6859 return pSDB->activateReplicaGroup ( pName, replicaGroup ) ;
6869 INT32 execUpdate(
const CHAR *sql, bson::BSONObj *pResult = NULL )
6873 return SDB_NOT_CONNECTED ;
6875 return pSDB->execUpdate( sql, pResult ) ;
6886 INT32 exec(
const CHAR *sql,
6887 _sdbCursor **result )
6891 return SDB_NOT_CONNECTED ;
6893 return pSDB->exec( sql, result ) ;
6904 INT32 exec(
const CHAR *sql,
6909 return SDB_NOT_CONNECTED ;
6912 return pSDB->exec( sql, cursor ) ;
6920 INT32 transactionBegin()
6924 return SDB_NOT_CONNECTED ;
6926 return pSDB->transactionBegin() ;
6936 INT32 transactionCommit(
const bson::BSONObj &hint = _sdbStaticObject )
6940 return SDB_NOT_CONNECTED ;
6942 return pSDB->transactionCommit( hint ) ;
6950 INT32 transactionRollback()
6954 return SDB_NOT_CONNECTED ;
6956 return pSDB->transactionRollback() ;
6967 INT32 flushConfigure(
const bson::BSONObj &options )
6971 return SDB_NOT_CONNECTED ;
6973 return pSDB->flushConfigure( options ) ;
6982 INT32 crtJSProcedure (
const CHAR *code )
6986 return SDB_NOT_CONNECTED ;
6988 return pSDB->crtJSProcedure( code ) ;
6997 INT32 rmProcedure(
const CHAR *spName )
7001 return SDB_NOT_CONNECTED ;
7003 return pSDB->rmProcedure( spName ) ;
7006 INT32 listProcedures( _sdbCursor **cursor,
const bson::BSONObj &condition )
7010 return SDB_NOT_CONNECTED ;
7012 return pSDB->listProcedures( cursor, condition ) ;
7022 INT32 listProcedures(
sdbCursor &cursor,
const bson::BSONObj &condition )
7026 return SDB_NOT_CONNECTED ;
7029 return pSDB->listProcedures( cursor, condition ) ;
7032 INT32 evalJS(
const CHAR *code,
7034 _sdbCursor **cursor,
7035 bson::BSONObj &errmsg )
7039 return SDB_NOT_CONNECTED ;
7041 return pSDB->evalJS( code, type, cursor, errmsg ) ;
7058 bson::BSONObj &errmsg )
7062 return SDB_NOT_CONNECTED ;
7065 return pSDB->evalJS( code, type, cursor, errmsg ) ;
7087 INT32 backupOffline (
const bson::BSONObj &options)
7089 return backup( options ) ;
7110 INT32 backup (
const bson::BSONObj &options)
7114 return SDB_NOT_CONNECTED ;
7116 return pSDB->backup( options ) ;
7120 INT32 listBackup ( _sdbCursor **cursor,
7121 const bson::BSONObj &options,
7122 const bson::BSONObj &condition = _sdbStaticObject,
7123 const bson::BSONObj &selector = _sdbStaticObject,
7124 const bson::BSONObj &orderBy = _sdbStaticObject)
7128 return SDB_NOT_CONNECTED ;
7130 return pSDB->listBackup( cursor, options, condition, selector, orderBy ) ;
7156 const bson::BSONObj &options,
7157 const bson::BSONObj &condition = _sdbStaticObject,
7158 const bson::BSONObj &selector = _sdbStaticObject,
7159 const bson::BSONObj &orderBy = _sdbStaticObject)
7163 return SDB_NOT_CONNECTED ;
7166 return pSDB->listBackup( cursor, options, condition, selector, orderBy ) ;
7183 INT32 removeBackup (
const bson::BSONObj &options)
7187 return SDB_NOT_CONNECTED ;
7189 return pSDB->removeBackup( options ) ;
7192 INT32 listTasks ( _sdbCursor **cursor,
7193 const bson::BSONObj &condition = _sdbStaticObject,
7194 const bson::BSONObj &selector = _sdbStaticObject,
7195 const bson::BSONObj &orderBy = _sdbStaticObject,
7196 const bson::BSONObj &hint = _sdbStaticObject)
7200 return SDB_NOT_CONNECTED ;
7202 return pSDB->listTasks ( cursor,
7226 const bson::BSONObj &condition = _sdbStaticObject,
7227 const bson::BSONObj &selector = _sdbStaticObject,
7228 const bson::BSONObj &orderBy = _sdbStaticObject,
7229 const bson::BSONObj &hint = _sdbStaticObject)
7233 return SDB_NOT_CONNECTED ;
7236 return pSDB->listTasks ( cursor,
7251 INT32 waitTasks (
const SINT64 *taskIDs,
7256 return SDB_NOT_CONNECTED ;
7258 return pSDB->waitTasks ( taskIDs,
7271 INT32 cancelTask ( SINT64 taskID,
7276 return SDB_NOT_CONNECTED ;
7278 return pSDB->cancelTask ( taskID,
7292 INT32 setSessionAttr (
const bson::BSONObj &options = _sdbStaticObject )
7296 return SDB_NOT_CONNECTED ;
7298 return pSDB->setSessionAttr ( options ) ;
7309 INT32 getSessionAttr ( bson::BSONObj & result,
7310 BOOLEAN useCache = TRUE )
7314 return SDB_NOT_CONNECTED ;
7316 return pSDB->getSessionAttr( result, useCache ) ;
7325 INT32 closeAllCursors ()
7327 return interrupt() ;
7340 return SDB_NOT_CONNECTED ;
7342 return pSDB->interrupt () ;
7353 INT32 interruptOperation()
7357 return SDB_NOT_CONNECTED ;
7359 return pSDB->interruptOperation () ;
7369 INT32 isValid ( BOOLEAN *result )
7373 return SDB_NOT_CONNECTED ;
7375 return pSDB->isValid ( result ) ;
7388 return pSDB->isValid () ;
7401 return pSDB->isClosed() ;
7422 INT32 createDomain (
const CHAR *pDomainName,
7423 const bson::BSONObj &options,
7428 return SDB_NOT_CONNECTED ;
7431 return pSDB->createDomain ( pDomainName, options, domain ) ;
7434 INT32 createDomain (
const CHAR *pDomainName,
7435 const bson::BSONObj &options,
7436 _sdbDomain **domain )
7440 return SDB_NOT_CONNECTED ;
7442 return pSDB->createDomain ( pDomainName, options, domain ) ;
7451 INT32 dropDomain (
const CHAR *pDomainName )
7455 return SDB_NOT_CONNECTED ;
7457 return pSDB->dropDomain ( pDomainName ) ;
7460 INT32 getDomain (
const CHAR *pDomainName,
7461 _sdbDomain **domain )
7465 return SDB_NOT_CONNECTED ;
7467 return pSDB->getDomain ( pDomainName, domain ) ;
7478 INT32 getDomain (
const CHAR *pDomainName,
7483 return SDB_NOT_CONNECTED ;
7486 return pSDB->getDomain ( pDomainName, domain ) ;
7489 INT32 listDomains ( _sdbCursor **cursor,
7490 const bson::BSONObj &condition = _sdbStaticObject,
7491 const bson::BSONObj &selector = _sdbStaticObject,
7492 const bson::BSONObj &orderBy = _sdbStaticObject,
7493 const bson::BSONObj &hint = _sdbStaticObject )
7497 return SDB_NOT_CONNECTED ;
7499 return pSDB->listDomains ( cursor, condition, selector, orderBy, hint ) ;
7520 const bson::BSONObj &condition = _sdbStaticObject,
7521 const bson::BSONObj &selector = _sdbStaticObject,
7522 const bson::BSONObj &orderBy = _sdbStaticObject,
7523 const bson::BSONObj &hint = _sdbStaticObject )
7527 return SDB_NOT_CONNECTED ;
7530 return pSDB->listDomains ( cursor, condition, selector, orderBy, hint ) ;
7538 INT32 getDC( sdbDataCenter &dc )
7542 return SDB_NOT_CONNECTED ;
7545 return pSDB->getDC ( dc ) ;
7553 INT32 getDC( _sdbDataCenter **dc )
7557 return SDB_NOT_CONNECTED ;
7559 return pSDB->getDC ( dc ) ;
7567 INT32 getRecycleBin( sdbRecycleBin &recycleBin )
7571 return SDB_NOT_CONNECTED ;
7574 return pSDB->getRecycleBin( recycleBin ) ;
7582 INT32 getRecycleBin( _sdbRecycleBin **recycleBin )
7586 return SDB_NOT_CONNECTED ;
7588 return pSDB->getRecycleBin( recycleBin ) ;
7620 INT32 syncDB(
const bson::BSONObj &options = _sdbStaticObject )
7624 return SDB_NOT_CONNECTED ;
7626 return pSDB->syncDB ( options ) ;
7655 INT32 analyze (
const bson::BSONObj &options = _sdbStaticObject )
7659 return SDB_NOT_CONNECTED ;
7661 return pSDB->analyze ( options ) ;
7679 INT32 forceSession( SINT64 sessionID,
7680 const bson::BSONObj &options = _sdbStaticObject )
7684 return SDB_NOT_CONNECTED ;
7686 return pSDB->forceSession( sessionID, options ) ;
7703 INT32 forceStepUp(
const bson::BSONObj &options = _sdbStaticObject )
7707 return SDB_NOT_CONNECTED ;
7709 return pSDB->forceStepUp( options ) ;
7724 INT32 invalidateCache(
const bson::BSONObj &options = _sdbStaticObject )
7728 return SDB_NOT_CONNECTED ;
7730 return pSDB->invalidateCache( options ) ;
7746 INT32 reloadConfig(
const bson::BSONObj &options = _sdbStaticObject )
7750 return SDB_NOT_CONNECTED ;
7752 return pSDB->reloadConfig( options ) ;
7771 INT32 updateConfig(
const bson::BSONObj &configs = _sdbStaticObject,
7772 const bson::BSONObj &options = _sdbStaticObject )
7776 return SDB_NOT_CONNECTED ;
7778 return pSDB->updateConfig( configs, options ) ;
7797 INT32 deleteConfig(
const bson::BSONObj &configs = _sdbStaticObject,
7798 const bson::BSONObj &options = _sdbStaticObject )
7802 return SDB_NOT_CONNECTED ;
7804 return pSDB->deleteConfig( configs, options ) ;
7829 INT32 setPDLevel( INT32 level,
7830 const bson::BSONObj &options = _sdbStaticObject )
7834 return SDB_NOT_CONNECTED ;
7836 return pSDB->setPDLevel( level, options ) ;
7839 INT32 msg(
const CHAR* msg )
7843 return SDB_NOT_CONNECTED ;
7845 return pSDB->msg( msg ) ;
7863 INT32 loadCS(
const CHAR* csName,
7864 const bson::BSONObj &options = _sdbStaticObject )
7868 return SDB_NOT_CONNECTED ;
7870 return pSDB->loadCS( csName, options ) ;
7888 INT32 unloadCS(
const CHAR* csName,
7889 const bson::BSONObj &options = _sdbStaticObject )
7893 return SDB_NOT_CONNECTED ;
7895 return pSDB->unloadCS( csName, options ) ;
7910 INT32 traceStart( UINT32 traceBufferSize,
7911 const CHAR* component = NULL,
7912 const CHAR* breakpoint = NULL,
7913 const vector<UINT32> &tidVec = _sdbStaticUINT32Vec )
7917 return SDB_NOT_CONNECTED ;
7919 return pSDB->traceStart( traceBufferSize, component,
7920 breakpoint, tidVec ) ;
7942 INT32 traceStart( UINT32 traceBufferSize,
7943 const bson::BSONObj &options )
7947 return SDB_NOT_CONNECTED ;
7949 return pSDB->traceStart( traceBufferSize, options ) ;
7960 INT32 traceStop(
const CHAR* dumpFileName )
7964 return SDB_NOT_CONNECTED ;
7966 return pSDB->traceStop( dumpFileName ) ;
7978 return SDB_NOT_CONNECTED ;
7980 return pSDB->traceResume() ;
7993 return SDB_NOT_CONNECTED ;
7996 return pSDB->traceStatus( cursor ) ;
7999 INT32 traceStatus( _sdbCursor** cursor )
8003 return SDB_NOT_CONNECTED ;
8005 return pSDB->traceStatus( cursor ) ;
8018 INT32 renameCollectionSpace(
const CHAR* oldName,
8019 const CHAR* newName,
8020 const bson::BSONObj &options = _sdbStaticObject )
8024 return SDB_NOT_CONNECTED ;
8026 return pSDB->renameCollectionSpace( oldName, newName, options ) ;
8040 INT32 getLastErrorObj( bson::BSONObj &errObj )
8044 return SDB_NOT_CONNECTED ;
8046 return pSDB->getLastErrorObj( errObj ) ;
8052 void cleanLastErrorObj()
8058 return pSDB->cleanLastErrorObj() ;
8071 INT32 getLastResultObj( bson::BSONObj &result,
8072 BOOLEAN getOwned = FALSE )
const
8076 return SDB_NOT_CONNECTED ;
8078 return pSDB->getLastResultObj( result, getOwned ) ;
8100 INT32 createSequence(
const CHAR *pSequenceName,
8101 const bson::BSONObj &options,
8102 _sdbSequence **sequence )
8106 return SDB_NOT_CONNECTED ;
8108 return pSDB->createSequence( pSequenceName, options, sequence ) ;
8130 INT32 createSequence(
const CHAR *pSequenceName,
8131 const bson::BSONObj &options,
8136 return SDB_NOT_CONNECTED ;
8138 return pSDB->createSequence( pSequenceName, options, sequence ) ;
8149 INT32 createSequence(
const CHAR *pSequenceName,
8154 return SDB_NOT_CONNECTED ;
8156 return pSDB->createSequence( pSequenceName, sequence ) ;
8167 INT32 getSequence(
const CHAR *pSequenceName,
8168 _sdbSequence **sequence )
8172 return SDB_NOT_CONNECTED ;
8174 return pSDB->getSequence( pSequenceName, sequence ) ;
8185 INT32 getSequence(
const CHAR *pSequenceName,
8190 return SDB_NOT_CONNECTED ;
8192 return pSDB->getSequence( pSequenceName, sequence ) ;
8202 INT32 renameSequence(
const CHAR *pOldName,
const CHAR *pNewName )
8206 return SDB_NOT_CONNECTED ;
8208 return pSDB->renameSequence( pOldName, pNewName ) ;
8217 INT32 dropSequence(
const CHAR *pSequenceName )
8221 return SDB_NOT_CONNECTED ;
8223 return pSDB->dropSequence( pSequenceName ) ;
8275 const CHAR *pDataSourceName,
8276 const CHAR *addresses,
8277 const CHAR *user = NULL,
8278 const CHAR *password = NULL,
8279 const CHAR *type = NULL,
8280 const bson::BSONObj *options = NULL )
8284 return SDB_NOT_CONNECTED ;
8287 return pSDB->createDataSource( &dataSource.pDataSource, pDataSourceName, addresses,
8288 user, password, type, options ) ;
8297 INT32 dropDataSource(
const CHAR *pDataSourceName )
8301 return SDB_NOT_CONNECTED ;
8303 return pSDB->dropDataSource( pDataSourceName ) ;
8314 INT32 getDataSource(
const CHAR *pDataSourceName,
8319 return SDB_NOT_CONNECTED ;
8322 return pSDB->getDataSource( pDataSourceName, &dataSource.pDataSource ) ;
8340 const bson::BSONObj &condition = _sdbStaticObject,
8341 const bson::BSONObj &selector = _sdbStaticObject,
8342 const bson::BSONObj &orderBy = _sdbStaticObject,
8343 const bson::BSONObj &hint = _sdbStaticObject )
8347 return SDB_NOT_CONNECTED ;
8350 return pSDB->listDataSources( &cursor.
pCursor, condition, selector, orderBy, hint ) ;