class_BasicMySql.inc.php 2.64 KB
<?php
/**
 * @file	BasicMySql.inc.php
 * @category freeSN
 * @mailto	code [at] netz.coop
 * @version 0.4.200901
 * @link http://netz.coop
 * 
 *  @copyright Copyright by netz.coop e.G. 2015
 *  
 *
 *   This program is free software: you can redistribute it and/or modify
 *   it under the terms of the GNU General Public License as published by
 *   the Free Software Foundation, either version 3 of the License, or
 *  (at your option) any later version.
 *
 *   This program is distributed in the hope that it will be useful,
 *   but WITHOUT ANY WARRANTY; without even the implied warranty of
 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *   GNU General Public License for more details.
 *
 *   You should have received a copy of the GNU General Public License
 *   along with this program.  If not, see <http://www.gnu.org/licenses/>.
 * 
 */
/**
 *	Klasse die die Standard SQL Funktionen umsetzt
 *
 *	@version 		0.1.080107
 *	@author 		dev [at] mensch [dot] coop
 *	@abstract
 */
abstract class BasicMySql implements iBasicSql {
	protected $User;
	protected $Password;
	protected $Database;
	protected $Host;

	protected $connection;
	protected $resource;
	protected $query;
	protected $db_selected;

	protected $SRequest;

	protected $ThisClassName;

	public static $count___construct=0;
	public static $MySql_count_query=0;
	public static $PDOSRequest_count_query=0;
	public static $count_nextRow=0;

	public function __toString() {
		$var_string='obj('.get_class($this).')';
		return $var_string;
	}

	public function	__construct(array $param_DataBaseData, PDO $param_PDO=null){
		BasicMySql::$count___construct++;
		$this->User 	= $param_DataBaseData['config_user'];
		$this->Password = $param_DataBaseData['config_passwd'];
		$this->Database = $param_DataBaseData['config_db'];
		$this->Host		= $param_DataBaseData['config_dbserver'];

		$this->ThisClassName = get_class($this);

		if(array_key_exists('SREQUEST', $param_DataBaseData) && is_array($param_DataBaseData['SREQUEST'])) {
			$var_PDOObject = new PDO(	"mysql:host=".$param_DataBaseData['SREQUEST']['config_dbserver'].";dbname=".$param_DataBaseData['SREQUEST']['config_db']."",
			$param_DataBaseData['SREQUEST']['config_user'],
			$param_DataBaseData['SREQUEST']['config_passwd']
			//				,						array(PDO::MYSQL_ATTR_USE_BUFFERED_QUERY => true)
			);
			$this->SRequest = new PDOSRequest($param_DataBaseData['SREQUEST'], $var_PDOObject);
		}
	}

	/**
	 * Function closes the connection to the MySQL-Server.
	 * @return bool
	 */
	public function disconnect(){
	}

	public function &getObjVar($param_ObjVar) {
		$ObjVar = trim($param_ObjVar);

		if($this->$ObjVar) {
			return $this->$ObjVar;
		}
	}
}

?>