1: <?php
2:
3: /**
4: * This file is part of the Nette Framework (http://nette.org)
5: *
6: * Copyright (c) 2004 David Grudl (http://davidgrudl.com)
7: *
8: * For the full copyright and license information, please view
9: * the file license.txt that was distributed with this source code.
10: * @package Nette\Database
11: */
12:
13:
14:
15: /**
16: * Information about tables and columns structure.
17: * @package Nette\Database
18: */
19: interface IReflection
20: {
21: const
22: FIELD_TEXT = 'string',
23: FIELD_BINARY = 'bin',
24: FIELD_BOOL = 'bool',
25: FIELD_INTEGER = 'int',
26: FIELD_FLOAT = 'float',
27: FIELD_DATE = 'date',
28: FIELD_TIME = 'time',
29: FIELD_DATETIME = 'datetime';
30:
31: /**
32: * Gets primary key of $table.
33: * @param string
34: * @return string
35: */
36: function getPrimary($table);
37:
38: /**
39: * Gets referenced table & referenced column.
40: * Example:
41: * author, book returns array(book, author_id)
42: *
43: * @param string source table
44: * @param string referencing key
45: * @return array array(referenced table, referenced column)
46: */
47: function getHasManyReference($table, $key);
48:
49: /**
50: * Gets referenced table & referencing column.
51: * Example
52: * book, author returns array(author, author_id)
53: * book, translator returns array(author, translator_id)
54: *
55: * @param string source table
56: * @param string referencing key
57: * @return array array(referenced table, referencing column)
58: */
59: function getBelongsToReference($table, $key);
60:
61: /**
62: * Injects database connection.
63: */
64: function setConnection(Connection $connection);
65:
66: }
67: