+ if (method_exists($d, 'availableColumns')) {
+ $cols = $d->availableColumns();
+ } else {
+
+ $re = $d->autoJoin();
+ //echo '<PRE>';print_r($re);
+ $cols = $re['cols'] ;
+
+
+ $types = array();
+ $tables = array();
+ $schemas = array($table => $d->table());
+
+ foreach($cols as $name=>$table_col) {
+ list($tbl, $col) = explode('.', $table_col);
+ if (!isset($schemas[$tbl])) {
+ $schemas[$tbl] = DB_DataObject::Factory($tbl)->table();
+ }
+ $types[$name] = $schemas[$tbl][$col];
+ $tables[$name] = $tbl;
+ }
+
+ foreach($re['join_names'] as $c=>$f) {
+ $cols[$c] = $f;
+ }
+