From 8f60da0a29744d456cb074af05aeb4b40d1774fa Mon Sep 17 00:00:00 2001 From: Noel Grandin Date: Wed, 14 Oct 2015 11:49:19 +0200 Subject: cid#1326681 DLS: Dead local store and clean up the return value, no need to return a TypeInfo when all we need is a boolean Change-Id: I0909c2b96762870d753c22ab5056e718af56d75b --- wizards/com/sun/star/wizards/db/TypeInspector.java | 27 ++++------------------ .../sun/star/wizards/table/PrimaryKeyHandler.java | 9 +------- 2 files changed, 6 insertions(+), 30 deletions(-) diff --git a/wizards/com/sun/star/wizards/db/TypeInspector.java b/wizards/com/sun/star/wizards/db/TypeInspector.java index e8084b046cd1..a555078a0385 100644 --- a/wizards/com/sun/star/wizards/db/TypeInspector.java +++ b/wizards/com/sun/star/wizards/db/TypeInspector.java @@ -354,28 +354,13 @@ public class TypeInspector return (getAutoIncrementIndex(_xColPropertySet) != INVALID); } - /** finds the first available DataType that can be used as a primary key in a table. - * @return The first datatype that also supports Autoincrmentation is taken according to the following list: - *1) INTEGER - *2) FLOAT - *3) REAL - *4) DOUBLE - *5) NUMERIC - *6) DECIMAL * - * If no appropriate datatype is found the first available numeric type after DataType.INTEGER - * according to the 'convertDataType' method is returned + /** Do we have a datatype that supports AutoIncrementation? */ - /**TODO the fallback order is the same as implemented in the method 'convertDataType'. - * It's not very elegant to have the same intelligence - * on several spots in the class!! - * - */ - public TypeInfo findAutomaticPrimaryKeyType() + public boolean isAutoIncrementationSupported() { - int nDataType; for (int n = 0; n < this.nNumericFallBackList.length; n++) { - nDataType = nNumericFallBackList[n]; + int nDataType = nNumericFallBackList[n]; boolean bleaveloop = false; int startindex = 0; while (!bleaveloop) @@ -386,15 +371,13 @@ public class TypeInspector { if (this.bisAutoIncrementableInfos[i]) { - return new TypeInfo(true); + return true; } startindex = i + 1; } startindex = i + 1; } } - // As Autoincrementation is not supported for any numeric datatype we take the first available numeric Type; - nDataType = convertDataType(DataType.INTEGER); - return new TypeInfo(false); + return false; } } diff --git a/wizards/com/sun/star/wizards/table/PrimaryKeyHandler.java b/wizards/com/sun/star/wizards/table/PrimaryKeyHandler.java index 0fa3e29888ad..64b811403b8c 100644 --- a/wizards/com/sun/star/wizards/table/PrimaryKeyHandler.java +++ b/wizards/com/sun/star/wizards/table/PrimaryKeyHandler.java @@ -60,7 +60,7 @@ public class PrimaryKeyHandler implements XFieldSelectionListener { this.CurUnoDialog = _CurUnoDialog; curTableDescriptor = _curTableDescriptor; - bAutoPrimaryKeysupportsAutoIncrmentation = isAutoPrimeKeyAutoIncrementationsupported(); + bAutoPrimaryKeysupportsAutoIncrmentation = curTableDescriptor.oTypeInspector.isAutoIncrementationSupported(); short curtabindex = (short) ((TableWizard.SOPRIMARYKEYPAGE * 100) - 20); Integer IPRIMEKEYSTEP = Integer.valueOf(TableWizard.SOPRIMARYKEYPAGE); final String sExplanations = CurUnoDialog.m_oResource.getResText(UIConsts.RID_TABLE + 26); @@ -245,13 +245,6 @@ public class PrimaryKeyHandler implements XFieldSelectionListener togglePrimeKeyFields(); } - private boolean isAutoPrimeKeyAutoIncrementationsupported() - { - TypeInspector.TypeInfo aAutoPrimeTypeInfo; - aAutoPrimeTypeInfo = curTableDescriptor.oTypeInspector.findAutomaticPrimaryKeyType(); - return aAutoPrimeTypeInfo.bisAutoIncrementable; - } - public boolean iscompleted() { if (chkcreatePrimaryKey.getState() == 0) -- cgit