Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
RQL
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
cubicweb
RQL
Commits
19ad9d65a95e
Commit
19ad9d65a95e
authored
15 years ago
by
Sylvain Thénault
Browse files
Options
Downloads
Patches
Plain Diff
Union.locate_subquery now return a 2-uple (select subquery, column index in the subquery)
parent
71f875e3e2c1
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
stmts.py
+8
-4
8 additions, 4 deletions
stmts.py
with
8 additions
and
4 deletions
stmts.py
+
8
−
4
View file @
19ad9d65
...
@@ -275,8 +275,8 @@
...
@@ -275,8 +275,8 @@
def
_locate_subquery
(
self
,
col
,
etype
,
kwargs
):
def
_locate_subquery
(
self
,
col
,
etype
,
kwargs
):
if
len
(
self
.
children
)
==
1
and
not
self
.
children
[
0
].
with_
:
if
len
(
self
.
children
)
==
1
and
not
self
.
children
[
0
].
with_
:
return
self
.
children
[
0
]
return
self
.
children
[
0
]
,
col
for
select
in
self
.
children
:
for
select
in
self
.
children
:
term
=
select
.
selection
[
col
]
term
=
select
.
selection
[
col
]
try
:
try
:
if
term
.
name
in
select
.
aliases
:
if
term
.
name
in
select
.
aliases
:
...
@@ -279,10 +279,11 @@
...
@@ -279,10 +279,11 @@
for
select
in
self
.
children
:
for
select
in
self
.
children
:
term
=
select
.
selection
[
col
]
term
=
select
.
selection
[
col
]
try
:
try
:
if
term
.
name
in
select
.
aliases
:
if
term
.
name
in
select
.
aliases
:
union
=
select
.
aliases
[
term
.
name
].
query
alias
=
select
.
aliases
[
term
.
name
]
return
union
.
_locate_subquery
(
col
,
etype
,
kwargs
)
return
alias
.
query
.
_locate_subquery
(
alias
.
colnum
,
etype
,
kwargs
)
except
AttributeError
:
except
AttributeError
:
pass
pass
for
i
,
solution
in
enumerate
(
select
.
solutions
):
for
i
,
solution
in
enumerate
(
select
.
solutions
):
if
term
.
get_type
(
solution
,
kwargs
)
==
etype
:
if
term
.
get_type
(
solution
,
kwargs
)
==
etype
:
...
@@ -285,8 +286,8 @@
...
@@ -285,8 +286,8 @@
except
AttributeError
:
except
AttributeError
:
pass
pass
for
i
,
solution
in
enumerate
(
select
.
solutions
):
for
i
,
solution
in
enumerate
(
select
.
solutions
):
if
term
.
get_type
(
solution
,
kwargs
)
==
etype
:
if
term
.
get_type
(
solution
,
kwargs
)
==
etype
:
return
select
return
select
,
col
raise
Exception
(
'
internal error, %s not found on col %s
'
%
(
etype
,
col
))
raise
Exception
(
'
internal error, %s not found on col %s
'
%
(
etype
,
col
))
def
locate_subquery
(
self
,
col
,
etype
,
kwargs
=
None
):
def
locate_subquery
(
self
,
col
,
etype
,
kwargs
=
None
):
...
@@ -290,6 +291,9 @@
...
@@ -290,6 +291,9 @@
raise
Exception
(
'
internal error, %s not found on col %s
'
%
(
etype
,
col
))
raise
Exception
(
'
internal error, %s not found on col %s
'
%
(
etype
,
col
))
def
locate_subquery
(
self
,
col
,
etype
,
kwargs
=
None
):
def
locate_subquery
(
self
,
col
,
etype
,
kwargs
=
None
):
"""
return a select node and associated selection index where root
variable at column `col` is of type `etype`
"""
try
:
try
:
return
self
.
_subq_cache
[(
col
,
etype
)]
return
self
.
_subq_cache
[(
col
,
etype
)]
except
AttributeError
:
except
AttributeError
:
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment