[ https://issues.apache.org/jira/browse/DERBY-3181?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15299241#comment-15299241 ]
ASF subversion and git services commented on DERBY-3181: -------------------------------------------------------- Commit 1745414 from [~bryanpendleton] in branch 'code/trunk' [ https://svn.apache.org/r1745414 ] DERBY-3181: DatabaseMetaData.getBestRowIdentifier behavior with invalid scope This patch was contributed by Danoja Dias (danojadias at gmail dot com) The DatabaseMetaData.getBestRowIdentifier method takes a number of arguments, including "scope", which is supposed to be one of the enumerated values: bestRowTemporary, bestRowTransaction, and bestRowSession. If an invalid scope argument was passed to this method, Derby was returning a hard-coded "empty" row identifier, which was slightly different, in detail, to the row identifier that is returned for a valid scope argument. Since JDBC does not require that we return such a row identifier for an invalid scope argument, it seems cleaner and more useful to throw an exception with a message indicating that an invalid scope argument was passed. The caller can then correct their application to make the call with a valid scope argument, and will then receive a valid row identifier. > isNullable on ResultSetMetaData from DatabaseMetaData.getBestRowIdentifier > values are opposite when there is no rows in ResultSet vs. when there is a > row. > ---------------------------------------------------------------------------------------------------------------------------------------------------------- > > Key: DERBY-3181 > URL: https://issues.apache.org/jira/browse/DERBY-3181 > Project: Derby > Issue Type: Bug > Components: JDBC > Affects Versions: 10.4.1.3 > Reporter: Myrna van Lunteren > Assignee: Danoja Dias > Priority: Trivial > Labels: derby_triage10_5_2 > Attachments: Derby-3181.diff, Derby3181.diff, repro.java, > testChange.diff > > > With code like the following: > DatabaseMetaData dmd = conn.getMetaData(); > ResultSet rs = dmd.getBestRowIdentifier(null,"APP","a",3,true); > ResultSetMetaData rsmd = rs.getMetaData(); > int actualCols = rsmd.getColumnCount(); > for (int i = 0; i < actualCols; i++) > { > System.out.print("getColumnName: " + rsmd.getColumnName(i+1) > + ", isNullable: "); > System.out.println(rsmd.isNullable(i+1)); > } > The printed values for isNullable returned are opposite of what they are when > the getBestRowIdentifier call looks like this: > ResultSet rs = dmd.getBestRowIdentifier(null,"APP","a",1,true); > In the latter case, the values are: > getColumnName: SCOPE, isNullable: 0 > getColumnName: COLUMN_NAME, isNullable: 1 > getColumnName: DATA_TYPE, isNullable: 0 > getColumnName: TYPE_NAME, isNullable: 1 > getColumnName: COLUMN_SIZE, isNullable: 0 > getColumnName: BUFFER_LENGTH, isNullable: 0 > getColumnName: DECIMAL_DIGITS, isNullable: 0 > getColumnName: PSEUDO_COLUMN, isNullable: 0 > In the first case, the values are: > getColumnName: SCOPE, isNullable: 1 > getColumnName: COLUMN_NAME, isNullable: 0 > getColumnName: DATA_TYPE, isNullable: 1 > getColumnName: TYPE_NAME, isNullable: 1 > getColumnName: COLUMN_SIZE, isNullable: 1 > getColumnName: BUFFER_LENGTH, isNullable: 1 > getColumnName: DECIMAL_DIGITS, isNullable: 1 > getColumnName: PSEUDO_COLUMN, isNullable: 1 > The isNullable value should be stable. > It's probably worthwhile verifying what the value *should* be in the first > place. -- This message was sent by Atlassian JIRA (v6.3.4#6332)