<?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;
use Xyndravandria\Dyverath\Query\Query;
/// A class representing a Server. class Server extends ExtendedRepresentingClass {
/// This @ref Server "Server's" MySQL link identifier. /// <dl class = "type"><dt><b>%Type:</b></dt> /// <dd>resource</dd></dl> /// @private private $Connection = null; /// Returns Server::$Connection. /// @public /// @returns resource public function Connection( ) { return $this->Connection; }
/// Creates a new Server. /// @public /// @param string $Name: The name of the Server. /// @param resource $Connection: The @ref Server "Server's" /// MySQL link identifier. public function __construct( $Name, $Connection ) { //\settype( $Name, 'string' ); if( ! \is_resource( $Connection ) ) throw new XyndravandriaDyverathException( '$Connection is no resource.' ); else { parent::__construct( $Name ); $this->Connection = $Connection; } return; } /// Accessess one of this @ref Server "Server's" @ref /// Database "Databases". /// @public /// @param string $Name: The name of the Database. /// @returns Database public function Database( $Name ) { //\settype( $Name, 'string' ); $Database = new Database( $Name, $this ); if( ( $DatabaseSaved = Database::Cache( )->Get( $Database->UniqueIdentifier( ) ) ) ) return $DatabaseSaved; elseif( \mysql_num_rows( $this->ExecuteQuery( new Query( 'SELECT TRUE FROM `INFORMATION_SCHEMA`.`SCHEMATA` WHERE `SCHEMATA`.`SCHEMA_NAME` = \'' . \mysql_real_escape_string( $Database->Name( ) ) . '\' LIMIT 1' ) ) ) == 0 ) throw new XyndravandriaDyverathException( 'Requested unknown database \'' . $Database->Name( ) . '\'.' ); else if( Database::Configuration( ) & Database::CacheEnabled ) return Database::Cache( )->Add( $Database ); else return $Database; return null; }
/// Alias of Server::Database( ). public function __get( $Name ) { return $this->Database( $Name ); }
/// Returns all this @ref Server "Server's" @ref /// Database "Databases". /// @public /// @returns array of Database public function Databases( ) { $Databases = array( ); if( ! ( $Result = $this->Query( 'SELECT `SCHEMATA`.`SCHEMA_NAME` FROM `INFORMATION_SCHEMA`.`SCHEMATA` WHERE 1' ) ) ) throw new XyndravandriaDyverathException( 'Unable to read out the databases of the server \'' . $this->Name . '\' from the information schema.' ); else while( $Dataset = \mysql_fetch_object( $Result ) ) { $Database = new Database( $Dataset->SCHEMA_NAME, $this ); if( ( $DatabaseSaved = Database::Cache( )->Get( $Database->UniqueIdentifier( ) ) ) ) $Databases[ ] = $DatabaseSaved; elseif( Database::Configuration( ) & Database::CacheEnabled ) $Databases[ ] = Database::Cache( )->Add( $Database ); else $Databases[ ] = $Database; } return $Databases; }
/// Executes a Query on this Server. /// @public /// @param Query $Query: The Query to be executed. public function ExecuteQuery( Query $Query ) { if( ! ( $Result = \mysql_query( $Query, $this->Connection ) ) ) throw new XyndravandriaDyverathException( 'Error in query. Query: \'' . $Query . '\'. Error message: ' . \mysql_error( ) ); else return $Result; return; } /// Alias of Server::Cache( )->CurrentObject( ). /// @public /// @static /// @returns Server public static function Current( ) { return self::Cache( )->CurrentObject( ); }
/// Returns the declared name of this class. /// @public /// @static /// @returns string /// @note Required by the CacheAble interface. public static function ClassName( ) { return __CLASS__; } } ?>
|