SequoiaDB
 All Classes Files Functions Variables Pages
Functions
driver_function.php File Reference

driver function More...

Functions

 sdbInitClient ($config)
 
 sdbGetLastErrorMsg ()
 

Detailed Description

driver function

Function Documentation

sdbGetLastErrorMsg ( )

Get detailed information about the last error.

Returns
Returns the result of the last error message
Return values
arrayarray( 'errno' => 0, 'description' => '', 'detail' => '', ... )

Example:

$db = new SequoiaDB() ;
$err = $db -> connect( "192.168.1.10:11810" ) ;
if( $err['errno'] != 0 )
{
echo "Failed to connect database, error code: ".$err['errno'] ;
return ;
}
$cl = $db -> getCL( "foo.bar" ) ;
echo "Get the last error message." ;
$errMsg = sdbGetLastErrorMsg() ;
var_dump( $errMsg ) ;
sdbInitClient (   $config)

Open cache strategy to improve performance

Parameters
$configan array argument. The configuration, the options as below:
enableCacheStrategy : a boolean argument. The flag to open the cache strategy.
cacheTimeInterval : an integer argument. The life cycle of cached object.
Returns
Returns the number of errno.
Return values
integererrno

Example: open cache

$rc = sdbInitClient( array( 'enableCacheStrategy' => true, 'cacheTimeInterval' => 200 ) ) ;
if( $rc != 0 )
{
echo "Failed to open cache, error code: ".$rc ;
return ;
}
$db = new SequoiaDB() ;
$err = $db -> connect( "192.168.1.10:11810" ) ;
if( $err['errno'] != 0 ) {
echo "Failed to connect database, error code: ".$err['errno'] ;
return ;
}
$cs = $db -> selectCS( 'foo' ) ;
if( empty( $cs ) ) {
$err = $db -> getError() ;
echo "Failed to call selectCS, error code: ".$err['errno'] ;
return ;
}