Skip to content

Commit

Permalink
Bug 1737 fixed : Concatenation error with POstgreSQL
Browse files Browse the repository at this point in the history
Simplify same function for SQLite

git-svn-id: http://piwigo.org/svn/trunk@6580 68402e56-0260-453c-a942-63ccdbb3a9ee
  • Loading branch information
nikrou committed Jun 22, 2010
1 parent 5a677f1 commit bedacf7
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 10 deletions.
4 changes: 1 addition & 3 deletions include/dblayer/functions_pdo-sqlite.inc.php
Expand Up @@ -413,9 +413,7 @@ function pwg_db_concat($array)

function pwg_db_concat_ws($array, $separator)
{
$glue = sprintf(' || \'%s\' || ', $separator);

return implode($array, $glue);
return implode($array, ' || \''.$separator.'\' || ');
}

function pwg_db_cast_to_text($string)
Expand Down
6 changes: 2 additions & 4 deletions include/dblayer/functions_pgsql.inc.php
Expand Up @@ -449,14 +449,12 @@ function do_maintenance_all_tables()

function pwg_db_concat($array)
{
$string = implode($array, ',');
return 'ARRAY_TO_STRING(ARRAY['.$string.'])';
return implode($array, ' || ');
}

function pwg_db_concat_ws($array, $separator)
{
$string = implode($array, ',');
return 'ARRAY_TO_STRING(ARRAY['.$string.'],\''.$separator.'\')';
return implode($array, ' || \''.$separator.'\' || ');
}

function pwg_db_cast_to_text($string)
Expand Down
4 changes: 1 addition & 3 deletions include/dblayer/functions_sqlite.inc.php
Expand Up @@ -425,9 +425,7 @@ function pwg_db_concat($array)

function pwg_db_concat_ws($array, $separator)
{
$glue = sprintf(' || \'%s\' || ', $separator);

return implode($array, $glue);
return implode($array, ' || \''.$separator.'\' || ');
}

function pwg_db_cast_to_text($string)
Expand Down

0 comments on commit bedacf7

Please sign in to comment.