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