Skip to content
Permalink
Browse files

fixed #1064 added LIMIT N OFFSET M form; added cases to test 171

  • Loading branch information...
tomatolog committed Oct 7, 2019
1 parent fdc9f04 commit 46c1cad8fa11c1fc09cc34b20d978fdfcd4e6d27
Showing with 21 additions and 1 deletion.
  1. +1 −0 src/sphinxql.l
  2. +11 −0 src/sphinxql.y
  3. +1 −1 test/test_171/model.bin
  4. +8 −0 test/test_171/test.xml
@@ -117,6 +117,7 @@ ALPHA [a-zA-Z_]+
"NAMES" { YYSTOREBOUNDS; return TOK_NAMES; }
"NOT" { YYSTOREBOUNDS; return TOK_NOT; }
"NULL" { YYSTOREBOUNDS; return TOK_NULL; }
"OFFSET" { YYSTOREBOUNDS; return TOK_OFFSET; }
"OPTION" { YYSTOREBOUNDS; return TOK_OPTION; }
"OPTIMIZE" { YYSTOREBOUNDS; return TOK_OPTIMIZE; }
"OR" { YYSTOREBOUNDS; return TOK_OR; }
@@ -100,6 +100,7 @@
%token TOK_MULTI64
%token TOK_NAMES
%token TOK_NULL
%token TOK_OFFSET
%token TOK_OPTION
%token TOK_ORDER
%token TOK_OPTIMIZE
@@ -367,6 +368,12 @@ opt_outer_limit:
pParser->m_pQuery->m_iOuterLimit = $4.m_iValue;
pParser->m_pQuery->m_bHasOuter = true;
}
| TOK_LIMIT TOK_CONST_INT TOK_OFFSET TOK_CONST_INT
{
pParser->m_pQuery->m_iOuterLimit = $2.m_iValue;
pParser->m_pQuery->m_iOuterOffset = $4.m_iValue;
pParser->m_pQuery->m_bHasOuter = true;
}
;

select_from:
@@ -891,6 +898,10 @@ limit_clause:
{
pParser->SetLimit ( $2.m_iValue, $4.m_iValue );
}
| TOK_LIMIT TOK_CONST_INT TOK_OFFSET TOK_CONST_INT
{
pParser->SetLimit ( $4.m_iValue, $2.m_iValue );
}
;

opt_option_clause:

Large diffs are not rendered by default.

@@ -470,6 +470,14 @@ index dist_j
<!-- regression prohibit HAVING on regular\pool'ed attribute -->
<sphinxql>SELECT id, COUNT(*) cc, GROUPBY() gg FROM dist_j GROUP BY j.j1 HAVING j.j1 IN ( 1,2 )</sphinxql>
<sphinxql>SELECT id, COUNT(*) cc, GROUPBY() gg FROM dist_j GROUP BY j.j1 HAVING gg IN ( 1,2 )</sphinxql>

<!-- limit and offset different forms -->
<sphinxql>SELECT id, tag FROM idx_keys limit 3</sphinxql>
<sphinxql>SELECT id, tag FROM idx_keys limit 3,3</sphinxql>
<sphinxql>SELECT id, tag FROM idx_keys limit 3 offset 3</sphinxql>
<sphinxql>SELECT id, tag FROM idx_keys limit 2 offset 6</sphinxql>
<sphinxql>SELECT id, tag FROM idx_keys limit 10 offset 5</sphinxql>

</sphqueries>

<db_create>

0 comments on commit 46c1cad

Please sign in to comment.
You can’t perform that action at this time.