Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
V
vollt
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
Package registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
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
Sonia Zorba
vollt
Commits
7f5f1992
Commit
7f5f1992
authored
10 years ago
by
gmantele
Browse files
Options
Downloads
Patches
Plain Diff
[ADQL] Fix major bug for 'SELECT table.* ...' (it was translated by a 'SELECT * ...')
parent
abc1c18b
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/adql/query/ADQLQuery.java
+7
-2
7 additions, 2 deletions
src/adql/query/ADQLQuery.java
src/adql/query/SelectAllColumns.java
+9
-4
9 additions, 4 deletions
src/adql/query/SelectAllColumns.java
with
16 additions
and
6 deletions
src/adql/query/ADQLQuery.java
+
7
−
2
View file @
7f5f1992
...
...
@@ -38,7 +38,7 @@ import adql.search.ISearchHandler;
* <p>The resulting object of the {@link ADQLParser} is an object of this class.</p>
*
* @author Grégory Mantelet (CDS;ARI)
* @version 1.2 (
11
/201
3
)
* @version 1.2 (
09
/201
4
)
*/
public
class
ADQLQuery
implements
ADQLObject
{
...
...
@@ -262,7 +262,12 @@ public class ADQLQuery implements ADQLObject {
ADQLOperand
operand
=
item
.
getOperand
();
if
(
item
instanceof
SelectAllColumns
){
try
{
columns
.
addAll
(
from
.
getDBColumns
());
// If "{table}.*", add all columns of the specified table:
if
(((
SelectAllColumns
)
item
).
getAdqlTable
()
!=
null
)
columns
.
addAll
(((
SelectAllColumns
)
item
).
getAdqlTable
().
getDBColumns
());
// Otherwise ("*"), add all columns of all selected tables:
else
columns
.
addAll
(
from
.
getDBColumns
());
}
catch
(
ParseException
pe
){
// Here, this error should not occur any more, since it must have been caught by the DBChecker!
}
...
...
This diff is collapsed.
Click to expand it.
src/adql/query/SelectAllColumns.java
+
9
−
4
View file @
7f5f1992
...
...
@@ -20,15 +20,16 @@ import adql.query.from.ADQLTable;
* You should have received a copy of the GNU Lesser General Public License
* along with ADQLLibrary. If not, see <http://www.gnu.org/licenses/>.
*
* Copyright 2012 - UDS/Centre de Données astronomiques de Strasbourg (CDS)
* Copyright 2012,2014 - UDS/Centre de Données astronomiques de Strasbourg (CDS),
* Astronomisches Rechen Institut (ARI)
*/
/**
* In ADQL it corresponds to the '*' and '{tableName}.*' items in the SELECT clause.
* It means: 'select all columns'.
*
* @author Grégory Mantelet (CDS)
* @version
0
1/201
2
* @author Grégory Mantelet (CDS
;ARI
)
* @version 1
.2 (09
/201
4)
*/
public
final
class
SelectAllColumns
extends
SelectItem
{
...
...
@@ -106,7 +107,7 @@ public final class SelectAllColumns extends SelectItem {
* @param table An {@link ADQLTable} (MUST NOT BE NULL).
*/
public
final
void
setAdqlTable
(
final
ADQLTable
table
){
if
(
table
=
=
null
){
if
(
table
!
=
null
){
adqlTable
=
table
;
query
=
null
;
}
...
...
@@ -128,6 +129,7 @@ public final class SelectAllColumns extends SelectItem {
private
boolean
tableGot
=
(
adqlTable
==
null
);
@Override
public
ADQLObject
next
()
throws
NoSuchElementException
{
if
(
tableGot
)
throw
new
NoSuchElementException
();
...
...
@@ -135,10 +137,12 @@ public final class SelectAllColumns extends SelectItem {
return
adqlTable
;
}
@Override
public
boolean
hasNext
(){
return
!
tableGot
;
}
@Override
public
void
replace
(
ADQLObject
replacer
)
throws
UnsupportedOperationException
,
IllegalStateException
{
if
(
replacer
==
null
)
remove
();
...
...
@@ -150,6 +154,7 @@ public final class SelectAllColumns extends SelectItem {
adqlTable
=
(
ADQLTable
)
replacer
;
}
@Override
public
void
remove
(){
if
(!
tableGot
)
throw
new
IllegalStateException
(
"remove() impossible: next() has not yet been called !"
);
...
...
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