You are not logged in.
Pages: 1
The question of best practice programming.
Why two SQL queries with PHP code better than one SQL query?
/textpattern/lib/txplib_misc.php line 2127
$out = safe_field('user_html','txp_page',"name='error_".doSlash($code)."'");
if ($out === false)
$out = safe_field('user_html','txp_page',"name='error_default'");
vs
$out = safe_field('user_html','txp_page',"name='error_".doSlash($code)."' or name='error_default' order by name limit 1");
Thanks for the response.
aks_cron : Cron inside Textpattern | aks_article : extended article_custom tag
aks_cache : cache for TxP | aks_meta | aks_header : Compress your pages on the fly
Offline
Which comes first, error_Xavier or error_default?
Rah-plugins | What? I’m a little confused… again :-) <txp:is_god />
Offline
IMHO, $code – is a numeric or blank.
error_000, error_999, error_ always will be first then error_default
or in Textpattern $code maybe a string?…
Upd: RFC2616 describe numeric codes from 100 to 505.
Last edited by makss (2012-05-10 13:01:22)
aks_cron : Cron inside Textpattern | aks_article : extended article_custom tag
aks_cache : cache for TxP | aks_meta | aks_header : Compress your pages on the fly
Offline
Status is just the name of the prefixed page template. As currently there are no actual set limitations what that name should be, the status can be anything.
Last edited by Gocom (2012-05-10 13:00:37)
Rah-plugins | What? I’m a little confused… again :-) <txp:is_god />
Offline
Gocom wrote:
Status is just the name of the prefixed page template. As currently there are no actual set limitations what that name should be, the status can be anything.
What about RFC2616 ?
Status used in txp_status_header($status); like header("HTTP/1.1 $status");
aks_cron : Cron inside Textpattern | aks_article : extended article_custom tag
aks_cache : cache for TxP | aks_meta | aks_header : Compress your pages on the fly
Offline
Sure, the header will be invalid, didn’t say otherwise. But. There is no validation. The function or its tag presentation doesn’t make sure that the used status numeric or that it passes as a HTTP status code.
Last edited by Gocom (2012-05-10 13:24:26)
Rah-plugins | What? I’m a little confused… again :-) <txp:is_god />
Offline
Let me explain my reasoning why I chose one patch over the other:
I consider the patch I merged into r3780 as a more robust and – imho even more important – a more legible solution. Exploiting side effects (like sort order) for program logic might be useful for time critical code paths where we want to squeeze out every single cpu cycle but in this case I’d rather have an obvious code path than a clever hack.
Try wet_quicklink | Me | @rwetzlmayr | +Robert Wetzlmayr | Repos
Offline
Jukka, Robert, Thanks for the responses.
aks_cron : Cron inside Textpattern | aks_article : extended article_custom tag
aks_cache : cache for TxP | aks_meta | aks_header : Compress your pages on the fly
Offline
Pages: 1