1 file + 52 − 48 Inline Compare changes Side-by-side Inline Show whitespace changes Files 1 src/main/java/fr/soleil/archiving/hdbtdb/api/management/attributes/extractor/GenericExtractorMethods.java +52 −48 Original line number Diff line number Diff line 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; Loading @@ -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; Loading @@ -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 ! "; Loading Loading @@ -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; Loading Loading @@ -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) Loading Loading @@ -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; Loading Loading @@ -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 { Loading
src/main/java/fr/soleil/archiving/hdbtdb/api/management/attributes/extractor/GenericExtractorMethods.java +52 −48 Original line number Diff line number Diff line 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; Loading @@ -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; Loading @@ -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 ! "; Loading Loading @@ -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; Loading Loading @@ -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) Loading Loading @@ -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; Loading Loading @@ -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 { Loading