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 autoincrement primary key name.
50: * @param string
51: * @return string|null
52: */
53: //function getPrimaryAutoincrementKey($table);
54:
55: /**
56: * Returns table primary key sequence.
57: * @param string
58: * @return string|null
59: */
60: function getPrimaryKeySequence($table);
61:
62: /**
63: * Returns hasMany reference.
64: * If a targetTable is not provided, returns references for all tables.
65: * @param string
66: * @param string|null
67: * @return array|null
68: */
69: function getHasManyReference($table, $targetTable = null);
70:
71: /**
72: * Returns belongsTo reference.
73: * If a column is not provided, returns references for all columns.
74: * @param string
75: * @param string|null
76: * @return array|null
77: */
78: function getBelongsToReference($table, $column = null);
79:
80: /**
81: * Rebuilds database structure cache.
82: * @return void
83: */
84: function rebuild();
85:
86: /**
87: * Returns true if database cached structure has been rebuilt.
88: * @return bool
89: */
90: function isRebuilt();
91: }
92: