diff options
author | nikrou <nikrou@piwigo.org> | 2009-11-29 14:06:16 +0000 |
---|---|---|
committer | nikrou <nikrou@piwigo.org> | 2009-11-29 14:06:16 +0000 |
commit | ad796f152f38a37c3c9be438ee9a79ba7b307ebd (patch) | |
tree | 4862e6895ff5bee4f38914d942cda31ffa66b7c1 /include/dblayer/functions_mysql.inc.php | |
parent | c96097529e49943eddba78d70e23e38c0eac494d (diff) |
Feature_1255:
- bug fix : function pwg_db_get_recent_period_expression
- add extra fields for select based on "order by"
git-svn-id: http://piwigo.org/svn/trunk@4387 68402e56-0260-453c-a942-63ccdbb3a9ee
Diffstat (limited to 'include/dblayer/functions_mysql.inc.php')
-rw-r--r-- | include/dblayer/functions_mysql.inc.php | 17 |
1 files changed, 4 insertions, 13 deletions
diff --git a/include/dblayer/functions_mysql.inc.php b/include/dblayer/functions_mysql.inc.php index e47119535..cc5ca3081 100644 --- a/include/dblayer/functions_mysql.inc.php +++ b/include/dblayer/functions_mysql.inc.php @@ -458,23 +458,14 @@ function do_maintenance_all_tables() } } -function pwg_db_get_recent_period_expression($period, $date='CURRENT_DATE') +function pwg_db_concat_ws($string, $separaor) { - if ($date!='CURRENT_DATE') - { - $date = '\''.$date.'\''; - } - - return 'SUBDATE('.$date.',INTERVAL '.$period.' DAY)'; + return 'CONCAT_WS(\''.$separaor.'\','. $string.')'; } -function pwg_db_get_recent_period($period, $date='CURRENT_DATE') +function pwg_db_cast_to_text($string) { - $query = ' -SELECT '.pwg_db_get_recent_period_expression($period); - list($d) = pwg_db_fetch_row(pwg_query($query)); - - return $d; + return 'CAST('.$string.' AS CHAR)'; } /** |