Вы находитесь на странице: 1из 4

<?

php

define('dbcore_version','0.1');
define('OBJECT','OBJECT',true);
define('ARRAY_A','ARRAY_A',true);
define('ARRAY_N','ARRAY_N',true);
define('ERR','Your database specific php class file does not contain function ');

class dbCore {
//errors
public $show_errors = true;
public $captured_errors = array();
//log
public $num_queries = 0;
public $last_query = null;
public $last_error = null;
public $col_info = null;
//cache
public $cache_dir = false;
public $cache_queries = false;
public $cache_inserts = false;
public $use_disk_cache = false;
public $cache_timeout = 24; //hours

function __construct() {
echo " hi there.You are in dbcore.php :) ";
}

function connect() {
die(ERR . __FUNCTION__ ."()");
}

function select() {
die(ERR . __FUNCTION__ ."()");
}

function query() {
die(ERR . __FUNCTION__ ."()");
}

function register_error($err_str) {
$this->last_error = $err_str;
$this->captured_errors[] = array
(
'error_str' => $err_str,
'query' => $this->last_query
);
}

function show_errors() {
$this->show_errors = false;
}

function hide_errors() {
$this->show_errors = false;
}
function flush() {
$this->last_result = null;
$this->col_info = null;
$this->last_query = null;
$this->from_disk_cache = false;
}

function get_var($query=null, $col=0, $row=0) {


//log how the function was called
$this->func_call = "\$db->get_var(\"$query\",$col,$row)";
//perform the query
if ($query) {
$this->query($query);
}

if ( $this->last_result[$row] ) {
$values = array_values(get_object_vars($this-
>last_result[$row]));
}

return (isset($values[$col]) && $values[$col] !==


'')?$values[$col]:null;

function get_row($query=null, $output=OBJECT, $y=0) {


if ($query) {
$this->query($query);
}
if ($output == OBJECT) {
return $this->last_result[$y] ? $this->last_result[$y] : null;
}
if ($output == ARRAY_A) {
return $this->last_result[$y] ? get_object_vars($this-
>last_result[$y]) : null;
}
if ($output == ARRAY_N) {
return $this->last_result[$y] ?
array_values(get_object_vars($this->last_result[$y])) : null;
}
else {
echo "\$db->get_row(string query, output type, int offset) --
Output type must be one of: OBJECT, ARRAY_A, ARRAY_N";
}
}

function get_col($query=null, $col=0) {


if( $query ) {
$this->query($query);
}
for ($i=0; $i < count($this->last_result); $i++) {
$new_array[$i] = $this->get_var(null,$col,$i);
}
return $new_array;
}

function get_results($query=null, $output = OBJECT) {


if($query) {
$this->query($query);
}

if ($output == OBJECT) {
return $this->last_result;
}
elseif ($output == ARRAY_A || $output = ARRAY_N) {

if ($this->last_result) {
$i = 0;
foreach ($this->last_result as $row) {
$new_array[$i] = get_object_vars($row);
if ($output == ARRAY_N) {
$new_array[$i] = array_values($new_array[$i]);
}
$i++;
}
return $new_array;
}
else {
return null;
}
}
//else {
//echo " Invalid $output";
//}
}

function get_col_info($info_type='name',$col_offset=-1) {
if ($this->col_info) {
if ( $col_offset == -1) {
$i = 0;
foreach ($this->col_info as $col) {
$new_array[$i] = $col->{$info_type};
$i++;
}
return $new_array;
}
else {
return $this->col_info[$col_offset]->{$info_type};

}
}
else {
echo " There is no last query executed ";
}
}

function store_cache($query,$is_insert) {
}

function get_cache($query) {
}

function var_dump($mixed = '') {


}

function debug() {
}
}
?>

Вам также может понравиться

  • HCK BTC
    HCK BTC
    Документ36 страниц
    HCK BTC
    Krishna Thoka
    100% (1)
  • Introduction to PHP, Part 2, Second Edition
    Introduction to PHP, Part 2, Second Edition
    От Everand
    Introduction to PHP, Part 2, Second Edition
    Оценок пока нет
  • Import Data From Excel
    Import Data From Excel
    Документ2 страницы
    Import Data From Excel
    muttuswami
    Оценок пока нет
  • Introduction to PHP, Part 5, Second Edition
    Introduction to PHP, Part 5, Second Edition
    От Everand
    Introduction to PHP, Part 5, Second Edition
    Оценок пока нет
  • J ADH0 EAZ
    J ADH0 EAZ
    Документ63 страницы
    J ADH0 EAZ
    Anonymous aKzd0QMWe
    Оценок пока нет
  • My Book of Python Computing - Abhijit Kar Gupta
    My Book of Python Computing - Abhijit Kar Gupta
    Документ385 страниц
    My Book of Python Computing - Abhijit Kar Gupta
    Kabir West
    100% (1)
  • API Ref AOS v6 - 0
    API Ref AOS v6 - 0
    Документ1 015 страниц
    API Ref AOS v6 - 0
    Vishal Idge
    Оценок пока нет
  • PC Lint
    PC Lint
    Документ367 страниц
    PC Lint
    Mu-Tai Lin
    100% (1)
  • Cpayeer PHP
    Cpayeer PHP
    Документ4 страницы
    Cpayeer PHP
    wiwin wiwin
    Оценок пока нет
  • Oop Based PHP DB Class
    Oop Based PHP DB Class
    Документ7 страниц
    Oop Based PHP DB Class
    naeemkashif
    Оценок пока нет
  • Super-Fast PHP Mysql Database Class: Source
    Super-Fast PHP Mysql Database Class: Source
    Документ7 страниц
    Super-Fast PHP Mysql Database Class: Source
    naeemkashif
    Оценок пока нет
  • W3data PHP
    W3data PHP
    Документ7 страниц
    W3data PHP
    Did You Know ?
    Оценок пока нет
  • HTML Parser PHP Tutorial
    HTML Parser PHP Tutorial
    Документ13 страниц
    HTML Parser PHP Tutorial
    zeroxcool4968
    Оценок пока нет
  • API Mikrotik Terbaru
    API Mikrotik Terbaru
    Документ13 страниц
    API Mikrotik Terbaru
    taurus1928
    Оценок пока нет
  • Appml PHP
    Appml PHP
    Документ20 страниц
    Appml PHP
    Did You Know ?
    Оценок пока нет
  • CHP 5-7 Rough
    CHP 5-7 Rough
    Документ46 страниц
    CHP 5-7 Rough
    Meet Mehta
    Оценок пока нет
  • DB Result
    DB Result
    Документ12 страниц
    DB Result
    Lenovo Shyukri
    Оценок пока нет
  • c99 PHP
    c99 PHP
    Документ71 страница
    c99 PHP
    egyhacker
    Оценок пока нет
  • Atomlib
    Atomlib
    Документ7 страниц
    Atomlib
    kandorp
    Оценок пока нет
  • CC Class PHP
    CC Class PHP
    Документ3 страницы
    CC Class PHP
    noncorv
    Оценок пока нет
  • Example
    Example
    Документ2 страницы
    Example
    Bugra Swax
    Оценок пока нет
  • 23
    23
    Документ4 страницы
    23
    Maury Júnior
    Оценок пока нет
  • Script Program Rental Mobil (Soal Nomor 26)
    Script Program Rental Mobil (Soal Nomor 26)
    Документ129 страниц
    Script Program Rental Mobil (Soal Nomor 26)
    Ike Indriani
    Оценок пока нет
  • Append J Son Serialize Sub Class Code
    Append J Son Serialize Sub Class Code
    Документ1 страница
    Append J Son Serialize Sub Class Code
    thanh nguyen
    Оценок пока нет
  • 2 - PHP MVC Frameworks MVC Introduction Lab
    2 - PHP MVC Frameworks MVC Introduction Lab
    Документ14 страниц
    2 - PHP MVC Frameworks MVC Introduction Lab
    Nguyen Tuan Kiet (FGW DN)
    Оценок пока нет
  • Interviu PHP
    Interviu PHP
    Документ9 страниц
    Interviu PHP
    VCatavFcsb
    Оценок пока нет
  • Append J Son Serialize Code
    Append J Son Serialize Code
    Документ1 страница
    Append J Son Serialize Code
    thanh nguyen
    Оценок пока нет
  • Header PHP
    Header PHP
    Документ2 страницы
    Header PHP
    Yoel Velasquez
    Оценок пока нет
  • Class Dnslib
    Class Dnslib
    Документ44 страницы
    Class Dnslib
    jaier
    Оценок пока нет
  • PHP
    PHP
    Документ98 страниц
    PHP
    Nadya Khoirunnisa
    Оценок пока нет
  • Mysql Forge
    Mysql Forge
    Документ5 страниц
    Mysql Forge
    Lenovo Shyukri
    Оценок пока нет
  • GGJ
    GGJ
    Документ156 страниц
    GGJ
    farah
    Оценок пока нет
  • Factory Metod
    Factory Metod
    Документ16 страниц
    Factory Metod
    kiranmann
    Оценок пока нет
  • Crud Dasar
    Crud Dasar
    Документ3 страницы
    Crud Dasar
    Ary Empat September
    Оценок пока нет
  • Fisier
    Fisier
    Документ18 страниц
    Fisier
    Sergiu Dan
    Оценок пока нет
  • Untitled 1
    Untitled 1
    Документ9 страниц
    Untitled 1
    TEST
    Оценок пока нет
  • Untitled
    Untitled
    Документ252 страницы
    Untitled
    Akbar Abdullayev
    Оценок пока нет
  • PolylineEncoder Class PHP
    PolylineEncoder Class PHP
    Документ6 страниц
    PolylineEncoder Class PHP
    mreall
    100% (6)
  • Lampiran Fix
    Lampiran Fix
    Документ42 страницы
    Lampiran Fix
    MaghfirahEkasariLaitjinara
    Оценок пока нет
  • Function RL
    Function RL
    Документ5 страниц
    Function RL
    Luluk MasUdah
    Оценок пока нет
  • Mysqli Utalur
    Mysqli Utalur
    Документ4 страницы
    Mysqli Utalur
    Lenovo Shyukri
    Оценок пока нет
  • Script PHP
    Script PHP
    Документ54 страницы
    Script PHP
    Anonymous SMyzIRQA
    Оценок пока нет
  • Approach For Cache System: Step 1: Create A Table To Save Last Bug Fix Update Time
    Approach For Cache System: Step 1: Create A Table To Save Last Bug Fix Update Time
    Документ4 страницы
    Approach For Cache System: Step 1: Create A Table To Save Last Bug Fix Update Time
    kriti_ag123
    Оценок пока нет
  • AngularJS PHP MySql
    AngularJS PHP MySql
    Документ12 страниц
    AngularJS PHP MySql
    Mycel Calanza
    Оценок пока нет
  • Hacked by MR - Singh
    Hacked by MR - Singh
    Документ133 страницы
    Hacked by MR - Singh
    Anonymous bKlBR5c
    Оценок пока нет
  • MODUL 5.1 CRUD DGN PHP OOP
    MODUL 5.1 CRUD DGN PHP OOP
    Документ2 страницы
    MODUL 5.1 CRUD DGN PHP OOP
    Lavina
    Оценок пока нет
  • DMS Format 1711944865 1712040264
    DMS Format 1711944865 1712040264
    Документ4 страницы
    DMS Format 1711944865 1712040264
    Jivanjyoti Ray
    Оценок пока нет
  • SAQIBSOA
    SAQIBSOA
    Документ5 страниц
    SAQIBSOA
    Ubaidullah Pirzada
    Оценок пока нет
  • 17 - Lampiran
    17 - Lampiran
    Документ25 страниц
    17 - Lampiran
    Aldi Fitriadi
    Оценок пока нет
  • DCXP
    DCXP
    Документ5 страниц
    DCXP
    Adam F
    Оценок пока нет
  • Laravel Tricks in 50 Minutes
    Laravel Tricks in 50 Minutes
    Документ83 страницы
    Laravel Tricks in 50 Minutes
    Thitinan Kliangsuwan
    Оценок пока нет
  • PHP Login Multi User
    PHP Login Multi User
    Документ1 страница
    PHP Login Multi User
    Miran 1996
    Оценок пока нет
  • Pesan 3296
    Pesan 3296
    Документ128 страниц
    Pesan 3296
    Achmad Yusuf
    Оценок пока нет
  • Get-TLS ps1
    Get-TLS ps1
    Документ2 страницы
    Get-TLS ps1
    Luigi Quiros
    Оценок пока нет
  • 2.Php Arrays and Superglobals
    2.Php Arrays and Superglobals
    Документ16 страниц
    2.Php Arrays and Superglobals
    mba20238
    Оценок пока нет
  • Index
    Index
    Документ10 страниц
    Index
    Marin Burlea
    Оценок пока нет
  • Praktikum Pertemuan 7
    Praktikum Pertemuan 7
    Документ14 страниц
    Praktikum Pertemuan 7
    Andrew Narapati
    Оценок пока нет
  • AD Privileged Audit - ps1
    AD Privileged Audit - ps1
    Документ24 страницы
    AD Privileged Audit - ps1
    Adegbola Oluwaseun
    Оценок пока нет
  • File Temp
    File Temp
    Документ66 страниц
    File Temp
    Shem Kironde
    Оценок пока нет
  • Login Form PHP Code
    Login Form PHP Code
    Документ6 страниц
    Login Form PHP Code
    atifcomputerz
    Оценок пока нет
  • Ped
    Ped
    Документ9 страниц
    Ped
    HenryMorgan1
    Оценок пока нет
  • Jquery Quicksearch Js
    Jquery Quicksearch Js
    Документ6 страниц
    Jquery Quicksearch Js
    theealok
    Оценок пока нет
  • Bundle Practice
    Bundle Practice
    Документ2 страницы
    Bundle Practice
    praveen139
    Оценок пока нет
  • Lightbox Css
    Lightbox Css
    Документ1 страница
    Lightbox Css
    eghanvat
    100% (1)
  • Home Css
    Home Css
    Документ1 страница
    Home Css
    eghanvat
    Оценок пока нет
  • Form Css
    Form Css
    Документ3 страницы
    Form Css
    eghanvat
    100% (1)
  • Basic Css
    Basic Css
    Документ1 страница
    Basic Css
    eghanvat
    100% (1)
  • Software Engineering
    Software Engineering
    Документ11 страниц
    Software Engineering
    Mahesh Darvankar
    Оценок пока нет
  • ITS332 SDP Template
    ITS332 SDP Template
    Документ8 страниц
    ITS332 SDP Template
    Ay Sy
    Оценок пока нет
  • Odoo Javascript
    Odoo Javascript
    Документ120 страниц
    Odoo Javascript
    Mahmoud Naguib
    100% (1)
  • Java Exception Handling
    Java Exception Handling
    Документ14 страниц
    Java Exception Handling
    Dr Narayana Swamy Ramaiah
    Оценок пока нет
  • Maximo JSON API Overview
    Maximo JSON API Overview
    Документ8 страниц
    Maximo JSON API Overview
    pramodkumar
    Оценок пока нет
  • Ijsret v6 Issue3 344
    Ijsret v6 Issue3 344
    Документ4 страницы
    Ijsret v6 Issue3 344
    rajdeep3srivastava
    Оценок пока нет
  • The Log Stash Book
    The Log Stash Book
    Документ209 страниц
    The Log Stash Book
    bg9mecr
    Оценок пока нет
  • C++ Uses Iostream.h For These Functions. Constructor and Destructors Are There in C++. Inline Functions Are Supported by C++
    C++ Uses Iostream.h For These Functions. Constructor and Destructors Are There in C++. Inline Functions Are Supported by C++
    Документ30 страниц
    C++ Uses Iostream.h For These Functions. Constructor and Destructors Are There in C++. Inline Functions Are Supported by C++
    Rama Murthy
    Оценок пока нет
  • Enhancing With Multi Threading
    Enhancing With Multi Threading
    Документ38 страниц
    Enhancing With Multi Threading
    ra_po_1
    Оценок пока нет
  • Java Programming MCQ-Answers-90min
    Java Programming MCQ-Answers-90min
    Документ20 страниц
    Java Programming MCQ-Answers-90min
    karthiktaneti94
    Оценок пока нет
  • Unit Testing
    Unit Testing
    Документ17 страниц
    Unit Testing
    Karthik Tantri
    100% (1)
  • Responsibility Collaborator: CRC Cards
    Responsibility Collaborator: CRC Cards
    Документ5 страниц
    Responsibility Collaborator: CRC Cards
    Ummu Ahmed
    Оценок пока нет
  • TAC Vista TAC Menta Technical Manual 2008
    TAC Vista TAC Menta Technical Manual 2008
    Документ416 страниц
    TAC Vista TAC Menta Technical Manual 2008
    Scribber
    Оценок пока нет
  • Student Guide For MS Teams - Desktop
    Student Guide For MS Teams - Desktop
    Документ19 страниц
    Student Guide For MS Teams - Desktop
    daney67299
    Оценок пока нет
  • First Ansible Playbook For Beginners
    First Ansible Playbook For Beginners
    Документ8 страниц
    First Ansible Playbook For Beginners
    xmywayx5316
    Оценок пока нет
  • Assignment 4 - Comp8547
    Assignment 4 - Comp8547
    Документ2 страницы
    Assignment 4 - Comp8547
    Jay Saavn
    Оценок пока нет
  • Batangas State University
    Batangas State University
    Документ54 страницы
    Batangas State University
    Ralph Matthew Marcial Sangalang
    Оценок пока нет
  • Design and Development
    Design and Development
    Документ15 страниц
    Design and Development
    Ahmad Umar
    Оценок пока нет
  • August Ticket Dump 2022
    August Ticket Dump 2022
    Документ261 страница
    August Ticket Dump 2022
    Pradeep Manral
    Оценок пока нет
  • Tutorial 01-02-2013 Exercises
    Tutorial 01-02-2013 Exercises
    Документ1 страница
    Tutorial 01-02-2013 Exercises
    Apostolis Giannakidis
    Оценок пока нет
  • Bug Life Cycle
    Bug Life Cycle
    Документ3 страницы
    Bug Life Cycle
    Lakshmi
    Оценок пока нет
  • Customer Connect: HCM Extracts: Product Update
    Customer Connect: HCM Extracts: Product Update
    Документ14 страниц
    Customer Connect: HCM Extracts: Product Update
    Leave Testing
    Оценок пока нет
  • Advanced Concurrency in Java
    Advanced Concurrency in Java
    Документ68 страниц
    Advanced Concurrency in Java
    Madura Nattudurai
    Оценок пока нет
  • C++ Programming: Repetition Structure
    C++ Programming: Repetition Structure
    Документ33 страницы
    C++ Programming: Repetition Structure
    Umar Shah
    Оценок пока нет
  • MiVueManagerLog Mac
    MiVueManagerLog Mac
    Документ3 страницы
    MiVueManagerLog Mac
    Leo Dumitru
    Оценок пока нет
  • Scope of Work
    Scope of Work
    Документ64 страницы
    Scope of Work
    Ankit Singhal
    Оценок пока нет
  • CSC2102 Data Structures and Algorithm Program BSSE-3 Sec. A Week 1
    CSC2102 Data Structures and Algorithm Program BSSE-3 Sec. A Week 1
    Документ30 страниц
    CSC2102 Data Structures and Algorithm Program BSSE-3 Sec. A Week 1
    Dr-Mahmoud Aljawarneh
    Оценок пока нет