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 mixed
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:
79: /********************* reflection ****************d*g**/
80:
81:
82: /**
83: * Returns list of tables.
84: * @return array of [name [, (bool) view]]
85: */
86: function getTables();
87:
88: /**
89: * Returns metadata for all columns in a table.
90: * @param string
91: * @return array of [name, nativetype, primary [, table, fullname, (int) size, (bool) nullable, (mixed) default, (bool) autoincrement, (array) vendor]]
92: */
93: function getColumns($table);
94:
95: /**
96: * Returns metadata for all indexes in a table.
97: * @param string
98: * @return array of [name, (array of names) columns [, (bool) unique, (bool) primary]]
99: */
100: function getIndexes($table);
101:
102: /**
103: * Returns metadata for all foreign keys in a table.
104: * @param string
105: * @return array
106: */
107: function getForeignKeys($table);
108:
109: /**
110: * Returns associative array of detected types (IStructure::FIELD_*) in result set.
111: * @param \PDOStatement
112: * @return array
113: */
114: function getColumnTypes(\PDOStatement $statement);
115:
116: /**
117: * Cheks if driver supports specific property
118: * @param string self::SUPPORT_* property
119: * @return bool
120: */
121: function isSupported($item);
122:
123: }
124: