function getTitusFields() { $data = array(); $dbr = wfGetDB(DB_SLAVE); $res = $dbr->query("SELECT * FROM titus LIMIT 1"); $n = mysql_num_fields($res->result); for ($i = 0; $i < $n; $i++) { $meta = mysql_fetch_field($res->result, $i); $field = new MySQLField($meta); $data[] = array('field' => $field->name(), 'name' => $field->name(), 'id' => $i, 'ftype' => $field->type(), 'defaultval' => '[enter val]'); } return $data; }
function getTitusFields() { $data = array(); $titus = $this->titus; $res = $titus->performTitusQuery("SELECT * FROM " . TitusDB::TITUS_TABLE_NAME . " LIMIT 1"); $n = mysql_num_fields($res->result); for ($i = 0; $i < $n; $i++) { $meta = mysql_fetch_field($res->result, $i); $field = new MySQLField($meta); if ($field->name() != ti_language_code) { $data[] = array('field' => "titus" . '.' . $field->name(), 'name' => $field->name(), 'id' => $i, 'ftype' => $field->type(), 'defaultval' => '[enter val]'); } } return json_encode($data); }
function getFields() { $sql = "select * from flavius_summary limit 1"; $res = $this->flavius->performQuery($sql); $n = mysql_num_fields($res->result); $fields = array(); $intervalFields = $this->flavius->getIntervalFields(); for ($k = 0; $k < $n; $k++) { $meta = mysql_fetch_field($res->result, $k); $field = new MySQLField($meta); $name = $field->name(); //Exclude interval fields except _all, and for _all drop the _all. $exclude = false; foreach ($intervalFields as $iField) { if (preg_match("@^" . $iField . "_\\d+@", $name) || preg_match("@^" . $iField . "_lw@", $name)) { $exclude = true; } elseif (preg_match("@^" . $iField . "_all@", $name)) { $name = $iField; } } if (!$exclude) { $fields[] = array('field' => 'flavius_summary.' . $name, 'name' => $name, 'id' => $i, 'ftype' => $field->type(), 'defaultval' => '[enter val]'); $i++; } } return $fields; }