Public Member Functions | |
drop () | |
alter (array|string $options) | |
enableSharding (array|string $options) | |
disableSharding () | |
enableCompression (array|string $options) | |
disableCompression () | |
setAttributes (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) | |
createAutoIncrement (array|string $field) | |
dropAutoIncrement (array|string $field) | |
insert (array|string $record, integer $flags=SDB_FLG_INSERT_RETURN_OID) | |
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, integer $flag=0) | |
upsert (array|string $rule, array|string $condition=null, array|string $hint=null, array|string $setOnInsert=null, integer $flag=0) | |
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, array|string $options) | |
createIndex (array|string $indexDef, string $indexName, boolean $isUnique=false, boolean $isEnforced=false, integer $sortBufferSize=64) | |
dropIndex (string $indexName) | |
getIndexes () | |
getIndexInfo (string $name) | |
getIndexStat (string $name) | |
getIndexStat (string $name, boolean $detail=false) | |
createIdIndex (array|string $args=null) | |
dropIdIndex () | |
openLob (string $oid, integer $mode) | |
removeLob (string $oid) | |
truncateLob (string $oid, integer|SequoiaINT64 $length) | |
listLob (array|string $condition=null, array|string $selector=null, array|string $orderBy=null, array|string $hint=null, integer $numToSkip=0, integer $numToReturn=-1) | |
listLobPieces (array|string $condition=null, array|string $selector=null, array|string $orderBy=null, array|string $hint=null, integer $numToSkip=0, integer $numToReturn=-1) | |
createLobID (string $time="") | |
getCollectionName () | |
deleteIndex () | |
getIndex (string $indexName="") | |
Public Attributes | |
const | SDB_FLG_INSERT_CONTONDUP 0x00000001 |
const | SDB_FLG_INSERT_REPLACEONDUP 0x00000004 |
const | SDB_FLG_INSERT_CONTONDUP_ID 0x00000020 |
const | SDB_FLG_INSERT_RETURN_OID 0x10000000 |
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_FLG_QUERY_PREPARE_MORE 0x00004000 |
const | SDB_FLG_QUERY_KEEP_SHARDINGKEY_IN_UPDATE 0x00008000 |
const | SDB_FLG_QUERY_FOR_UPDATE 0x00010000 |
const | SDB_FLG_UPDATE_KEEP_SHARDINGKEY 0x00008000 |
const | SDB_LOB_CREATEONLY 0x00000001 |
const | SDB_LOB_READ 0x00000004 |
const | SDB_LOB_WRITE 0x00000008 |
const | SDB_LOB_SHAREREAD 0x00000040 |
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. The options are as following: ReplSize : Assign how many replica nodes need to be synchronized when a write
ShardingKey : Assign the sharding key, foramt: { ShardingKey: { <key name>: <1/-1>} },
1 indicates positive order, -1 indicates reverse order.
e.g. array( "ShardingKey" => array( "a" => 1 ) )
ShardingType : Assign the sharding type, default is "hash"
Partition : The number of partition, it is valid when ShardingType is "hash",
the range is [2^3, 2^20], default is 4096
AutoSplit : Whether to enable the automatic partitioning, it is valid when
ShardingType is "hash", defalut is false
EnsureShardingIndex : Whether to build sharding index, default is true
Compressed : Whether to enable data compression, default is true
CompressionType : The compression type of data, could be "snappy" or "lzw", default is "lzw"
StrictDataMode : Whether to enable strict date mode in numeric operations, default is false
AutoIncrement : Assign attributes of an autoincrement field or batch autoincrement fields
e.g. array( "AutoIncrement" => array( "Field" => "a", "MaxValue" => 2000 ) ),
array( "AutoIncrement" => array( array( "Field" => "a", "MaxValue" => 2000 ), array( "Field" => "a", "MaxValue" => 4000 ) ) )
AutoIndexId : Whether to build "$id" index, default is true
|
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. 0 : while 0 is set, database will stop inserting
when the record hit index key duplicate error.
SDB_FLG_INSERT_CONTONDUP : if the record hit index key duplicate error,
database will skip them and go on inserting.
SDB_FLG_INSERT_RETURN_OID : return the value of "_id" field in the record.
SDB_FLG_INSERT_REPLACEONDUP : if the record hit index key duplicate error,
database will replace the existing record by
the inserting new record and then go on inserting.
|
array | array( 'errno' => 0, 'InsertedNum' => <long>, 'DuplicatedNum' => <long> ) |
string | { "errno": 0, "InsertedNum": <long>, "DuplicatedNum": <long> } |
Example: Insert an array record
Example: Insert the json string
Example: Insert multiple records
Example: Set $flags SDB_FLG_INSERT_CONTONDUP
Example: Set $flags SDB_FLG_INSERT_RETURN_OID
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::createAutoIncrement | ( | array|string | $field | ) |
Create autoincrement field on collection
$field | an array or the string argument. The arguments of field. e.g. array( 'Field' => 'a', 'MaxValue' => 2000 ) Field : The name of autoincrement field
StartValue : The start value of autoincrement field
MinValue : The minimum value of autoincrement field
MaxValue : The maxmun value of autoincrement field
Increment : The increment value of autoincrement field
CacheSize : The cache size of autoincrement field
AcquireSize : The acquire size of autoincrement field
Cycled : The cycled flag of autoincrement field
Generated : The generated mode of autoincrement field
|
array | array( 'errno' => 0 ) |
string | { "errno": 0 } |
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, | ||
array|string | $options | ||
) |
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. |
$options | an array or the string argument. The options are as below: Unique: Whether the index elements are unique or not
Enforced: Whether the index is enforced unique. This element is meaningful when Unique is true
NotNull: Any field of index key should exist and cannot be null when NotNull is true
SortBufferSize: The size of sort buffer used when creating index. Unit is MB. Zero means don't use sort buffer
|
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::createLobID | ( | string | $time = "" | ) |
Create a lob ID.
$time | the string argument. Timestamp(format:YYYY-MM-DD-HH.mm.ss). if Timestamp is empty string, the Timestamp will be generated by server. |
string | lob id |
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::disableCompression | ( | ) |
Alter collection to disable compression.
$options | an array or the string argument. New collection options. |
array | array( 'errno' => 0 ) |
string | { "errno": 0 } |
Example: Alter collection to disable compression
SequoiaCL::disableSharding | ( | ) |
Alter collection to disable sharding.
$options | an array or the string argument. New collection options. |
array | array( 'errno' => 0 ) |
string | { "errno": 0 } |
Example: Alter collection to disable sharding
SequoiaCL::drop | ( | ) |
Drop collection.
array | array( 'errno' => 0 ) |
string | { "errno": 0 } |
Example: Drop collection
SequoiaCL::dropAutoIncrement | ( | array|string | $field | ) |
Drop autoincrement field on collection
$field | an array or the string argument. The arguments of field. e.g. array( 'Field' => 'a' ) Field : The name of autoincrement field
|
array | array( 'errno' => 0 ) |
string | { "errno": 0 } |
Example:
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::enableCompression | ( | array|string | $options | ) |
Alter collection to enable compression.
$options | an array or the string argument. New collection options. |
array | array( 'errno' => 0 ) |
string | { "errno": 0 } |
Example: Alter collection to enable compression
SequoiaCL::enableSharding | ( | array|string | $options | ) |
Alter collection to enable sharding.
$options | an array or the string argument. New collection options. |
array | array( 'errno' => 0 ) |
string | { "errno": 0 } |
Example: Alter collection to enable sharding
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 has no index assigned by the hint, fail to query
SDB_FLG_QUERY_PARALLED(0x00000100) : Enable parallel sub-query, each sub-query will finish scanning different part of data
SDB_FLG_QUERY_WITH_RETURNDATA(0x00000200) : In general, query won't return data until cursor gets the record from database, when adding 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 has no index assigned by the hint, fail to query
SDB_FLG_QUERY_PARALLED(0x00000100) : Enable parallel sub-query, each sub-query will finish scanning different part of data
SDB_FLG_QUERY_WITH_RETURNDATA(0x00000200) : In general, query won't return data until cursor gets the record from database, when adding this flag,
return data in query response, it will be more high-performance
SDB_FLG_QUERY_PREPARE_MORE(0x00004000) : Enable prepare more data when querying
SDB_FLG_UPDATE_KEEP_SHARDINGKEY(0x00008000) : The sharding key in update rule is not filtered, when updating records.
SDB_FLG_QUERY_FOR_UPDATE(0x00010000 ) : Acquire U lock on the records that are read. When the session is in
transaction and setting this flag, the transaction lock will not be released
until the transaction is committed or rollbacked. When the session is not
in transaction, the flag does not work
|
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 has no index assigned by the hint, fail to query
SDB_FLG_QUERY_PARALLED(0x00000100) : Enable parallel sub-query, each sub-query will finish scanning different part of data
SDB_FLG_QUERY_WITH_RETURNDATA(0x00000200) : In general, query won't return data until cursor gets the record from database, when adding this flag,
return data in query response, it will be more high-performance
SDB_FLG_QUERY_FOR_UPDATE(0x00010000 ) : Acquire U lock on the records that are read. When the session is in
transaction and setting this flag, the transaction lock will not be released
until the transaction is committed or rollbacked. When the session is not
in transaction, the flag does not work
|
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 has no index assigned by the hint, fail to query
SDB_FLG_QUERY_PARALLED(0x00000100) : Enable parallel sub-query, each sub-query will finish scanning different part of data
SDB_FLG_QUERY_WITH_RETURNDATA(0x00000200) : In general, query won't return data until cursor gets the record from database, when adding this flag,
return data in query response, it will be more high-performance
SDB_FLG_QUERY_KEEP_SHARDINGKEY_IN_UPDATE(0x00008000) : The sharding key in update rule is not filtered.
SDB_FLG_QUERY_FOR_UPDATE(0x00010000 ) : Acquire U lock on the records that are read. When the session is in
transaction and setting this flag, the transaction lock will not be released
until the transaction is committed or rollbacked. When the session is not
in transaction, the flag does not work
|
$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.
SequoiaCL::getIndexes | ( | ) |
Get the information of all the indexes in current collection.
SequoiaCursor | Object |
Example:
SequoiaCL::getIndexInfo | ( | string | $name | ) |
Get the information of the specified index in current collection.
$name | the string argument. The index name. |
array | record |
string | record |
Example:
SequoiaCL::getIndexStat | ( | string | $name | ) |
Get the statistics of the specified index in current collection.
$name | the string argument. The index name. |
array | record |
string | record |
Example:
SequoiaCL::getIndexStat | ( | string | $name, |
boolean | $detail = false |
||
) |
Get the statistics of the specified index in current collection.
$name | the string argument. The index name. |
$detail | a boolean argument. Whether to get additional MCV (Most Common Values) statistics of index. |
array | record |
string | record |
Example:
SequoiaCL::getName | ( | ) |
Get the specified collection name.
string | <cl_name> |
Example:
SequoiaCL::insert | ( | array|string | $record, |
integer | $flags = SDB_FLG_INSERT_RETURN_OID |
||
) |
Insert a record into current collection.
$record | an array or the string argument. The inserted record, cannot be empty. |
$flags | an integer argument. 0 : while 0 is set, database will stop inserting
when the record hit index key duplicate error.
SDB_FLG_INSERT_CONTONDUP : if the record hit index key duplicate error,
database will skip them and go on inserting.
SDB_FLG_INSERT_RETURN_OID : return the value of "_id" field in the record.
SDB_FLG_INSERT_REPLACEONDUP : if the record hit index key duplicate error,
database will replace the existing record by
the inserting new record.
|
array | array( 'errno' => 0, '_id' => <24 hexadecimal characters>, 'InsertedNum' => <long>, 'DuplicatedNum' => <long> ) |
string | { "errno": 0, "_id": <24 hexadecimal characters>, "InsertedNum": <long>, "DuplicatedNum": <long> } |
Example: Record type is php array
Example: Record type is json string
Example:
SequoiaCL::listLob | ( | array|string | $condition = null , |
array|string | $selector = null , |
||
array|string | $orderBy = null , |
||
array|string | $hint = null , |
||
integer | $numToSkip = 0 , |
||
integer | $numToReturn = -1 |
||
) |
List all the lobs' meta data in current collection.
$condition | an array or the string argument. The matching rule, return all the lob if not provided. |
$selector | an array or the string argument. The selective rule, return the whole infomation if not provided. |
$orderBy | an array or the string argument. The ordered rule, result set is unordered if not provided. |
$hint | an array or the string argument. Specified options. e.g. {"ListPieces": 1} means get the detail piece info of lobs. |
$numToSkip | an integer argument. Skip the first numToSkip lob, default is 0. |
$numToReturn | an integer argument. Only return numToReturn lob, default is -1 for returning all results. |
SequoiaCursor | Object |
Example:
SequoiaCL::listLobPieces | ( | array|string | $condition = null , |
array|string | $selector = null , |
||
array|string | $orderBy = null , |
||
array|string | $hint = null , |
||
integer | $numToSkip = 0 , |
||
integer | $numToReturn = -1 |
||
) |
List all the pieces in the lob.
$condition | an array or the string argument. The matching rule, return all the lob if not provided. |
$selector | an array or the string argument. The selective rule, return the whole infomation if not provided. |
$orderBy | an array or the string argument. The ordered rule, result set is unordered if not provided. |
$hint | an array or the string argument. Specified options. e.g. {"ListPieces": 1} means get the detail piece info of lobs. |
$numToSkip | an integer argument. Skip the first numToSkip lob, default is 0. |
$numToReturn | an integer argument. Only return numToReturn lob, default is -1 for returning all results. |
SequoiaCursor | Object |
Example:
SequoiaCL::openLob | ( | string | $oid, |
integer | $mode | ||
) |
Create a large object or open a large object to read or write.
$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, 'DeletedNum' => <long> ) |
string | { "errno": 0, "DeletedNum": <long> } |
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::setAttributes | ( | array|string | $options | ) |
Alter collection options.
$options | an array or the string argument. The options are as following: ReplSize : Assign how many replica nodes need to be synchronized when a write
ShardingKey : Assign the sharding key, foramt: { ShardingKey: { <key name>: <1/-1>} },
1 indicates positive order, -1 indicates reverse order.
e.g. array( "ShardingKey" => array( "a" => 1 ) )
ShardingType : Assign the sharding type, default is "hash"
Partition : The number of partition, it is valid when ShardingType is "hash",
the range is [2^3, 2^20], default is 4096
AutoSplit : Whether to enable the automatic partitioning, it is valid when
ShardingType is "hash", defalut is false
EnsureShardingIndex : Whether to build sharding index, default is true
Compressed : Whether to enable data compression, default is true
CompressionType : The compression type of data, could be "snappy" or "lzw", default is "lzw"
StrictDataMode : Whether to enable strict date mode in numeric operations, default is false
AutoIncrement : Assign attributes of an autoincrement field or batch autoincrement fields
e.g. array( "AutoIncrement" => array( "Field" => "a", "MaxValue" => 2000 ) ),
array( "AutoIncrement" => array( array( "Field" => "a", "MaxValue" => 2000 ), array( "Field" => "a", "MaxValue" => 4000 ) ) )
AutoIndexId : Whether to build "$id" index, default is true
|
array | array( 'errno' => 0 ) |
string | { "errno": 0 } |
Example: Alter collection option ReplSize
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::truncateLob | ( | string | $oid, |
integer|SequoiaINT64 | $length | ||
) |
Truncate lob
$oid | the string argument. The object id. |
$length | the integer argument. The truncate length. |
array | array( 'errno' => 0 ) |
string | { "errno": 0 } |
Example:
SequoiaCL::update | ( | array|string | $rule, |
array|string | $condition = null , |
||
array|string | $hint = null , |
||
integer | $flag = 0 |
||
) |
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. |
$flag | an integer argument. The query flag, default to be 0. SDB_FLG_UPDATE_KEEP_SHARDINGKEY(0x00008000) : The sharding key in update rule is not filtered.
|
array | array( 'errno' => 0, 'UpdatedNum' => <long>, 'ModifiedNum' => <long>, 'InsertedNum' => <long> ) |
string | { "errno": 0, "UpdatedNum" => <long>, "ModifiedNum" => <long>, "InsertedNum" => <long> } |
Example:
SequoiaCL::upsert | ( | array|string | $rule, |
array|string | $condition = null , |
||
array|string | $hint = null , |
||
array|string | $setOnInsert = null , |
||
integer | $flag = 0 |
||
) |
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. |
$setOnInsert | an array or the string argument. The setOnInsert, assigns the specified values to the fileds when insert |
$flag | an integer argument. The query flag, default to be 0. SDB_FLG_UPDATE_KEEP_SHARDINGKEY(0x00008000) : The sharding key in update rule is not filtered.
|
array | array( 'errno' => 0, 'UpdatedNum' => <long>, 'ModifiedNum' => <long>, 'InsertedNum' => <long> ) |
string | { "errno": 0, "UpdatedNum" => <long>, "ModifiedNum" => <long>, "InsertedNum" => <long> } |
Example:
const SequoiaCL::SDB_FLG_FIND_FORCE_HINT 0x00000080 |
Force to use specified hint to query, if database has no index assigned by the hint, fail to query.
const SequoiaCL::SDB_FLG_FIND_PARALLED 0x00000100 |
Enable parallel sub-query, each sub-query will finish scanning different part of data.
const SequoiaCL::SDB_FLG_FIND_WITH_RETURNDATA 0x00000200 |
In general, query will not return data until cursor get from database, when adding this flag, return data in query response, it will be more high-performance.
const SequoiaCL::SDB_FLG_INSERT_CONTONDUP 0x00000001 |
The flag represent whether insert continue(no errors were reported) when hitting index key duplicate error
const SequoiaCL::SDB_FLG_INSERT_CONTONDUP_ID 0x00000020 |
The flag represent the error of the dup key will be ignored when the dup key is '_id'.
const SequoiaCL::SDB_FLG_INSERT_REPLACEONDUP 0x00000004 |
The flag represent if the record hit index key duplicate error, database will replace the existing record by the inserting new record.
const SequoiaCL::SDB_FLG_INSERT_RETURN_OID 0x10000000 |
The flag represents the error of the dup key will be ignored when the dup key is '_id', and the original record will be replaced by new record.
const SequoiaCL::SDB_FLG_QUERY_FOR_UPDATE 0x00010000 |
When the transaction is turned on and the transaction isolation level is "RC", the transaction lock will be released after the record is read by default. However, when setting this flag, the transaction lock will not be released until the transaction is committed or rollbacked. When the transaction is turned off or the transaction isolation level is "RU", the flag does not work.
const SequoiaCL::SDB_FLG_QUERY_FORCE_HINT 0x00000080 |
Force to use specified hint to query, if database has no index assigned by the hint, fail to query
const SequoiaCL::SDB_FLG_QUERY_KEEP_SHARDINGKEY_IN_UPDATE 0x00008000 |
The sharding key in update rule is not filtered, when executing findAndUpdate
const SequoiaCL::SDB_FLG_QUERY_PARALLED 0x00000100 |
Enable parallel sub-query, each sub-query will finish scanning different part of data
const SequoiaCL::SDB_FLG_QUERY_PREPARE_MORE 0x00004000 |
Enable prepare more data when querying
const SequoiaCL::SDB_FLG_QUERY_WITH_RETURNDATA 0x00000200 |
In general, query won't return data until cursor gets the record from database, when adding this flag, return data in query response, it will be more high-performance
const SequoiaCL::SDB_FLG_UPDATE_KEEP_SHARDINGKEY 0x00008000 |
The sharding key in update rule is not filtered, when executing update or upsert. SDB_FLG_QUERY_KEEP_SHARDINGKEY_IN_UPDATE is equal to SDB_FLG_UPDATE_KEEP_SHARDINGKEY, to prevent confusion.
const SequoiaCL::SDB_LOB_CREATEONLY 0x00000001 |
Open a new lob only.
const SequoiaCL::SDB_LOB_READ 0x00000004 |
Open an existing lob to read.
const SequoiaCL::SDB_LOB_SHAREREAD 0x00000040 |
Open an existing lob to share read.
const SequoiaCL::SDB_LOB_WRITE 0x00000008 |
Open an existing lob to write.