예제 #1
0
 /**
  * Get the names of the fields for a particular table
  * @param string $tablename The name of the table.
  * @return array of string The public fields in the table.
  */
 function get_fields($tablename)
 {
     global $_AWL_field_cache;
     if (!isset($_AWL_field_cache[$tablename])) {
         dbg_error_log("core", ":get_fields: Loading fields for table '{$tablename}'");
         $qry = new AwlQuery();
         $db = $qry->GetConnection();
         $qry->SetSQL($db->GetFields($tablename));
         $qry->Exec("core");
         $fields = array();
         while ($row = $qry->Fetch()) {
             $fields[$row->fieldname] = $row->typename . ($row->precision >= 0 ? sprintf('(%d)', $row->precision) : '');
         }
         $_AWL_field_cache[$tablename] = $fields;
     }
     return $_AWL_field_cache[$tablename];
 }