Returns the Query-hint value for the final query object.

The Query hint is used for value-conversions.

@return SqlConversionInfo
435804
public function getQueryHintValue(): SqlConversionInfo
    {
        if (null === $this->whereClause) {
            throw new BadMethodCallException(
                'Unable to get query-hint value for ConditionGenerator. Call getWhereClause() before calling this method.'
            );
        }

        return new SqlConversionInfo(
            $this->nativePlatform,
            $this->parameters,
            $this->conditionGenerator->getFieldsConfig()->getFields()
        );
    }
1262840
public function getQuery()
    {
        $query = null;

        switch ($this->type) {
            case self::SELECT:
                $query = $this->getSelectQuery();
                break;
            case self::INSERT:
                $query = $this->getInsertQuery();
                break;
            case self::UPDATE:
                $query = $this->getUpdateQuery();
                break;
            case self::DELETE:
                $query = $this->getDeleteQuery();
                break;
        }

        return $query;
    }
970161
final public function getQuery()
    {
        if (null === $this->query) {

            $this->query = $this->buildQuery();

            // Apply conditions.
            foreach ($this->conditions as $statement => $value) {
                $this->applyOperator($this->query, $statement, $value);
            }

            $limit = $this->getLimit();

            if (CursorInterface::LIMIT_NONE !== $limit) {
                $this->query->range($this->getOffset(), $limit);
            }
        }

        return $this->query;
    }
446785
public function getQuery()
    {
        $sql = $this->prepareSelectString();
        $sql .= $this->prepareJoinString();
        $sql .= $this->prepareWhereString();
        $sql .= $this->prepareGroupByString();
        $sql .= $this->prepareHavingString();
        $sql .= $this->prepareOrderByString();
        $sql .= $this->prepareLimitString();

        return $sql;
    }
902643
public function getDefaultValue()
    {
        if (!$this->hasDefaultValue()) {
            return null;
        }

        if ($this->defaultValue instanceof FragmentInterface) {
            //Defined as SQL piece
            return $this->defaultValue;
        }

        if (in_array($this->getAbstractType(), ['time', 'date', 'datetime', 'timestamp'])) {
            return $this->formatDatetime($this->getAbstractType(), $this->defaultValue);
        }

        switch ($this->getType()) {
            case 'int':
                return (int)$this->defaultValue;
            case 'float':
                return (float)$this->defaultValue;
            case 'bool':
                if (is_string($this->defaultValue) && strtolower($this->defaultValue) == 'false') {
                    return false;
                }

                return (bool)$this->defaultValue;
        }

        return (string)$this->defaultValue;
    }
749063
public function getLast()
    {
        try {
            $query = (new SelectQueryBuilder())->select([
                'max_value' => QueryExpression::max('id')
            ])->from(static::tableName());
            $sql = $query->parse($this->connection->getDialect())->getSQL();
            $data = $this->connection->prepare($sql)->execute()->fetch();
            return $data['max_value'];
        } catch (\PDOException $e) {
            return -1;
        }
    }
59059
public function getDbFormattedValue()
    {
        // SRM: This code finds the table where the field named $this->name lives
        // Todo: move to somewhere more appropriate, such as DataMapper, the magical class-to-be?

        if ($this->aggregate) {
            return intval($this->value);
        }

        /** @var DBField $dbField */
        $dbField = singleton($this->model)->dbObject($this->name);
        $dbField->setValue($this->value);
        return $dbField->RAW();
    }
1336959
private function errorCode()
    {
        if ($this->preparedExec == false){
    		$returnValue = $this->dbConnector->errorCode();
    	}
    	else{
    		$returnValue = $this->lastPreparedExecStatement->errorCode();
    	}
        return (string) $returnValue;
    }
581108
protected function _getQueryCacheId()
    {
        ksort($this->_hints);

        $platform = $this->getEntityManager()
            ->getConnection()
            ->getDatabasePlatform()
            ->getName();

        return md5(
            $this->getDql() . serialize($this->_hints) .
            '&platform=' . $platform .
            ($this->_em->hasFilters() ? $this->_em->getFilters()->getHash() : '') .
            '&firstResult=' . $this->_firstResult . '&maxResult=' . $this->_maxResults .
            '&hydrationMode=' . $this->_hydrationMode . '&types=' . serialize($this->_parsedTypes) . 'DOCTRINE_QUERY_CACHE_SALT'
        );
    }
348028
public function convert(QueryCriterionInterface $query) {
        $value = '%' . $query->getValue();
        $value = $this->getDriverEscaper()->escape($value);
        $value = $this->getDriverEscaper()->quote($value);
        return '' .$this->setPropertyName($query->getName()) . ' ' . $this->getDriverEscaper()->reserved('object') . ' ' . $this->getOperator() . ' ' . $value . '';
    }
924106
public function getTypeVal() {
        if (!$this->type)
            trigger_error(sprintf('Cannot build a column query for `%s`: no column type set',$this->name),E_USER_ERROR);
        if ($this->passThrough)
            $this->type_val = $this->type;
        else {
            $this->type_val = $this->findQuery($this->schema->dataTypes[strtoupper($this->type)]);
            if (!$this->type_val) {
                if (Schema::$strict) {
                    trigger_error(sprintf(self::TEXT_NoDataType, strtoupper($this->type),
                        $this->db->driver()),E_USER_ERROR);
                    return FALSE;
                } else {
                    // auto pass-through if not found
                    $this->type_val = $this->type;
                }
            }
        }
        return $this->type_val;
    }
587187
public function getQueryString()
    {
        $dialect = Dialect::create($this->_adapter->getDialect(), $this);
        return $dialect->getSqlStatement();
    }
848189
public function getFirst()
    {
        if (is_array($this->queryResult)) {
            $queryResult = &$this->queryResult;
        } else {
            $query = clone $this->query;
            $query->setLimit(1);
            $queryResult = $this->dataMapper->mapToObjects($this->persistenceManager->getObjectDataByQuery($query));
        }
        return (isset($queryResult[0])) ? $queryResult[0] : null;
    }
316728
public function getServerType()
	{
		if (empty($this->serverType))
		{
			$name = $this->getName();

			if (stristr($name, 'mysql') !== false)
			{
				$this->serverType = 'mysql';
			}
			elseif (stristr($name, 'postgre') !== false)
			{
				$this->serverType = 'postgresql';
			}
			elseif (stristr($name, 'pgsql') !== false)
			{
				$this->serverType = 'postgresql';
			}
			elseif (stristr($name, 'oracle') !== false)
			{
				$this->serverType = 'oracle';
			}
			elseif (stristr($name, 'sqlite') !== false)
			{
				$this->serverType = 'sqlite';
			}
			elseif (stristr($name, 'sqlsrv') !== false)
			{
				$this->serverType = 'mssql';
			}
			elseif (stristr($name, 'sqlazure') !== false)
			{
				$this->serverType = 'mssql';
			}
			elseif (stristr($name, 'mssql') !== false)
			{
				$this->serverType = 'mssql';
			}
			else
			{
				$this->serverType = $name;
			}
		}

		return $this->serverType;
	}
1332036
public function getSqlSegment()
    {
        if (!empty($this->sqlSegment)) {
            return $this->sqlSegment;
        }

        if ($this->dbTableName && $this->columnName) {
            return $this->dbTableName . '.' . $this->columnName;
        }
    }
247753
public function queryObject()
    {
        $bindingType = $this->options['bindingType'];

        $queryObj = [];
        $queryObj['queryString'] = $this->query;
        $queryObj['allowLiterals'] = (bool) $this->options['allowLiterals'];

        $bindings = $this->mapBindings($bindingType, $this->options['bindings']);
        if (!empty($bindings)) {
            $queryObj[$this->options['bindingType']] = $bindings;
        }

        return $queryObj;
    }
1340321
public function getCeil()
	{
		if ( $this->getIsDecimal() === false )
		{
			return $this;
		}

		if ( $this->getIsNegative() === true )
		{
			return new DecimalValue( bcadd( $this->_value, '0', 0 ) );
		}

		return new DecimalValue( bcadd( $this->_value, '1', 0 ) );  // Add one and truncate
	}