function __construct($table, $words, $use_boolean_mode = true, $conn) { $match = $this->_buildMatch($words, $use_boolean_mode); $where = $this->_buildWhere($words, $use_boolean_mode); $sql = "SELECT {$table}.*, {$match} %fields% FROM {$table} %tables% %left_join% " . "{$where} %where% %group% %having% ORDER BY score DESC %order%"; parent::__construct($sql, $conn); }
function __construct($table, $conn = null) { parent::__construct(lmbSelectRawQuery::DEFAULT_SQL_TEMPLATE, $conn); $this->addTable($table); }
function fetch($decorate = true) { $this->_applyJoins($this->base_object, $this->join_relations); $rs = parent::fetch(); if ($decorate) { $rs = new lmbARRecordSetDecorator($rs, $this->base_object, $this->_conn, $this->base_object->getLazyAttributes(), $this->use_proxy); } $rs = $this->_decorateWithJoinDecorator($rs); $rs = $this->_decorateWithAttachDecorator($rs); if ($this->sort_params) { $rs->sort($this->sort_params); } return $rs; }
function testThrowExceptionOnActionWIthNotExistingPlaholder() { $sql = new lmbSelectRawQuery("SELECT * FROM test ", $this->conn); $sql->addTable('test2'); $sql->addTable('test3'); try { $sql->toString(); $this->assertTrue(false, 'An exception should be thrown'); } catch (lmbException $e) { $this->assertTrue(true); } }