Details
-
Bug
-
Resolution: Fixed
-
Medium
-
3.8.7, 3.9.1
-
None
-
Operating System: any
PHP Version: 4.4.x
Database and version: any
Browser (and version): any
Description
This will allow the creation of IN-parts in SQL statements that are compatible to oracle (limitation for elements used by IN is 1000).
The function definition could look like this:
function createIn( $column, $elements ) {}
The mysql version is very simple and just creates an IN part as is. The oracle version could look like this:
function createIn( $column, $elements = array() )
{
$amountElements = count( $elements );
if ( $amountElements > 1000 )
{
$parts = array();
$offset = 0;
while ( $offset < $amountElements )
{
$length = 1000;
if ( $offset + 1000 > $amountElements )
$parts[] = $column . ' IN (' . implode( ', ', array_slice( $elements, $offset, $length ) ) . ')';
$offset += $length;
}
return '( ' . implode( ' OR ', $nodeParts ) . ' )';
}
else
}
This allows us to reduce redundancies, because at the moment this piece of code is inserted as needed.