Class jDaoFactoryBase

Description
  • abstract:

Located in /dao/jDaoFactoryBase.class.php (line 32)


	
			
Variable Summary
Method Summary
jDaoFactoryBase __construct (jDbConnection $conn)
int countAll ()
int countBy (jDaoConditions $searchcond, [ $distinct = null])
int delete (string $key)
number deleteBy (jDaoConditions $searchcond)
jDbResultSet findBy (jDaoConditions $searchcond, [int $limitOffset = 0], [int $limitCount = null])
jDaoRecordBase get (string $key)
string getPrimaryTable ()
array getProperties ()
array getTables ()
integer insert (jDaoRecordBase $record)
integer update (jDaoRecordBase $record)
void _createConditionsClause ( $daocond, [ $forSelect = true])
void _createOrderClause ( $daocond)
string _getPkWhereClauseForNonSelect (array $pk)
string _getPkWhereClauseForSelect (array $pk)
Variables
mixed $falseValue = 0 (line 108)
  • since: 1.0
  • access: protected
mixed $trueValue = 1 (line 104)
  • since: 1.0
  • access: protected
jDbConnection $_conn (line 56)

the database connector

  • access: protected
string $_DaoRecordClassName (line 76)

the class name of a dao record for this dao factory

  • access: protected
string $_daoSelector (line 82)

the selector of the dao, to be sent with events

  • access: protected
mixed $_deleteAfterEvent = false (line 91)
  • since: 1.0
  • access: protected
mixed $_deleteBeforeEvent = false (line 87)
  • since: 1.0
  • access: protected
mixed $_deleteByAfterEvent = false (line 99)
  • since: 1.0
  • access: protected
mixed $_deleteByBeforeEvent = false (line 95)
  • since: 1.0
  • access: protected
string $_fromClause (line 66)

the from clause you can reuse for a specific SELECT query

  • access: protected
string $_primaryTable (line 51)

the id of the primary table

  • access: protected
string $_selectClause (line 61)

the select clause you can reuse for a specific SELECT query

  • access: protected
array $_tables (line 46)

informations on tables

Keys of elements are the alias of the table. values are arrays like that :

 array (
   'name' => ' the table alias',
   'realname' => 'the real name of the table',
   'pk' => array ( list of primary keys name ),
   'fields' => array ( list of property name attached to this table )
 )

  • access: protected
string $_whereClause (line 71)

the where clause you can reuse for a specific SELECT query

  • access: protected
Methods
Constructor __construct (line 112)
jDaoFactoryBase __construct (jDbConnection $conn)
countAll (line 188)

return the number of all records

  • return: the count
  • access: public
int countAll ()
countBy (line 299)

return the number of records corresponding to the conditions stored into the jDaoConditions object.

  • return: the count
  • author: Loic Mathaud
  • copyright: 2007 Loic Mathaud
  • contributor: Steven Jehannet
  • since: 1.0b2
  • access: public
int countBy (jDaoConditions $searchcond, [ $distinct = null])
delete (line 225)

delete a record corresponding to the given key

  • return: the number of deleted record
  • access: public
int delete (string $key)
  • string $key: one or more primary key
deleteBy (line 331)

delete all record corresponding to the conditions stored into the jDaoConditions object.

  • return: of deleted rows
  • since: 1.0beta3
  • access: public
number deleteBy (jDaoConditions $searchcond)
findAll (line 178)

return all records

  • access: public
jDbResultSet findAll ()
findBy (line 271)

return all record corresponding to the conditions stored into the jDaoConditions object.

you can limit the number of results by given an offset and a count

  • access: public
jDbResultSet findBy (jDaoConditions $searchcond, int $limitOffset, [int $limitCount = null])
get (line 200)

return the record corresponding to the given key

  • access: public
jDaoRecordBase get (string $key)
  • string $key: one or more primary key
getPrimaryKeyNames (line 172)

list of id of primary properties

  • return: list of properties name which contains primary keys
  • since: 1.0beta3
  • access: public
array getPrimaryKeyNames ()
getPrimaryTable (line 135)
  • return: the id (alias or realname) of the primary table
  • since: 1.3.2
  • access: public
string getPrimaryTable ()
getProperties (line 165)

informations on all properties

keys are property name, and values are an array like that :

 array (
  'name' => 'name of property',
  'fieldName' => 'name of fieldname',
  'regExp' => NULL, // or the regular expression to test the value
  'required' => true/false,
  'isPK' => true/false, //says if it is a primary key
  'isFK' => true/false, //says if it is a foreign key
  'datatype' => '', // type of data : string
  'unifiedType'=> '' // the corresponding unified type
  'table' => 'grp', // alias of the table the property is attached to
  'updatePattern' => '%s',
  'insertPattern' => '%s',
  'selectPattern' => '%s',
  'sequenceName' => '', // name of the sequence when field is autoincrement
  'maxlength' => NULL, // or a number
  'minlength' => NULL, // or a number
  'ofPrimaryTable' => true/false
  'autoIncrement'=> true/false
 )

  • return: informations on all properties
  • since: 1.0beta3
  • access: public
array getProperties ()
getTables (line 127)
array getTables ()
insert (line 253)

save a new record into the database

if the dao record has an autoincrement key, its corresponding property is updated

  • return: 1 if success (the number of affected rows). False if the query has failed.
  • abstract:
  • access: public
integer insert (jDaoRecordBase $record)
update (line 260)

save a modified record into the database

  • return: 1 if success (the number of affected rows). False if the query has failed.
  • abstract:
  • access: public
integer update (jDaoRecordBase $record)
_createConditionsClause (line 369)
  • access: protected
void _createConditionsClause ( $daocond, [ $forSelect = true])
  • $daocond
  • $forSelect
_createOrderClause (line 376)
  • access: protected
void _createOrderClause ( $daocond)
  • $daocond
_getPkWhereClauseForNonSelect (line 364)

create a WHERE clause with conditions on primary keys with given value. This method should be used for DELETE and UPDATE queries.

  • return: a 'where' clause (WHERE mypk = 'myvalue' ...)
  • abstract:
  • access: protected
string _getPkWhereClauseForNonSelect (array $pk)
  • array $pk: associated array : keys = primary key name, values : value of a primary key
_getPkWhereClauseForSelect (line 356)

create a WHERE clause with conditions on primary keys with given value. This method should be used for SELECT queries. You haven't to escape values.

  • return: a 'where' clause (WHERE mypk = 'myvalue' ...)
  • abstract:
  • access: protected
string _getPkWhereClauseForSelect (array $pk)
  • array $pk: associated array : keys = primary key name, values : value of a primary key

Documentation generated on Wed, 04 Jan 2017 22:53:01 +0100 by phpDocumentor 1.4.3