function date_sql_coalesce in Date 8
Same name and namespace in other branches
- 5.2 date_api_sql.inc \date_sql_coalesce()
- 6.2 date_api_sql.inc \date_sql_coalesce()
- 7.3 date_api/date_api_sql.inc \date_sql_coalesce()
- 7 date_api/date_api_sql.inc \date_sql_coalesce()
- 7.2 date_api/date_api_sql.inc \date_sql_coalesce()
Helper function to do cross-database NULL replacements
Parameters
array $array: An array of values to test for NULL values.
Return value
string SQL statement to return the first non-NULL value in the list.
File
- date_api/
date_api.module, line 702 - This module will make the date API available to other modules. Designed to provide a light but flexible assortment of functions and constants, with more functionality in additional files that are not loaded unless other modules specifically include them.
Code
function date_sql_coalesce($array) {
switch (db_driver()) {
case 'mysql':
case 'mysqli':
case 'pgsql':
return "COALESCE(" . implode(',', $array) . ")";
}
}