36 function __construct($xml_tables_tag, $xml_index_hints_tag = NULL)
38 $this->tables = array();
40 $xml_tables = $xml_tables_tag->table;
41 if(!is_array($xml_tables))
43 $xml_tables = array($xml_tables);
46 if($xml_index_hints_tag)
48 $index_nodes = $xml_index_hints_tag->index;
49 if(!is_array($index_nodes))
51 $index_nodes = array($index_nodes);
53 foreach($index_nodes as $index_node)
55 if(!isset($indexes[$index_node->attrs->table]))
57 $indexes[$index_node->attrs->table] = array();
59 $count = count($indexes[$index_node->attrs->table]);
60 $indexes[$index_node->attrs->table][$count] = (object) NULL;
61 $indexes[$index_node->attrs->table][$count]->name = $index_node->attrs->name;
62 $indexes[$index_node->attrs->table][$count]->type = $index_node->attrs->type;
66 foreach($xml_tables as $tag)
68 if($tag->attrs->query ==
'true')
70 $this->tables[] =
new QueryTag($tag,
true);
74 if(isset($indexes[$tag->attrs->name]) && $indexes[$tag->attrs->name])
76 $this->tables[] =
new HintTableTag($tag, $indexes[$tag->attrs->name]);
80 $this->tables[] =
new TableTag($tag);
93 $output_tables =
'array(' . PHP_EOL;
94 foreach($this->tables as $table)
96 if(is_a($table,
'QueryTag'))
98 $output_tables .= $table->toString() . PHP_EOL .
',';
102 $output_tables .= $table->getTableString() . PHP_EOL .
',';
105 $output_tables = substr($output_tables, 0, -1);
106 $output_tables .=
')';
107 return $output_tables;
112 $arguments = array();
113 foreach($this->tables as $table)
115 $arguments = array_merge($arguments, $table->getArguments());
__construct($xml_tables_tag, $xml_index_hints_tag=NULL)