protected static final function getSqlResult($name, $sql) { $hash = sha1($sql); $s = self::getSchema($name); $ssql_name = self::getSSqlName($name); if (isset($s->sql_result_cache[$hash])) { $result = $s->sql_result_cache[$hash]; SSql::rewind($result, $ssql_name); # rewind the result automatically return $result; } # we didn't find the cached result so execute, add to cache and return the result $s->sql_result_cache[$hash] = $result = SSql::query($sql, $ssql_name); return $result; }