|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
namespace Lagdo\DbAdmin\Db\Driver\Facades; |
|
4
|
|
|
|
|
5
|
|
|
/** |
|
6
|
|
|
* Facade to database functions |
|
7
|
|
|
*/ |
|
8
|
|
|
trait DatabaseTrait |
|
9
|
|
|
{ |
|
10
|
|
|
use AbstractTrait; |
|
11
|
|
|
|
|
12
|
|
|
/** |
|
13
|
|
|
* Get the facade |
|
14
|
|
|
* |
|
15
|
|
|
* @return DatabaseFacade |
|
16
|
|
|
*/ |
|
17
|
|
|
protected function databaseFacade() |
|
18
|
|
|
{ |
|
19
|
|
|
return $this->di()->g(DatabaseFacade::class); |
|
20
|
|
|
} |
|
21
|
|
|
|
|
22
|
|
|
/** |
|
23
|
|
|
* Connect to a database server |
|
24
|
|
|
* |
|
25
|
|
|
* @param bool $schemaAccess |
|
26
|
|
|
* |
|
27
|
|
|
* @return array |
|
28
|
|
|
*/ |
|
29
|
|
|
public function getDatabaseInfo(bool $schemaAccess) |
|
30
|
|
|
{ |
|
31
|
|
|
$this->connectToDatabase(); |
|
32
|
|
|
$this->breadcrumbs(true); |
|
33
|
|
|
return $this->databaseFacade()->getDatabaseInfo($schemaAccess); |
|
34
|
|
|
} |
|
35
|
|
|
|
|
36
|
|
|
/** |
|
37
|
|
|
* Get the tables from a database server |
|
38
|
|
|
* |
|
39
|
|
|
* @return array |
|
40
|
|
|
*/ |
|
41
|
|
|
public function getTables() |
|
42
|
|
|
{ |
|
43
|
|
|
$this->connectToSchema(); |
|
44
|
|
|
$this->breadcrumbs(true)->item($this->utils->trans->lang('Tables')); |
|
45
|
|
|
return $this->databaseFacade()->getTables(); |
|
46
|
|
|
} |
|
47
|
|
|
|
|
48
|
|
|
/** |
|
49
|
|
|
* Get the views from a database server |
|
50
|
|
|
* |
|
51
|
|
|
* @return array |
|
52
|
|
|
*/ |
|
53
|
|
|
public function getViews() |
|
54
|
|
|
{ |
|
55
|
|
|
$this->connectToSchema(); |
|
56
|
|
|
$this->breadcrumbs(true)->item($this->utils->trans->lang('Views')); |
|
57
|
|
|
return $this->databaseFacade()->getViews(); |
|
58
|
|
|
} |
|
59
|
|
|
|
|
60
|
|
|
/** |
|
61
|
|
|
* Get the routines from a given database |
|
62
|
|
|
* |
|
63
|
|
|
* @return array |
|
64
|
|
|
*/ |
|
65
|
|
|
public function getRoutines() |
|
66
|
|
|
{ |
|
67
|
|
|
$this->connectToSchema(); |
|
68
|
|
|
$this->breadcrumbs(true)->item($this->utils->trans->lang('Routines')); |
|
69
|
|
|
return $this->databaseFacade()->getRoutines(); |
|
70
|
|
|
} |
|
71
|
|
|
|
|
72
|
|
|
/** |
|
73
|
|
|
* Get the sequences from a given database |
|
74
|
|
|
* |
|
75
|
|
|
* @return array |
|
76
|
|
|
*/ |
|
77
|
|
|
public function getSequences() |
|
78
|
|
|
{ |
|
79
|
|
|
$this->connectToSchema(); |
|
80
|
|
|
$this->breadcrumbs(true)->item($this->utils->trans->lang('Sequences')); |
|
81
|
|
|
return $this->databaseFacade()->getSequences(); |
|
82
|
|
|
} |
|
83
|
|
|
|
|
84
|
|
|
/** |
|
85
|
|
|
* Get the user types from a given database |
|
86
|
|
|
* |
|
87
|
|
|
* @return array |
|
88
|
|
|
*/ |
|
89
|
|
|
public function getUserTypes() |
|
90
|
|
|
{ |
|
91
|
|
|
$this->connectToSchema(); |
|
92
|
|
|
$this->breadcrumbs(true)->item($this->utils->trans->lang('User types')); |
|
93
|
|
|
return $this->databaseFacade()->getUserTypes(); |
|
94
|
|
|
} |
|
95
|
|
|
|
|
96
|
|
|
/** |
|
97
|
|
|
* Get the events from a given database |
|
98
|
|
|
* |
|
99
|
|
|
* @return array |
|
100
|
|
|
*/ |
|
101
|
|
|
public function getEvents() |
|
102
|
|
|
{ |
|
103
|
|
|
$this->connectToSchema(); |
|
104
|
|
|
$this->breadcrumbs(true)->item($this->utils->trans->lang('Events')); |
|
105
|
|
|
return $this->databaseFacade()->getEvents(); |
|
106
|
|
|
} |
|
107
|
|
|
} |
|
108
|
|
|
|