A modest collection of PHP libraries used at SparkFun.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 

25 lines
510 B

<?php
namespace SparkLib\DB;
class Field implements Literal {
protected $_field = null;
public function __construct ($field)
{
$this->_field = $field;
}
// You'll shoot your eye out!
public function literal ()
{
// We might have a tablename.columnname instead of columnname
if (false !== strpos($this->_field, '.')) {
list($table, $column) = explode('.', $this->_field);
return '"' . $table . '"."' . $column . '"';
}
return '"' . $this->_field . '"';
}
}