summaryrefslogtreecommitdiff
path: root/wizards/com/sun/star/wizards/db/TypeInspector.java
diff options
context:
space:
mode:
Diffstat (limited to 'wizards/com/sun/star/wizards/db/TypeInspector.java')
-rw-r--r--wizards/com/sun/star/wizards/db/TypeInspector.java34
1 files changed, 14 insertions, 20 deletions
diff --git a/wizards/com/sun/star/wizards/db/TypeInspector.java b/wizards/com/sun/star/wizards/db/TypeInspector.java
index 1f22801fd8c5..bf1a8c3a483f 100644
--- a/wizards/com/sun/star/wizards/db/TypeInspector.java
+++ b/wizards/com/sun/star/wizards/db/TypeInspector.java
@@ -38,6 +38,7 @@ import com.sun.star.sdbc.XRow;
import com.sun.star.uno.AnyConverter;
import com.sun.star.uno.UnoRuntime;
import com.sun.star.wizards.common.JavaTools;
+import com.sun.star.wizards.common.PropertyNames;
public class TypeInspector
{
@@ -87,15 +88,15 @@ public class TypeInspector
Vector<Integer> aSearchableVector = new Vector<Integer>();
// Integer[] aIntegerDataTypes = null;
// XResultSet xResultSet = xDBMetaDagetTypeInfo();
- XRow xRow = (XRow) UnoRuntime.queryInterface(XRow.class, xResultSet);
+ XRow xRow = UnoRuntime.queryInterface(XRow.class, xResultSet);
while (xResultSet.next())
{
- aTypeNameVector.addElement(new String(xRow.getString(1)));
+ aTypeNameVector.addElement(xRow.getString(1));
aTypeVector.addElement(new Integer(xRow.getShort(2)));
aPrecisionVector.addElement(new Integer(xRow.getInt(3)));
aNullableVector.addElement(new Integer(xRow.getShort(7)));
aSearchableVector.addElement(new Integer(xRow.getShort(9)));
- aAutoIncrementVector.addElement(new Boolean(xRow.getBoolean(12)));
+ aAutoIncrementVector.addElement(Boolean.valueOf(xRow.getBoolean(12)));
aMinScaleVector.addElement(new Integer(xRow.getShort(14)));
aMaxScaleVector.addElement(new Integer(xRow.getShort(15)));
@@ -153,12 +154,11 @@ public class TypeInspector
{
return ColumnValue.NO_NULLS;
}
- int nNullable = _nNullable;
- if (nNullable == ColumnValue.NULLABLE)
+ if (_nNullable == ColumnValue.NULLABLE)
{
return nNullableInfos[i]; //probably nullability is not allowed
}
- return nNullable;
+ return _nNullable;
}
public int getNullability(XPropertySet _xColPropertySet)
@@ -230,25 +230,19 @@ public class TypeInspector
int i = JavaTools.FieldInIntTable(nDataTypeInfos, nDataType, startindex);
startindex = i + 1;
bleaveloop = (i < 0);
- if (!bleaveloop)
+ if (!bleaveloop && sTypeName.equals(sDataTypeNames[i]))
{
- if (sTypeName.equals(sDataTypeNames[i]))
+ if (_bCheckNumericAttributes)
{
- if (_bCheckNumericAttributes)
- {
- if (nPrecision <= nPrecisionInfos[i])
- {
- if ((nScale >= nMinScaleInfos[i]) && (nScale <= nMinScaleInfos[i]))
- {
- return i;
- }
- }
- }
- else
+ if (nPrecision <= nPrecisionInfos[i] && (nScale >= nMinScaleInfos[i]) && (nScale <= nMinScaleInfos[i]) )
{
return i;
}
}
+ else
+ {
+ return i;
+ }
}
}
}
@@ -284,7 +278,7 @@ public class TypeInspector
*/
public String getDefaultTypeName(int _curDataType, Integer precision)
{
- String ret = "";
+ String ret = PropertyNames.EMPTY_STRING;
for (int i = 0; i < nDataTypeInfos.length; i++)
{
if (nDataTypeInfos[i] == _curDataType)