ACC SHELL

Path : /srv/www/vhosts/ambfinance/admin/library/TF/Db/
File Upload :
Current File : /srv/www/vhosts/ambfinance/admin/library/TF/Db/Table.php

<?php
class TF_Db_Table extends Zend_Db_Table
{
	protected function setWhere(&$sql, $wheres)
	{
		foreach($wheres as $column => $condition)
		{
			if($condition == ''){
				continue;
			}
			if(strpos($column, '_id') !== false){
				$sql->where($this->getAdapter()->quoteIdentifier($column) . ' = ?', $condition);
			} else {
				$sql->where($this->getAdapter()->quoteIdentifier($column) . ' LIKE ?', '%' . $condition . '%');
			}
		}
	} 
	
	/**
	 * DB Quote
	 * @param $value
	 * @param $type
	 * @return unknown_type
	 */
	protected function q($value, $type = null)
	{
		return $this->getAdapter()->quote($value, $type);
	}
	
	/**
	 * DB Quote Identifier
	 * @param $ident
	 * @param $auto
	 * @return unknown_type
	 */
	protected function qi($ident, $auto=false)
	{
		return $this->getAdapter()->quoteIdentifier($ident, $auto);
	}
	
	/**
	 * DB Quote Into
	 * @param $text
	 * @param $value
	 * @param $type
	 * @param $count
	 * @return unknown_type
	 */
	protected function qinto($text, $value, $type = null, $count = null)
	{
		return $this->getAdapter()->quoteInto($text, $value, $type, $count);
	}
	
	public function fetchPairs($nameCol = 'name')
	{
		$sql = $this->getAdapter()
					->select()
					->from($this->_name,array('id', $nameCol))
					->order($nameCol . ' ASC');
		return $this->getAdapter()
					->fetchPairs($sql);
	}
}

ACC SHELL 2018