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