SequoiaDB
 All Classes Files Functions Variables Pages
Public Member Functions | List of all members
SequoiaCS Class Reference

Public Member Functions

 drop ()
 
 getName ()
 
 selectCL (string $name, array|string $options=null)
 
 createCL (string $name, array|string $options=null)
 
 getCL (string $name)
 
 dropCL (string $name)
 
 selectCollection (string $name, array|string $options=NULL)
 
 dropCollection (string $name)
 

Detailed Description

SequoiaCS Class. To get this Class object must be call SequoiaDB::selectCS or SequoiaDB::getCS.

Class for create an object of the collection space

Member Function Documentation

SequoiaCS::createCL ( string  $name,
array|string  $options = null 
)

Create the specified collection.

Parameters
$namethe string argument. The collection name.
$optionsan array or the string argument. The options specified by use. e.g.
array( 'Compressed' => true )
ShardingKey : The partition key.
ShardingType : The partition type.
Partition : Number of partitions, ShardingType is 'hash', represented the number of hash partitions, its value must be a power of 2, range [ 2^3, 2^20 ], default 1024.
ReplSize : Copy write by default number is 1.
Compressed : Data compression, default false.
CompressionType : Types of compression, default 'snappy'.
IsMainCL : Main partition, default false.
AutoSplit : Automatic split, defualt true.
Group : To create a replication group.
AutoIndexId : Collection is automatically created using the _id field is called '$id' a unique index, default true.
EnsureShardingIndex : Collection is automatically created using the ShardingKey contains the field names for the '$shard' index, default true.
Returns
Returns the result, default return array.
Return values
arrayarray( 'errno' => 0 )
string{ "errno": 0 }

Example:

$err = $cs -> createCL( 'bar', array( 'Compressed' => true ) ) ;
if( $err['errno'] != 0 ) {
echo "Failed to create collection, error code: ".$err['errno'] ;
return ;
}
SequoiaCS::drop ( )

Drop collection space.

Returns
Returns the result, default return array.
Return values
arrayarray( 'errno' => 0 )
string{ "errno": 0 }

Example:

$err = $cs -> drop() ;
if( $err['errno'] != 0 ) {
echo "Failed to drop collection space, error code: ".$err['errno'] ;
return ;
}
SequoiaCS::dropCL ( string  $name)

Drop the specified collection.

Parameters
$namethe string argument. The collection name.
Returns
Returns the result, default return array.
Return values
arrayarray( 'errno' => 0 )
string{ "errno": 0 }

Example:

$err = $cs -> dropCL( 'bar' ) ;
if( $err['errno'] != 0 ) {
echo "Failed to drop collection, error code: ".$err['errno'] ;
return ;
}
SequoiaCS::dropCollection ( string  $name)

Drop the specified collection.

See Also
dropCL().
Deprecated:
This function is deprecated, use the function dropCL() instead.
SequoiaCS::getCL ( string  $name)

Get the specified collection.

Parameters
$namethe string argument. The collection name.
Returns
Returns a new SequoiaCL object.
Return values
SequoiaCLObject

Example:

$cl = $cs -> getCL( 'bar' ) ;
if( empty( $cl ) ) {
$err = $db -> getError() ;
echo "Failed to call getCL, error code: ".$err['errno'] ;
return ;
}
SequoiaCS::getName ( )

Get the specified collection space name.

Returns
Returns the collection space name.
Return values
string<cs_name>

Example:

$csName = $cs -> getName() ;
$err = $db -> getError() ;
if( $err['errno'] != 0 ) {
echo "Failed to get collection space name, error code: ".$err['errno'] ;
return ;
}
echo "Collection space name is: ".$csName ;
SequoiaCS::selectCL ( string  $name,
array|string  $options = null 
)

Get the specified collection, if is not exist, will auto create.

Parameters
$namethe string argument. The collection name.
$optionsan array or the string argument. When the collection is created, $options into force.
ShardingKey : The partition key.
ShardingType : The partition type.
Partition : Number of partitions, ShardingType is 'hash', represented the number of hash partitions, its value must be a power of 2, range [ 2^3, 2^20 ], default 1024.
ReplSize : Copy write by default number is 1.
Compressed : Data compression, default false.
CompressionType : Types of compression, default 'snappy'.
IsMainCL : Main partition, default false.
AutoSplit : Automatic split, defualt true.
Group : To create a replication group.
AutoIndexId : Collection is automatically created using the _id field is called '$id' a unique index, default true.
EnsureShardingIndex : Collection is automatically created using the ShardingKey contains the field names for the '$shard' index, default true.
Returns
Returns a new SequoiaCL object.
Return values
SequoiaCLObject

Example:

$cl = $cs -> selectCL( 'bar', array( 'Compressed' => true ) ) ;
if( empty( $cl ) ) {
$err = $db -> getError() ;
echo "Failed to call selectCL, error code: ".$err['errno'] ;
return ;
}
SequoiaCS::selectCollection ( string  $name,
array|string  $options = NULL 
)

Get the specified collection, if is not exist,will auto create.

See Also
selectCL().
Deprecated:
This function is deprecated, use the function selectCL() instead.

The documentation for this class was generated from the following files: