public static function getFields($tbl): array
    {
        if (Settings::isCacheEnabled()) {
            $cache_key = 'db_table_columns_' . $tbl;
            $cacher = Cacher::getInstance()->getDefaultCacher();

            if (!isset(self::$_cached_tbl_columns[$tbl])) {
                self::$_cached_tbl_columns[$tbl] = $cacher->get($cache_key);
            }
        }

        if (isset(self::$_cached_tbl_columns[$tbl])) {
            return self::$_cached_tbl_columns[$tbl];
        }

        $res = [];
        $sql = self::getInstance()->sql_query("SHOW COLUMNS FROM `$tbl`");

        while ($q = $sql->fetch(PDO::FETCH_NUM)) {
            $res[] = $q[0];
        }

        if (Settings::isCacheEnabled()) {
            $cacher->set($cache_key, $res, 86400);
        }

        return self::$_cached_tbl_columns[$tbl] = $res;
    }
public static function getFields($tbl): array
    {
        if (Settings::isCacheEnabled()) {
            $cache_key = 'db_table_columns_' . $tbl;
            $cacher = Cacher::getInstance()->getDefaultCacher();

            if (!isset(self::$_cached_tbl_columns[$tbl])) {
                self::$_cached_tbl_columns[$tbl] = $cacher->get($cache_key);
            }
        }

        if (isset(self::$_cached_tbl_columns[$tbl])) {
            return self::$_cached_tbl_columns[$tbl];
        }

        $res = [];
        $sql = self::getInstance()->sql_query("SHOW COLUMNS FROM `$tbl`");

        while ($q = $sql->fetch(PDO::FETCH_NUM)) {
            $res[] = $q[0];
        }

        if (Settings::isCacheEnabled()) {
            $cacher->set($cache_key, $res, 86400);
        }

        return self::$_cached_tbl_columns[$tbl] = $res;
    }
public static function getFields ( $ tbl ) : array { if ( Settings :: isCacheEnabled ( ) ) { $ cache_key = 'db_table_columns_' . $ tbl ; $ cacher = Cacher :: getInstance ( ) -> getDefaultCacher ( ) ; if ( ! isset ( self :: $ _cached_tbl_columns [ $ tbl ] ) ) { self :: $ _cached_tbl_columns [ $ tbl ] = $ cacher -> get ( $ cache_key ) ; } } if ( isset ( self :: $ _cached_tbl_columns [ $ tbl ] ) ) { return self :: $ _cached_tbl_columns [ $ tbl ] ; } $ res = [ ] ; $ sql = self :: getInstance ( ) -> sql_query ( "SHOW COLUMNS FROM `$tbl`" ) ; while ( $ q = $ sql -> fetch ( PDO :: FETCH_NUM ) ) { $ res [ ] = $ q [ 0 ] ; } if ( Settings :: isCacheEnabled ( ) ) { $ cacher -> set ( $ cache_key , $ res , 86400 ) ; } return self :: $ _cached_tbl_columns [ $ tbl ] = $ res ; }
Show all columns in table

@param string $tbl - table name
@return array - list
Show all columns in table