You are viewing a plain text version of this content. The canonical link for it is here.
Posted to derby-dev@db.apache.org by "Tomohito Nakayama (JIRA)" <de...@db.apache.org> on 2006/09/04 19:42:24 UTC

[jira] Commented: (DERBY-1610) Resolve difference of type compatibility between Embedded and NetworkServer/NetworkDriver

    [ http://issues.apache.org/jira/browse/DERBY-1610?page=comments#action_12432531 ] 
            
Tomohito Nakayama commented on DERBY-1610:
------------------------------------------

Now, I'm adding type checking code to org.apache.derby.client.am.PreparedStatement, 
and found what is questionable in test of setNull method.

Reading the jdbcapi/parameterMapping.java, 
it seems that only exception of "22005" is regarded as expected exception in test of setNull method.

Next is the code of that:

org.apache.derbyTesting.functionTests.tests.jdbcapi.parameterMapping :
				 // NOW THE SET METHODS
				 System.out.println("setNull() with all JDBC Types on " + SQLTypes[type]);
				 for (int st = 0; st <= jdbcTypes.length + 1; st++) {

					if (st >= jdbcTypes.length || jdbcTypes[st] != Types.NULL)
					{
						// explictily test Types.NULL.
						 int sqlTypeNull;
						 if (st == jdbcTypes.length + 1)
							sqlTypeNull = 235350345; // bad value
						 else if (st == jdbcTypes.length)
							 sqlTypeNull = Types.NULL;
						 else
							sqlTypeNull = jdbcTypes[st];

						s.execute("DELETE FROM PM.TYPE_AS");

						SQLException sqleResult = null;
						try {
							System.out.print("  setNull(" + TestUtil.sqlNameFromJdbc(sqlTypeNull) + ") ");
							psi.setNull(1, sqlTypeNull);
							psi.executeUpdate();

							getValidValue(psq, jdbcTypes[type]); // yes type, not st

							System.out.println("");

						} catch (SQLException sqle) {
							sqleResult = sqle;
							if ("22005".equals(sqle.getSQLState()))
								System.out.println("IC");
							else
								dumpSQLExceptions(sqle);

						}

The error of 22005 was found in SQLState as next.
	String LANG_DATA_TYPE_GET_MISMATCH                                 = "22005"; // same 22005 error

The name of this variable told that this exception is thrown from get method.

However, this part of the test is setNull test and not test of get method.
Is it mean that setNull method does not throw any exception caused by incompatible type ?

//Well... reading http://db.apache.org/derby/docs/dev/ref/rrefsqlj19433.html#rrefsqlj19433__sqlj18370, 
//it is told that NULL is an untyped constant representing the unknown value.
//Then, it may be natural consequence setNull method does not throw any exception for  incompatible type...

> Resolve difference of type compatibility between Embedded and NetworkServer/NetworkDriver
> -----------------------------------------------------------------------------------------
>
>                 Key: DERBY-1610
>                 URL: http://issues.apache.org/jira/browse/DERBY-1610
>             Project: Derby
>          Issue Type: Bug
>          Components: Network Server, Network Client
>            Reporter: Tomohito Nakayama
>         Assigned To: Tomohito Nakayama
>         Attachments: DERBY-1610.diff, DERBY-1610_2.diff, parameterMapping.diff, parameterMapping.diff, parameterMapping.diff.betweenEmbedded_and_NetworkServerNetworkClient, TestNullChar.java
>
>
> There exists difference of type compatibility between  Embedded and NetworkServer/NetworkClient.
> This issue tries to resolve it.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira