N°1213 - Allow NOT IN SELECT in OQL syntax

This commit is contained in:
Eric
2019-12-03 09:07:54 +01:00
parent 7845cbcc55
commit c0ae983faa
9 changed files with 467 additions and 466 deletions

View File

@@ -337,7 +337,7 @@ class DBObjectSearch extends DBSearch
$this->m_aParams = array_merge($this->m_aParams, $oFilter->m_aParams);
}
protected function RenameParam($sOldName, $sNewName)
public function RenameParam($sOldName, $sNewName)
{
$this->m_oSearchCondition->RenameParam($sOldName, $sNewName);
foreach($this->m_aPointingTo as $sExtKeyAttCode=>$aPointingTo)
@@ -1518,6 +1518,10 @@ class DBObjectSearch extends DBSearch
{
return new IntervalExpression($oExpression->GetValue(), $oExpression->GetUnit());
}
elseif ($oExpression instanceof NestedQueryOqlExpression)
{
return NestedQueryExpression::FromOQLObjectQuery($oExpression->GetOQLObjectQuery());
}
else
{
throw new CoreException('Unknown expression type', array('class'=>get_class($oExpression), 'query'=>$sQuery));

View File

@@ -119,13 +119,14 @@ abstract class Expression
abstract public function ToJSON(&$aArgs = null, $bRetrofitParams = false);
/**
* @param DBObjectSearch $oSearch
* @param DBSearch $oSearch
* @param array $aArgs
* @param AttributeDefinition $oAttDef
*
* @param array $aCtx
*
* @return array parameters for the search form
* @throws \MissingQueryArgument
*/
public function Display($oSearch, &$aArgs = null, $oAttDef = null, &$aCtx = array())
{
@@ -252,10 +253,6 @@ abstract class Expression
);
}
public function GetCriteria()
{
return $this;
}
/**
* Split binary expression on given operator
*
@@ -1893,6 +1890,7 @@ class ListExpression extends Expression
class NestedQueryExpression extends Expression
{
/** @var DBSearch */
protected $m_oNestedQuery;
/*$m_oNestedQuery is an DBSearch object*/
@@ -1900,10 +1898,16 @@ class NestedQueryExpression extends Expression
{
$this->m_oNestedQuery = $oNestedQuery;
}
public static function FromOQLObjectQuery($oObjQuery)//$oNestedQuery as OQLObjectQuery
/**
* @param OQLObjectQuery $oObjQuery
*
* @return \NestedQueryExpression
*/
public static function FromOQLObjectQuery($oObjQuery)
{
$aExpressions = $oObjQuery->ToDBSearch("");
return new NestedQueryExpression($aExpressions);
$oExpressions = $oObjQuery->ToDBSearch("");
return new NestedQueryExpression($oExpressions);
}
public function IsTrue()
@@ -1917,14 +1921,28 @@ class NestedQueryExpression extends Expression
}
// recursive rendering
/*TODO modif en cours*/
/**
* @param bool $bForSQL
* @param null $aArgs
* @param bool $bRetrofitParams
*
* @return array|string
* @throws \CoreException
* @throws \MissingQueryArgument
*/
public function RenderExpression($bForSQL = false, &$aArgs = null, $bRetrofitParams = false)
{
if ($bForSQL)
{
return '('.$this->m_oNestedQuery->GetRootFilter()->MakeSelectQuery().')';
$aAttToLoad = array();
foreach ($this->m_oNestedQuery->GetSelectedClasses() as $sClassAlias => $sClass)
{
$aAttToLoad[$sClassAlias] = array();
}
return '('.$this->m_oNestedQuery->MakeSelectQuery(array(), $aArgs, $aAttToLoad).')';
}
else{
else
{
return '('.$this->m_oNestedQuery->ToOQL(false, null, false).')';
}
}
@@ -1932,10 +1950,6 @@ class NestedQueryExpression extends Expression
public function Browse(Closure $callback)
{
$callback($this);
foreach ($this->m_oCondition as $oExpr)
{
$oExpr->Browse($callback);
}
}
/**/
public function ApplyParameters($aArgs)
@@ -1945,15 +1959,15 @@ class NestedQueryExpression extends Expression
/**/
public function GetUnresolvedFields($sAlias, &$aUnresolved)
{
$this->m_oNestedQuery->m_oQBExpressions->GetUnresolvedFields($sAlias, $aUnresolved);
}
/**/
public function Translate($aTranslationData, $bMatchAll = true, $bMarkFieldsAsResolved = true)
{
// Check and prepare the select information
$this->m_oNestedQuery->m_oQBExpressions-> Translate($aTranslationData, $bMatchAll , $bMarkFieldsAsResolved );
$oExpression = $this->m_oNestedQuery->GetCriteria()->Translate($aTranslationData, $bMatchAll , $bMarkFieldsAsResolved );
$this->m_oNestedQuery->ResetCondition();
$this->m_oNestedQuery->AddConditionExpression($oExpression);
return clone $this;
}
/*TODO*/
public function ListRequiredFields()
@@ -1985,14 +1999,16 @@ class NestedQueryExpression extends Expression
{
$this->m_oNestedQuery->RenameAlias($sOldName, $sNewName);
}
/*TODO return QueryBuiderContext*/
public function GetCriteria()
/**
* @inheritDoc
*/
public function ToJSON(&$aArgs = null, $bRetrofitParams = false)
{
//transform oNestedQuery to object QueryBuilderContext
$queryBuilderContext=new QueryBuilderContext($this->m_oNestedQuery, null, null, null, null);
return new NestedQueryExpression($queryBuilderContext);
// TODO: Implement ToJSON() method.
}
}
class FunctionExpression extends Expression
{
protected $m_sVerb;

View File

@@ -186,9 +186,9 @@ class OQLParserRaw#line 102 "..\oql-parser.php"
const F_FLOOR = 73;
const F_INET_ATON = 74;
const F_INET_NTOA = 75;
const YY_NO_ACTION = 296;
const YY_ACCEPT_ACTION = 295;
const YY_ERROR_ACTION = 294;
const YY_NO_ACTION = 299;
const YY_ACCEPT_ACTION = 298;
const YY_ERROR_ACTION = 297;
/* Next are that tables used to determine what action to take based on the
** current state and lookahead token. These tables are used to implement
@@ -240,145 +240,155 @@ class OQLParserRaw#line 102 "..\oql-parser.php"
** shifting non-terminals after a reduce.
** self::$yy_default Default action for each state.
*/
const YY_SZ_ACTTAB = 540;
const YY_SZ_ACTTAB = 584;
static public $yy_action = array(
/* 0 */ 21, 152, 138, 46, 180, 180, 45, 41, 70, 62,
/* 10 */ 41, 139, 140, 133, 127, 124, 7, 48, 123, 125,
/* 20 */ 65, 37, 164, 162, 155, 104, 4, 107, 106, 101,
/* 30 */ 61, 110, 111, 78, 117, 109, 116, 102, 103, 63,
/* 40 */ 28, 27, 26, 25, 24, 23, 22, 19, 20, 30,
/* 50 */ 105, 93, 57, 106, 112, 113, 114, 115, 134, 118,
/* 60 */ 135, 154, 156, 157, 158, 159, 160, 161, 165, 166,
/* 70 */ 167, 168, 169, 163, 7, 59, 5, 128, 11, 93,
/* 80 */ 164, 162, 155, 104, 10, 107, 106, 101, 61, 110,
/* 90 */ 111, 130, 131, 153, 145, 7, 120, 67, 3, 141,
/* 100 */ 142, 164, 162, 155, 104, 93, 107, 106, 101, 61,
/* 110 */ 110, 111, 112, 113, 114, 115, 134, 118, 135, 154,
/* 120 */ 156, 157, 158, 159, 160, 161, 165, 166, 167, 168,
/* 130 */ 169, 163, 132, 112, 113, 114, 115, 134, 118, 135,
/* 140 */ 154, 156, 157, 158, 159, 160, 161, 165, 166, 167,
/* 150 */ 168, 169, 163, 51, 52, 47, 40, 40, 295, 99,
/* 160 */ 66, 170, 62, 8, 126, 9, 77, 13, 124, 33,
/* 170 */ 49, 123, 125, 65, 38, 44, 62, 17, 129, 14,
/* 180 */ 75, 36, 82, 128, 108, 93, 235, 117, 109, 116,
/* 190 */ 102, 103, 63, 62, 91, 1, 64, 130, 131, 124,
/* 200 */ 31, 49, 123, 125, 65, 58, 63, 62, 17, 62,
/* 210 */ 14, 39, 36, 88, 90, 56, 94, 54, 117, 109,
/* 220 */ 116, 102, 103, 63, 122, 62, 93, 43, 41, 21,
/* 230 */ 73, 124, 33, 49, 123, 125, 65, 63, 121, 63,
/* 240 */ 17, 62, 14, 62, 36, 55, 85, 56, 6, 80,
/* 250 */ 117, 109, 116, 102, 103, 63, 243, 93, 42, 62,
/* 260 */ 93, 92, 72, 12, 40, 124, 34, 49, 123, 125,
/* 270 */ 65, 63, 53, 63, 17, 40, 14, 2, 36, 76,
/* 280 */ 50, 60, 243, 40, 117, 109, 116, 102, 103, 63,
/* 290 */ 62, 119, 243, 74, 243, 243, 124, 31, 49, 123,
/* 300 */ 125, 65, 243, 243, 62, 17, 62, 14, 8, 36,
/* 310 */ 87, 243, 98, 68, 243, 117, 109, 116, 102, 103,
/* 320 */ 63, 243, 62, 129, 243, 243, 243, 243, 124, 32,
/* 330 */ 49, 123, 125, 65, 63, 243, 63, 17, 243, 14,
/* 340 */ 243, 36, 243, 243, 243, 243, 243, 117, 109, 116,
/* 350 */ 102, 103, 63, 243, 243, 243, 62, 243, 243, 243,
/* 360 */ 243, 243, 124, 29, 49, 123, 125, 65, 243, 243,
/* 370 */ 62, 17, 243, 14, 243, 36, 83, 243, 243, 243,
/* 380 */ 243, 117, 109, 116, 102, 103, 63, 62, 243, 243,
/* 390 */ 243, 243, 243, 124, 16, 49, 123, 125, 65, 243,
/* 400 */ 63, 62, 17, 243, 14, 243, 36, 84, 243, 243,
/* 410 */ 243, 243, 117, 109, 116, 102, 103, 63, 243, 62,
/* 420 */ 243, 243, 243, 243, 243, 124, 243, 49, 123, 125,
/* 430 */ 65, 63, 243, 243, 17, 243, 14, 243, 35, 243,
/* 440 */ 243, 243, 243, 243, 117, 109, 116, 102, 103, 63,
/* 450 */ 243, 243, 243, 62, 243, 243, 243, 243, 243, 124,
/* 460 */ 243, 49, 123, 125, 65, 243, 243, 243, 17, 243,
/* 470 */ 15, 71, 79, 89, 97, 96, 95, 243, 117, 109,
/* 480 */ 116, 102, 103, 63, 62, 243, 243, 243, 128, 243,
/* 490 */ 124, 243, 49, 123, 125, 65, 243, 243, 62, 18,
/* 500 */ 137, 62, 130, 131, 81, 243, 243, 69, 243, 117,
/* 510 */ 109, 116, 102, 103, 63, 243, 243, 243, 243, 243,
/* 520 */ 243, 243, 243, 147, 243, 243, 143, 144, 63, 243,
/* 530 */ 243, 63, 146, 148, 149, 150, 151, 136, 100, 86,
/* 0 */ 25, 154, 140, 38, 182, 182, 9, 41, 46, 65,
/* 10 */ 45, 141, 142, 13, 41, 126, 6, 48, 125, 127,
/* 20 */ 67, 73, 166, 164, 157, 106, 2, 109, 108, 103,
/* 30 */ 63, 112, 113, 108, 119, 111, 118, 104, 105, 68,
/* 40 */ 26, 24, 20, 21, 28, 22, 19, 27, 23, 30,
/* 50 */ 44, 43, 60, 4, 114, 115, 116, 117, 136, 120,
/* 60 */ 137, 156, 158, 159, 160, 161, 162, 163, 167, 168,
/* 70 */ 169, 170, 171, 165, 6, 42, 5, 130, 11, 82,
/* 80 */ 166, 164, 157, 106, 10, 109, 108, 103, 63, 112,
/* 90 */ 113, 132, 133, 155, 147, 6, 122, 66, 76, 101,
/* 100 */ 143, 166, 164, 157, 106, 82, 109, 108, 103, 63,
/* 110 */ 112, 113, 114, 115, 116, 117, 136, 120, 137, 156,
/* 120 */ 158, 159, 160, 161, 162, 163, 167, 168, 169, 170,
/* 130 */ 171, 165, 79, 114, 115, 116, 117, 136, 120, 137,
/* 140 */ 156, 158, 159, 160, 161, 162, 163, 167, 168, 169,
/* 150 */ 170, 171, 165, 54, 135, 129, 40, 81, 298, 100,
/* 160 */ 62, 172, 65, 128, 71, 110, 39, 40, 126, 34,
/* 170 */ 49, 125, 127, 67, 12, 55, 57, 17, 40, 14,
/* 180 */ 8, 36, 130, 90, 50, 238, 123, 119, 111, 118,
/* 190 */ 104, 105, 68, 65, 89, 131, 132, 133, 64, 126,
/* 200 */ 31, 49, 125, 127, 67, 58, 82, 25, 17, 65,
/* 210 */ 14, 7, 36, 134, 80, 56, 97, 75, 119, 111,
/* 220 */ 118, 104, 105, 68, 61, 77, 65, 47, 82, 8,
/* 230 */ 37, 41, 126, 33, 49, 125, 127, 67, 1, 68,
/* 240 */ 107, 17, 51, 14, 131, 36, 53, 82, 59, 40,
/* 250 */ 72, 119, 111, 118, 104, 105, 68, 82, 124, 65,
/* 260 */ 82, 3, 244, 244, 74, 126, 34, 49, 125, 127,
/* 270 */ 67, 244, 244, 65, 17, 121, 14, 244, 36, 98,
/* 280 */ 52, 244, 244, 40, 119, 111, 118, 104, 105, 68,
/* 290 */ 65, 244, 244, 244, 244, 244, 126, 31, 49, 125,
/* 300 */ 127, 67, 244, 68, 244, 17, 65, 14, 244, 36,
/* 310 */ 244, 88, 56, 87, 244, 119, 111, 118, 104, 105,
/* 320 */ 68, 244, 244, 65, 244, 244, 244, 244, 244, 126,
/* 330 */ 29, 49, 125, 127, 67, 244, 68, 244, 17, 244,
/* 340 */ 14, 244, 36, 244, 244, 244, 244, 244, 119, 111,
/* 350 */ 118, 104, 105, 68, 244, 244, 65, 244, 244, 244,
/* 360 */ 244, 244, 126, 32, 49, 125, 127, 67, 244, 244,
/* 370 */ 65, 17, 244, 14, 244, 36, 70, 244, 244, 244,
/* 380 */ 244, 119, 111, 118, 104, 105, 68, 65, 244, 244,
/* 390 */ 244, 244, 244, 126, 16, 49, 125, 127, 67, 244,
/* 400 */ 68, 244, 17, 244, 14, 244, 36, 244, 244, 244,
/* 410 */ 244, 244, 119, 111, 118, 104, 105, 68, 244, 244,
/* 420 */ 65, 244, 244, 244, 244, 244, 126, 244, 49, 125,
/* 430 */ 127, 67, 244, 244, 244, 17, 244, 14, 244, 35,
/* 440 */ 244, 244, 244, 244, 244, 119, 111, 118, 104, 105,
/* 450 */ 68, 244, 244, 65, 244, 244, 244, 244, 244, 126,
/* 460 */ 244, 49, 125, 127, 67, 244, 244, 244, 17, 244,
/* 470 */ 15, 91, 92, 93, 94, 95, 96, 244, 119, 111,
/* 480 */ 118, 104, 105, 68, 65, 244, 244, 244, 130, 244,
/* 490 */ 126, 244, 49, 125, 127, 67, 244, 244, 65, 18,
/* 500 */ 145, 244, 132, 133, 78, 244, 244, 244, 244, 119,
/* 510 */ 111, 118, 104, 105, 68, 244, 244, 244, 244, 65,
/* 520 */ 244, 244, 244, 148, 244, 69, 144, 139, 68, 244,
/* 530 */ 244, 244, 146, 149, 150, 151, 152, 153, 138, 102,
/* 540 */ 244, 65, 244, 244, 65, 65, 65, 83, 244, 68,
/* 550 */ 86, 84, 85, 65, 244, 244, 244, 244, 244, 99,
/* 560 */ 244, 244, 244, 244, 244, 244, 244, 244, 244, 244,
/* 570 */ 244, 68, 244, 244, 68, 68, 68, 244, 244, 244,
/* 580 */ 244, 244, 244, 68,
);
static public $yy_lookahead = array(
/* 0 */ 2, 39, 40, 3, 4, 5, 3, 7, 83, 81,
/* 10 */ 7, 49, 50, 54, 55, 87, 18, 89, 90, 91,
/* 20 */ 92, 81, 24, 25, 26, 27, 6, 29, 30, 31,
/* 30 */ 32, 33, 34, 83, 106, 107, 108, 109, 110, 111,
/* 0 */ 2, 39, 40, 3, 4, 5, 101, 7, 3, 81,
/* 10 */ 3, 49, 50, 8, 7, 87, 18, 89, 90, 91,
/* 20 */ 92, 116, 24, 25, 26, 27, 18, 29, 30, 31,
/* 30 */ 32, 33, 34, 30, 106, 107, 108, 109, 110, 111,
/* 40 */ 9, 10, 11, 12, 13, 14, 15, 16, 17, 81,
/* 50 */ 111, 111, 84, 30, 56, 57, 58, 59, 60, 61,
/* 50 */ 4, 5, 84, 6, 56, 57, 58, 59, 60, 61,
/* 60 */ 62, 63, 64, 65, 66, 67, 68, 69, 70, 71,
/* 70 */ 72, 73, 74, 75, 18, 81, 20, 38, 97, 111,
/* 80 */ 24, 25, 26, 27, 99, 29, 30, 31, 32, 33,
/* 90 */ 34, 52, 53, 112, 113, 18, 78, 79, 18, 114,
/* 90 */ 34, 52, 53, 112, 113, 18, 78, 79, 83, 114,
/* 100 */ 115, 24, 25, 26, 27, 111, 29, 30, 31, 32,
/* 110 */ 33, 34, 56, 57, 58, 59, 60, 61, 62, 63,
/* 120 */ 64, 65, 66, 67, 68, 69, 70, 71, 72, 73,
/* 130 */ 74, 75, 95, 56, 57, 58, 59, 60, 61, 62,
/* 130 */ 74, 75, 83, 56, 57, 58, 59, 60, 61, 62,
/* 140 */ 63, 64, 65, 66, 67, 68, 69, 70, 71, 72,
/* 150 */ 73, 74, 75, 82, 82, 81, 85, 85, 77, 78,
/* 160 */ 79, 80, 81, 102, 19, 101, 105, 8, 87, 88,
/* 170 */ 89, 90, 91, 92, 4, 5, 81, 96, 117, 98,
/* 180 */ 116, 100, 87, 38, 31, 111, 28, 106, 107, 108,
/* 190 */ 109, 110, 111, 81, 83, 18, 81, 52, 53, 87,
/* 200 */ 88, 89, 90, 91, 92, 93, 111, 81, 96, 81,
/* 210 */ 98, 1, 100, 87, 86, 87, 104, 28, 106, 107,
/* 220 */ 108, 109, 110, 111, 80, 81, 111, 81, 7, 2,
/* 230 */ 81, 87, 88, 89, 90, 91, 92, 111, 83, 111,
/* 240 */ 96, 81, 98, 81, 100, 94, 86, 87, 5, 87,
/* 250 */ 106, 107, 108, 109, 110, 111, 118, 111, 3, 81,
/* 260 */ 111, 82, 19, 8, 85, 87, 88, 89, 90, 91,
/* 270 */ 92, 111, 82, 111, 96, 85, 98, 5, 100, 37,
/* 280 */ 82, 103, 118, 85, 106, 107, 108, 109, 110, 111,
/* 290 */ 81, 19, 118, 51, 118, 118, 87, 88, 89, 90,
/* 300 */ 91, 92, 118, 118, 81, 96, 81, 98, 102, 100,
/* 310 */ 87, 118, 87, 104, 118, 106, 107, 108, 109, 110,
/* 320 */ 111, 118, 81, 117, 118, 118, 118, 118, 87, 88,
/* 330 */ 89, 90, 91, 92, 111, 118, 111, 96, 118, 98,
/* 340 */ 118, 100, 118, 118, 118, 118, 118, 106, 107, 108,
/* 350 */ 109, 110, 111, 118, 118, 118, 81, 118, 118, 118,
/* 150 */ 73, 74, 75, 82, 54, 55, 85, 19, 77, 78,
/* 160 */ 79, 80, 81, 19, 82, 31, 1, 85, 87, 88,
/* 170 */ 89, 90, 91, 92, 8, 82, 81, 96, 85, 98,
/* 180 */ 102, 100, 38, 105, 28, 28, 83, 106, 107, 108,
/* 190 */ 109, 110, 111, 81, 83, 117, 52, 53, 81, 87,
/* 200 */ 88, 89, 90, 91, 92, 93, 111, 2, 96, 81,
/* 210 */ 98, 5, 100, 95, 86, 87, 104, 81, 106, 107,
/* 220 */ 108, 109, 110, 111, 79, 19, 81, 81, 111, 102,
/* 230 */ 81, 7, 87, 88, 89, 90, 91, 92, 18, 111,
/* 240 */ 111, 96, 94, 98, 117, 100, 82, 111, 103, 85,
/* 250 */ 37, 106, 107, 108, 109, 110, 111, 111, 80, 81,
/* 260 */ 111, 5, 118, 118, 51, 87, 88, 89, 90, 91,
/* 270 */ 92, 118, 118, 81, 96, 19, 98, 118, 100, 87,
/* 280 */ 82, 118, 118, 85, 106, 107, 108, 109, 110, 111,
/* 290 */ 81, 118, 118, 118, 118, 118, 87, 88, 89, 90,
/* 300 */ 91, 92, 118, 111, 118, 96, 81, 98, 118, 100,
/* 310 */ 118, 86, 87, 104, 118, 106, 107, 108, 109, 110,
/* 320 */ 111, 118, 118, 81, 118, 118, 118, 118, 118, 87,
/* 330 */ 88, 89, 90, 91, 92, 118, 111, 118, 96, 118,
/* 340 */ 98, 118, 100, 118, 118, 118, 118, 118, 106, 107,
/* 350 */ 108, 109, 110, 111, 118, 118, 81, 118, 118, 118,
/* 360 */ 118, 118, 87, 88, 89, 90, 91, 92, 118, 118,
/* 370 */ 81, 96, 118, 98, 118, 100, 87, 118, 118, 118,
/* 380 */ 118, 106, 107, 108, 109, 110, 111, 81, 118, 118,
/* 390 */ 118, 118, 118, 87, 88, 89, 90, 91, 92, 118,
/* 400 */ 111, 81, 96, 118, 98, 118, 100, 87, 118, 118,
/* 410 */ 118, 118, 106, 107, 108, 109, 110, 111, 118, 81,
/* 420 */ 118, 118, 118, 118, 118, 87, 118, 89, 90, 91,
/* 430 */ 92, 111, 118, 118, 96, 118, 98, 118, 100, 118,
/* 440 */ 118, 118, 118, 118, 106, 107, 108, 109, 110, 111,
/* 450 */ 118, 118, 118, 81, 118, 118, 118, 118, 118, 87,
/* 400 */ 111, 118, 96, 118, 98, 118, 100, 118, 118, 118,
/* 410 */ 118, 118, 106, 107, 108, 109, 110, 111, 118, 118,
/* 420 */ 81, 118, 118, 118, 118, 118, 87, 118, 89, 90,
/* 430 */ 91, 92, 118, 118, 118, 96, 118, 98, 118, 100,
/* 440 */ 118, 118, 118, 118, 118, 106, 107, 108, 109, 110,
/* 450 */ 111, 118, 118, 81, 118, 118, 118, 118, 118, 87,
/* 460 */ 118, 89, 90, 91, 92, 118, 118, 118, 96, 118,
/* 470 */ 98, 21, 22, 23, 24, 25, 26, 118, 106, 107,
/* 480 */ 108, 109, 110, 111, 81, 118, 118, 118, 38, 118,
/* 490 */ 87, 118, 89, 90, 91, 92, 118, 118, 81, 96,
/* 500 */ 9, 81, 52, 53, 87, 118, 118, 87, 118, 106,
/* 510 */ 107, 108, 109, 110, 111, 118, 118, 118, 118, 118,
/* 520 */ 118, 118, 118, 32, 118, 118, 35, 36, 111, 118,
/* 530 */ 118, 111, 41, 42, 43, 44, 45, 46, 47, 48,
/* 500 */ 9, 118, 52, 53, 87, 118, 118, 118, 118, 106,
/* 510 */ 107, 108, 109, 110, 111, 118, 118, 118, 118, 81,
/* 520 */ 118, 118, 118, 32, 118, 87, 35, 36, 111, 118,
/* 530 */ 118, 118, 41, 42, 43, 44, 45, 46, 47, 48,
/* 540 */ 118, 81, 118, 118, 81, 81, 81, 87, 118, 111,
/* 550 */ 87, 87, 87, 81, 118, 118, 118, 118, 118, 87,
/* 560 */ 118, 118, 118, 118, 118, 118, 118, 118, 118, 118,
/* 570 */ 118, 111, 118, 118, 111, 111, 111, 118, 118, 118,
/* 580 */ 118, 118, 118, 111,
);
const YY_SHIFT_USE_DFLT = -42;
const YY_SHIFT_MAX = 67;
const YY_SHIFT_USE_DFLT = -39;
const YY_SHIFT_MAX = 68;
static public $yy_shift_ofst = array(
/* 0 */ -2, 56, 56, 77, 77, 77, 77, 77, 77, 77,
/* 10 */ 77, 77, 23, 23, 491, 491, 450, -38, -38, 23,
/* 20 */ 23, 23, 23, 23, 23, 23, 23, 23, 23, 145,
/* 30 */ 0, 39, 39, 39, 39, 242, 242, 3, 23, 227,
/* 40 */ 221, 23, 23, 221, 23, 23, 23, 221, -41, -41,
/* 50 */ 20, 20, 20, 20, 23, 80, 31, 170, 272, 255,
/* 60 */ 243, 153, 189, 158, 159, 177, 210, 210,
/* 0 */ -2, -2, 56, 56, 77, 77, 77, 77, 77, 77,
/* 10 */ 77, 77, 3, 3, 491, 491, 450, -38, -38, 3,
/* 20 */ 3, 3, 3, 3, 3, 3, 3, 3, 3, 144,
/* 30 */ 0, 39, 39, 39, 39, 213, 213, 7, 3, 205,
/* 40 */ 224, 3, 224, 3, 3, 3, 3, 224, 100, 100,
/* 50 */ 3, 220, 47, 47, 47, 47, 31, 5, 256, 206,
/* 60 */ 46, 138, 165, 134, 166, 156, 165, 8, 157,
);
const YY_REDUCE_USE_DFLT = -76;
const YY_REDUCE_USE_DFLT = -96;
const YY_REDUCE_MAX = 55;
static public $yy_reduce_ofst = array(
/* 0 */ 81, 112, 209, 178, 144, 306, 241, 275, 338, 372,
/* 10 */ 403, -72, 160, 128, -15, -15, 61, -19, -19, 417,
/* 20 */ 420, -32, 95, 289, 320, 225, 223, 162, 126, 206,
/* 30 */ 198, 206, 206, 206, 206, 64, 64, 71, -60, 18,
/* 40 */ 179, -6, 115, 190, 149, 74, 146, 72, 151, 151,
/* 50 */ 155, 111, -75, -50, -61, 37,
/* 0 */ 81, 145, 112, 209, 178, 306, 242, 275, 339, 372,
/* 10 */ 403, -72, 225, 128, -15, -15, 78, -19, -19, 464,
/* 20 */ 465, 472, 463, 460, 438, -32, 417, 289, 192, 127,
/* 30 */ 198, 127, 127, 127, 127, -95, -95, 71, -6, 18,
/* 40 */ 82, 95, 93, 136, 149, 146, 117, 164, 148, 148,
/* 50 */ 129, 118, 103, 15, 49, 111,
);
static public $yyExpectedTokens = array(
/* 0 */ array(2, 18, 24, 25, 26, 27, 29, 30, 31, 32, 33, 34, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, ),
/* 1 */ array(18, 20, 24, 25, 26, 27, 29, 30, 31, 32, 33, 34, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, ),
/* 1 */ array(2, 18, 24, 25, 26, 27, 29, 30, 31, 32, 33, 34, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, ),
/* 2 */ array(18, 20, 24, 25, 26, 27, 29, 30, 31, 32, 33, 34, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, ),
/* 3 */ array(18, 24, 25, 26, 27, 29, 30, 31, 32, 33, 34, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, ),
/* 3 */ array(18, 20, 24, 25, 26, 27, 29, 30, 31, 32, 33, 34, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, ),
/* 4 */ array(18, 24, 25, 26, 27, 29, 30, 31, 32, 33, 34, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, ),
/* 5 */ array(18, 24, 25, 26, 27, 29, 30, 31, 32, 33, 34, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, ),
/* 6 */ array(18, 24, 25, 26, 27, 29, 30, 31, 32, 33, 34, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, ),
@@ -417,33 +427,33 @@ static public $yy_action = array(
/* 39 */ array(2, ),
/* 40 */ array(7, ),
/* 41 */ array(30, ),
/* 42 */ array(30, ),
/* 43 */ array(7, ),
/* 42 */ array(7, ),
/* 43 */ array(30, ),
/* 44 */ array(30, ),
/* 45 */ array(30, ),
/* 46 */ array(30, ),
/* 47 */ array(7, ),
/* 48 */ array(54, 55, ),
/* 49 */ array(54, 55, ),
/* 50 */ array(6, ),
/* 51 */ array(6, ),
/* 50 */ array(30, ),
/* 51 */ array(18, ),
/* 52 */ array(6, ),
/* 53 */ array(6, ),
/* 54 */ array(30, ),
/* 55 */ array(18, ),
/* 54 */ array(6, ),
/* 55 */ array(6, ),
/* 56 */ array(9, 10, 11, 12, 13, 14, 15, 16, 17, ),
/* 57 */ array(4, 5, ),
/* 57 */ array(3, 8, ),
/* 58 */ array(5, 19, ),
/* 59 */ array(3, 8, ),
/* 60 */ array(5, 19, ),
/* 61 */ array(31, ),
/* 62 */ array(28, ),
/* 63 */ array(28, ),
/* 59 */ array(5, 19, ),
/* 60 */ array(4, 5, ),
/* 61 */ array(19, ),
/* 62 */ array(1, ),
/* 63 */ array(31, ),
/* 64 */ array(8, ),
/* 65 */ array(18, ),
/* 65 */ array(28, ),
/* 66 */ array(1, ),
/* 67 */ array(1, ),
/* 68 */ array(),
/* 67 */ array(18, ),
/* 68 */ array(28, ),
/* 69 */ array(),
/* 70 */ array(),
/* 71 */ array(),
@@ -546,26 +556,28 @@ static public $yy_action = array(
/* 168 */ array(),
/* 169 */ array(),
/* 170 */ array(),
/* 171 */ array(),
/* 172 */ array(),
);
static public $yy_default = array(
/* 0 */ 294, 216, 294, 294, 294, 294, 294, 294, 294, 294,
/* 10 */ 294, 294, 294, 294, 209, 210, 294, 207, 208, 294,
/* 20 */ 294, 294, 294, 294, 294, 294, 294, 294, 294, 294,
/* 30 */ 186, 219, 215, 198, 214, 212, 211, 186, 294, 294,
/* 40 */ 185, 294, 294, 186, 294, 294, 294, 186, 206, 205,
/* 50 */ 183, 183, 183, 183, 294, 294, 294, 294, 294, 294,
/* 60 */ 294, 294, 294, 233, 294, 294, 172, 174, 218, 197,
/* 70 */ 179, 221, 213, 181, 266, 250, 249, 220, 177, 222,
/* 80 */ 190, 196, 195, 194, 193, 188, 263, 191, 189, 223,
/* 90 */ 187, 178, 184, 235, 217, 226, 225, 224, 192, 171,
/* 100 */ 262, 238, 230, 231, 232, 234, 237, 236, 239, 228,
/* 110 */ 240, 241, 271, 272, 273, 274, 229, 227, 276, 202,
/* 120 */ 175, 176, 182, 199, 200, 201, 203, 270, 251, 252,
/* 130 */ 267, 268, 204, 269, 275, 277, 261, 247, 254, 264,
/* 140 */ 265, 244, 245, 246, 248, 243, 255, 256, 257, 258,
/* 150 */ 259, 260, 253, 242, 278, 285, 279, 280, 281, 282,
/* 160 */ 283, 284, 286, 293, 287, 288, 289, 290, 291, 292,
/* 170 */ 173,
/* 0 */ 297, 297, 219, 297, 297, 297, 297, 297, 297, 297,
/* 10 */ 297, 297, 297, 297, 211, 212, 297, 209, 210, 297,
/* 20 */ 297, 297, 297, 297, 297, 297, 297, 297, 297, 297,
/* 30 */ 188, 222, 218, 217, 200, 214, 213, 188, 297, 297,
/* 40 */ 187, 297, 188, 297, 297, 297, 297, 188, 208, 207,
/* 50 */ 297, 297, 185, 185, 185, 185, 297, 297, 297, 297,
/* 60 */ 297, 297, 174, 297, 297, 297, 176, 297, 236, 192,
/* 70 */ 198, 186, 252, 253, 269, 183, 181, 215, 191, 180,
/* 80 */ 190, 216, 238, 199, 197, 193, 196, 221, 189, 179,
/* 90 */ 223, 224, 225, 226, 227, 228, 229, 220, 195, 194,
/* 100 */ 173, 247, 266, 241, 233, 234, 235, 237, 240, 239,
/* 110 */ 242, 231, 243, 244, 274, 275, 276, 277, 232, 230,
/* 120 */ 279, 204, 177, 178, 184, 201, 202, 203, 205, 273,
/* 130 */ 254, 255, 270, 271, 206, 272, 278, 280, 265, 251,
/* 140 */ 257, 267, 268, 248, 249, 250, 258, 246, 259, 260,
/* 150 */ 261, 262, 263, 264, 256, 245, 281, 288, 282, 283,
/* 160 */ 284, 285, 286, 287, 289, 296, 290, 291, 292, 293,
/* 170 */ 294, 295, 175,
);
/* The next thing included is series of defines which control
** various aspects of the generated parser.
@@ -584,8 +596,8 @@ static public $yy_action = array(
*/
const YYNOCODE = 119;
const YYSTACKDEPTH = 100;
const YYNSTATE = 171;
const YYNRULE = 123;
const YYNSTATE = 173;
const YYNRULE = 124;
const YYERRORSYMBOL = 76;
const YYERRSYMDT = 'yy0';
const YYFALLBACK = 0;
@@ -748,86 +760,87 @@ static public $yy_action = array(
/* 40 */ "expression_prio4 ::= expression_prio3",
/* 41 */ "expression_prio4 ::= expression_prio4 operator4 expression_prio3",
/* 42 */ "list ::= PAR_OPEN list_items PAR_CLOSE",
/* 43 */ "list_items ::= expression_prio4",
/* 44 */ "list_items ::= list_items COMA expression_prio4",
/* 45 */ "arg_list ::=",
/* 46 */ "arg_list ::= argument",
/* 47 */ "arg_list ::= arg_list COMA argument",
/* 48 */ "argument ::= expression_prio4",
/* 49 */ "argument ::= INTERVAL expression_prio4 interval_unit",
/* 50 */ "interval_unit ::= F_SECOND",
/* 51 */ "interval_unit ::= F_MINUTE",
/* 52 */ "interval_unit ::= F_HOUR",
/* 53 */ "interval_unit ::= F_DAY",
/* 54 */ "interval_unit ::= F_MONTH",
/* 55 */ "interval_unit ::= F_YEAR",
/* 56 */ "scalar ::= num_scalar",
/* 57 */ "scalar ::= str_scalar",
/* 58 */ "scalar ::= null_scalar",
/* 59 */ "num_scalar ::= num_value",
/* 60 */ "str_scalar ::= str_value",
/* 61 */ "null_scalar ::= NULL_VAL",
/* 62 */ "field_id ::= name",
/* 63 */ "field_id ::= class_name DOT name",
/* 64 */ "class_name ::= name",
/* 65 */ "var_name ::= VARNAME",
/* 66 */ "name ::= NAME",
/* 67 */ "num_value ::= NUMVAL",
/* 68 */ "num_value ::= MATH_MINUS NUMVAL",
/* 69 */ "num_value ::= HEXVAL",
/* 70 */ "str_value ::= STRVAL",
/* 71 */ "operator1 ::= num_operator1",
/* 72 */ "operator1 ::= bitwise_operator1",
/* 73 */ "operator2 ::= num_operator2",
/* 74 */ "operator2 ::= str_operator",
/* 75 */ "operator2 ::= REGEXP",
/* 76 */ "operator2 ::= EQ",
/* 77 */ "operator2 ::= NOT_EQ",
/* 78 */ "operator3 ::= LOG_AND",
/* 79 */ "operator3 ::= bitwise_operator3",
/* 80 */ "operator4 ::= LOG_OR",
/* 81 */ "operator4 ::= bitwise_operator4",
/* 82 */ "num_operator1 ::= MATH_DIV",
/* 83 */ "num_operator1 ::= MATH_MULT",
/* 84 */ "num_operator2 ::= MATH_PLUS",
/* 85 */ "num_operator2 ::= MATH_MINUS",
/* 86 */ "num_operator2 ::= GT",
/* 87 */ "num_operator2 ::= LT",
/* 88 */ "num_operator2 ::= GE",
/* 89 */ "num_operator2 ::= LE",
/* 90 */ "str_operator ::= LIKE",
/* 91 */ "str_operator ::= NOT_LIKE",
/* 92 */ "str_operator ::= MATCHES",
/* 93 */ "bitwise_operator1 ::= BITWISE_LEFT_SHIFT",
/* 94 */ "bitwise_operator1 ::= BITWISE_RIGHT_SHIFT",
/* 95 */ "bitwise_operator3 ::= BITWISE_AND",
/* 96 */ "bitwise_operator4 ::= BITWISE_OR",
/* 97 */ "bitwise_operator4 ::= BITWISE_XOR",
/* 98 */ "list_operator ::= IN",
/* 99 */ "list_operator ::= NOT_IN",
/* 100 */ "func_name ::= F_IF",
/* 101 */ "func_name ::= F_ELT",
/* 102 */ "func_name ::= F_COALESCE",
/* 103 */ "func_name ::= F_ISNULL",
/* 104 */ "func_name ::= F_CONCAT",
/* 105 */ "func_name ::= F_SUBSTR",
/* 106 */ "func_name ::= F_TRIM",
/* 107 */ "func_name ::= F_DATE",
/* 108 */ "func_name ::= F_DATE_FORMAT",
/* 109 */ "func_name ::= F_CURRENT_DATE",
/* 110 */ "func_name ::= F_NOW",
/* 111 */ "func_name ::= F_TIME",
/* 112 */ "func_name ::= F_TO_DAYS",
/* 113 */ "func_name ::= F_FROM_DAYS",
/* 114 */ "func_name ::= F_YEAR",
/* 115 */ "func_name ::= F_MONTH",
/* 116 */ "func_name ::= F_DAY",
/* 117 */ "func_name ::= F_DATE_ADD",
/* 118 */ "func_name ::= F_DATE_SUB",
/* 119 */ "func_name ::= F_ROUND",
/* 120 */ "func_name ::= F_FLOOR",
/* 121 */ "func_name ::= F_INET_ATON",
/* 122 */ "func_name ::= F_INET_NTOA",
/* 43 */ "list ::= PAR_OPEN query PAR_CLOSE",
/* 44 */ "list_items ::= expression_prio4",
/* 45 */ "list_items ::= list_items COMA expression_prio4",
/* 46 */ "arg_list ::=",
/* 47 */ "arg_list ::= argument",
/* 48 */ "arg_list ::= arg_list COMA argument",
/* 49 */ "argument ::= expression_prio4",
/* 50 */ "argument ::= INTERVAL expression_prio4 interval_unit",
/* 51 */ "interval_unit ::= F_SECOND",
/* 52 */ "interval_unit ::= F_MINUTE",
/* 53 */ "interval_unit ::= F_HOUR",
/* 54 */ "interval_unit ::= F_DAY",
/* 55 */ "interval_unit ::= F_MONTH",
/* 56 */ "interval_unit ::= F_YEAR",
/* 57 */ "scalar ::= num_scalar",
/* 58 */ "scalar ::= str_scalar",
/* 59 */ "scalar ::= null_scalar",
/* 60 */ "num_scalar ::= num_value",
/* 61 */ "str_scalar ::= str_value",
/* 62 */ "null_scalar ::= NULL_VAL",
/* 63 */ "field_id ::= name",
/* 64 */ "field_id ::= class_name DOT name",
/* 65 */ "class_name ::= name",
/* 66 */ "var_name ::= VARNAME",
/* 67 */ "name ::= NAME",
/* 68 */ "num_value ::= NUMVAL",
/* 69 */ "num_value ::= MATH_MINUS NUMVAL",
/* 70 */ "num_value ::= HEXVAL",
/* 71 */ "str_value ::= STRVAL",
/* 72 */ "operator1 ::= num_operator1",
/* 73 */ "operator1 ::= bitwise_operator1",
/* 74 */ "operator2 ::= num_operator2",
/* 75 */ "operator2 ::= str_operator",
/* 76 */ "operator2 ::= REGEXP",
/* 77 */ "operator2 ::= EQ",
/* 78 */ "operator2 ::= NOT_EQ",
/* 79 */ "operator3 ::= LOG_AND",
/* 80 */ "operator3 ::= bitwise_operator3",
/* 81 */ "operator4 ::= LOG_OR",
/* 82 */ "operator4 ::= bitwise_operator4",
/* 83 */ "num_operator1 ::= MATH_DIV",
/* 84 */ "num_operator1 ::= MATH_MULT",
/* 85 */ "num_operator2 ::= MATH_PLUS",
/* 86 */ "num_operator2 ::= MATH_MINUS",
/* 87 */ "num_operator2 ::= GT",
/* 88 */ "num_operator2 ::= LT",
/* 89 */ "num_operator2 ::= GE",
/* 90 */ "num_operator2 ::= LE",
/* 91 */ "str_operator ::= LIKE",
/* 92 */ "str_operator ::= NOT_LIKE",
/* 93 */ "str_operator ::= MATCHES",
/* 94 */ "bitwise_operator1 ::= BITWISE_LEFT_SHIFT",
/* 95 */ "bitwise_operator1 ::= BITWISE_RIGHT_SHIFT",
/* 96 */ "bitwise_operator3 ::= BITWISE_AND",
/* 97 */ "bitwise_operator4 ::= BITWISE_OR",
/* 98 */ "bitwise_operator4 ::= BITWISE_XOR",
/* 99 */ "list_operator ::= IN",
/* 100 */ "list_operator ::= NOT_IN",
/* 101 */ "func_name ::= F_IF",
/* 102 */ "func_name ::= F_ELT",
/* 103 */ "func_name ::= F_COALESCE",
/* 104 */ "func_name ::= F_ISNULL",
/* 105 */ "func_name ::= F_CONCAT",
/* 106 */ "func_name ::= F_SUBSTR",
/* 107 */ "func_name ::= F_TRIM",
/* 108 */ "func_name ::= F_DATE",
/* 109 */ "func_name ::= F_DATE_FORMAT",
/* 110 */ "func_name ::= F_CURRENT_DATE",
/* 111 */ "func_name ::= F_NOW",
/* 112 */ "func_name ::= F_TIME",
/* 113 */ "func_name ::= F_TO_DAYS",
/* 114 */ "func_name ::= F_FROM_DAYS",
/* 115 */ "func_name ::= F_YEAR",
/* 116 */ "func_name ::= F_MONTH",
/* 117 */ "func_name ::= F_DAY",
/* 118 */ "func_name ::= F_DATE_ADD",
/* 119 */ "func_name ::= F_DATE_SUB",
/* 120 */ "func_name ::= F_ROUND",
/* 121 */ "func_name ::= F_FLOOR",
/* 122 */ "func_name ::= F_INET_ATON",
/* 123 */ "func_name ::= F_INET_NTOA",
);
/**
@@ -1235,6 +1248,7 @@ static public $yy_action = array(
array( 'lhs' => 88, 'rhs' => 1 ),
array( 'lhs' => 88, 'rhs' => 3 ),
array( 'lhs' => 95, 'rhs' => 3 ),
array( 'lhs' => 95, 'rhs' => 3 ),
array( 'lhs' => 103, 'rhs' => 1 ),
array( 'lhs' => 103, 'rhs' => 3 ),
array( 'lhs' => 93, 'rhs' => 0 ),
@@ -1334,11 +1348,11 @@ static public $yy_action = array(
7 => 7,
8 => 8,
9 => 9,
43 => 9,
46 => 9,
44 => 9,
47 => 9,
10 => 10,
44 => 10,
47 => 10,
45 => 10,
48 => 10,
11 => 11,
12 => 12,
15 => 12,
@@ -1363,8 +1377,7 @@ static public $yy_action = array(
36 => 27,
38 => 27,
40 => 27,
48 => 27,
50 => 27,
49 => 27,
51 => 27,
52 => 27,
53 => 27,
@@ -1373,6 +1386,7 @@ static public $yy_action = array(
56 => 27,
57 => 27,
58 => 27,
59 => 27,
31 => 31,
32 => 32,
33 => 33,
@@ -1381,72 +1395,73 @@ static public $yy_action = array(
41 => 33,
37 => 37,
42 => 42,
45 => 45,
49 => 49,
59 => 59,
60 => 59,
61 => 61,
43 => 43,
46 => 46,
50 => 50,
60 => 60,
61 => 60,
62 => 62,
63 => 63,
64 => 64,
100 => 64,
101 => 64,
102 => 64,
103 => 64,
104 => 64,
105 => 64,
106 => 64,
107 => 64,
108 => 64,
109 => 64,
110 => 64,
111 => 64,
112 => 64,
113 => 64,
114 => 64,
115 => 64,
116 => 64,
117 => 64,
118 => 64,
119 => 64,
120 => 64,
121 => 64,
122 => 64,
65 => 65,
101 => 65,
102 => 65,
103 => 65,
104 => 65,
105 => 65,
106 => 65,
107 => 65,
108 => 65,
109 => 65,
110 => 65,
111 => 65,
112 => 65,
113 => 65,
114 => 65,
115 => 65,
116 => 65,
117 => 65,
118 => 65,
119 => 65,
120 => 65,
121 => 65,
122 => 65,
123 => 65,
66 => 66,
67 => 67,
68 => 68,
69 => 69,
70 => 70,
71 => 71,
72 => 71,
73 => 71,
74 => 71,
75 => 71,
76 => 71,
77 => 71,
78 => 71,
79 => 71,
80 => 71,
81 => 71,
82 => 71,
83 => 71,
84 => 71,
85 => 71,
86 => 71,
87 => 71,
88 => 71,
89 => 71,
90 => 71,
91 => 71,
92 => 71,
93 => 71,
94 => 71,
95 => 71,
96 => 71,
97 => 71,
98 => 71,
99 => 71,
72 => 72,
73 => 72,
74 => 72,
75 => 72,
76 => 72,
77 => 72,
78 => 72,
79 => 72,
80 => 72,
81 => 72,
82 => 72,
83 => 72,
84 => 72,
85 => 72,
86 => 72,
87 => 72,
88 => 72,
89 => 72,
90 => 72,
91 => 72,
92 => 72,
93 => 72,
94 => 72,
95 => 72,
96 => 72,
97 => 72,
98 => 72,
99 => 72,
100 => 72,
);
/* Beginning here are the reduction cases. A typical example
** follows:
@@ -1456,49 +1471,49 @@ static public $yy_action = array(
*/
#line 29 "..\oql-parser.y"
function yy_r0(){ $this->my_result = $this->yystack[$this->yyidx + 0]->minor; }
#line 1463 "..\oql-parser.php"
#line 1478 "..\oql-parser.php"
#line 33 "..\oql-parser.y"
function yy_r3(){
$this->_retvalue = new OqlUnionQuery($this->yystack[$this->yyidx + -2]->minor, $this->yystack[$this->yyidx + 0]->minor);
}
#line 1468 "..\oql-parser.php"
#line 1483 "..\oql-parser.php"
#line 40 "..\oql-parser.y"
function yy_r5(){
$this->_retvalue = new OqlObjectQuery($this->yystack[$this->yyidx + -2]->minor, $this->yystack[$this->yyidx + -2]->minor, $this->yystack[$this->yyidx + 0]->minor, $this->yystack[$this->yyidx + -1]->minor, array($this->yystack[$this->yyidx + -2]->minor));
}
#line 1473 "..\oql-parser.php"
#line 1488 "..\oql-parser.php"
#line 43 "..\oql-parser.y"
function yy_r6(){
$this->_retvalue = new OqlObjectQuery($this->yystack[$this->yyidx + -4]->minor, $this->yystack[$this->yyidx + -2]->minor, $this->yystack[$this->yyidx + 0]->minor, $this->yystack[$this->yyidx + -1]->minor, array($this->yystack[$this->yyidx + -2]->minor));
}
#line 1478 "..\oql-parser.php"
#line 1493 "..\oql-parser.php"
#line 47 "..\oql-parser.y"
function yy_r7(){
$this->_retvalue = new OqlObjectQuery($this->yystack[$this->yyidx + -2]->minor, $this->yystack[$this->yyidx + -2]->minor, $this->yystack[$this->yyidx + 0]->minor, $this->yystack[$this->yyidx + -1]->minor, $this->yystack[$this->yyidx + -4]->minor);
}
#line 1483 "..\oql-parser.php"
#line 1498 "..\oql-parser.php"
#line 50 "..\oql-parser.y"
function yy_r8(){
$this->_retvalue = new OqlObjectQuery($this->yystack[$this->yyidx + -4]->minor, $this->yystack[$this->yyidx + -2]->minor, $this->yystack[$this->yyidx + 0]->minor, $this->yystack[$this->yyidx + -1]->minor, $this->yystack[$this->yyidx + -6]->minor);
}
#line 1488 "..\oql-parser.php"
#line 1503 "..\oql-parser.php"
#line 55 "..\oql-parser.y"
function yy_r9(){
$this->_retvalue = array($this->yystack[$this->yyidx + 0]->minor);
}
#line 1493 "..\oql-parser.php"
#line 1508 "..\oql-parser.php"
#line 58 "..\oql-parser.y"
function yy_r10(){
array_push($this->yystack[$this->yyidx + -2]->minor, $this->yystack[$this->yyidx + 0]->minor);
$this->_retvalue = $this->yystack[$this->yyidx + -2]->minor;
}
#line 1499 "..\oql-parser.php"
#line 1514 "..\oql-parser.php"
#line 63 "..\oql-parser.y"
function yy_r11(){ $this->_retvalue = $this->yystack[$this->yyidx + 0]->minor; }
#line 1502 "..\oql-parser.php"
#line 1517 "..\oql-parser.php"
#line 64 "..\oql-parser.y"
function yy_r12(){ $this->_retvalue = null; }
#line 1505 "..\oql-parser.php"
#line 1520 "..\oql-parser.php"
#line 66 "..\oql-parser.y"
function yy_r13(){
// insert the join statement on top of the existing list
@@ -1506,63 +1521,63 @@ static public $yy_action = array(
// and return the updated array
$this->_retvalue = $this->yystack[$this->yyidx + 0]->minor;
}
#line 1513 "..\oql-parser.php"
#line 1528 "..\oql-parser.php"
#line 72 "..\oql-parser.y"
function yy_r14(){
$this->_retvalue = Array($this->yystack[$this->yyidx + 0]->minor);
}
#line 1518 "..\oql-parser.php"
#line 1533 "..\oql-parser.php"
#line 78 "..\oql-parser.y"
function yy_r16(){
// create an array with one single item
$this->_retvalue = new OqlJoinSpec($this->yystack[$this->yyidx + -4]->minor, $this->yystack[$this->yyidx + -2]->minor, $this->yystack[$this->yyidx + 0]->minor);
}
#line 1524 "..\oql-parser.php"
#line 1539 "..\oql-parser.php"
#line 83 "..\oql-parser.y"
function yy_r17(){
// create an array with one single item
$this->_retvalue = new OqlJoinSpec($this->yystack[$this->yyidx + -2]->minor, $this->yystack[$this->yyidx + -2]->minor, $this->yystack[$this->yyidx + 0]->minor);
}
#line 1530 "..\oql-parser.php"
#line 1545 "..\oql-parser.php"
#line 88 "..\oql-parser.y"
function yy_r18(){ $this->_retvalue = new BinaryOqlExpression($this->yystack[$this->yyidx + -2]->minor, '=', $this->yystack[$this->yyidx + 0]->minor); }
#line 1533 "..\oql-parser.php"
#line 1548 "..\oql-parser.php"
#line 89 "..\oql-parser.y"
function yy_r19(){ $this->_retvalue = new BinaryOqlExpression($this->yystack[$this->yyidx + -2]->minor, 'BELOW', $this->yystack[$this->yyidx + 0]->minor); }
#line 1536 "..\oql-parser.php"
#line 1551 "..\oql-parser.php"
#line 90 "..\oql-parser.y"
function yy_r20(){ $this->_retvalue = new BinaryOqlExpression($this->yystack[$this->yyidx + -2]->minor, 'BELOW_STRICT', $this->yystack[$this->yyidx + 0]->minor); }
#line 1539 "..\oql-parser.php"
#line 1554 "..\oql-parser.php"
#line 91 "..\oql-parser.y"
function yy_r21(){ $this->_retvalue = new BinaryOqlExpression($this->yystack[$this->yyidx + -2]->minor, 'NOT_BELOW', $this->yystack[$this->yyidx + 0]->minor); }
#line 1542 "..\oql-parser.php"
#line 1557 "..\oql-parser.php"
#line 92 "..\oql-parser.y"
function yy_r22(){ $this->_retvalue = new BinaryOqlExpression($this->yystack[$this->yyidx + -2]->minor, 'NOT_BELOW_STRICT', $this->yystack[$this->yyidx + 0]->minor); }
#line 1545 "..\oql-parser.php"
#line 1560 "..\oql-parser.php"
#line 93 "..\oql-parser.y"
function yy_r23(){ $this->_retvalue = new BinaryOqlExpression($this->yystack[$this->yyidx + -2]->minor, 'ABOVE', $this->yystack[$this->yyidx + 0]->minor); }
#line 1548 "..\oql-parser.php"
#line 1563 "..\oql-parser.php"
#line 94 "..\oql-parser.y"
function yy_r24(){ $this->_retvalue = new BinaryOqlExpression($this->yystack[$this->yyidx + -2]->minor, 'ABOVE_STRICT', $this->yystack[$this->yyidx + 0]->minor); }
#line 1551 "..\oql-parser.php"
#line 1566 "..\oql-parser.php"
#line 95 "..\oql-parser.y"
function yy_r25(){ $this->_retvalue = new BinaryOqlExpression($this->yystack[$this->yyidx + -2]->minor, 'NOT_ABOVE', $this->yystack[$this->yyidx + 0]->minor); }
#line 1554 "..\oql-parser.php"
#line 1569 "..\oql-parser.php"
#line 96 "..\oql-parser.y"
function yy_r26(){ $this->_retvalue = new BinaryOqlExpression($this->yystack[$this->yyidx + -2]->minor, 'NOT_ABOVE_STRICT', $this->yystack[$this->yyidx + 0]->minor); }
#line 1557 "..\oql-parser.php"
#line 1572 "..\oql-parser.php"
#line 98 "..\oql-parser.y"
function yy_r27(){ $this->_retvalue = $this->yystack[$this->yyidx + 0]->minor; }
#line 1560 "..\oql-parser.php"
#line 1575 "..\oql-parser.php"
#line 103 "..\oql-parser.y"
function yy_r31(){ $this->_retvalue = new FunctionOqlExpression($this->yystack[$this->yyidx + -3]->minor, $this->yystack[$this->yyidx + -1]->minor); }
#line 1563 "..\oql-parser.php"
#line 1578 "..\oql-parser.php"
#line 104 "..\oql-parser.y"
function yy_r32(){ $this->_retvalue = $this->yystack[$this->yyidx + -1]->minor; }
#line 1566 "..\oql-parser.php"
#line 1581 "..\oql-parser.php"
#line 105 "..\oql-parser.y"
function yy_r33(){ $this->_retvalue = new BinaryOqlExpression($this->yystack[$this->yyidx + -2]->minor, $this->yystack[$this->yyidx + -1]->minor, $this->yystack[$this->yyidx + 0]->minor); }
#line 1569 "..\oql-parser.php"
#line 1584 "..\oql-parser.php"
#line 111 "..\oql-parser.y"
function yy_r37(){
if ($this->yystack[$this->yyidx + -1]->minor == 'MATCHES')
@@ -1574,40 +1589,45 @@ static public $yy_action = array(
$this->_retvalue = new BinaryOqlExpression($this->yystack[$this->yyidx + -2]->minor, $this->yystack[$this->yyidx + -1]->minor, $this->yystack[$this->yyidx + 0]->minor);
}
}
#line 1581 "..\oql-parser.php"
#line 129 "..\oql-parser.y"
#line 1596 "..\oql-parser.php"
#line 128 "..\oql-parser.y"
function yy_r42(){
$this->_retvalue = new ListOqlExpression($this->yystack[$this->yyidx + -1]->minor);
}
#line 1586 "..\oql-parser.php"
#line 140 "..\oql-parser.y"
function yy_r45(){
#line 1601 "..\oql-parser.php"
#line 132 "..\oql-parser.y"
function yy_r43(){
$this->_retvalue = new NestedQueryOqlExpression($this->yystack[$this->yyidx + -1]->minor);
}
#line 1606 "..\oql-parser.php"
#line 144 "..\oql-parser.y"
function yy_r46(){
$this->_retvalue = array();
}
#line 1591 "..\oql-parser.php"
#line 151 "..\oql-parser.y"
function yy_r49(){ $this->_retvalue = new IntervalOqlExpression($this->yystack[$this->yyidx + -1]->minor, $this->yystack[$this->yyidx + 0]->minor); }
#line 1594 "..\oql-parser.php"
#line 164 "..\oql-parser.y"
function yy_r59(){ $this->_retvalue = new ScalarOqlExpression($this->yystack[$this->yyidx + 0]->minor); }
#line 1597 "..\oql-parser.php"
#line 166 "..\oql-parser.y"
function yy_r61(){ $this->_retvalue = new ScalarOqlExpression(null); }
#line 1600 "..\oql-parser.php"
#line 1611 "..\oql-parser.php"
#line 155 "..\oql-parser.y"
function yy_r50(){ $this->_retvalue = new IntervalOqlExpression($this->yystack[$this->yyidx + -1]->minor, $this->yystack[$this->yyidx + 0]->minor); }
#line 1614 "..\oql-parser.php"
#line 168 "..\oql-parser.y"
function yy_r62(){ $this->_retvalue = new FieldOqlExpression($this->yystack[$this->yyidx + 0]->minor); }
#line 1603 "..\oql-parser.php"
#line 169 "..\oql-parser.y"
function yy_r63(){ $this->_retvalue = new FieldOqlExpression($this->yystack[$this->yyidx + 0]->minor, $this->yystack[$this->yyidx + -2]->minor); }
#line 1606 "..\oql-parser.php"
function yy_r60(){ $this->_retvalue = new ScalarOqlExpression($this->yystack[$this->yyidx + 0]->minor); }
#line 1617 "..\oql-parser.php"
#line 170 "..\oql-parser.y"
function yy_r64(){ $this->_retvalue=$this->yystack[$this->yyidx + 0]->minor; }
#line 1609 "..\oql-parser.php"
function yy_r62(){ $this->_retvalue = new ScalarOqlExpression(null); }
#line 1620 "..\oql-parser.php"
#line 172 "..\oql-parser.y"
function yy_r63(){ $this->_retvalue = new FieldOqlExpression($this->yystack[$this->yyidx + 0]->minor); }
#line 1623 "..\oql-parser.php"
#line 173 "..\oql-parser.y"
function yy_r65(){ $this->_retvalue = new VariableOqlExpression(substr($this->yystack[$this->yyidx + 0]->minor, 1)); }
#line 1612 "..\oql-parser.php"
#line 175 "..\oql-parser.y"
function yy_r66(){
function yy_r64(){ $this->_retvalue = new FieldOqlExpression($this->yystack[$this->yyidx + 0]->minor, $this->yystack[$this->yyidx + -2]->minor); }
#line 1626 "..\oql-parser.php"
#line 174 "..\oql-parser.y"
function yy_r65(){ $this->_retvalue=$this->yystack[$this->yyidx + 0]->minor; }
#line 1629 "..\oql-parser.php"
#line 177 "..\oql-parser.y"
function yy_r66(){ $this->_retvalue = new VariableOqlExpression(substr($this->yystack[$this->yyidx + 0]->minor, 1)); }
#line 1632 "..\oql-parser.php"
#line 179 "..\oql-parser.y"
function yy_r67(){
if ($this->yystack[$this->yyidx + 0]->minor[0] == '`')
{
$name = substr($this->yystack[$this->yyidx + 0]->minor, 1, strlen($this->yystack[$this->yyidx + 0]->minor) - 2);
@@ -1618,22 +1638,22 @@ static public $yy_action = array(
}
$this->_retvalue = new OqlName($name, $this->m_iColPrev);
}
#line 1625 "..\oql-parser.php"
#line 186 "..\oql-parser.y"
function yy_r67(){$this->_retvalue=(int)$this->yystack[$this->yyidx + 0]->minor; }
#line 1628 "..\oql-parser.php"
#line 187 "..\oql-parser.y"
function yy_r68(){$this->_retvalue=(int)-$this->yystack[$this->yyidx + 0]->minor; }
#line 1631 "..\oql-parser.php"
#line 188 "..\oql-parser.y"
function yy_r69(){$this->_retvalue=new OqlHexValue($this->yystack[$this->yyidx + 0]->minor); }
#line 1634 "..\oql-parser.php"
#line 189 "..\oql-parser.y"
function yy_r70(){$this->_retvalue=stripslashes(substr($this->yystack[$this->yyidx + 0]->minor, 1, strlen($this->yystack[$this->yyidx + 0]->minor) - 2)); }
#line 1637 "..\oql-parser.php"
#line 1645 "..\oql-parser.php"
#line 190 "..\oql-parser.y"
function yy_r68(){$this->_retvalue=(int)$this->yystack[$this->yyidx + 0]->minor; }
#line 1648 "..\oql-parser.php"
#line 191 "..\oql-parser.y"
function yy_r69(){$this->_retvalue=(int)-$this->yystack[$this->yyidx + 0]->minor; }
#line 1651 "..\oql-parser.php"
#line 192 "..\oql-parser.y"
function yy_r71(){$this->_retvalue=$this->yystack[$this->yyidx + 0]->minor; }
#line 1640 "..\oql-parser.php"
function yy_r70(){$this->_retvalue=new OqlHexValue($this->yystack[$this->yyidx + 0]->minor); }
#line 1654 "..\oql-parser.php"
#line 193 "..\oql-parser.y"
function yy_r71(){$this->_retvalue=stripslashes(substr($this->yystack[$this->yyidx + 0]->minor, 1, strlen($this->yystack[$this->yyidx + 0]->minor) - 2)); }
#line 1657 "..\oql-parser.php"
#line 196 "..\oql-parser.y"
function yy_r72(){$this->_retvalue=$this->yystack[$this->yyidx + 0]->minor; }
#line 1660 "..\oql-parser.php"
/**
* placeholder for the left hand side in a reduce operation.
@@ -1748,7 +1768,7 @@ static public $yy_action = array(
#line 25 "..\oql-parser.y"
throw new OQLParserException($this->m_sSourceQuery, $this->m_iLine, $this->m_iCol, $this->tokenName($yymajor), $TOKEN);
#line 1756 "..\oql-parser.php"
#line 1776 "..\oql-parser.php"
}
/**
@@ -1915,7 +1935,7 @@ throw new OQLParserException($this->m_sSourceQuery, $this->m_iLine, $this->m_iCo
} while ($yymajor != self::YYNOCODE && $this->yyidx >= 0);
}
}
#line 257 "..\oql-parser.y"
#line 261 "..\oql-parser.y"
class OQLParserException extends OQLException
@@ -1980,4 +2000,4 @@ class OQLParser extends OQLParserRaw
}
}
#line 1989 "..\oql-parser.php"
#line 2009 "..\oql-parser.php"

View File

@@ -188,25 +188,40 @@ class ScalarOqlExpression extends ScalarExpression implements CheckableExpressio
}
}
class NestedQueryOqlExpression extends NestedQueryExpression implements CheckableExpression{
class NestedQueryOqlExpression extends NestedQueryExpression implements CheckableExpression
{
/** @var OQLObjectQuery */
private $m_oOQLObjectQuery;
/*Here $m_oNestedQuery is an OQLObjectQuery*/
public function __construct($oNestedQuery)
/**
* NestedQueryOqlExpression constructor.
*
* @param OQLObjectQuery $oOQLObjectQuery
*/
public function __construct($oOQLObjectQuery )
{
//OQLObjectQuery
$this->m_oNestedQuery = $oNestedQuery;
$this->m_sQuery="";
parent::__construct(null);
$this->m_oOQLObjectQuery = $oOQLObjectQuery;
}
/**
* Recursively check the validity of the expression with regard to the data model
* and the query in which it is used
*
* @param ModelReflection $oModelReflection MetaModel to consider
* @throws OqlNormalizeException
* @param array $aAliases
* @param string $sSourceQuery
*
* @throws \OqlNormalizeException
*/
public function Check(ModelReflection $oModelReflection, $aAliases, $sSourceQuery)
{
$this->m_oNestedQuery-> Check($oModelReflection, "", $aAliases);
$this->m_oOQLObjectQuery->Check($oModelReflection, "", $aAliases);
}
public function GetOQLObjectQuery()
{
return $this->m_oOQLObjectQuery;
}
}
@@ -589,6 +604,7 @@ class OqlUnionQuery extends OqlQuery
public function __construct(OqlObjectQuery $oLeftQuery, OqlQuery $oRightQueryOrUnion)
{
parent::__construct();
$this->aQueries[] = $oLeftQuery;
if ($oRightQueryOrUnion instanceof OqlUnionQuery)
{
@@ -659,6 +675,7 @@ class OqlUnionQuery extends OqlQuery
}
foreach ($aColumnToClasses as $iColumn => $aClasses)
{
$sRootClass = null;
foreach ($aClasses as $iQuery => $aData)
{
if ($iQuery == 0)
@@ -731,10 +748,6 @@ class OqlUnionQuery extends OqlQuery
// first loop
$sAncestor = $sClass;
}
elseif ($sClass == $sAncestor)
{
// remains the same
}
elseif ($oModelReflection->GetRootClass($sClass) != $oModelReflection->GetRootClass($sAncestor))
{
$sAncestor = null;
@@ -786,4 +799,4 @@ class OqlUnionQuery extends OqlQuery
$oSearch = new DBUnionSearch($aSearches);
return $oSearch;
}
}
}

View File

@@ -1 +1 @@
2019-11-28
2019-12-03

View File

@@ -33,6 +33,7 @@ class QueryBuilderContext
protected $m_aFilteredTables;
protected $m_sEmptyClassAlias;
/** @var \QueryBuilderExpressions */
public $m_oQBExpressions;
/**

View File

@@ -17,7 +17,7 @@ use utils;
* @preserveGlobalState disabled
* @backupGlobals disabled
*/
class OQLToSQLTest extends ItopDataTestCase
class OQLToSQLNestedSelectTest extends ItopDataTestCase
{
const USE_TRANSACTION = false;
const TEST_CSV_RESULT = 'OQLToSQLTest.csv';
@@ -30,8 +30,6 @@ class OQLToSQLTest extends ItopDataTestCase
SetupUtils::builddir(APPROOT.'log/test/OQLToSQL');
}
/**
* @doesNotPerformAssertions
*
@@ -143,15 +141,8 @@ class OQLToSQLTest extends ItopDataTestCase
$sSQL = $oSearch->MakeSelectQuery($aOrderBy, $aArgs, $aAttToLoad, $aExtendedDataSpec, $iLimitCount, $iLimitStart);
$fStart = $this->GetMicroTime();
$aRow = $this->GetArrayResult($sSQL);
$this->GetArrayResult($sSQL);
$fDataDuration = $this->GetMicroTime() - $fStart;
if (is_null($aRow))
{
$aRow = array();
}
// Store only to the 10 first entries
$aRow = array_slice($aRow, 0, 10);
$iJoinData = count(explode(' JOIN ', $sSQL)) - 1;
$aResult = array(
@@ -175,64 +166,19 @@ class OQLToSQLTest extends ItopDataTestCase
private function OQLSelectProviderStatic()
{
$aArgs = array(
'ActionEmail_finalclass' => 'ActionEmail',
'UserInternal_status' => 'active',
'current_contact_id' => '2',
'id' => 3,
'login' => 'admin',
'menu_code' => 'WelcomeMenuPage',
'name' => 'database_uuid',
'this->brand_id' => '1',
'this->finalclass' => 'NetworkDevice',
'this->id' => 3,
'this->location_id' => 2,
'this->org_id' => 3,
'this->osfamily_id' => '6',
'this->osversion_id' => '8',
'this->rack_id' => '3',
'this->request_type' => 'incident',
'this->service_id' => '1',
'user_id' => '5',
'userid' => '5',
);
$aAttToLoad150 = array(
'WebServer' => array(
'business_criticity',
'description',
'name',
'friendlyname',
'obsolescence_flag',
'finalclass',
),
);
$aData = array(
"SELECT UserRequest 112" =>array('SELECT `UserRequest` FROM UserRequest AS `UserRequest` WHERE (`UserRequest`.org_id IN (SELECT `Organization` FROM Organization AS `Organization` WHERE (`Organization`.`id` = `UserRequest`.`org_id`)))'),
"SELECT UserRequest 113" => array("SELECT `UserRequest` FROM UserRequest AS `UserRequest` WHERE `UserRequest`.org_id IN (SELECT `Organization` FROM Organization AS `Organization` JOIN Organization AS `Organization1` ON `Organization`.parent_id BELOW `Organization1`.id WHERE (`Organization1`.`id` = '3'))", array('UserRequest.friendlyname' => true), $aArgs),
"SELECT UserRequest 111" => array("SELECT `UserRequest` FROM UserRequest AS `UserRequest` WHERE `UserRequest`.org_id IN (1,2,3)", array('UserRequest.friendlyname' => true), $aArgs),
return array(
array('SELECT `UserRequest` FROM UserRequest AS `UserRequest` JOIN Person AS `P` ON `UserRequest`.agent_id = `P`.id JOIN Organization AS `Organization` ON `P`.org_id = `Organization`.id WHERE (`UserRequest`.`org_id` IN (SELECT `Organization` FROM Organization AS `Organization` WHERE (`Organization`.`id` = `UserRequest`.`org_id`)))'),
"SELECT UserRequest 112" => array('SELECT `UserRequest` FROM UserRequest AS `UserRequest` WHERE (`UserRequest`.org_id IN (SELECT `Organization` FROM Organization AS `Organization` WHERE (`Organization`.`id` = `UserRequest`.`org_id`)))'),
"SELECT UserRequest 113" => array("SELECT `UserRequest` FROM UserRequest AS `UserRequest` WHERE `UserRequest`.org_id IN (SELECT `Organization` FROM Organization AS `Organization` JOIN Organization AS `Organization1` ON `Organization`.parent_id BELOW `Organization1`.id WHERE (`Organization1`.`id` = '3'))", array('UserRequest.friendlyname' => true)),
"SELECT UserRequest 111" => array("SELECT `UserRequest` FROM UserRequest AS `UserRequest` WHERE `UserRequest`.org_id IN (1,2,3)", array('UserRequest.friendlyname' => true)),
);
return $aData;
}
public function OQLSelectProvider()
{
$aData = $this->OQLSelectProviderStatic();
return $aData;
return $this->OQLSelectProviderStatic();
}
private function GetId()
{
$sId = str_replace('"', '', $this->getName());
$sId = str_replace('Legacy', '', $sId);
$sId = str_replace(' ', '_', $sId);
return $sId;
}
/**
* @param $sSQL

View File

@@ -10,6 +10,7 @@
namespace Combodo\iTop\Test\UnitTest\Core;
use Combodo\iTop\Test\UnitTest\ItopDataTestCase;
use Combodo\iTop\Test\UnitTest\ItopTestCase;
use DBObjectSearch;
@@ -18,8 +19,10 @@ use DBObjectSearch;
* @preserveGlobalState disabled
* @backupGlobals disabled
*/
class OQLParserTest extends ItopTestCase
class OQLParserTest extends ItopDataTestCase
{
const USE_TRANSACTION = false;
/**
* @dataProvider NestedQueryProvider
*
@@ -39,6 +42,7 @@ class OQLParserTest extends ItopTestCase
public function NestedQueryProvider()
{
return array(
array('SELECT `UserRequest` FROM UserRequest AS `UserRequest` JOIN Person AS `P` ON `UserRequest`.agent_id = `P`.id JOIN Organization AS `Organization` ON `P`.org_id = `Organization`.id WHERE (`UserRequest`.`org_id` IN (SELECT `Organization` FROM Organization AS `Organization` WHERE (`Organization`.`id` = `UserRequest`.`org_id`)))'),
array('SELECT `UserRequest` FROM UserRequest AS `UserRequest` WHERE (`UserRequest`.`org_id` IN (SELECT `Organization` FROM Organization AS `Organization` WHERE (`Organization`.`id` = `UserRequest`.`org_id`)))'),
array('SELECT `UserRequest` FROM UserRequest AS `UserRequest` WHERE (`UserRequest`.`org_id` IN (SELECT `Organization` FROM Organization AS `Organization` WHERE 1))'),
array('SELECT `UserRequest` FROM UserRequest AS `UserRequest` WHERE (`UserRequest`.`org_id` NOT IN (SELECT `Organization` FROM Organization AS `Organization` WHERE 1))'),

View File

@@ -64,9 +64,7 @@ class OQLTest extends ItopDataTestCase
return array(
array('SELECT `UserRequest` FROM UserRequest AS `UserRequest` WHERE `UserRequest`.org_id IN (SELECT id FROM Organization AS `Organization` JOIN Organization AS `Organization1` ON `Organization`.parent_id BELOW `Organization1`.id WHERE (`Organization1`.`id` = \'3\'))'),
array('SELECT `UserRequest` FROM UserRequest AS `UserRequest` WHERE (`UserRequest`.`org_id` IN (SELECT `Organization` FROM Organization AS `Organization` WHERE `Organization`.`id`=`UserRequest`.`org_id`))'),
array('SELECT toto WHERE id NOT IN (aaa,2,3)'),
array('SELECT toto WHERE id IN (SELECT titi)'),
array('SELECT toto WHERE a=1'),
array('SELECT toto WHERE id IN (SELECT titi WHERE a=1)'),
array('SELECT toto WHERE id IN (SELECT titi AS ti JOIN toto AS to ON to.a=ti.b)'),
array('SELECT toto WHERE id IN (SELECT titi AS ti JOIN toto AS to ON to.a=ti.b WHERE to.a=1)'),
@@ -74,7 +72,6 @@ class OQLTest extends ItopDataTestCase
);
}
/**
* @dataProvider GoodQueryProvider
* @depends testOQLSetup