public function getRelations ($db, $table)
	{
		
		// If there are no table constraints
		
		if (!isset ($this->relations[$db][$table]))
		{
			
			// Set blank array
			
			$this->relations[$db][$table]	= array ();
			
			// Query database
			
			$query	= $this->db->query ('SHOW CREATE TABLE ' . $db . '.' . $table);
			
			// get SQL
			
			$sql	= $query->fetchColumn (1);
			
			// For each line
			
			foreach (explode ("\n", $sql) as $line)
			{
				
				// Trim
				
				$line	= trim ($line);
				
				// If the line starts with CONSTRAINT
				
				if (strpos ($line, 'CONSTRAINT') === 0)
				{
					
					// Reset pattern
					
					$pattern	= array ();
					
					// Get necessary information out of the constraint
					
					preg_match ('/FOREIGN KEY \(`(.*?)`\) REFERENCES `(.*?)` \(`(.*?)`\)/', 
						$line, $pattern);
					
					// Add to relations array
					
					$this->relations[$db][$table][]	= array (
						'attribute'		=> $pattern[1], 
						'table'			=> $pattern[2], 
						'column'		=> $pattern[3]
					);
					
				}
				
			}
			
		}
		
		// Return relations
		
		return $this->relations[$db][$table];
		
	}