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: * Provides cached reflection for database structure.
13: */
14: interface IStructure
15: {
16: const
17: FIELD_TEXT = 'string',
18: FIELD_BINARY = 'bin',
19: FIELD_BOOL = 'bool',
20: FIELD_INTEGER = 'int',
21: FIELD_FLOAT = 'float',
22: FIELD_DATE = 'date',
23: FIELD_TIME = 'time',
24: FIELD_DATETIME = 'datetime',
25: FIELD_UNIX_TIMESTAMP = 'timestamp',
26: FIELD_TIME_INTERVAL = 'timeint';
27:
28: /**
29: * Returns tables list.
30: * @return array
31: */
32: function getTables();
33:
34: /**
35: * Returns table columns list.
36: * @param string
37: * @return array
38: */
39: function getColumns($table);
40:
41: /**
42: * Returns table primary key.
43: * @param string
44: * @return string|array|NULL
45: */
46: function getPrimaryKey($table);
47:
48: /**
49: * Returns table primary key sequence.
50: * @param string
51: * @return string|NULL
52: */
53: function getPrimaryKeySequence($table);
54:
55: /**
56: * Returns hasMany reference.
57: * If a targetTable is not provided, returns references for all tables.
58: * @param string
59: * @param string|NULL
60: * @return mixed
61: */
62: function getHasManyReference($table, $targetTable = NULL);
63:
64: /**
65: * Returns belongsTo reference.
66: * If a column is not provided, returns references for all columns.
67: * @param string
68: * @param string|NULL
69: * @return mixed
70: */
71: function getBelongsToReference($table, $column = NULL);
72:
73: /**
74: * Rebuilds database structure cache.
75: * @return mixed
76: */
77: function rebuild();
78:
79: /**
80: * Returns true if database cached structure has been rebuilt.
81: * @return bool
82: */
83: function isRebuilt();
84:
85: }
86: