Overview

Namespaces

  • App
    • Components
    • Interfaces
    • Lib
      • Files
      • Forms
        • Controls
      • Html
      • Repair
      • Statics
    • Model
    • Modules
      • BaseModule
        • Presenters
      • PartnersModule
        • Presenters
      • ProductModule
        • Presenters
      • SaleModule
        • Model
        • Presenters
      • SettingsModule
        • Model
        • Presenters
      • StoreModule
        • Model
        • Presenters
    • Presenters
    • Router
  • PHP

Classes

  • DateTime
  • SplFileInfo

Interfaces

  • ArrayAccess
  • Countable
  • Exception
  • Iterator
  • Traversable
  • Overview
  • Namespace
  • Class
  • Tree
  • Deprecated
  • Download
 1: <?php
 2: 
 3: /**
 4:  * Project sberp
 5:  *
 6:  * @file database 
 7:  * @author Jaromír Polášek
 8:  * @version 0.5.1
 9:  * Encoding UTF-8
10:  */
11: 
12: namespace App\Model;
13: 
14: Use Nette,
15:     Nette\Database\Context,
16:     Nette\Object,
17:     App\Lib\Statics\Vars;
18: 
19: /**
20:  * Třída pro přístup k uživatelské databázi a informačnímu schématu
21:  */
22: class Database extends Object {
23: 
24:     /** @var Nette\Database\Context */
25:     private $data;
26:     /** @var Nette\Database\Context */
27:     private $info;
28:     
29:     /**
30:      * Konstruktor vytvoří proměnou $data pro přístup k uživatelské databázi 
31:      * a $info, pro přístup k informačním schématům.
32:      * @param \Nette\Database\Context $data
33:      * @param \Nette\Database\Context $info
34:      */
35:     public function __construct(Context $data,Context $info) {
36:     $this->data = $data;
37:     $this->info = $info;    
38:     }
39:     
40:     /**
41:      * Vrací uživatelskou databázi 
42:      * @return Nette\Database\Context
43:      */
44:     public function getData(){
45:     return $this->data;
46:     }
47:     
48:     /**
49:      * Vrací informační schéma
50:      * @return Nette\Database\Context
51:      */
52:     public function getInfo(){
53:     return $this->info;
54:     }
55:     
56:     /**
57:      * Vrací jméno aktuální databáze
58:      * @return string
59:      */
60:     public function getName(){
61:     if (is_null(Vars::$database)) {
62:         $result = $this->data->query('SELECT DATABASE()')->fetch();
63:         Vars::$database = (string) $result['DATABASE()'];
64:     }
65:        return Vars::$database;
66:     }
67: }
68: 
sberp API API documentation generated by ApiGen