Revision 44678 trunk/org.gvsig.desktop/org.gvsig.desktop.compat.cdc/org.gvsig.fmap.dal/org.gvsig.fmap.dal.spi/src/main/java/org/gvsig/fmap/dal/feature/spi/SQLBuilderBase.java
SQLBuilderBase.java | ||
---|---|---|
50 | 50 |
import org.gvsig.fmap.dal.SQLBuilder.UpdateTableStatisticsBuilder; |
51 | 51 |
import org.gvsig.fmap.dal.feature.FeatureAttributeDescriptor; |
52 | 52 |
import org.gvsig.fmap.geom.Geometry; |
53 |
import org.gvsig.tools.dataTypes.DataType; |
|
53 | 54 |
import org.slf4j.Logger; |
54 | 55 |
import org.slf4j.LoggerFactory; |
55 | 56 |
|
... | ... | |
2476 | 2477 |
protected String type_char = "CHARACTER(1)"; |
2477 | 2478 |
protected String type_date = "DATE"; |
2478 | 2479 |
protected String type_double = "DOUBLE PRECISION"; //float con 53 bits de mantisa, float(54) |
2479 |
protected String type_numeric_p = "NUMERIC({0,Number,#######})"; |
|
2480 |
protected String type_numeric_ps = "NUMERIC({0,Number,#######},{1,Number,#######})"; |
|
2481 |
protected String type_bigdecimal = "NUMERIC({0,Number,#######},{1,Number,#######})"; |
|
2480 |
protected String type_decimal_ps = "NUMERIC({0,Number,##########},{1,Number,##########})"; |
|
2481 |
protected String type_decimal_p = "NUMERIC({0,Number,##########})"; |
|
2482 | 2482 |
protected String type_float = "REAL"; //float con 24 bits de mantisa, float(24) |
2483 | 2483 |
protected String type_int = "INT"; |
2484 | 2484 |
protected String type_long = "BIGINT"; |
... | ... | |
2636 | 2636 |
switch (type) { |
2637 | 2637 |
case DataTypes.BOOLEAN: |
2638 | 2638 |
return type_boolean; |
2639 |
case DataTypes.BYTE: |
|
2640 |
return type_byte; |
|
2641 |
case DataTypes.BYTEARRAY: |
|
2642 |
return type_bytearray; |
|
2643 |
case DataTypes.GEOMETRY: |
|
2644 |
return type_geometry; |
|
2645 | 2639 |
case DataTypes.CHAR: |
2646 | 2640 |
return type_char; |
2647 |
case DataTypes.DATE: |
|
2648 |
return type_date; |
|
2649 |
case DataTypes.DOUBLE: |
|
2650 |
// FIXME: Si cargamos la capa "country" al exportarla a |
|
2651 |
// SQLServer falla por: |
|
2652 |
// Error de desbordamiento aritm?tico al convertir float al tipo de datos numeric. |
|
2653 |
// Al parecer la capa declara la columna sqkm_ctry como Numeric(12,6) y para |
|
2654 |
// Algeria intenta asignarle un valor de 2320972.0 y falla. |
|
2655 |
// Habria que repasar el proveedor de shape. |
|
2656 | 2641 |
|
2657 |
// if (p > 1) { |
|
2658 |
// if (s < 0) { |
|
2659 |
// return MessageFormat.format(config.getString(SQLConfig.type_numeric_p), p); |
|
2660 |
// } |
|
2661 |
// return MessageFormat.format(config.getString(SQLConfig.type_numeric_ps), p,s); |
|
2662 |
// } |
|
2663 |
return MessageFormat.format(type_double, precision, scale); |
|
2642 |
|
|
2643 |
case DataTypes.BYTE: |
|
2644 |
return type_byte; |
|
2645 |
case DataTypes.INT: |
|
2646 |
return type_int; |
|
2647 |
case DataTypes.LONG: |
|
2648 |
return type_long; |
|
2649 |
|
|
2650 |
case DataTypes.FLOAT: |
|
2651 |
return type_float; |
|
2652 |
case DataTypes.DOUBLE: |
|
2653 |
return type_double; |
|
2664 | 2654 |
case DataTypes.DECIMAL: |
2665 | 2655 |
if (precision < 1) { |
2666 |
precision = 20;
|
|
2656 |
precision = DataType.DECIMAL_DEFAULT_PRECISION;
|
|
2667 | 2657 |
} |
2668 |
if (scale < 0) {
|
|
2669 |
scale = 10;
|
|
2658 |
if (scale < 1) {
|
|
2659 |
return MessageFormat.format(type_decimal_p, precision);
|
|
2670 | 2660 |
} |
2671 |
return MessageFormat.format(type_bigdecimal, precision, scale); |
|
2672 |
case DataTypes.FLOAT: |
|
2673 |
return MessageFormat.format(type_float, precision, scale); |
|
2674 |
case DataTypes.INT: |
|
2675 |
return MessageFormat.format(type_int, precision, scale); |
|
2676 |
case DataTypes.LONG: |
|
2677 |
return MessageFormat.format(type_long, precision, scale); |
|
2661 |
return MessageFormat.format(type_decimal_ps, precision, scale); |
|
2662 |
|
|
2663 |
|
|
2678 | 2664 |
case DataTypes.STRING: |
2679 | 2665 |
if (size < 0) { |
2680 | 2666 |
return type_string; |
... | ... | |
2682 | 2668 |
return MessageFormat.format(type_string_p, size); |
2683 | 2669 |
} |
2684 | 2670 |
return type_string; |
2671 |
|
|
2672 |
|
|
2673 |
case DataTypes.DATE: |
|
2674 |
return type_date; |
|
2685 | 2675 |
case DataTypes.TIME: |
2686 | 2676 |
return type_time; |
2687 | 2677 |
case DataTypes.TIMESTAMP: |
2688 | 2678 |
return type_timestamp; |
2679 |
|
|
2680 |
case DataTypes.BYTEARRAY: |
|
2681 |
return type_bytearray; |
|
2682 |
|
|
2683 |
case DataTypes.GEOMETRY: |
|
2684 |
return type_geometry; |
|
2685 |
|
|
2689 | 2686 |
case DataTypes.VERSION: |
2690 | 2687 |
return type_version; |
2691 | 2688 |
case DataTypes.URI: |
Also available in: Unified diff