src/Koldy/Db/Query.php
public function debug(bool $oneLine = false): string
    {
        $query = $this->getSQL();

        foreach ($this->getBindings()->getBindings() as $parameter => $bind) {
            if ($parameter[0] == ':') {
                $parameter = substr($parameter, 1);
            }

            $value = $bind->getValue();

            $type = gettype($value);
            switch ($type) {
                case 'string':
                    $query = str_replace(":{$parameter}", ("'" . addslashes((string) $value) . "'"), $query);
                    break;

                case 'integer':
                case 'float':
                case 'double':
                    $query = str_replace(":{$parameter}", $value, $query);
                    break;

                case 'NULL':
                    $query = str_replace(":{$parameter}", 'NULL', $query);
                    break;

                case 'boolean':
                    $true = (bool)$value;
                    $query = str_replace(":{$parameter}", $true ? 'true' : 'false', $query);
                    break;

                case 'object':
                case 'array':
                case 'resource':
                case 'unknown type':
	                throw new QueryException("Unsupported type ({$type}) was passed as parameter ({$parameter}) to SQL statement");
                    break;

                default:
	                throw new \Koldy\Exception('Unknown data type (' . $type . ') was passed to SQL statement');
                    break;
            }
        }

        if ($oneLine) {
            $query = str_replace("\t", '', $query);
            $query = str_replace("\n", ' ', $query);
            $query = str_replace('  ', ' ', $query);
        }

        return $query;
    }
public function debug(bool $oneLine = false): string
    {
        $query = $this->getSQL();

        foreach ($this->getBindings()->getBindings() as $parameter => $bind) {
            if ($parameter[0] == ':') {
                $parameter = substr($parameter, 1);
            }

            $value = $bind->getValue();

            $type = gettype($value);
            switch ($type) {
                case 'string':
                    $query = str_replace(":{$parameter}", ("'" . addslashes((string) $value) . "'"), $query);
                    break;

                case 'integer':
                case 'float':
                case 'double':
                    $query = str_replace(":{$parameter}", $value, $query);
                    break;

                case 'NULL':
                    $query = str_replace(":{$parameter}", 'NULL', $query);
                    break;

                case 'boolean':
                    $true = (bool)$value;
                    $query = str_replace(":{$parameter}", $true ? 'true' : 'false', $query);
                    break;

                case 'object':
                case 'array':
                case 'resource':
                case 'unknown type':
	                throw new QueryException("Unsupported type ({$type}) was passed as parameter ({$parameter}) to SQL statement");
                    break;

                default:
	                throw new \Koldy\Exception('Unknown data type (' . $type . ') was passed to SQL statement');
                    break;
            }
        }

        if ($oneLine) {
            $query = str_replace("\t", '', $query);
            $query = str_replace("\n", ' ', $query);
            $query = str_replace('  ', ' ', $query);
        }

        return $query;
    }
public function debug ( bool $ oneLine = false ) : string { $ query = $ this -> getSQL ( ) ; foreach ( $ this -> getBindings ( ) -> getBindings ( ) as $ parameter => $ bind ) { if ( $ parameter [ 0 ] == ':' ) { $ parameter = substr ( $ parameter , 1 ) ; } $ value = $ bind -> getValue ( ) ; $ type = gettype ( $ value ) ; switch ( $ type ) { case 'string' : $ query = str_replace ( ":{$parameter}" , ( "'" . addslashes ( ( string ) $ value ) . "'" ) , $ query ) ; break ; case 'integer' : case 'float' : case 'double' : $ query = str_replace ( ":{$parameter}" , $ value , $ query ) ; break ; case 'NULL' : $ query = str_replace ( ":{$parameter}" , 'NULL' , $ query ) ; break ; case 'boolean' : $ true = ( bool ) $ value ; $ query = str_replace ( ":{$parameter}" , $ true ? 'true' : 'false' , $ query ) ; break ; case 'object' : case 'array' : case 'resource' : case 'unknown type' : throw new QueryException ( "Unsupported type ({$type}) was passed as parameter ({$parameter}) to SQL statement" ) ; break ; default : throw new \ Koldy \ Exception ( 'Unknown data type (' . $ type . ') was passed to SQL statement' ) ; break ; } } if ( $ oneLine ) { $ query = str_replace ( "\t" , '' , $ query ) ; $ query = str_replace ( "\n" , ' ' , $ query ) ; $ query = str_replace ( '  ' , ' ' , $ query ) ; } return $ query ; }
Return some debug information about the query you built

@param bool $oneLine return query in one line

@return string

@throws QueryException
@throws \Koldy\Exception
Return some debug information about the query you built