Skip to content

Commit

Permalink
Adding the random function, defaults to RAND().
Browse files Browse the repository at this point in the history
git-svn-id: http://svn.php.net/repository/pear/packages/MDB2/trunk@214663 c90b9560-bf6c-de11-be94-00142212c4b1
  • Loading branch information
helgi committed Jun 12, 2006
1 parent 250ef20 commit 46d6467
Show file tree
Hide file tree
Showing 3 changed files with 44 additions and 0 deletions.
14 changes: 14 additions & 0 deletions MDB2/Driver/Function/Common.php
Expand Up @@ -161,6 +161,20 @@ function concat($value1, $value2)
return "(".implode(' || ', $args).")";
}

// }}}
// {{{ random()

/**
* return string to call a function to get random value inside an SQL statement
*
* @return string to call a function to get random value
* @access public
*/
function random()
{
return 'RAND()';
}

// }}}
}
?>
14 changes: 14 additions & 0 deletions MDB2/Driver/Function/pgsql.php
Expand Up @@ -81,5 +81,19 @@ function &executeStoredProc($name, $params = null, $types = null, $result_class
return $db->query($query, $types, $result_class, $result_wrap_class);
}
// }}}
// {{{ random()

/**
* return string to call a function to get random value inside an SQL statement
*
* @return string to call a function to get random value
* @access public
*/
function random()
{
return 'RANDOM()';
}

// }}}
}
?>
16 changes: 16 additions & 0 deletions MDB2/Driver/Function/sqlite.php
Expand Up @@ -105,5 +105,21 @@ function substring($value, $position = 1, $length = null)
}
return "substr($value,$position,length($value))";
}

// }}}
// {{{ random()

/**
* return string to call a function to get random value inside an SQL statement
*
* @return string to call a function to get random value
* @access public
*/
function random()
{
return 'RANDOM()';
}

// }}}
}
?>

0 comments on commit 46d6467

Please sign in to comment.