.

DBSqlBuilderUpdate Class Reference
[Model]

Build an update query. More...

Inheritance diagram for DBSqlBuilderUpdate:
DBSqlBuilderBase IDBSqlBuilder DBSqlBuilderUpdateMysql

List of all members.

Protected Member Functions

  get_fields_values ($arr_fields, IDBTable $table)
  get_limit ($arr_limit)
  get_sql_template ()
  get_substitutes ()

Detailed Description

Build an update query.

Author:
Gerd Riesselmann

Definition at line 8 of file dbsqlbuilder.update.cls.php.


Member Function Documentation

DBSqlBuilderUpdate::get_fields_values ( arr_fields,
IDBTable table  
) [protected]

Definition at line 25 of file dbsqlbuilder.update.cls.php.

00025                                                                            {
00026                 $fields = array();
00027                 foreach($arr_fields as $column => $value) {
00028                         $fieldname = $this->prefix_column($column, $table);
00029                         $fields[$fieldname] = DB::format($value, $table, $column);;
00030                 }
00031                 return Arr::implode(', ', $fields, ' = ');
00032         }
DBSqlBuilderUpdate::get_limit ( arr_limit  )  [protected]

Reimplemented from DBSqlBuilderBase.

Definition at line 35 of file dbsqlbuilder.update.cls.php.

00035                                                  {
00036                 $arr_limit = array_map('intval', $arr_limit);
00037                 $ret = '';
00038                 if ($arr_limit[1] > 0) {
00039                         $ret = ' LIMIT ' . $arr_limit[1];
00040                 }
00041                 return $ret;
00042         }
DBSqlBuilderUpdate::get_sql_template (  )  [protected]

Reimplemented from DBSqlBuilderBase.

Definition at line 9 of file dbsqlbuilder.update.cls.php.

00009                                               {         
00010                 return 'UPDATE%ignore %!table SET %!fields_values%where%order_by%limit';                
00011         }
DBSqlBuilderUpdate::get_substitutes (  )  [protected]

Reimplemented from DBSqlBuilderBase.

Definition at line 13 of file dbsqlbuilder.update.cls.php.

00013                                              {
00014                 $ret = array(
00015                         '%!fields_values' => $this->get_fields_values($this->fields, $this->query->get_table()),
00016                         '%!table' => $this->get_table_and_alias($this->query->get_table()),
00017                         '%where' => $this->get_where($this->query->get_wheres()),
00018                         '%ignore' => $this->get_feature_sql($this->params, 'ignore', 'IGNORE'),
00019                         '%limit' => $this->get_limit(Arr::get_item($this->params, 'limit', array(0,0))),
00020                         '%order_by' => $this->get_order_by(Arr::get_item($this->params, 'order_by', array()))
00021                 );      
00022                 return $ret;
00023         }

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