public
|
#
setEvent( string $name, string $class )
Set a event function of CUD and save operations.
Set a event function of CUD and save operations.
Parameters
- $name
The event name.
('creating', 'created')
('updating', 'updated')
('saving', 'saved')
('deleting', 'deleted')
- $class
- A static function class name of event handler.
|
public
Transactd\QueryExecuter
|
#
reset( )
Reset the execute paramators.
Reset the execute paramators.
Returns
|
protected
BizStation\Transactd\Recordset
|
#
setFetchClass( BizStation\Transactd\Recordset $rs )
Parameters
Returns
BizStation\Transactd\Recordset
|
protected
int[]
|
#
primaryKeyFields( )
Get the array of primary key field number.
Get the array of primary key field number.
Returns
int[]
|
public
integer
|
#
primarykey( )
Get the primary key number.
Get the primary key number.
Returns
integer
|
public
string[]
|
#
primaryKeyFieldNames( )
Get the array of primary key field name.
Get the array of primary key field name.
Returns
string[]
|
public
string[]
|
#
keyFieldNames( integer $index )
Get the array of key field name of specified index.
Get the array of key field name of specified index.
Parameters
Returns
string[]
|
public
boolean
|
#
isSeekHasMany( integer $index, integer $segments )
Returns whether multiple records search from the specified parameters.
Returns whether multiple records search from the specified parameters.
Parameters
- $index
- The key number.
- $segments
- The number of segments to be used.
Returns
boolean
|
public
BizStation\Transactd\Table
|
#
table( )
Get the writable internal table Object.
Get the writable internal table Object.
Returns
BizStation\Transactd\Table
|
public
BizStation\Transactd\ActiveTable
|
#
activeTable( )
Get the internal ActiveTable Object.
Get the internal ActiveTable Object.
Returns
BizStation\Transactd\ActiveTable
|
public
BizStation\Transactd\Table
|
#
getWritableTable( )
Get the writable internal table Object.
Get the writable internal table Object.
Returns
BizStation\Transactd\Table
|
public
BizStation\Transactd\Table
|
#
getReadbleTable( )
Get the read-only internal table Object.
Get the read-only internal table Object.
Returns
BizStation\Transactd\Table
|
public
|
#
__construct( string $tableName, BizStation\Transactd\PooledDbManager|BizStation\Transactd\database $dbm, BizStation\Transactd\PooledDbManager|BizStation\Transactd\database $dbs, string $className = 'stdClass' )
Parameters
- $tableName
- $dbm
- Master database.
- $dbs
- Slave database.
- $className
- (optional) A class name of result.
Throws
|
protected
|
#
copyKeyValues( BizStation\Transactd\Table $tb, BizStation\Transactd\Table $src )
|
protected
|
#
setKeyValues( mixed|mixed[] $id, BizStation\Transactd\Table $tb )
Set key values to current key fields
Set key values to current key fields
Parameters
|
public
integer
|
#
getIndexByFieldNames( string|string[] $fieldNames, boolean $notUniqueAble = false, boolean $ignoreCount = false )
Parameters
- $fieldNames
- $notUniqueAble
- $ignoreCount
Returns
integer
Throws
UnexpectedValueException
|
public
|
#
setTimeStampMode( boolean $v )
Set timestamp mode to wriatble internal table.
Set timestamp mode to wriatble internal table.
Parameters
|
public
|
#
setAliases( array $aliases )
Set field name aliases
Parameters
- $aliases
- [['original' => 'alias'], ...]
|
public
Transactd\QueryExecuter
|
#
index( integer $index )
Set the index number for search.
Set the index number for search.
Parameters
Returns
|
public
Transactd\QueryExecuter
|
#
indexToPrimaryKey( )
Change the index number to the primary key.
Change the index number to the primary key.
Returns
|
public
Transactd\QueryExecuter
|
#
keyValue( mixed $v1, mixed $v2 = null, mixed $v3 = null, mixed $v4 = null, mixed $v5 = null, mixed $v6 = null, mixed $v7 = null, mixed $v8 = null )
Set key value(s) of current key.
Set key value(s) of current key.
Parameters
- $v1
- First segment value.
- $v2
- (optional) Second segment value.
- $v3
- (optional) Third segment value.
- $v4
- (optional) Fourth segment value.
- $v5
- (optional) Fifth segment value.
- $v6
- (optional) Sixth segment value.
- $v7
- (optional) Seventh segment value.
- $v8
- (optional) Eighth segment value.
Returns
|
public
Transactd\QueryExecuter
|
#
updateConflictCheck( boolean $v )
Whether or not to enable updateConflictCheck.
Whether or not to enable updateConflictCheck.
Parameters
Returns
Throws
RuntimeException
|
public
boolean
|
#
chunk( integer $n, callable $func )
Search results the registration of the chunk.
Search results the registration of the chunk.
Parameters
- $n
- Count of a chunk.
- $func
- Handler function name.
Returns
boolean
|
public
Transactd\Collection |BizStation\Transactd\Recordset
|
#
read( boolean $toArray = true )
Execute the contents of the queue in the order. And returns the result.
Execute the contents of the queue in the order. And returns the result.
Parameters
- $toArray
- (optional) false: Get by recordset.
Returns
Throw
IOException
|
public
Transactd\Collection
|
#
arrayToCollection( array $ar, Transactd\Relation $rel = null, object $parent = null )
Create a collection from a result array.
Create a collection from a result array.
Parameters
- $ar
- A array of result.
- $rel
- (optinal) Relation object of result.
- $parent
- (optinal) A parent object of relation.
Returns
|
public
Transactd\Collection |BizStation\Transactd\Recordset
|
#
get( boolean $toArray = true )
The alias of this::read().
The alias of this::read().
Parameters
- $toArray
- (optional) false: Get by recordset.
Returns
Throw
IOException
|
public
Transactd\Collection
|
#
outerJoin( Transactd\QueryExecuter |Transactd\Recordset $qOrRs, string|string[]|RecordsetQuery $keyNmaesOrRecordsetQuery )
Add the outer-join in the execution queue.
Add the outer-join in the execution queue.
Table outer-join : Specify QueryExecuter and keyNmaes.
Recordset outer-join : Specify Recordset and RecordsetQuery.
Parameters
- $qOrRs
- QueryExecuter or \Transactd\Recordset
- $keyNmaesOrRecordsetQuery
- Key names of this table or RecordsetQuery.
Returns
|
public
Transactd\Collection
|
#
join( Transactd\QueryExecuter |Transactd\Recordset $qOrRs, string|string[]|RecordsetQuery $keyNmaesOrRecordsetQuery )
Add the inner-join in the execution queue.
Table inner-join : Specify QueryExecuter and keyNmaes.
Recordset inner-join : Specify Recordset and RecordsetQuery.
Add the inner-join in the execution queue.
Table inner-join : Specify QueryExecuter and keyNmaes.
Recordset inner-join : Specify Recordset and RecordsetQuery.
Parameters
- $qOrRs
- QueryExecuter or \Transactd\Recordset
- $keyNmaesOrRecordsetQuery
- Key names of this table or RecordsetQuery.
Returns
|
public
Transactd\QueryExecuter
|
#
groupBy( BizStation\Transactd\GroupQuery $gq )
Add the grouping query in the execution queue.
Add the grouping query in the execution queue.
Parameters
Returns
Throws
InvalidArgumentException
|
public
Transactd\QueryExecuter
|
#
orderBy( string $name, boolean $asc )
Add the sort-ordering query in the execution queue.
Add the sort-ordering query in the execution queue.
Parameters
- $name
- A name of sort-target field name
- $asc
- Specifies whether the ascending order.
Returns
Throws
InvalidArgumentException
|
public
Transactd\QueryExecuter
|
#
matchBy( BizStation\Transactd\RecordsetQuery $rq )
Add the filter(match-by) query in the execution queue.
Add the filter(match-by) query in the execution queue.
Parameters
Returns
|
public
BizStation\Transactd\Recordset
|
#
recordset( )
Execute the contents of the queue in the order. And returns the BizStation\Transactd\Recordset result.
Execute the contents of the queue in the order. And returns the BizStation\Transactd\Recordset result.
Returns
BizStation\Transactd\Recordset
|
public
Transactd\QueryExecuter
|
#
union( BizStation\Transactd\Recordset $rs )
Set the union data.
Parameters
- $rs
- A source data of recordset.
Returns
Throws
InvalidArgumentException
|
public
Transactd\QueryExecuter
|
|
public
Transactd\QueryExecuter
|
#
removeNullRecord( )
Add the remove null operation in the execution queue.
Add the remove null operation in the execution queue.
Returns
|
public
Transactd\Collection |BizStation\Transactd\Recordset
|
#
all( boolean $toArray = true )
Reads all records from a table by the primary key.
Reads all records from a table by the primary key.
Parameters
- $toArray
- (optional) false: Get by recordset.
Returns
|
public
object|null
|
#
find( mixed|mixed[] $id, boolean $throwException = false )
Find a record from the table by the current key.
Find a record from the table by the current key.
Parameters
- $id
- The primary key values.
- $throwException
- Whether to return an error when an exception.
Returns
object|null
Throws
|
public
Transactd\Collection
|
#
findMany( array $keyValuesArray )
Find multiple records by the current key values.
Find multiple records by the current key values.
Parameters
- $keyValuesArray
- A araay of the current key values. Ex:[1, 2] or [[1,1],[1,2]]
Returns
Throws
InvalidArgumentException
|
public
object
|
#
first( boolean $throwException = false )
Find a first record by the current conditions.
Find a first record by the current conditions.
Parameters
- $throwException
- Whether throw an exception that could not be found.
Returns
object
Throws
|
public
Generator
|
#
cursor( )
Get a genaretor of the current query.
Please set Index keyValue and query conditions beforehand.
Get a genaretor of the current query.
Please set Index keyValue and query conditions beforehand.
Returns
Generator
|
public static
Transactd\TableIterator
|
#
getIterator( type $tb, type $op = 0, $lockBias = Transactd\Transactd::LOCK_BIAS_DEFAULT, $forword = true )
Read a record with the $op and return a iteraor.
Please set key number and key value beforehand.
Read a record with the $op and return a iteraor.
Please set key number and key value beforehand.
Parameters
- $tb
- $op
- $op
- $lockBias SEEK_EQUAL(0) to SEEK_LESSTHAN(6)
- $lockBias
- $forword
Returns
Throws
InvalidArgumentException
|
public
BizStation\Transactd\TableIterator
|
#
serverCursor( integer $op = self::SEEK_EQUAL, integer $lockBias = Transactd\Transactd::LOCK_BIAS_DEFAULT, boolean $forword = true )
Read a record with the $op and return a writable iteraor.
Please set Index and keyValue beforehand. And finally call reset() to restore index and keyValue.
Read a record with the $op and return a writable iteraor.
Please set Index and keyValue beforehand. And finally call reset() to restore index and keyValue.
Parameters
- $op
- Table::SEEK_EQUAL to Table::SEEK_LESSTHAN
- $lockBias
- $forword
- Choicing ForwordIterator or ReverseIterator.
Returns
BizStation\Transactd\TableIterator
Throw
IOException
|
public
object
|
#
create( array $attributes, type $nosave = false )
Create(insert) a new object specified by the property of fetchClass.
Create(insert) a new object specified by the property of fetchClass.
Parameters
- $attributes
- The initial value of the attribute.
- $nosave
Whether at the same time it stored in the database?
- true Do not save.
- false Do save.
- true : Do not save
- false : Do save
Returns
object
Throws
|
public
object
|
#
firstOrCreate( array $attributes )
Find or create(insert) a object specified by attribute.
Find or create(insert) a object specified by attribute.
Parameters
- $attributes
- The initial value of the attribute.
Returns
object
Throws
|
public
object
|
#
firstOrNew( array $attributes )
Find or instantiate a object specified by attribute.
Find or instantiate a object specified by attribute.
Parameters
- $attributes
- The initial value of the attribute.
Returns
object
Throws
|
protected
object[]
|
#
doUpdate( array $attributes )
Parameters
- $attributes
- The update value of attributes.
Returns
object[]
Throws
|
protected
object[]
|
|
public
integer
|
#
update( array $attributes )
Update records selected by current conditions by the attributes.
If no conditions specified updates current key values.
If conditions specified the updateConflictCheck dose not works.
Update records selected by current conditions by the attributes.
If no conditions specified updates current key values.
If conditions specified the updateConflictCheck dose not works.
Parameters
- $attributes
The update value of attributes.
Do not specify the current key field.
Returns
integer Count of effects.
Throws
|
public
integer
|
#
delete( )
Delete records selected by current conditions.
If no conditions specified deletes current key values.
If conditions specified the updateConflictCheck dose not works.
Delete records selected by current conditions.
If no conditions specified deletes current key values.
If conditions specified the updateConflictCheck dose not works.
Returns
integer Count of effects.
Throws
|
protected
|
#
doDestroy( $ids )
No error is thrown if id is not found, IOException is thrown if other errors.
No error is thrown if id is not found, IOException is thrown if other errors.
|
public
integer
|
#
destroy( integer|string|(int|string)[] $ids )
Parameters
Returns
integer
|
public
boolean
|
|
public
boolean
|
#
save( object $obj, boolean $forceInsert = false )
Parameters
Returns
boolean
Throws
|
public
object
|
#
insert( array $attributes )
Insert a record.
Parameters
- $attributes
- The initial value of the attribute.
Returns
object
Throws
|
public
integer
|
#
deleteMany( array $values, function $func = null )
Delete records by current index's values.
NOTE: The current record is changed by this operation.
Delete records by current index's values.
NOTE: The current record is changed by this operation.
Parameters
- $values
- $func
- onDeleted event function func($obj)
Returns
integer Number of deleted object.
|
public
string
|
#
getUniqueKey( object $obj )
Get a key string from primary key field value of the object.
Get a key string from primary key field value of the object.
Parameters
Returns
string
|
public
|
|
public
Transactd\QueryExecuter
|
#
when( boolean $condition, type $func )
Execute the closure that has been specified by the condition.
Execute the closure that has been specified by the condition.
Parameters
- $condition
- $func
- The closure.
Returns
|
public
Transactd\QueryExecuter
|
#
where( string $name, string|mixed $operator = null, mixed $value = null )
Parameters
- $name
- A field name.
- $operator
- Operator or a value.
- $value
- (optional) a value
Returns
|
public
Transactd\QueryExecuter
|
#
orWhere( string $name, string $operator = null, mixed $value = null )
Parameters
- $name
- A field name.
- $operator
- Operator or a value.
- $value
- a value
Returns
|
public
Transactd\QueryExecuter
|
|
public
Transactd\QueryExecuter
|
|
public
Transactd\QueryExecuter
|
|
public
Transactd\QueryExecuter
|
|
public
Transactd\QueryExecuter
|
#
whereInKey( @param $values, @param $segments = null )
Parameters
- $values
- $values Key values
- $segments
- $segments The segment count of values.
Returns
|
public
Transactd\QueryExecuter
|
#
whereIn( string $name, array $values )
Parameters
- $name
- A field name.
- $values
- Key values.
Returns
|
public
Transactd\QueryExecuter
|
#
whereNotIn( string $name, mixed $values )
Parameters
- $name
- A field name.
- $values
- Key values.
Returns
|
public
Transactd\QueryExecuter
|
#
whereBetween( string $name, mixed[2] $valuePair )
Parameters
- $name
- A field name.
- $valuePair
- A pair of first value and end value.
Returns
|
public
Transactd\QueryExecuter
|
#
whereNotBetween( string $name, mixed[2] $valuePair )
Parameters
- $name
- A field name.
- $valuePair
- A pair of first value and end value.
Returns
|
public
Transactd\QueryExecuter
|
#
whereColumn( string $name, string|mixed $operator = null, mixed $value = null )
Parameters
- $name
- A field name.
- $operator
- Operator or a value.
- $value
- (optional) a value
Returns
|
public
Transactd\QueryExecuter
|
#
orColumn( string $name, string|mixed $operator = null, mixed $value = null )
Parameters
- $name
- A field name.
- $operator
- Operator or a value.
- $value
- (optional) a value
Returns
|
public
Transactd\QueryExecuter
|
#
select( string|string[] $name1, string $name2 = null, string $name3 = null, string $name4 = null, string $name5 = null, string $name6 = null, string $name7 = null, string $name8 = null )
Parameters
- $name1
- A field name.
- $name2
- (optional) A field name.
- $name3
- (optional) A field name.
- $name4
- (optional) A field name.
- $name5
- (optional) A field name.
- $name6
- (optional) A field name.
- $name7
- (optional) A field name.
- $name8
- (optional) A field name.
Returns
|
public
Transactd\QueryExecuter
|
|
public
Transactd\QueryExecuter
|
|
public
Transactd\QueryExecuter
|
|
public
Transactd\QueryExecuter
|
|
public
Transactd\QueryExecuter
|
|
public
Transactd\QueryExecuter
|
#
limit( integer $n )
Alias to the take
Parameters
Returns
|
public
Transactd\QueryExecuter
|
#
direction( integer $v )
Parameters
- $v
- Nstable::findForword| Nstable::findBackForword
Returns
|
public
string
|
#
queryString( )
Get a description of the query.
Get a description of the query.
Returns
string
|
public
string
|
#
queryDescription( BizStation\Transactd\Query $q = null )
Get a description of the key values and query.
Get a description of the key values and query.
Parameters
Returns
string
|
public
integer
|
#
count( )
Get the record count.
Returns
integer
|
public
float
|
#
sum( string $column )
Calculate the total value of the specified column.
Calculate the total value of the specified column.
Parameters
Returns
float
|
public
float
|
#
min( string $column )
Find the minimum value of the specified column.
Find the minimum value of the specified column.
Parameters
Returns
float
|
public
float
|
#
max( string $column )
Find the maximum value of the specified column.
Find the maximum value of the specified column.
Parameters
Returns
float
|
public
float
|
#
avg( string $column )
Calculate the average value of the specified column.
Calculate the average value of the specified column.
Parameters
Returns
float
|
public
float
|
#
average( string $column )
The alias name of the avg function .
The alias name of the avg function .
Parameters
Returns
float
|