<?php /* ============================================================================================================================================= | This file is part of a project released under the terms of the Xyndravandria PHP License (XyndravandriaPHPLicense.txt). | | | | You should be given a copy of the Xyndravandria PHP License (XyndravandriaPHPLicense.txt) within the same directory as the README.md; | | if not, you can get a copy at http://Xyndravandria.ohost.de/XyndravandriaPHPLicense.txt . | | | | The copyright (c) of this project is owned by Mauro Di Girolamo <maurodigirolamo@.web.de>. | ============================================================================================================================================|
Xyndravandria Dyverath ---------------------- Alpha 0.0.0
Xyndravandria is the name of a collection of projects designed and developed by Mauro Di Girolamo (maurodigirolamo@web.de); he is therefore the copyright (c) owner of Xyndravandria itself and all of its projects.
Xyndravandria Dyverath is released under the terms of the Xyndravandria PHP License (XyndravandriaPHPLicense.txt). You should be given a copy of the Xyndravandria PHP License (XyndravandriaPHPLicense.txt) within the same directory as the README.md; if not, you can get a copy at http://Xyndravandria.ohost.de/XyndravandriaPHPLicense.txt . There might be a release under a freer license for a later, more stable version.
The documentation is either included in ./admin_media/Documentation/ or can be read at http://Xyndravandria.ohost.de/Dyverath/Documentation/.
All projects:
Xyndravandria Averazain http://github.com/MauroDiGirolamo/Xyndravandria_Averazain PHP Averazain is an Ajax framework supporting also JavaScript disabled clients perfectly - including search engines like Google. Xyndravandria Dyverath http://github.com/MauroDiGirolamo/Xyndravandria_Dyverath PHP Dyverath is a database access wrapper. Xyndravandria Erozaver http://github.com/MauroDiGirolamo/Xyndravandria_Erozaver PHP Erozaver is a class extending the type hinting given by the PHP engine (additional support for basic type hinting and size constraints). Xyndravandria Mondraviel http://github.com/MauroDiGirolamo/Xyndravandria_Mondraviel PHP Mondraviel is a class used to separate HTML from PHP code by firstly register models - files containing place holders embedded in HTML code - and then later fill them dynamically with content by passing values for the place holders. */
namespace Xyndravandria\Dyverath\Query;
use Xyndravandria\Dyverath\Table; use Xyndravandria\Dyverath\Query\Component\Statement\StatementListing\Where; use Xyndravandria\Dyverath\Query\Component\Type\Column; use Xyndravandria\Dyverath\Query\Component\Type\Limit; use Xyndravandria\Erozaver\XyndravandriaDyverathException;
/// A class representing a SELECT statement. class Select extends Query { /// The @ref Column "Column(s)" to be selected. /// <dl class = "type"><dt><b>%Type:</b></dt> /// <dd>Column</dd></dl> /// @private private $Column; /// The Where used to select the Data. /// <dl class = "type"><dt><b>%Type:</b></dt> /// <dd>Database</dd></dl> /// @private private $Where; /// The Limit of the selection. /// <dl class = "type"><dt><b>%Type:</b></dt> /// <dd>Limit</dd></dl> /// @private private $Limit; /// The ORDER BY clause. /// <dl class = "type"><dt><b>%Type:</b></dt> /// <dd>Column</dd></dl> /// @private private $OrderBy; /// Creates a new Select. /// @public /// @param Column $Column: The @ref Column "Column(s)" /// to be selected. /// @param Table $Table: The Table this Query is /// executed in. /// @param Where $Where: The Where used to select the /// Data. /// @param Column $OrderBy: The order of the selection. /// @param Limit $Limit: The Limit of the selection. /// @note $Where, $OrderBy and $Limit are optional /// parameters. @n /// You can also pass only one of them and leave the /// other out; passing null is not needed. public function __construct( Column $Column, Table $Table, Where $Where = null, Column $OrderBy = null, Limit $Limit = null ) { $this->Column = $Column; $this->Table = $Table; $this->Where = $Where; if( $OrderBy instanceof Limit ) { $Limit = $OrderBy; $OrderBy = null; } $this->Limit = $Limit; $this->OrderBy = $OrderBy; $this->Optimise( ); return; } /// Optimises a Select. /// @public public function Optimise( ) { $this->Column->Optimise( $this->Table ); \is_null( $this->OrderBy ) || $this->OrderBy->Optimise( $this->Table ); \is_null( $this->Where ) || $this->Where->Optimise( $this->Table ); return; } /// Returns the complete statement. /// @public /// @returns string public function __ToString( ) { return 'SELECT ' . $this->Column . ' FROM ' . $this->Table . ( \is_null( $this->Where ) ? '' : ' WHERE ' . $this->Where ) . ( \is_null( $this->OrderBy ) ? '' : ' ORDER BY ' . $this->OrderBy ) . ( \is_null( $this->Limit ) ? '' : ' LIMIT ' . $this->Limit ); } } ?>
|