Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
H
HdbTdbArchivingApi
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Jira
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
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
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Software Control System
Tango controls archiving
HdbTdbArchivingApi
Commits
c6b58b0d
Commit
c6b58b0d
authored
Nov 20, 2023
by
gwen-soleil
Browse files
Options
Downloads
Patches
Plain Diff
fix data fetching for boolean scalar (SOLEIL Jira
TANGOARCH-827
)
parent
e1543c3b
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/main/java/fr/soleil/archiving/hdbtdb/api/management/attributes/extractor/GenericExtractorMethods.java
+52
-48
52 additions, 48 deletions
...agement/attributes/extractor/GenericExtractorMethods.java
with
52 additions
and
48 deletions
src/main/java/fr/soleil/archiving/hdbtdb/api/management/attributes/extractor/GenericExtractorMethods.java
+
52
−
48
View file @
c6b58b0d
package
fr.soleil.archiving.hdbtdb.api.management.attributes.extractor
;
import
java.lang.reflect.Array
;
import
java.sql.Connection
;
import
java.sql.ResultSet
;
import
java.sql.SQLException
;
import
java.sql.Statement
;
import
java.util.ArrayList
;
import
java.util.List
;
import
fr.esrf.Tango.AttrWriteType
;
import
fr.esrf.Tango.ErrSeverity
;
import
fr.esrf.TangoDs.TangoConst
;
...
...
@@ -26,11 +18,19 @@ import fr.soleil.database.DBExtractionConst;
import
fr.soleil.database.connection.AbstractDataBaseConnector
;
import
fr.soleil.lib.project.math.MathConst
;
import
java.lang.reflect.Array
;
import
java.sql.Connection
;
import
java.sql.ResultSet
;
import
java.sql.SQLException
;
import
java.sql.Statement
;
import
java.util.ArrayList
;
import
java.util.List
;
public
abstract
class
GenericExtractorMethods
implements
DBExtractionConst
{
protected
final
AbstractDataBaseConnector
connector
;
private
volatile
Statement
lastStatement
;
private
volatile
boolean
canceled
;
protected
final
AbstractDataBaseConnector
connector
;
public
GenericExtractorMethods
(
final
AbstractDataBaseConnector
connector
)
{
lastStatement
=
null
;
...
...
@@ -38,19 +38,6 @@ public abstract class GenericExtractorMethods implements DBExtractionConst {
this
.
connector
=
connector
;
}
public
boolean
isCanceled
()
{
return
canceled
;
}
public
void
setCanceled
(
final
boolean
canceled
)
throws
ArchivingException
{
this
.
canceled
=
canceled
;
if
(
canceled
)
{
if
(
canceled
)
{
ConnectionCommands
.
cancelStatement
(
lastStatement
);
}
}
}
public
void
makeDataException
(
final
int
format
,
final
String
type1
,
final
String
type2
)
throws
ArchivingException
{
String
message
=
""
,
reason
=
""
,
desc
=
""
;
message
=
"Failed retrieving data ! "
;
...
...
@@ -107,6 +94,19 @@ public abstract class GenericExtractorMethods implements DBExtractionConst {
return
valuesCount
;
}
public
boolean
isCanceled
()
{
return
canceled
;
}
public
void
setCanceled
(
final
boolean
canceled
)
throws
ArchivingException
{
this
.
canceled
=
canceled
;
if
(
canceled
)
{
if
(
canceled
)
{
ConnectionCommands
.
cancelStatement
(
lastStatement
);
}
}
}
public
DbData
[]
getAttScalarDataForQuery
(
final
String
query
,
final
DbData
...
dbData
)
throws
ArchivingException
{
DbData
[]
result
;
Connection
conn
=
null
;
...
...
@@ -139,27 +139,6 @@ public abstract class GenericExtractorMethods implements DBExtractionConst {
return
result
;
}
private
Object
extractData
(
ResultSet
rset
,
int
index
,
int
dataType
,
boolean
...
nullElements
)
throws
SQLException
{
Object
value
;
if
(
dataType
==
TangoConst
.
Tango_DEV_STRING
)
{
value
=
rset
.
getString
(
index
);
if
(
rset
.
wasNull
())
{
nullElements
[
0
]
=
true
;
}
else
{
value
=
StringFormater
.
formatStringToRead
((
String
)
value
);
}
}
else
{
value
=
rset
.
getDouble
(
index
);
if
(
rset
.
wasNull
())
{
nullElements
[
0
]
=
true
;
value
=
DbUtils
.
cast
(
dataType
,
MathConst
.
NAN_FOR_NULL
);
}
else
{
value
=
DbUtils
.
cast
(
dataType
,
(
double
)
value
);
}
}
return
value
;
}
public
void
treatStatementResultForGetScalarData
(
ResultSet
rset
,
DbData
...
result
)
throws
SQLException
,
ArchivingException
{
if
((
rset
!=
null
)
&&
(
result
!=
null
)
&&
(
result
.
length
==
2
)
...
...
@@ -207,6 +186,32 @@ public abstract class GenericExtractorMethods implements DBExtractionConst {
}
}
private
Object
extractData
(
ResultSet
rset
,
int
index
,
int
dataType
,
boolean
...
nullElements
)
throws
SQLException
{
Object
value
;
if
(
dataType
==
TangoConst
.
Tango_DEV_STRING
)
{
value
=
rset
.
getString
(
index
);
if
(
rset
.
wasNull
())
{
nullElements
[
0
]
=
true
;
}
else
{
value
=
StringFormater
.
formatStringToRead
((
String
)
value
);
}
}
else
if
(
dataType
==
TangoConst
.
Tango_DEV_BOOLEAN
)
{
value
=
rset
.
getBoolean
(
index
);
if
(
rset
.
wasNull
())
{
nullElements
[
0
]
=
true
;
}
}
else
{
value
=
rset
.
getDouble
(
index
);
if
(
rset
.
wasNull
())
{
nullElements
[
0
]
=
true
;
value
=
DbUtils
.
cast
(
dataType
,
MathConst
.
NAN_FOR_NULL
);
}
else
{
value
=
DbUtils
.
cast
(
dataType
,
(
double
)
value
);
}
}
return
value
;
}
public
abstract
DbData
[]
treatStatementResultForGetSpectData
(
ResultSet
rset
,
final
String
attributeName
,
DbData
...
dbData
)
throws
ArchivingException
;
...
...
@@ -436,8 +441,7 @@ public abstract class GenericExtractorMethods implements DBExtractionConst {
* <b>Description : </b> Creates the table of an image read/write type
* attribute <I>(mySQL only)</I>.
*
* @param attributeID
* The ID of the associated attribute
* @param attributeID The ID of the associated attribute
*/
public
void
buildAttributeImageTab
(
final
String
attributeID
,
final
String
[]
tab
,
final
int
dataType
)
throws
ArchivingException
{
...
...
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