Public Member Functions | |
drop () | |
alter (array|string $options) | |
split (string $sourceGroup, string $targetGroup, integer|double $percent) | |
split (string $sourceGroup, string $targetGroup, array|string $condition, array|string $endCondition=null) | |
splitAsync (string $sourceGroup, string $targetGroup, integer|double $percent) | |
splitAsync (string $sourceGroup, string $targetGroup, array|string $condition, array|string $endCondition=null) | |
getFullName () | |
getCSName () | |
getName () | |
attachCL (string $subClFullName, array|string $options) | |
detachCL (string $subClFullName) | |
insert (array|string $record) | |
bulkInsert (array|string $records, integer $flags=0) | |
remove (array|string $condition=null, array|string $hint=null) | |
update (array|string $rule, array|string $condition=null, array|string $hint=null) | |
upsert (array|string $rule, array|string $condition=null, array|string $hint=null) | |
find (array|string $condition=null, array|string $selector=null, array|string $orderBy=null, array|string $hint=null, integer $numToSkip=0, integer $numToReturn=-1, integer $flag=0) | |
findAndUpdate (array|string $rule, array|string $condition=null, array|string $selector=null, array|string $orderBy=null, array|string $hint=null, integer $numToSkip=0, integer $numToReturn=-1, integer $flag=0, boolean $returnNew=false) | |
findAndRemove (array|string $condition=null, array|string $selector=null, array|string $orderBy=null, array|string $hint=null, integer $numToSkip=0, integer $numToReturn=-1, integer $flag=0) | |
explain (array|string $condition=null, array|string $selector=null, array|string $orderBy=null, array|string $hint=null, integer $numToSkip=0, integer $numToReturn=-1, integer $flag=0, array|string $options=null) | |
count (array|string $condition=null, array|string $hint=null) | |
aggregate (array|string $aggrObj) | |
createIndex (array|string $indexDef, string $indexName, boolean $isUnique=false, boolean $isEnforced=false, integer $sortBufferSize=64) | |
dropIndex (string $indexName) | |
getIndex (string $indexName="") | |
createIdIndex (array|string $args=null) | |
dropIdIndex () | |
openLob (string $oid, integer $mode) | |
removeLob (string $oid) | |
listLob (array|string $condition=null, array|string $selector=null, array|string $orderBy=null, array|string $hint=null) | |
listLobPieces (array|string $condition=null, array|string $selector=null, array|string $orderBy=null, array|string $hint=null) | |
getCollectionName () | |
deleteIndex () | |
Public Attributes | |
const | SDB_FLG_INSERT_CONTONDUP 0x00000001 |
const | SDB_FLG_FIND_FORCE_HINT 0x00000080 |
const | SDB_FLG_FIND_PARALLED 0x00000100 |
const | SDB_FLG_FIND_WITH_RETURNDATA 0x00000200 |
const | SDB_FLG_QUERY_FORCE_HINT 0x00000080 |
const | SDB_FLG_QUERY_PARALLED 0x00000100 |
const | SDB_FLG_QUERY_WITH_RETURNDATA 0x00000200 |
const | SDB_LOB_CREATEONLY 0x00000001 |
const | SDB_LOB_READ 0x00000004 |
SequoiaCL Class. To get this Class object must be call SequoiaDB::getCL or SequoiaCS::selectCL or SequoiaCS::getCL.
Class for create an object of the collection
SequoiaCL::aggregate | ( | array|string | $aggrObj | ) |
Execute aggregate operation in specified collection.
$aggrObj | an array or the string argument. Aggregation parameter, if the input string or an array, you can enter only one parameter, such as the string: '{ "$project": { "field": 1 } }'
array( '$project' => array ( 'field' => 1 ) )
array ( '{ "$project": { "field1": 1, "field2": 2 } }', '{ "$project": { "field1": 1 } }' )
array ( array ( '$project' => array ( 'field1' => 1, 'field2' => 2 ) ), array ( '$project' => array ( 'field1' => 1 ) ) )
|
SequoiaCursor | Object |
Example:
SequoiaCL::alter | ( | array|string | $options | ) |
Alter collection options.
$options | an array or the string argument. New collection options. |
array | array( 'errno' => 0 ) |
string | { "errno": 0 } |
Example: Alter collection option ReplSize
SequoiaCL::attachCL | ( | string | $subClFullName, |
array|string | $options | ||
) |
Attach the specified collection.
$subClFullName | the string argument. The name of the subcollection. |
$options | an array or the string argument. The low boudary and up boudary eg: array( 'LowBound' => array( '<key>' => <value> ), 'UpBound' => array( '<key>' => <value> ) )
|
array | array( 'errno' => 0 ) |
string | { "errno": 0 } |
Example: 2 collections have been created, one of which is a vertival partition.
SequoiaCL::bulkInsert | ( | array|string | $records, |
integer | $flags = 0 |
||
) |
Insert records into current collection.
$records | an array or the string argument. The inserted record, cannot be empty. |
$flags | an integer argument. While SDB_FLG_INSERT_CONTONDUP is set, if some records hit index key duplicate error, database will skip them and go on inserting. However, while 0 is set, database will stop inserting in that case, and return errno code. |
array | array( 'errno' => 0 ) |
string | { "errno": 0 } |
Example: Insert an array record
Example: Insert the json string
Example: Insert multiple records
Example: Set $flags SDB_FLG_INSERT_CONTONDUP
SequoiaCL::count | ( | array|string | $condition = null , |
array|string | $hint = null |
||
) |
Get the count of records in specified collection.
$condition | an array or the string argument. The matching rule, return the count of all records if this parameter is null. |
$hint | an array or the string argument. The hint, automatically match the optimal hint if null. |
integer|SequoiaINT64 | Records number |
Example:
SequoiaCL::createIdIndex | ( | array|string | $args = null | ) |
Create $id index in collection.
$args | an array or the string argument. The arguments of creating id index. set it as null if no args. e.g. array( 'SortBufferSize' => 64 ) SortBufferSize : The size of sort buffer used when creating index, the unit is MB,
zero means don't use sort buffer
|
array | array( 'errno' => 0 ) |
string | { "errno": 0 } |
Example:
SequoiaCL::createIndex | ( | array|string | $indexDef, |
string | $indexName, | ||
boolean | $isUnique = false , |
||
boolean | $isEnforced = false , |
||
integer | $sortBufferSize = 64 |
||
) |
Create the index in current collection.
$indexDef | an array or the string argument. The index element. e.g. array( 'name' => 1, 'age' => -1 ) |
$indexName | the string argument. The index name. |
$isUnique | a boolean argument. Whether the index elements are unique or not,default is false. |
$isEnforced | a boolean argument. Whether the index is enforced unique This element is meaningful when isUnique is set to true. |
$sortBufferSize | an integer argument. The size of sort buffer used when creating index, the unit is MB, zero means don't use sort buffer. |
array | array( 'errno' => 0 ) |
string | { "errno": 0 } |
Example:
SequoiaCL::deleteIndex | ( | ) |
Delete $id index in collection.
SequoiaCL::detachCL | ( | string | $subClFullName | ) |
Detach the specified collection.
$subClFullName | the string argument. The name of the subcollection. |
array | array( 'errno' => 0 ) |
string | { "errno": 0 } |
Example: 2 collections have been created, one of which is a vertival partition and attach collection.
SequoiaCL::drop | ( | ) |
Drop collection.
array | array( 'errno' => 0 ) |
string | { "errno": 0 } |
Example: Drop collection
SequoiaCL::dropIdIndex | ( | ) |
Drop $id index in collection.
array | array( 'errno' => 0 ) |
string | { "errno": 0 } |
Example:
SequoiaCL::dropIndex | ( | string | $indexName | ) |
Drop the index in current collection.
$indexName | the string argument. The index name. |
array | array( 'errno' => 0 ) |
string | { "errno": 0 } |
Example:
SequoiaCL::explain | ( | array|string | $condition = null , |
array|string | $selector = null , |
||
array|string | $orderBy = null , |
||
array|string | $hint = null , |
||
integer | $numToSkip = 0 , |
||
integer | $numToReturn = -1 , |
||
integer | $flag = 0 , |
||
array|string | $options = null |
||
) |
Get access plan of query
$condition | an array or the string argument. The matching rule, return all the record if null. |
$selector | an array or the string argument. The selective rule, return the whole record if null. |
$orderBy | an array or the string argument. The ordered rule, never sort if null. |
$hint | an array or the string argument. The hint, automatically match the optimal hint if null. |
$numToSkip | an integer argument. Skip the first numToSkip records, never skip if this parameter is 0. |
$numToReturn | an integer argument. Only return numToReturn records, return all if this parameter is -1. |
$flag | an integer argument. The query flag, default to be 0. SDB_FLG_QUERY_FORCE_HINT(0x00000080) : Force to use specified hint to query, if database have no index assigned by the hint, fail to query
SDB_FLG_QUERY_PARALLED(0x00000100) : Enable paralled sub query
SDB_FLG_QUERY_WITH_RETURNDATA(0x00000200) : In general, query won't return data until cursor get from database,
when add this flag, return data in query response, it will be more high-performance
|
$options | an array or the string argument. The rules of explain, the options are as below: |
SequoiaCursor | Object |
Example:
SequoiaCL::find | ( | array|string | $condition = null , |
array|string | $selector = null , |
||
array|string | $orderBy = null , |
||
array|string | $hint = null , |
||
integer | $numToSkip = 0 , |
||
integer | $numToReturn = -1 , |
||
integer | $flag = 0 |
||
) |
Get the matching records in current collection.
$condition | an array or the string argument. The matching rule, return all the record if null. |
$selector | an array or the string argument. The selective rule, return the whole record if null. |
$orderBy | an array or the string argument. The The ordered rule, never sort if null. |
$hint | an array or the string argument. The hint, automatically match the optimal hint if null. |
$numToSkip | an integer argument. Skip the first numToSkip records, never skip if this parameter is 0. |
$numToReturn | an integer argument. Only return numToReturn records, return all if this parameter is -1. |
$flag | an integer argument. The query flag, default to be 0. SDB_FLG_QUERY_FORCE_HINT(0x00000080) : Force to use specified hint to query, if database have no index assigned by the hint, fail to query
SDB_FLG_QUERY_PARALLED(0x00000100) : Enable paralled sub query
SDB_FLG_QUERY_WITH_RETURNDATA(0x00000200) : In general, query won't return data until cursor get from database,
when add this flag, return data in query response, it will be more high-performance
|
SequoiaCursor | Object |
Example:
SequoiaCL::findAndRemove | ( | array|string | $condition = null , |
array|string | $selector = null , |
||
array|string | $orderBy = null , |
||
array|string | $hint = null , |
||
integer | $numToSkip = 0 , |
||
integer | $numToReturn = -1 , |
||
integer | $flag = 0 |
||
) |
Get the matching documents in current collection and remove.
$condition | an array or the string argument. The matching rule, return all the record if null. |
$selector | an array or the string argument. The selective rule, return the whole record if null. |
$orderBy | an array or the string argument. The The ordered rule, never sort if null. |
$hint | an array or the string argument. The hint, automatically match the optimal hint if null. |
$numToSkip | an integer argument. Skip the first numToSkip records, never skip if this parameter is 0. |
$numToReturn | an integer argument. Only return numToReturn records, return all if this parameter is -1. |
$flag | an integer argument. The query flag, default to be 0. SDB_FLG_QUERY_FORCE_HINT(0x00000080) : Force to use specified hint to query, if database have no index assigned by the hint, fail to query
SDB_FLG_QUERY_PARALLED(0x00000100) : Enable paralled sub query
SDB_FLG_QUERY_WITH_RETURNDATA(0x00000200) : In general, query won't return data until cursor get from database,
when add this flag, return data in query response, it will be more high-performance
|
SequoiaCursor | Object |
Example:
SequoiaCL::findAndUpdate | ( | array|string | $rule, |
array|string | $condition = null , |
||
array|string | $selector = null , |
||
array|string | $orderBy = null , |
||
array|string | $hint = null , |
||
integer | $numToSkip = 0 , |
||
integer | $numToReturn = -1 , |
||
integer | $flag = 0 , |
||
boolean | $returnNew = false |
||
) |
Get the matching records in current collection and update.
$rule | an array or the string argument. The update rule, can't be null. |
$condition | an array or the string argument. The matching rule, return all the record if null. |
$selector | an array or the string argument. The selective rule, return the whole record if null. |
$orderBy | an array or the string argument. The The ordered rule, never sort if null. |
$hint | an array or the string argument. The hint, automatically match the optimal hint if null. |
$numToSkip | an integer argument. Skip the first numToSkip records, never skip if this parameter is 0. |
$numToReturn | an integer argument. Only return numToReturn records, return all if this parameter is -1. |
$flag | an integer argument. The query flag, default to be 0. SDB_FLG_QUERY_FORCE_HINT(0x00000080) : Force to use specified hint to query, if database have no index assigned by the hint, fail to query
SDB_FLG_QUERY_PARALLED(0x00000100) : Enable paralled sub query
SDB_FLG_QUERY_WITH_RETURNDATA(0x00000200) : In general, query won't return data until cursor get from database,
when add this flag, return data in query response, it will be more high-performance
|
$returnNew | a boolean argument. When TRUE, returns the updated record rather than the original. |
SequoiaCursor | Object |
Example:
SequoiaCL::getCollectionName | ( | ) |
Get the specified collection name.
SequoiaCL::getCSName | ( | ) |
Get the specified collection space name.
string | <cs_name> |
Example:
SequoiaCL::getFullName | ( | ) |
Get the specified collection full name.
string | <cs_name.cl_name> |
Example:
SequoiaCL::getIndex | ( | string | $indexName = "" | ) |
Get all of or one of the indexes in current collection.
$indexName | the string argument. The index name, returns all of the indexes if this parameter is empty string. |
SequoiaCursor | Object |
Example:
SequoiaCL::getName | ( | ) |
Get the specified collection name.
string | <cl_name> |
Example:
SequoiaCL::insert | ( | array|string | $record | ) |
Insert a record into current collection.
$record | an array or the string argument. The inserted record, cannot be empty. |
array | array( 'errno' => 0, '_id' => <24 hexadecimal characters> ) |
string | { "errno": 0, "_id": <24 hexadecimal characters> } |
Example: Record type is php array
Example: Record type is json string
SequoiaCL::listLob | ( | array|string | $condition = null , |
array|string | $selector = null , |
||
array|string | $orderBy = null , |
||
array|string | $hint = null |
||
) |
List all the lobs' meta data in current collection.
$condition | an array or the string argument. This parameter is reserved and must be null. |
$selector | an array or the string argument. This parameter is reserved and must be null. |
$orderBy | an array or the string argument. This parameter is reserved and must be null. |
$hint | an array or the string argument. This parameter is reserved and must be null. |
SequoiaCursor | Object |
Example:
SequoiaCL::listLobPieces | ( | array|string | $condition = null , |
array|string | $selector = null , |
||
array|string | $orderBy = null , |
||
array|string | $hint = null |
||
) |
List all the pieces in the lob.
$condition | an array or the string argument. This parameter is reserved and must be null. |
$selector | an array or the string argument. This parameter is reserved and must be null. |
$orderBy | an array or the string argument. This parameter is reserved and must be null. |
$hint | an array or the string argument. This parameter is reserved and must be null. |
SequoiaCursor | Object |
Example:
SequoiaCL::openLob | ( | string | $oid, |
integer | $mode | ||
) |
Create a large object.
$oid | the string argument. The object id. |
$mode | an integer argument. The open mode: |
SequoiaLob | Object |
Example:
SequoiaCL::remove | ( | array|string | $condition = null , |
array|string | $hint = null |
||
) |
Delete the matching documents in current collection, never rollback if failed.
$condition | an array or the string argument. The matching rule, delete all the documents if null. |
$hint | an array or the string argument. The hint, automatically match the optimal hint if null. |
array | array( 'errno' => 0 ) |
string | { "errno": 0 } |
Example: Remove all records
Example: Remove match condition records
SequoiaCL::removeLob | ( | string | $oid | ) |
Remove lob
$oid | the string argument. The object id. |
array | array( 'errno' => 0 ) |
string | { "errno": 0 } |
Example:
SequoiaCL::split | ( | string | $sourceGroup, |
string | $targetGroup, | ||
integer|double | $percent | ||
) |
Split the specified collection from source replica group to target by percent.
$sourceGroup | the string argument. The source replica group name. |
$targetGroup | the string argument. The target replica group name. |
$percent | an integer or a double argument. The split percent, Range:(0.0, 100.0]. |
array | array( 'errno' => 0 ) |
string | { "errno": 0 } |
Example:
SequoiaCL::split | ( | string | $sourceGroup, |
string | $targetGroup, | ||
array|string | $condition, | ||
array|string | $endCondition = null |
||
) |
Split the specified collection from source replica group to target by range.
$sourceGroup | the string argument. The source replica group name. |
$targetGroup | the string argument. The target replica group name. |
$condition | an array or the string argument. The split condition. |
$endCondition | an array or the string argument. The split end condition. |
array | array( 'errno' => 0 ) |
string | { "errno": 0 } |
Example:
SequoiaCL::splitAsync | ( | string | $sourceGroup, |
string | $targetGroup, | ||
integer|double | $percent | ||
) |
Split the specified collection from source replica group to target by range.
$sourceGroup | the string argument. The source replica group name. |
$targetGroup | the string argument. The target replica group name. |
$percent | an integer or a double argument. The split percent, Range:(0.0, 100.0]. |
array | array( 'errno' => 0, 'taskID' => 1 ) |
string | { "errno": 0, "taskID": 1 } |
Example:
SequoiaCL::splitAsync | ( | string | $sourceGroup, |
string | $targetGroup, | ||
array|string | $condition, | ||
array|string | $endCondition = null |
||
) |
Split the specified collection from source replica group to target by range.
$sourceGroup | the string argument. The source replica group name. |
$targetGroup | the string argument. The target replica group name. |
$condition | an array or the string argument. The split condition. |
$endCondition | an array or the string argument. The split end condition. |
array | array( 'errno' => 0, 'taskID' => 1 ) |
string | { "errno": 0, "taskID": 1 |
Example:
SequoiaCL::update | ( | array|string | $rule, |
array|string | $condition = null , |
||
array|string | $hint = null |
||
) |
Update the matching documents in current collection.
$rule | an array or the string argument. The updating rule, cannot be null. |
$condition | an array or the string argument. The matching rule, update all the documents if null. |
$hint | an array or the string argument. The hint, automatically match the optimal hint if null. |
array | array( 'errno' => 0 ) |
string | { "errno": 0 } |
Example:
SequoiaCL::upsert | ( | array|string | $rule, |
array|string | $condition = null , |
||
array|string | $hint = null |
||
) |
Update the matching documents in current collection, insert if no matching.
$rule | an array or the string argument. The updating rule, cannot be null. |
$condition | an array or the string argument. The matching rule, update all the documents if null. |
$hint | an array or the string argument. The hint, automatically match the optimal hint if null. |
array | array( 'errno' => 0 ) |
string | { "errno": 0 } |
Example:
const SequoiaCL::SDB_FLG_FIND_FORCE_HINT 0x00000080 |
Force to use specified hint to query, if database have no index assigned by the hint, fail to query.
const SequoiaCL::SDB_FLG_FIND_PARALLED 0x00000100 |
Enable paralled sub query.
const SequoiaCL::SDB_FLG_FIND_WITH_RETURNDATA 0x00000200 |
In general, query won't return data until cursor get from database, when add this flag, return data in query response, it will be more high-performance.
const SequoiaCL::SDB_FLG_INSERT_CONTONDUP 0x00000001 |
The flags represent whether bulk insert continue when hitting index key duplicate error.
const SequoiaCL::SDB_FLG_QUERY_FORCE_HINT 0x00000080 |
Force to use specified hint to query, if database have no index assigned by the hint, fail to query
const SequoiaCL::SDB_FLG_QUERY_PARALLED 0x00000100 |
Enable paralled sub query
const SequoiaCL::SDB_FLG_QUERY_WITH_RETURNDATA 0x00000200 |
In general, query won't return data until cursor get from database, when add this flag, return data in query response, it will be more high-performance
const SequoiaCL::SDB_LOB_CREATEONLY 0x00000001 |
Open a new lob only.
const SequoiaCL::SDB_LOB_READ 0x00000004 |
Open an existing lob to read.