trafodion-codereview mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kevinxu021 <...@git.apache.org>
Subject [GitHub] incubator-trafodion pull request #508: [TRAFODION-2018]T4 catalog (getProc...
Date Thu, 02 Jun 2016 01:35:22 GMT
Github user kevinxu021 commented on a diff in the pull request:

    https://github.com/apache/incubator-trafodion/pull/508#discussion_r65471952
  
    --- Diff: core/conn/jdbcT4/src/main/java/org/trafodion/jdbc/t4/T4DatabaseMetaData.java
---
    @@ -3092,27 +3090,40 @@ public boolean dataDefinitionIgnoredInTransactions() throws SQLException
{
     			// dropped from the search."
     			procedureNamePattern = "%";
     
    +		}else{
    +			procedureNamePattern = sqlValueFormat(procedureNamePattern);
    +		}
    +		MetadataHolder mdHolder = this.connection_.mdHolder_;
    +		int retryCnt = 0;
    +		while(retryCnt < 3 ) {
    +			try {
    +				PreparedStatement ps = mdHolder.getPStatement(SQL_API_SQLPROCEDURES, this.connection_);
    +				ps.setObject(1, schemaPattern);
    +				ps.setObject(2, procedureNamePattern);
    +				return ps.executeQuery();
    +			} catch (SQLException e) {
    +				mdHolder.removePStatement(SQL_API_SQLPROCEDURES);
    +				++retryCnt;
    +				if( retryCnt >= 3 ) {
    +					throw e;
    +				}
    +			}
     		}
    -		getSQLCatalogsInfo(connection_.getServerHandle(), // Server Handle
    -				SQL_API_SQLPROCEDURES, // catalogAPI
    -				catalogNm, // catalog
    -				schemaNm, // schema
    -				procedureNamePattern, // table name
    -				"", // tableTypeList
    -				"", // cloumn name
    -				(int) 0, // cloumnType
    -				(int) 0, // rowIdScope
    -				(long) 0, // nullable
    -				(int) 0, // uniqueness
    -				(int) 0, // accuracy
    -				(short) 0, // sqlType
    -				(int) 0, // metadataId
    -				"", // fcatalog
    -				"", // fschema
    -				"" // ftable
    -		);
    +		return null;
    +	}
    --- End diff --
    
    For ODBC: https://msdn.microsoft.com/en-us/library/ms715368(v=vs.85).aspx
    For JDBC: http://docs.oracle.com/javase/8/docs/api/     java.sql -> DatabaseMetaData
-> getProcedures(..)
    As you see, it's different between JDK1.7 and ODBC3.0. Do you want to add if-else on server-side?
If any changes, I think it's pretty easy to upgrade drivers instead of server for customer,
right? It should be nice for server to treat it as a common SELECT command instead of extra
maintenance work. My suggestion is to put it into drivers, not sure how many differences they
will have between driver in the future.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

Mime
View raw message