| [ Index ] |
PHP Cross Reference of Limb3 |
[Summary view] [Print] [Text view]
1 <?php 2 /* 3 * Limb PHP Framework 4 * 5 * @link http://limb-project.com 6 * @copyright Copyright © 2004-2007 BIT(http://bit-creative.com) 7 * @license LGPL http://www.gnu.org/copyleft/lesser.html 8 */ 9 lmb_require('limb/dbal/src/query/lmbCriteriaQuery.class.php'); 10 11 define('LIMB_UPDATE_QUERY_NON_VALUE', uniqid()); 12 13 /** 14 * class lmbUpdateQuery. 15 * 16 * @package dbal 17 * @version $Id: lmbUpdateQuery.class.php 6005 2007-06-19 21:14:49Z pachanga $ 18 */ 19 class lmbUpdateQuery extends lmbCriteriaQuery 20 { 21 protected $_table; 22 protected $_fields = array(); 23 protected $_raw_fields = array(); 24 protected $_set_values = array(); 25 26 function __construct($table, $conn) 27 { 28 $this->_table = $table; 29 parent :: __construct("UPDATE %table% SET %fields% %where%", $conn); 30 } 31 32 function addField($field, $value = LIMB_UPDATE_QUERY_NON_VALUE) 33 { 34 $this->_fields[$field] = $value; 35 } 36 37 function addRawField($field) 38 { 39 $this->_raw_fields[] = $field; 40 } 41 42 protected function _getTableHint() 43 { 44 return $this->_conn->quoteIdentifier($this->_table); 45 } 46 47 protected function _getFieldsHint() 48 { 49 $values = array(); 50 foreach($this->_fields as $field => $value) 51 { 52 if($value !== LIMB_UPDATE_QUERY_NON_VALUE) 53 $this->_set_values[$field] = $value; 54 55 $values[] = $this->_conn->quoteIdentifier($field) . " = :{$field}:"; 56 } 57 58 foreach($this->_raw_fields as $field) 59 { 60 $values[] = $field; 61 } 62 63 return implode(',', $values); 64 } 65 66 function getStatement() 67 { 68 $stmt = parent :: getStatement(); 69 foreach($this->_set_values as $key => $value) 70 $stmt->set($key, $value); 71 72 return $stmt; 73 } 74 75 } 76 ?>
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
| Generated: Sat Nov 22 03:48:54 2008 | Cross-referenced by PHPXref 0.7 |