Ignore:
Timestamp:
Nov 25, 2009, 8:02:57 PM (14 years ago)
Author:
nikrou
Message:

Feature 1255: modification in sql queries

  • manage random function
  • manage regex syntax
  • manage quote (single instead of double)
  • manage interval
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/include/ws_functions.inc.php

    r4348 r4367  
    122122        $matches[1][$i] = 'date_available'; break;
    123123      case 'rand': case 'random':
    124         $matches[1][$i] = 'RAND()'; break;
     124        $matches[1][$i] = DB_RANDOM_FUNCTION.'()'; break;
    125125    }
    126126    $sortable_fields = array('id', 'file', 'name', 'hit', 'average_rate',
    127       'date_creation', 'date_available', 'RAND()' );
     127      'date_creation', 'date_available', DB_RANDOM_FUNCTION.'()' );
    128128    if ( in_array($matches[1][$i], $sortable_fields) )
    129129    {
    130130      if (!empty($ret))
    131131        $ret .= ', ';
    132       if ($matches[1][$i] != 'RAND()' )
     132      if ($matches[1][$i] != DB_RANDOM_FUNCTION.'()' )
    133133      {
    134134        $ret .= $tbl_name;
     
    231231    if ($params['recursive'])
    232232    {
    233       $where_clauses[] = 'uppercats REGEXP \'(^|,)'.$cat_id.'(,|$)\'';
     233      $where_clauses[] = 'uppercats '.DB_REGEX_OPERATOR.' \'(^|,)'.$cat_id.'(,|$)\'';
    234234    }
    235235    else
     
    378378  else if ($params['cat_id']>0)
    379379  {
    380     $where[] = 'uppercats REGEXP \'(^|,)'.
     380    $where[] = 'uppercats '.DB_REGEX_OPERATOR.' \'(^|,)'.
    381381      (int)($params['cat_id'])
    382382      .'(,|$)\'';
Note: See TracChangeset for help on using the changeset viewer.