aql::sql()

From SkyPHP

Jump to: navigation, search

aql | aql sql |


Convert aql statement into sql.

Contents

Description

array sql ( string $aql [, array $clause ] )

Parameters

aql - the aql statement to convert

clause - additional clauses to inject into the aql statement (see clause array)

Return Values

Returns an array containing the sql.

Examples

$aql = "track {
            number,
            title,
            duration
        }
        album {
            name as album_name,
            year
        }
        artist {
            name as artist_name
            where name = 'Pink Floyd'
        }";
$sql_array = aql::sql( $aql );
echo $sql_array['sql'];

Output:

select track.id as track_id,
       track.number, 
       track.title,
       track.duration, 
       album.id as album_id,
       album.name as album_name,
       album.year,
       artist.id as artist_id,
       artist.name as artist_name
from track
left join album on album.id = track.album_id and album.active = 1
left join artist on artist.id = album.artist_id and artist.active = 1
where track.active = 1
and where artist.name = 'Pink Floyd'

See Also

Known Bugs & Issues

none

Personal tools