You are here

function date_sql_concat in Date 5

Same name and namespace in other branches
  1. 8 date_api/date_api.module \date_sql_concat()
  2. 5.2 date_api_sql.inc \date_sql_concat()
  3. 6.2 date_api_sql.inc \date_sql_concat()
  4. 6 date_api_sql.inc \date_sql_concat()
  5. 7.3 date_api/date_api_sql.inc \date_sql_concat()
  6. 7 date_api/date_api_sql.inc \date_sql_concat()
  7. 7.2 date_api/date_api_sql.inc \date_sql_concat()

A helper function to do cross-database concatation of date parts

Parameters

$array - an array of values to be concatonated in sql: @return - correct sql string for database type

1 call to date_sql_concat()
_date_views_argument_range_handler in ./date_views.inc

File

./date.inc, line 2144
Date/time API functions

Code

function date_sql_concat($array) {
  global $db_type;
  switch ($db_type) {
    case 'mysql':
    case 'mysqli':
      return "CONCAT(" . implode(",", $array) . ")";
    case 'pgsql':
      return implode(" || ", $array);
  }
}