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
2ad2007f
Commit
2ad2007f
authored
8 years ago
by
vforchi
Browse files
Options
Downloads
Plain Diff
Merge remote-tracking branch 'upstream/master'
parents
0ee4525f
704877d2
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/tap/data/ResultSetTableIterator.java
+6
-3
6 additions, 3 deletions
src/tap/data/ResultSetTableIterator.java
test/tap/data/ResultSetTableIteratorTest.java
+42
-0
42 additions, 0 deletions
test/tap/data/ResultSetTableIteratorTest.java
with
48 additions
and
3 deletions
src/tap/data/ResultSetTableIterator.java
+
6
−
3
View file @
2ad2007f
...
...
@@ -455,7 +455,7 @@ public class ResultSetTableIterator implements TableIterator {
* @since 2.1
*/
public
ResultSetTableIterator
(
final
DBConnection
dbConn
,
final
ResultSet
dataSet
,
final
DBColumn
[]
metadata
)
throws
NullPointerException
,
DataReadException
{
this
(
dbConn
,
dataSet
,
null
,
null
,
null
);
this
(
dbConn
,
dataSet
,
metadata
,
null
,
null
);
}
/**
...
...
@@ -579,9 +579,12 @@ public class ResultSetTableIterator implements TableIterator {
colMeta
=
new
TAPColumn
[
nbColumns
];
for
(
int
i
=
1
;
i
<=
nbColumns
;
i
++){
if
(
resultMeta
!=
null
&&
(
i
-
1
)
<
resultMeta
.
length
&&
resultMeta
[
i
-
1
]
!=
null
){
try
{
if
(
resultMeta
[
i
-
1
]
instanceof
TAPColumn
)
colMeta
[
i
-
1
]
=
(
TAPColumn
)
resultMeta
[
i
-
1
];
}
catch
(
ClassCastException
cce
){
else
if
(
resultMeta
[
i
-
1
].
getDatatype
()
!=
null
){
colMeta
[
i
-
1
]
=
new
TAPColumn
(
resultMeta
[
i
-
1
].
getADQLName
(),
resultMeta
[
i
-
1
].
getDatatype
());
colMeta
[
i
-
1
].
setDBName
(
resultMeta
[
i
-
1
].
getDBName
());
}
else
{
DBType
datatype
=
convertType
(
metadata
.
getColumnType
(
i
),
metadata
.
getColumnTypeName
(
i
),
dbms
);
colMeta
[
i
-
1
]
=
new
TAPColumn
(
resultMeta
[
i
-
1
].
getADQLName
(),
datatype
);
}
...
...
This diff is collapsed.
Click to expand it.
test/tap/data/ResultSetTableIteratorTest.java
+
42
−
0
View file @
2ad2007f
...
...
@@ -12,6 +12,11 @@ import org.junit.AfterClass;
import
org.junit.BeforeClass
;
import
org.junit.Test
;
import
adql.db.DBType
;
import
adql.parser.ADQLParser
;
import
adql.query.ADQLQuery
;
import
adql.translator.PgSphereTranslator
;
import
tap.metadata.TAPColumn
;
import
testtools.DBTools
;
public
class
ResultSetTableIteratorTest
{
...
...
@@ -165,4 +170,41 @@ public class ResultSetTableIteratorTest {
}
}
}
@Test
public
void
testGeometryColumns
(){
ResultSet
rs
=
null
;
try
{
ADQLQuery
query
=
(
new
ADQLParser
()).
parseQuery
(
"SELECT TOP 1 POINT('', ra, deg), CENTROID(CIRCLE('', ra, deg, 2)), BOX('', ra-10, deg-2, ra+10, deg+2), CIRCLE('', ra, deg, 2) FROM gums;"
);
// create a valid ResultSet:
rs
=
DBTools
.
select
(
conn
,
(
new
PgSphereTranslator
()).
translate
(
query
));
// Create the iterator:
ResultSetTableIterator
rsit
=
new
ResultSetTableIterator
(
rs
,
query
.
getResultingColumns
());
assertTrue
(
rsit
.
nextRow
());
// Fetch the metadata:
TAPColumn
[]
cols
=
rsit
.
getMetadata
();
assertEquals
(
4
,
cols
.
length
);
// Check that the two first columns are POINTs:
for
(
int
i
=
0
;
i
<
2
;
i
++)
assertEquals
(
DBType
.
DBDatatype
.
POINT
,
cols
[
i
].
getDatatype
().
type
);
// Check that the next columns are REGIONs:
for
(
int
i
=
2
;
i
<
3
;
i
++)
assertEquals
(
DBType
.
DBDatatype
.
REGION
,
cols
[
i
].
getDatatype
().
type
);
}
catch
(
Exception
ex
){
ex
.
printStackTrace
(
System
.
err
);
fail
(
"An exception occurs while formatting dates/times."
);
}
finally
{
if
(
rs
!=
null
){
try
{
rs
.
close
();
}
catch
(
Exception
ex
){}
}
}
}
}
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