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