public function __construct(SimDAL_Mapper_Entity $entity, $property, $fieldname, $datatype, $primarykey = false, $autoincrement = false, $alias = null) { $this->_entity = $entity; $this->_class = $entity->getClass(); $this->_table = $entity->getTable(); $this->_schema = $this->getSchema(); $this->_property = $property; $this->_fieldName = $fieldname; $this->_dataType = $datatype; $this->_primaryKey = $primarykey; $this->_autoIncrement = $autoincrement; $this->_alias = $alias; }
protected function _processDeleteQuery(SimDAL_Mapper_Entity $mapping, $id) { $pk = $mapping->getPrimaryKeyColumn(); $sql = "DELETE FROM " . $this->_quoteIdentifier($mapping->getTable()) . " WHERE `{$pk->getColumn()}`=" . $id; return $sql; }
/** * @return SimDAL_Mapper_Entity */ public function getFrom() { return $this->_from->getTable(); }
public function getRightValue() { return new SimDAL_Query_Where_Column($this->_entity->getTable(), $this->_entity->getColumn($this->_descendant->getParentKey())); }
protected function _processInsertQuery(SimDAL_Mapper_Entity $mapping, $data) { $sql = "INSERT INTO " . $this->_quoteIdentifier($mapping->getTable()) . " (" . implode(',', array_keys($data)) . ") VALUES (" . implode(',', $data) . ")"; return $sql; }
protected function _processInsertQuery(SimDAL_Mapper_Entity $mapping, $data) { $sql = "INSERT INTO " . $this->_quoteIdentifier($mapping->getTable()) . " ('" . implode('\',\'', array_keys($data)) . "') VALUES ("; foreach ($data as $key => $value) { $sql .= ':' . $key . ','; } $sql = substr($sql, 0, -1) . ')'; $stmt = $this->_conn->prepare($sql); foreach ($data as $key => $value) { $stmt->bindParam(':' . $key, $value); } return $stmt; }