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: * Converts PDOException to DriverException or its descendant.
25: * @return DriverException
26: */
27: function convertException(\PDOException $e);
28:
29: /**
30: * Delimites identifier for use in a SQL statement.
31: * @param string
32: * @return string
33: */
34: function delimite($name);
35:
36: /**
37: * Formats boolean for use in a SQL statement.
38: * @param bool
39: * @return string
40: */
41: function formatBool($value);
42:
43: /**
44: * Formats date-time for use in a SQL statement.
45: * @return string
46: */
47: function formatDateTime(/*\DateTimeInterface*/ $value);
48:
49: /**
50: * Formats date-time interval for use in a SQL statement.
51: * @return string
52: */
53: //function formatDateInterval(\DateInterval $value);
54:
55: /**
56: * Encodes string for use in a LIKE statement.
57: * @param string
58: * @param int
59: * @return string
60: */
61: function formatLike($value, $pos);
62:
63: /**
64: * Injects LIMIT/OFFSET to the SQL query.
65: * @param string SQL query that will be modified.
66: * @param int|null
67: * @param int|null
68: * @return void
69: */
70: function applyLimit(&$sql, $limit, $offset);
71:
72: /**
73: * Normalizes result row.
74: * @param array
75: * @return array
76: */
77: function normalizeRow($row);
78:
79: /********************* reflection ****************d*g**/
80:
81: /**
82: * Returns list of tables.
83: * @return array of tuples [(string) name, (bool) view, [(string) fullName]]
84: */
85: function getTables();
86:
87: /**
88: * Returns metadata for all columns in a table.
89: * @param string
90: * @return array of tuples [(string) name, (string) table, (string) nativetype, (int) size, (bool) nullable, (mixed) default, (bool) autoincrement, (bool) primary, (array) vendor]]
91: */
92: function getColumns($table);
93:
94: /**
95: * Returns metadata for all indexes in a table.
96: * @param string
97: * @return array of tuples [(string) name, (string[]) columns, (bool) unique, (bool) primary]
98: */
99: function getIndexes($table);
100:
101: /**
102: * Returns metadata for all foreign keys in a table.
103: * @param string
104: * @return array of tuples [(string) name, (string) local, (string) table, (string) foreign]
105: */
106: function getForeignKeys($table);
107:
108: /**
109: * Returns associative array of detected types (IStructure::FIELD_*) in result set.
110: * @param \PDOStatement
111: * @return array
112: */
113: function getColumnTypes(\PDOStatement $statement);
114:
115: /**
116: * Cheks if driver supports specific property
117: * @param string self::SUPPORT_* property
118: * @return bool
119: */
120: function isSupported($item);
121: }
122: