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

Public Member Functions

 close ()
 
 getSize ()
 
 getCreateTime ()
 
 getModificationTime ()
 
 write (string $buffer)
 
 read (integer|SequoiaINT64 $length)
 
 seek (integer|SequoiaINT64 $offset, integer $whence=SDB_LOB_SET)
 
 lock (integer|SequoiaINT64 offset, integer|SequoiaINT64 length)
 
 lockAndSeek (integer|SequoiaINT64 offset, integer|SequoiaINT64 length)
 
 isEof ()
 

Public Attributes

const SDB_LOB_SET 0
 
const SDB_LOB_CUR 1
 
const SDB_LOB_END 2
 

Detailed Description

SequoiaLob Class. To get this Class object must be call SequoiaCL::openLob.

Member Function Documentation

SequoiaLob::close ( )

Close lob.

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

Example:

$err = $lobObj -> close() ;
if( $err['errno'] != 0 ) {
echo "Failed to close lob, error code: ".$err['errno'] ;
return ;
}
SequoiaLob::getCreateTime ( )

Get the lob create time (millisecond).

Returns
Returns the create time.
Return values
integer|SequoiaINT64millisecond

Example:

$times = $lobObj -> getCreateTime() ;
$err = $db -> getLastErrorMsg() ;
if( $err['errno'] != 0 ) {
echo "Failed to get lob create time, error code: ".$err['errno'] ;
return ;
}
echo "Lob create time is: ".$times ;
SequoiaLob::getModificationTime ( )

Get the lob last modification time (millisecond).

Returns
Returns the create time.
Return values
integer|SequoiaINT64millisecond

Example:

$times = $lobObj -> getModificationTime() ;
$err = $db -> getLastErrorMsg() ;
if( $err['errno'] != 0 ) {
echo "Failed to get lob modification time, error code: ".$err['errno'] ;
return ;
}
echo "Lob modification time is: ".$times ;
SequoiaLob::getSize ( )

Get the lob size.

Returns
Returns the number of lob size.
Return values
integer|SequoiaINT64lob size

Example:

$lobSize = $lobObj -> getSize() ;
$err = $db -> getLastErrorMsg() ;
if( $err['errno'] != 0 ) {
echo "Failed to get lob size, error code: ".$err['errno'] ;
return ;
}
echo "Lob size is: ".$lobSize ;
SequoiaLob::isEof ( )

Check whether current offset has reached to the max size of current lob.

Returns
Returns the result.
Return values
booleanisEof

Example:

$err = $lobObj -> seek( 0, SDB_LOB_END ) ;
if( $err['errno'] != 0 ) {
echo "Failed to call seek, error code: ".$err['errno'] ;
return ;
}
$result = $lobObj -> isEof() ;
var_dump ( $result ) ;
SequoiaLob::lock ( integer|SequoiaINT64  offset,
integer|SequoiaINT64  length 
)

Lock LOB section for write mode.

Parameters
$offsetan integer or the SequoiaINT64 object argument. The lock start position.
$lengthan integer or the SequoiaINT64 object argument. The lock length, -1 means lock to the end of lob.
Returns
Returns the result, default return array.
Return values
arrayarray( 'errno' => 0 )
string{ "errno": 0 }

Example:

$err = $lobObj -> lock( 10, 100 ) ;
if( $err['errno'] != 0 ) {
echo "Failed to call lock, error code: ".$err['errno'] ;
return ;
}
SequoiaLob::lockAndSeek ( integer|SequoiaINT64  offset,
integer|SequoiaINT64  length 
)

Lock LOB section for write mode and seek to the offset position.

Parameters
$offsetan integer or the SequoiaINT64 object argument. The lock start position.
$lengthan integer or the SequoiaINT64 object argument. The lock length, -1 means lock to the end of lob.
Returns
Returns the result, default return array.
Return values
arrayarray( 'errno' => 0 )
string{ "errno": 0 }

Example:

$err = $lobObj -> lockAndSeek( 10, 100 ) ;
if( $err['errno'] != 0 ) {
echo "Failed to call lockAndSeek, error code: ".$err['errno'] ;
return ;
}
SequoiaLob::read ( integer|SequoiaINT64  $length)

Read lob.

Parameters
$lengthan integer or the SequoiaINT64 object argument. The length want to read.
Returns
Returns the string of read.
Return values
stringread buffer

Example:

$buffer = $lobObj -> read( 5 ) ;
$err = $db -> getLastErrorMsg() ;
if( $err['errno'] != 0 ) {
echo "Failed to read lob, error code: ".$err['errno'] ;
return ;
}
SequoiaLob::seek ( integer|SequoiaINT64  $offset,
integer  $whence = SDB_LOB_SET 
)

Seek the place to read or write.

Parameters
$offsetan integer or the SequoiaINT64 object argument. Lob offset position.
$whencean integer argument. Where to start position.
SDB_LOB_SET : Set position equal to offset bytes.
SDB_LOB_CUR : Set position to current location plus offset.
SDB_LOB_END : Set position to end of lob plus offset.
Returns
Returns the result, default return array.
Return values
arrayarray( 'errno' => 0 )
string{ "errno": 0 }

Example:

$err = $lobObj -> seek( 10, SDB_LOB_CUR ) ;
if( $err['errno'] != 0 ) {
echo "Failed to call seek, error code: ".$err['errno'] ;
return ;
}
SequoiaLob::write ( string  $buffer)

Write lob.

Parameters
$bufferthe string argument. The buffer of write.
Returns
Returns the result, default return array.
Return values
arrayarray( 'errno' => 0 )
string{ "errno": 0 }

Example:

$err = $lobObj -> write( 'hello' ) ;
if( $err['errno'] != 0 ) {
echo "Failed to write lob, error code: ".$err['errno'] ;
return ;
}

Member Data Documentation

const SequoiaLob::SDB_LOB_CUR 1

Set position to current location plus offset.

const SequoiaLob::SDB_LOB_END 2

Set position to end of lob plus offset.

const SequoiaLob::SDB_LOB_SET 0

Set position equal to offset bytes.


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