CDash:CodingRules: Difference between revisions
From KitwarePublic
Jump to navigationJump to search
(New page: This page describes the coding style and rules to adopt when developing CDash.) |
No edit summary |
||
Line 1: | Line 1: | ||
This page describes the coding style and rules to adopt when developing CDash. | This page describes the coding style and rules to adopt when developing CDash. | ||
= Coding Style = | |||
== Indentation == | |||
* Tabs are not allowed. Tabs should be replaced by two spaces | |||
* Indentation of curly braces should be as follow: | |||
if($test == $test2) | |||
{ | |||
} | |||
== Date/Time == | |||
In order to support MySQL and PostGreSQL the date and time should use the following defined variables: | |||
define("FMT_TIME", "H:i:s"); // time | |||
define("FMT_DATE", "Y-m-d"); // date | |||
define("FMT_DATETIME", "Y-m-d\TH:i:s"); // date and time | |||
define("FMT_DATETIMETZ", "Y-m-d\TH:i:s T"); // date and time with time zone | |||
define("FMT_DATETIMEMS", "Y-m-d\TH:i:s.u"); // date and time with milliseconds | |||
== Count(*) queries == | |||
SELECT count(*) FROM ... | |||
is used, then a column named "count(*)" is expected to contain the result. | |||
This is not portable and the following query should be used instead: | |||
SELECT count(*) AS num FROM ... |
Revision as of 15:03, 19 September 2008
This page describes the coding style and rules to adopt when developing CDash.
Coding Style
Indentation
- Tabs are not allowed. Tabs should be replaced by two spaces
- Indentation of curly braces should be as follow:
if($test == $test2) { }
Date/Time
In order to support MySQL and PostGreSQL the date and time should use the following defined variables:
define("FMT_TIME", "H:i:s"); // time define("FMT_DATE", "Y-m-d"); // date define("FMT_DATETIME", "Y-m-d\TH:i:s"); // date and time define("FMT_DATETIMETZ", "Y-m-d\TH:i:s T"); // date and time with time zone define("FMT_DATETIMEMS", "Y-m-d\TH:i:s.u"); // date and time with milliseconds
Count(*) queries
SELECT count(*) FROM ...
is used, then a column named "count(*)" is expected to contain the result. This is not portable and the following query should be used instead:
SELECT count(*) AS num FROM ...