Copies the query parameters contained in this object to another
SQLExpression

@param SQLExpression $object The object to copy properties to
760027
protected function copyTo(SQLExpression $object)
    {
        $target = array_keys(get_object_vars($object));
        foreach (get_object_vars($this) as $variable => $value) {
            if (in_array($variable, $target)) {
                $object->$variable = $value;
            }
        }
    }
1048090
public function remove($object)
    {
        // create property accessor
        $accessor = PropertyAccess::createPropertyAccessor();

        // delete existing documents with same id
        foreach ($this->index->find('id:' . $accessor->getValue($object, 'id')) as $hit) {
            $this->index->delete($hit->id);
        }
    }
1239853
@Override
    public void setObject(int parameterIndex, Object x, int targetSqlType, int scaleOrLength) throws SQLException
    {
        checkParameterBounds(parameterIndex);
        throw SQLError.noSupport();
    }
131398
public function clon(&$object=null) {
    list($object) = self::_wrapArgs(func_get_args(), 1);
    
    $clone = null;
    if(is_array($object)) $clone = (array) clone (object) $object;
    elseif(!is_object($object)) $clone = $object;
    elseif(!$clone) $clone = clone $object;
    
    // shallow copy object
    if(is_object($clone) && count($clone) > 0) {
      foreach($clone as $k=>$v) {
        if(is_array($v) || is_object($v)) $clone->$k =& $object->$k;
      }
    }
    
    // shallow copy array
    elseif(is_array($clone) && count($clone) > 0) {
      foreach($clone as $k=>$v) {
        if(is_array($v) || is_object($v)) $clone[$k] =& $object[$k];
      }
    }
    return self::_wrap($clone);
  }
1127513
function Equals(TableObject $object = null)
    {
        if (!$object)
            return false;

        if (get_class($this) == get_class($object))
            return $this->KeyValue() == $object->KeyValue();

        return $this === $object;
    }
309017
public function whereExpr($expr, $bind = null)
    {
        foreach ($this->queries as $query) {
            $query->whereExpr($expr, $bind);
        }

        return $this;
    }
494721
public function apply($dbDriver, $alias, $field, $exprValue, $namedParameter = null, &$value = null)
	{
		$matches = [];
		
		if (!preg_match(self::PATTERN, $exprValue, $matches)) {
			throw new BadQueryExprException(sprintf('The query expression converter "eq" does not support the following pattern "%s".', $exprValue));
		}
		
		$value = $matches[1];
		
		return $dbDriver === 'orm' ? 
				(new \Doctrine\ORM\Query\Expr())->eq($alias.'.'.$field, $namedParameter ?: ':'.$field) : 
				(new \Doctrine\MongoDB\Query\Expr())->field($field)->equals($value);
	}
566787
public function update(\Berthe\VO $object)
    {
        $this->validateTableAndIdentityColumn();

        $mappings = $this->getSaveMappings();

        if (empty($mappings)) {
            $mappings = $this->getDefaultMappings($object);
        }

        $clauseElements = array();
        $params = array();

        $values = $object->__toArray();

        foreach ($mappings as $column => $property) {
            $escape = $this->escapeCharacter;
            $clauseElements[] = sprintf('%s%s%s = %%s', $escape, $column, $escape);
            if (in_array($property, $object->getTranslatableFields())) {
                $value = $object->getAttribute($property);
            } else {
                $value = $values[$property];
            }
            $params[$column] = $value;

            if ($value instanceof \Berthe\Translation\Translation) {
                $this->translator->saveTranslation($value);
            }
        }

        $params['identity'] = $object->getId();

        $columnAssignment = implode(', ', $clauseElements);

        $query = <<<EOQ
UPDATE {$this->getTableName()} SET {$columnAssignment}
WHERE {$this->escapeCharacter}{$this->identityColumn}{$this->escapeCharacter} = %s;
EOQ;

        return (bool)$this->db->query($query, $params);
    }
537515
function execQueryString($sql, $params = null)
    {
        if (!is_array($params) && !is_null($params)) {
            $params = array($params);
        }

        $stmt = $this->prepare($sql);
        $stmt->execute($params);
        return $stmt;
    }
167234
public function create($object)
    {
        $db = new DatabaseManager();
        $connection = $db->getDbh();

        $objectAsArrayForSqlInsert = DatatbaseUtility::objectToArrayLessId($object);
        $fields = array_keys($objectAsArrayForSqlInsert);
        $insertFieldList = DatatbaseUtility::fieldListToInsertString($fields);
        $valuesFieldList = DatatbaseUtility::fieldListToValuesString($fields);

        $sql = 'INSERT into :table :insertFieldList :valuesFieldList';
        $sql = str_replace(':table', $this->tableName, $sql);
        $sql = str_replace(':insertFieldList', $insertFieldList, $sql);
        $sql = str_replace(':valuesFieldList', $valuesFieldList, $sql);

        $statement = $connection->prepare($sql);
        $statement->execute($objectAsArrayForSqlInsert);

        $queryWasSuccessful = ($statement->rowCount() > 0);
        if($queryWasSuccessful) {
            return $connection->lastInsertId();
        } else {
            return -1;
        }
    }
470149
private function insert($object)
    {
        //TODO: this should only be done if there is a Delete query pending for the same entity table
        $this->manager->commit();

        $query = $this->manager
            ->getDriver()
            ->getQueryBuilder()
            ->insert($this->getTable());

        $query->values(
            $query->createPositionalParameter(
                array_filter(
                    $this->toArray($object),
                    [Utils::class, 'notNull']
                )
            )
        );

        return $this->setFieldValue(
            $object,
            $this->getPrimaryKey(),
            $query->query()
        );
    }
903308
static function remove($object)
	{
		$db = new driver_mysql(config('main_bors_db'));

		$where = array(
			'target_class_id IN' => array($object->class_id(), $object->extends_class_id()),
			'target_object_id' => $object->id(),
		);

		bors_debug::syslog('__keywords_delete', 'where='.print_r($where, true));
		$db->delete('bors_keywords_index', $where);
	}
1279718
@Override
    public void setObject(int parameterIndex, Object x) throws SQLException
    {
        checkParameterBounds(parameterIndex);
        this.parameters[parameterIndex-1] = x;
    }
369339
public static function query($object = null)
    {
        if($object)
        {
            $class = BeanFactory::getObjectClass($object);
        }
        else
        {
            $class = static::__getRealClassName();
        }
        return Db::query(ModelManager::getDbPoolName($class), $class)->table(ModelManager::getTable($class));
    }
725587
private function initializeFromHardcodedObject($object)
    {
        //Typecast arrays to objects
        if (is_array($object)) $object = (object)$object;

        if (!empty($object->path)) {
            $this->path = $object->path;
        }

        if (!empty($object->name)) {
            $this->name = $object->name;
        }

        if (!empty($object->class)) {
            $this->class = $object->class;
        }

        if (!empty($object->priority)) {
            $this->priority = $object->priority;
        }

        if (!empty($object->pattern)) {
            if ($object->pattern instanceof Pattern)
            {
                $this->patternString = $object->pattern->getPatternString();
                $this->pattern = $object->pattern;
            }
            else
            {
                $this->patternString = $object->pattern;
                $this->pattern = new Pattern($this->path, $this->patternString);
            }
        }

        if (!empty($object->parameters)) {
            if (is_array($object->parameters)) {
                $this->parameters = (object)$object->parameters;
            } else {
                $this->parameters = $object->parameters;
            }
        }
    }
727130
public final void setValues(PreparedStatement ps) throws SQLException {
        if (this.logger.isDebugEnabled()) {
            this.logger.debug("Setting parameters " + this.parameters + " on prepared statement " + ps);
        }
        
        int parameterIndex = 0;
        for (final Phrase parameterPhrase : this.parameters) {
            final Object parameter = parameterPhrase.evaluate(this.req, this.res);
            ps.setObject(++parameterIndex, parameter);
        }
    }
919312
public function loadProperty($object, $propertyName)
    {
        if (get_class($object) !== $this->objectClass) {
            throw new \LogicException(sprintf('Invalid object type. Expected "%s" but got "%s".', $this->objectClass, get_class($object)));
        }

        if ($this->objectManager->isPropertyLoaded($object, $propertyName)) {
            return;
        }

        $hydrator = $this->objectManager->getHydratorFor($this->objectClass);
        $hydrator->loadProperty($object, $propertyName);
    }