|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
namespace Ubiquity\db\providers\pdo\drivers; |
|
4
|
|
|
|
|
5
|
|
|
/** |
|
6
|
|
|
* Ubiquity\db\providers$DriverMetaDatas |
|
7
|
|
|
* This class is part of Ubiquity |
|
8
|
|
|
* |
|
9
|
|
|
* @author jc |
|
10
|
|
|
* @version 1.0.1 |
|
11
|
|
|
* |
|
12
|
|
|
*/ |
|
13
|
|
|
abstract class AbstractDriverMetaDatas { |
|
14
|
|
|
protected $dbInstance; |
|
15
|
|
|
|
|
16
|
32 |
|
public function __construct($dbInstance) { |
|
17
|
32 |
|
$this->dbInstance = $dbInstance; |
|
18
|
32 |
|
} |
|
19
|
|
|
|
|
20
|
|
|
/** |
|
21
|
|
|
* Returns all table names in the database. |
|
22
|
|
|
* |
|
23
|
|
|
* @return array |
|
24
|
|
|
*/ |
|
25
|
|
|
abstract public function getTablesName(): array; |
|
26
|
|
|
|
|
27
|
|
|
/** |
|
28
|
|
|
* Returns an array of the primary keys field names. |
|
29
|
|
|
* |
|
30
|
|
|
* @param string $tableName |
|
31
|
|
|
* @return array |
|
32
|
|
|
*/ |
|
33
|
|
|
abstract public function getPrimaryKeys(string $tableName): array; |
|
34
|
|
|
|
|
35
|
|
|
/** |
|
36
|
|
|
* Returns the list of foreign keys in a table. |
|
37
|
|
|
* |
|
38
|
|
|
* @param string $tableName |
|
39
|
|
|
* @param string $pkName |
|
40
|
|
|
* @param string $dbName |
|
41
|
|
|
* @return array |
|
42
|
|
|
*/ |
|
43
|
|
|
abstract public function getForeignKeys(string $tableName, string $pkName, ?string $dbName = null): array; |
|
44
|
|
|
|
|
45
|
|
|
/** |
|
46
|
|
|
* Returns metadata related to the fields of the specified table. |
|
47
|
|
|
* |
|
48
|
|
|
* @param string $tableName |
|
49
|
|
|
* @return array |
|
50
|
|
|
*/ |
|
51
|
|
|
abstract public function getFieldsInfos(string $tableName): array; |
|
52
|
|
|
|
|
53
|
|
|
/** |
|
54
|
|
|
* Returns the line number of a data record. |
|
55
|
|
|
* |
|
56
|
|
|
* @param string $tableName |
|
57
|
|
|
* @param string $pkName |
|
58
|
|
|
* @param string $condition |
|
59
|
|
|
* @return int |
|
60
|
|
|
*/ |
|
61
|
|
|
abstract public function getRowNum(string $tableName, string $pkName, string $condition): int; |
|
62
|
|
|
|
|
63
|
|
|
/** |
|
64
|
|
|
* Returns the SQL callback for fields concatenation |
|
65
|
|
|
* |
|
66
|
|
|
* @param string $fields |
|
67
|
|
|
* @return string |
|
68
|
|
|
*/ |
|
69
|
|
|
abstract public function groupConcat(string $fields, string $separator): string; |
|
70
|
|
|
|
|
71
|
25 |
|
public function toStringOperator() { |
|
72
|
25 |
|
return ''; |
|
73
|
|
|
} |
|
74
|
|
|
|
|
75
|
|
|
public function getPHPType(string $dbType): string { |
|
|
|
|
|
|
76
|
|
|
return ''; |
|
77
|
|
|
} |
|
78
|
|
|
} |
|
79
|
|
|
|
|
80
|
|
|
|
This check looks for parameters that have been defined for a function or method, but which are not used in the method body.