mirror of
https://github.com/Piwigo/Piwigo.git
synced 2025-04-30 05:09:57 +03:00
Feature 1255: modification in sql queries
- manage random function - manage regex syntax - manage quote (single instead of double) - manage interval git-svn-id: http://piwigo.org/svn/trunk@4367 68402e56-0260-453c-a942-63ccdbb3a9ee
This commit is contained in:
parent
d30639ec98
commit
13ea9d50e3
20 changed files with 134 additions and 112 deletions
|
@ -121,15 +121,15 @@ function ws_std_image_sql_order( $params, $tbl_name='' )
|
|||
case 'date_posted':
|
||||
$matches[1][$i] = 'date_available'; break;
|
||||
case 'rand': case 'random':
|
||||
$matches[1][$i] = 'RAND()'; break;
|
||||
$matches[1][$i] = DB_RANDOM_FUNCTION.'()'; break;
|
||||
}
|
||||
$sortable_fields = array('id', 'file', 'name', 'hit', 'average_rate',
|
||||
'date_creation', 'date_available', 'RAND()' );
|
||||
'date_creation', 'date_available', DB_RANDOM_FUNCTION.'()' );
|
||||
if ( in_array($matches[1][$i], $sortable_fields) )
|
||||
{
|
||||
if (!empty($ret))
|
||||
$ret .= ', ';
|
||||
if ($matches[1][$i] != 'RAND()' )
|
||||
if ($matches[1][$i] != DB_RANDOM_FUNCTION.'()' )
|
||||
{
|
||||
$ret .= $tbl_name;
|
||||
}
|
||||
|
@ -230,7 +230,7 @@ function ws_categories_getImages($params, &$service)
|
|||
continue;
|
||||
if ($params['recursive'])
|
||||
{
|
||||
$where_clauses[] = 'uppercats REGEXP \'(^|,)'.$cat_id.'(,|$)\'';
|
||||
$where_clauses[] = 'uppercats '.DB_REGEX_OPERATOR.' \'(^|,)'.$cat_id.'(,|$)\'';
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -377,7 +377,7 @@ function ws_categories_getList($params, &$service)
|
|||
}
|
||||
else if ($params['cat_id']>0)
|
||||
{
|
||||
$where[] = 'uppercats REGEXP \'(^|,)'.
|
||||
$where[] = 'uppercats '.DB_REGEX_OPERATOR.' \'(^|,)'.
|
||||
(int)($params['cat_id'])
|
||||
.'(,|$)\'';
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue