Changeset: 890dce2d5305 for monetdb-java
URL: https://dev.monetdb.org/hg/monetdb-java?cmd=changeset;node=890dce2d5305
Added Files:
.hgignore
tests/BugResultSetMetaData_Bug_6183.java
Removed Files:
jdbc-3_0-fr-spec.pdf
jdbc4.0-fr-spec.pdf
Modified Files:
build.properties
pom.xml
src/main/java/nl/cwi/monetdb/jdbc/MonetPreparedStatement.java
tests/build.xml
Branch: embedded
Log Message:
Merged changes for Bug 6183
diffs (truncated from 779 to 300 lines):
diff --git a/.hgignore b/.hgignore
new file mode 100644
--- /dev/null
+++ b/.hgignore
@@ -0,0 +1,19 @@
+syntax: glob
+
+# files created by the normal build process
+*.class
+*.jar
+build/META-INF/services/java.sql.Driver
+src/main/java/nl/cwi/monetdb/jdbc/MonetDriver.java
+
+# files generated by various editors
+*.swp
+*~
+\#*
+.#*
+
+# other files we don't want
+TAGS
+tags
+*.rej
+*.orig
diff --git a/build.properties b/build.properties
--- a/build.properties
+++ b/build.properties
@@ -19,7 +19,7 @@ MCL_MINOR=14
# major release number
JDBC_MAJOR=2
# minor release number
-JDBC_MINOR=30
+JDBC_MINOR=31
# an additional identifying string
JDBC_VER_SUFFIX=Liberica
# the default port to connect on, if no port given when using SQL
diff --git a/jdbc-3_0-fr-spec.pdf b/jdbc-3_0-fr-spec.pdf
deleted file mode 100644
index
6ac85a733bcf33556961662141bb1bcf7abbd996..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391
GIT binary patch
literal 0
Hc$@<O00001
diff --git a/jdbc4.0-fr-spec.pdf b/jdbc4.0-fr-spec.pdf
deleted file mode 100644
index
61a3a4507dc615fcebb61f61ae05c4a537b03a88..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391
GIT binary patch
literal 0
Hc$@<O00001
diff --git a/pom.xml b/pom.xml
--- a/pom.xml
+++ b/pom.xml
@@ -6,7 +6,7 @@
<groupId>monetdb</groupId>
<artifactId>monetdb-jdbc-new</artifactId>
- <version>2.30</version>
+ <version>2.31</version>
<name>MonetDB JDBC new</name>
<description>MonetDB Adapted JDBC driver for embedded
connection</description>
<url>https://www.monetdb.org</url>
diff --git a/src/main/java/nl/cwi/monetdb/jdbc/MonetPreparedStatement.java
b/src/main/java/nl/cwi/monetdb/jdbc/MonetPreparedStatement.java
--- a/src/main/java/nl/cwi/monetdb/jdbc/MonetPreparedStatement.java
+++ b/src/main/java/nl/cwi/monetdb/jdbc/MonetPreparedStatement.java
@@ -16,6 +16,7 @@ import java.io.InputStream;
import java.io.Reader;
import java.io.IOException;
import java.math.BigDecimal;
+import java.math.BigInteger;
import java.math.RoundingMode;
import java.net.URL;
import java.nio.CharBuffer;
@@ -364,7 +365,7 @@ public class MonetPreparedStatement exte
public boolean isCurrency(int column) {
return false;
}
-
+
/**
* Indicates whether values in the designated column
are signed numbers.
* Within MonetDB all numeric types (except oid and
ptr) are signed.
@@ -637,7 +638,7 @@ public class MonetPreparedStatement exte
if (column[i] == null)
cnt++;
}
-
+
return cnt;
}
@@ -1067,7 +1068,7 @@ public class MonetPreparedStatement exte
*/
@Override
public void setBoolean(int parameterIndex, boolean x) throws
SQLException {
- setValue(parameterIndex, "" + x);
+ setValue(parameterIndex, Boolean.toString(x));
}
/**
@@ -1080,7 +1081,7 @@ public class MonetPreparedStatement exte
*/
@Override
public void setByte(int parameterIndex, byte x) throws SQLException {
- setValue(parameterIndex, "" + x);
+ setValue(parameterIndex, Byte.toString(x));
}
private static final String HEXES = "0123456789ABCDEF";
@@ -1322,7 +1323,7 @@ public class MonetPreparedStatement exte
*/
@Override
public void setDouble(int parameterIndex, double x) throws SQLException
{
- setValue(parameterIndex, "" + x);
+ setValue(parameterIndex, Double.toString(x));
}
/**
@@ -1335,7 +1336,7 @@ public class MonetPreparedStatement exte
*/
@Override
public void setFloat(int parameterIndex, float x) throws SQLException {
- setValue(parameterIndex, "" + x);
+ setValue(parameterIndex, Float.toString(x));
}
/**
@@ -1348,7 +1349,7 @@ public class MonetPreparedStatement exte
*/
@Override
public void setInt(int parameterIndex, int x) throws SQLException {
- setValue(parameterIndex, "" + x);
+ setValue(parameterIndex, Integer.toString(x));
}
/**
@@ -1361,7 +1362,7 @@ public class MonetPreparedStatement exte
*/
@Override
public void setLong(int parameterIndex, long x) throws SQLException {
- setValue(parameterIndex, "" + x);
+ setValue(parameterIndex, Long.toString(x));
}
/**
@@ -1599,123 +1600,120 @@ public class MonetPreparedStatement exte
* @see Types
*/
@Override
- public void setObject(int parameterIndex, Object x, int targetSqlType,
int scale) throws SQLException {
+ public void setObject(
+ int parameterIndex,
+ Object x,
+ int targetSqlType,
+ int scale)
+ throws SQLException
+ {
// this is according to table B-5
if (x instanceof String) {
switch (targetSqlType) {
+ case Types.CHAR:
+ case Types.VARCHAR:
+ case Types.LONGVARCHAR:
+ case Types.CLOB:
+ setString(parameterIndex, (String)x);
+ break;
case Types.TINYINT:
- byte val1;
- try {
- val1 =
Byte.parseByte((String)x);
- } catch (NumberFormatException e) {
- val1 = 0;
- }
- setByte(parameterIndex, val1);
- break;
case Types.SMALLINT:
- short val2;
+ case Types.INTEGER:
+ {
+ int val;
try {
- val2 =
Short.parseShort((String)x);
+ val =
Integer.parseInt((String)x);
} catch (NumberFormatException e) {
- val2 = 0;
+ val = 0;
}
- setShort(parameterIndex, val2);
- break;
- case Types.INTEGER:
- int val3;
- try {
- val3 =
Integer.parseInt((String)x);
- } catch (NumberFormatException e) {
- val3 = 0;
- }
- setInt(parameterIndex, val3);
- break;
+ setInt(parameterIndex, val);
+ } break;
case Types.BIGINT:
- long val4;
+ {
+ long val;
try {
- val4 =
Long.parseLong((String)x);
+ val = Long.parseLong((String)x);
} catch (NumberFormatException e) {
- val4 = 0;
- }
- setLong(parameterIndex, val4);
- break;
- case Types.REAL:
- float val5;
- try {
- val5 =
Float.parseFloat((String)x);
- } catch (NumberFormatException e) {
- val5 = 0;
+ val = 0;
}
- setFloat(parameterIndex, val5);
- break;
- case Types.DOUBLE:
- double val6;
+ setLong(parameterIndex, val);
+ } break;
+ case Types.REAL:
+ {
+ float val;
try {
- val6 =
Double.parseDouble((String)x);
+ val =
Float.parseFloat((String)x);
} catch (NumberFormatException e) {
- val6 = 0;
+ val = 0;
}
- setDouble(parameterIndex, val6);
- break;
+ setFloat(parameterIndex, val);
+ } break;
+ case Types.FLOAT:
+ case Types.DOUBLE:
+ {
+ double val;
+ try {
+ val =
Double.parseDouble((String)x);
+ } catch (NumberFormatException e) {
+ val = 0;
+ }
+ setDouble(parameterIndex, val);
+ } break;
+ case Types.DECIMAL:
case Types.NUMERIC:
- case Types.DECIMAL:
- BigDecimal val8;
+ {
+ BigDecimal val;
try {
- val8 = new
BigDecimal((String)x);
+ val = new BigDecimal((String)x);
} catch (NumberFormatException e) {
try {
- val8 = BigDecimal.ZERO;
+ val = new
BigDecimal(0.0);
} catch (NumberFormatException
ex) {
throw new
SQLException("Internal error: unable to create template BigDecimal: " +
ex.getMessage(), "M0M03");
}
}
- val8 = val8.setScale(scale,
BigDecimal.ROUND_HALF_UP);
- setBigDecimal(parameterIndex, val8);
- break;
+ val = val.setScale(scale,
BigDecimal.ROUND_HALF_UP);
+ setBigDecimal(parameterIndex, val);
+ } break;
+ case Types.BIT:
case Types.BOOLEAN:
- setBoolean(parameterIndex,
Boolean.valueOf((String) x));
+ setBoolean(parameterIndex,
(Boolean.valueOf((String)x)).booleanValue());
break;
- case Types.CHAR:
- case Types.VARCHAR:
- case Types.LONGVARCHAR:
- setString(parameterIndex, (String)x);
- break;
+ case Types.BINARY:
+ case Types.VARBINARY:
case Types.LONGVARBINARY:
setBytes(parameterIndex,
((String)x).getBytes());
break;
- case Types.BLOB:
- setBlob(parameterIndex, new
MonetBlob(((String)x).getBytes()));
- break;
- case Types.CLOB:
- setClob(parameterIndex, new
MonetClob((String)x));
- break;
case Types.DATE:
- Date val9;
+ {
+ java.sql.Date val;
try {
_______________________________________________
checkin-list mailing list
[email protected]
https://www.monetdb.org/mailman/listinfo/checkin-list