cSQLi – Mysqli Veritabanı Sınıfı

<?php
header('Content-Type: text/html; charset=utf-8');
class cSQLi {
	public $oci;
	public $rs;
	public function __construct($server, $user, $pass, $db) {
		$this->oci = new mysqli($server, $user, $pass, $db);
		if (mysqli_connect_errno()) {
				printf("Bağlantı Hatası: %s\n", mysqli_connect_error());
   			exit();
		}
		if (!$this->oci->set_charset("utf8")) {
				printf("Utf8 Karakter Seçim Hatası: %s\n", $this->oci->error);
				exit();
		}
  }
	public function affRows() {
		return $this->oci->affected_rows;
	}
	public function closeOCI() {
		$this->oci->close();
	}
	public function closeRS() {
		$this->rs->close();
	}
	public function escape($string) {
		return $this->oci->real_escape_string($string);
	}
	public function killThread($tid) {
		$this->oci->kill($tid);
	}
	public function lastID() {
		return $this->oci->insert_id;
	}
	public function numRows() {
		return $this->rs->num_rows;
	}
	public function query($query) {
		return $this->rs = $this->oci->query($query);
	}
	public function fetch($query) {
		while ( $row = $query->fetch_assoc() ) {
			$results[] = $row;
		}
		return $results;
	}
}
$db = new cSQLi('localhost','root', '', 'php');
$query=$db->query('SELECT * FROM php WHERE id = 1');
print_r($db->fetch($query));
print_r($db->numRows());
print_r($db->affRows());
print_r($db->lastID());
print_r($db->escape("merhaba'lar"));
print_r($db->killThread(1));
print_r($db->closeRS());
print_r($db->oci);
print_r($db->closeOCI());

Çıktısı

Array([0] => Array([id] => 1))
1
1
0
merhaba\'lar
0
0
mysqli Object ( [affected_rows] => 1 [client_info] => mysqlnd 5.0.10 - 20111026 - $Id: xxxxx $ [client_version] => 50010 [connect_errno] => 0 [connect_error] => [errno] => 0 [error] => [error_list] => Array ( ) [field_count] => 1 [host_info] => localhost via TCP/IP [info] => [insert_id] => 0 [server_info] => 5.6.15-log [server_version] => 50615 [stat] => Uptime: 200502 Threads: 1 Questions: 579 Slow queries: 0 Opens: 95 Flush tables: 1 Open tables: 64 Queries per second avg: 0.002 [sqlstate] => 00000 [protocol_version] => 10 [thread_id] => 95 [warning_count] => 0 )
mysqli_result Object ( [current_field] => 0 [field_count] => 6 [lengths] => [num_rows] => 1 [type] => 0 )

Sizin Değerli Görüşlerinize İhtiyacımız Var.