1: <?php
2:
3: /**
4: * This file is part of the Nette Framework (https://nette.org)
5: * Copyright (c) 2004 David Grudl (https://davidgrudl.com)
6: */
7:
8: namespace Nette\Database;
9:
10:
11: /**
12: * Supplemental PDO database driver.
13: */
14: interface ISupplementalDriver
15: {
16: const SUPPORT_SEQUENCE = 'sequence',
17: SUPPORT_SELECT_UNGROUPED_COLUMNS = 'ungrouped_cols',
18: SUPPORT_MULTI_INSERT_AS_SELECT = 'insert_as_select',
19: SUPPORT_MULTI_COLUMN_AS_OR_COND = 'multi_column_as_or',
20: SUPPORT_SUBSELECT = 'subselect',
21: SUPPORT_SCHEMA = 'schema';
22:
23: /**
24: * @return DriverException
25: */
26: function convertException(\PDOException $e);
27:
28: /**
29: * Delimites identifier for use in a SQL statement.
30: * @param string
31: * @return string
32: */
33: function delimite($name);
34:
35: /**
36: * Formats boolean for use in a SQL statement.
37: * @param bool
38: * @return string
39: */
40: function formatBool($value);
41:
42: /**
43: * Formats date-time for use in a SQL statement.
44: * @return string
45: */
46: function formatDateTime(/*\DateTimeInterface*/ $value);
47:
48: /**
49: * Formats date-time interval for use in a SQL statement.
50: * @return string
51: */
52: //function formatDateInterval(\DateInterval $value);
53:
54: /**
55: * Encodes string for use in a LIKE statement.
56: * @param string
57: * @param int
58: * @return string
59: */
60: function formatLike($value, $pos);
61:
62: /**
63: * Injects LIMIT/OFFSET to the SQL query.
64: * @param string SQL query that will be modified.
65: * @param int|null
66: * @param int|null
67: * @return void
68: */
69: function applyLimit(&$sql, $limit, $offset);
70:
71: /**
72: * Normalizes result row.
73: * @param array
74: * @return array
75: */
76: function normalizeRow($row);
77:
78: /********************* reflection ****************d*g**/
79:
80: /**
81: * Returns list of tables.
82: * @return array of [name [, (bool) view]]
83: */
84: function getTables();
85:
86: /**
87: * Returns metadata for all columns in a table.
88: * @param string
89: * @return array of [name, nativetype, primary [, table, fullname, (int) size, (bool) nullable, (mixed) default, (bool) autoincrement, (array) vendor]]
90: */
91: function getColumns($table);
92:
93: /**
94: * Returns metadata for all indexes in a table.
95: * @param string
96: * @return array of [name, (array of names) columns [, (bool) unique, (bool) primary]]
97: */
98: function getIndexes($table);
99:
100: /**
101: * Returns metadata for all foreign keys in a table.
102: * @param string
103: * @return array
104: */
105: function getForeignKeys($table);
106:
107: /**
108: * Returns associative array of detected types (IStructure::FIELD_*) in result set.
109: * @param \PDOStatement
110: * @return array
111: */
112: function getColumnTypes(\PDOStatement $statement);
113:
114: /**
115: * Cheks if driver supports specific property
116: * @param string self::SUPPORT_* property
117: * @return bool
118: */
119: function isSupported($item);
120: }
121: