-
-
Notifications
You must be signed in to change notification settings - Fork 113
Expand file tree
/
Copy pathDriver.php
More file actions
97 lines (72 loc) · 2.47 KB
/
Driver.php
File metadata and controls
97 lines (72 loc) · 2.47 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
<?php
/**
* This file is part of the Nette Framework (https://nette.org)
* Copyright (c) 2004 David Grudl (https://davidgrudl.com)
*/
declare(strict_types=1);
namespace Nette\Database;
/**
* Supplemental database driver.
*/
interface Driver
{
public const
SupportSequence = 'sequence',
SupportSelectUngroupedColumns = 'ungrouped_cols',
SupportMultiInsertAsSelect = 'insert_as_select',
SupportMultiColumnAsOrCond = 'multi_column_as_or',
SupportSubselect = 'subselect',
SupportSchema = 'schema';
/**
* Initializes connection.
* @throws ConnectionException
*/
function connect(string $dsn, ?string $user = null, ?string $password = null, ?array $options = null): void;
function query(string $queryString, array $params): ResultDriver;
function beginTransaction(): void;
function commit(): void;
function rollBack(): void;
/**
* Returns the ID of the last inserted row or sequence value.
*/
function getInsertId(?string $sequence = null): string;
/**
* Delimits string for use in SQL statement.
*/
function quote(string $string): string;
/**
* Delimits identifier for use in SQL statement.
*/
function delimite(string $name): string;
/**
* Formats date-time for use in a SQL statement.
*/
function formatDateTime(\DateTimeInterface $value): string;
/**
* Formats date-time interval for use in a SQL statement.
*/
function formatDateInterval(\DateInterval $value): string;
/**
* Encodes string for use in a LIKE statement.
*/
function formatLike(string $value, int $pos): string;
/**
* Injects LIMIT/OFFSET to the SQL query.
*/
function applyLimit(string &$sql, ?int $limit, ?int $offset): void;
/********************* reflection ****************d*g**/
/** @return list<array{name: string, fullName: string, view: bool}> */
function getTables(): array;
/** @return list<array{name: string, table: string, nativetype: string, size: int|null, nullable: bool, default: mixed, autoincrement: bool, primary: bool, vendor: array}> */
function getColumns(string $table): array;
/** @return list<array{name: string, columns: list<string>, unique: bool, primary: bool}> */
function getIndexes(string $table): array;
/** @return list<array{name: string, local: string, table: string, foreign: string}> */
function getForeignKeys(string $table): array;
/**
* Cheks if driver supports specific property
* @param self::Support* $item
*/
function isSupported(string $item): bool;
}
interface_exists(ISupplementalDriver::class);