Hoa central
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
Hoa\Database\Query\Update Class Reference
Inheritance diagram for Hoa\Database\Query\Update:

Public Member Functions

 rollback ()
 
 abort ()
 
 replace ()
 
 fail ()
 
 ignore ()
 
 table ($table)
 
 set ($name, $value)
 
 __toString ()
 
- Public Member Functions inherited from Hoa\Database\Query\Where
 where ($expression)
 
 __call ($name, Array $values)
 
 __get ($name)
 
 reset ()
 
 __toString ()
 

Protected Member Functions

 _or ($or)
 

Protected Attributes

 $_table = null
 
 $_or = null
 
 $_set = []
 
- Protected Attributes inherited from Hoa\Database\Query\Where
 $_where = []
 
 $_logicOperator = null
 

Detailed Description

Class .

Build an UPDATE query.

Definition at line 47 of file Update.php.

Member Function Documentation

Hoa\Database\Query\Update::__toString ( )

Generate the query.

Returns
string

Implements Hoa\Database\Query\Dml.

Definition at line 167 of file Update.php.

168  {
169  $out = 'UPDATE';
170 
171  if (null !== $this->_or) {
172  $out .= ' OR ' . $this->_or;
173  }
174 
175  $out .= ' ' . $this->_table;
176  $set = [];
177 
178  foreach ($this->_set as $name => $value) {
179  $set[] = $name . ' = ' . $value;
180  }
181 
182  $out .= ' SET ' . implode(', ', $set);
183 
184  return $out . parent::__toString();
185  }

Here is the call graph for this function:

Hoa\Database\Query\Update::_or (   $or)
protected

Declare an alternative to “INSERT”.

Parameters
string$orAlternative.
Returns

Definition at line 128 of file Update.php.

129  {
130  $this->_or = $or;
131 
132  return $this;
133  }

Here is the caller graph for this function:

Hoa\Database\Query\Update::abort ( )

Update or abort.

Returns

Definition at line 87 of file Update.php.

88  {
89  return $this->_or('ABORT');
90  }

Here is the call graph for this function:

Hoa\Database\Query\Update::fail ( )

Update or fail.

Returns

Definition at line 107 of file Update.php.

108  {
109  return $this->_or('FAIL');
110  }

Here is the call graph for this function:

Hoa\Database\Query\Update::ignore ( )

Update or ignore.

Returns

Definition at line 117 of file Update.php.

118  {
119  return $this->_or('IGNORE');
120  }

Here is the call graph for this function:

Hoa\Database\Query\Update::replace ( )

Update or replace.

Returns

Definition at line 97 of file Update.php.

98  {
99  return $this->_or('REPLACE');
100  }

Here is the call graph for this function:

Hoa\Database\Query\Update::rollback ( )

Update or rollback.

Returns

Definition at line 77 of file Update.php.

78  {
79  return $this->_or('ROLLBACK');
80  }

Here is the call graph for this function:

Hoa\Database\Query\Update::set (   $name,
  $value 
)

Set a pair.

Parameters
string$nameName.
mixed$valueValue.
Returns

Definition at line 155 of file Update.php.

156  {
157  $this->_set[$name] = $value;
158 
159  return $this;
160  }
Hoa\Database\Query\Update::table (   $table)

Set the table.

Parameters
string$tableTable.
Returns

Definition at line 141 of file Update.php.

142  {
143  $this->_table = $table;
144 
145  return $this;
146  }

Member Data Documentation

Hoa\Database\Query\Update::$_or = null
protected

Definition at line 61 of file Update.php.

Hoa\Database\Query\Update::$_set = []
protected

Definition at line 68 of file Update.php.

Hoa\Database\Query\Update::$_table = null
protected

Definition at line 54 of file Update.php.


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