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)
 
 renameCL (string $oldName, string $newName, array|string $options=null)
 
 alter (array|string $options)
 
 setDomain (array|string $options)
 
 removeDomain ()
 
 enableCapped ()
 
 disableCapped ()
 
 setAttributes (array|string $options)
 
 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::alter ( array|string  $options)

Alter the specified collection space.

Parameters
$optionsthe array or string argument. The options to alter.
Returns
Returns the result, default return array.
Return values
arrayarray( 'errno' => 0 )
string{ "errno": 0 }

Example:

$err = $cs -> alter( array( 'PageSize' => 4096 ) ;
if( $err['errno'] != 0 ) {
echo "Failed to alter collection space, error code: ".$err['errno'] ;
return ;
}
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 for creating collection. Please reference here for more detail.
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 ;
}

Example: create auto increment collection

$err = $cs -> createCL( 'bar', array( 'AutoIncrement' => array( 'Field' => 'a', 'MaxValue' => 20000 ) ) ) ;
if( $err['errno'] != 0 ) {
echo "Failed to create collection, error code: ".$err['errno'] ;
return ;
}
SequoiaCS::disableCapped ( )

Alter the specified collection space to disable capped.

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

Example:

$err = $cs -> disableCapped() ;
if( $err['errno'] != 0 ) {
echo "Failed to alter collection space, 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::enableCapped ( )

Alter the specified collection space to enable capped.

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

Example:

$err = $cs -> enableCapped() ;
if( $err['errno'] != 0 ) {
echo "Failed to alter collection space, error code: ".$err['errno'] ;
return ;
}
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 -> getLastErrorMsg() ;
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 -> getLastErrorMsg() ;
if( $err['errno'] != 0 ) {
echo "Failed to get collection space name, error code: ".$err['errno'] ;
return ;
}
echo "Collection space name is: ".$csName ;
SequoiaCS::removeDomain ( )

Alter the specified collection space to remove domain.

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

Example:

$err = $cs -> removeDomain() ;
if( $err['errno'] != 0 ) {
echo "Failed to alter collection space, error code: ".$err['errno'] ;
return ;
}
SequoiaCS::renameCL ( string  $oldName,
string  $newName,
array|string  $options = null 
)

Rename collection name

Parameters
$oldNameThe old collection name
$newNameThe new collection name
$optionsReserved
Returns
Returns the result, default return array.
Return values
arrayarray( 'errno' => 0 )
string{ "errno": 0 }

Example:

$err = $cs -> renameCL( 'bar', 'new_bar' ) ;
if( $err['errno'] != 0 ) {
echo "Failed to rename collection, error code: ".$err['errno'] ;
return ;
}
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. Please reference here to get the $options's info of create collection.
Returns
Returns a new SequoiaCL object.
Return values
SequoiaCLObject

Example:

$cl = $cs -> selectCL( 'bar', array( 'Compressed' => true ) ) ;
if( empty( $cl ) ) {
$err = $db -> getLastErrorMsg() ;
echo "Failed to call selectCL, error code: ".$err['errno'] ;
return ;
}

Example: create auto increment collection

$err = $cs -> selectCL( 'bar', array( 'AutoIncrement' => array( 'Field' => 'a', 'MaxValue' => 20000 ) ) ) ;
if( $err['errno'] != 0 ) {
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.
SequoiaCS::setAttributes ( array|string  $options)

Alter the specified collection space.

Parameters
$optionsthe array or string argument. The options to alter.
Returns
Returns the result, default return array.
Return values
arrayarray( 'errno' => 0 )
string{ "errno": 0 }

Example:

$err = $cs -> setAttributes( array( 'PageSize' => 4096 ) ;
if( $err['errno'] != 0 ) {
echo "Failed to alter collection space, error code: ".$err['errno'] ;
return ;
}
SequoiaCS::setDomain ( array|string  $options)

Alter the specified collection space to set domain.

Parameters
$optionsthe array or string argument. The options to alter.
Returns
Returns the result, default return array.
Return values
arrayarray( 'errno' => 0 )
string{ "errno": 0 }

Example:

$err = $cs -> setDomain( array( 'Domain' => 'domain' ) ;
if( $err['errno'] != 0 ) {
echo "Failed to alter collection space, error code: ".$err['errno'] ;
return ;
}

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