Skip to content

Commit

Permalink
Build Oracle-specific AND and OR clauses.
Browse files Browse the repository at this point in the history
  • Loading branch information
yunosh committed Jan 22, 2014
1 parent 653039d commit 614e631
Showing 1 changed file with 33 additions and 0 deletions.
33 changes: 33 additions & 0 deletions framework/Db/lib/Horde/Db/Adapter/Oracle/Schema.php
Expand Up @@ -706,6 +706,39 @@ public function addColumnOptions($sql, $options)
return $sql;
}

/**
* Returns an expression using the specified operator.
*
* @param string $lhs The column or expression to test.
* @param string $op The operator.
* @param string $rhs The comparison value.
* @param boolean $bind If true, the method returns the query and a list
* of values suitable for binding as an array.
* @param array $params Any additional parameters for the operator.
*
* @return string|array The SQL test fragment, or an array containing the
* query and a list of values if $bind is true.
*/
public function buildClause($lhs, $op, $rhs, $bind = false,
$params = array())
{
$lhs = $this->_escapePrepare($lhs);
switch ($op) {
case '|':
if ($bind) {
return array($lhs . ' + ? - BITAND(' . $lhs . ', ?)',
array((int)$rhs, (int)$rhs));
}
return $lhs . ' + ' . (int)$rhs . ' - BITAND(' . $lhs . ', ' . (int)$rhs . ')';
case '&':
if ($bind) {
return array('BITAND(' . $lhs . ', ?)',
array((int)$rhs));
}
return 'BITAND(' . $lhs . ', ' . (int)$rhs . ')';
}
return parent::buildClause($lhs, $op, $rhs, $bind, $params);
}

/*##########################################################################
# Protected
Expand Down

0 comments on commit 614e631

Please sign in to comment.