You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ignite.apache.org by vo...@apache.org on 2016/02/11 14:18:54 UTC
ignite git commit: 1) Moved "add quotation" method to utility class.
2) Added hashCode() to OdbcTableMeta.
Repository: ignite
Updated Branches:
refs/heads/ignite-1786 91f117e9f -> 07104c405
1) Moved "add quotation" method to utility class.
2) Added hashCode() to OdbcTableMeta.
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/07104c40
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/07104c40
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/07104c40
Branch: refs/heads/ignite-1786
Commit: 07104c40592230b3f3cbdcf22f16050b3cd8b147
Parents: 91f117e
Author: vozerov-gridgain <vo...@gridgain.com>
Authored: Thu Feb 11 16:18:50 2016 +0300
Committer: vozerov-gridgain <vo...@gridgain.com>
Committed: Thu Feb 11 16:18:50 2016 +0300
----------------------------------------------------------------------
.../processors/odbc/OdbcColumnMeta.java | 17 +-------
.../odbc/OdbcQueryExecuteRequest.java | 4 +-
.../odbc/OdbcQueryGetColumnsMetaRequest.java | 4 +-
.../internal/processors/odbc/OdbcTableMeta.java | 33 +++++++--------
.../internal/processors/odbc/OdbcUtils.java | 43 ++++++++++++++++++++
5 files changed, 65 insertions(+), 36 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/07104c40/modules/core/src/main/java/org/apache/ignite/internal/processors/odbc/OdbcColumnMeta.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/odbc/OdbcColumnMeta.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/odbc/OdbcColumnMeta.java
index 0294fcd..5e1b862 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/odbc/OdbcColumnMeta.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/odbc/OdbcColumnMeta.java
@@ -43,26 +43,13 @@ public class OdbcColumnMeta {
private final Class<?> dataType;
/**
- * Add quotation marks at the beginning and end of the string.
- *
- * @param str Input string.
- * @return String surrounded with quotation marks.
- */
- private String AddQuotationMarksIfNeeded(String str) {
- if (!str.startsWith("\"") && !str.isEmpty())
- return "\"" + str + "\"";
-
- return str;
- }
-
- /**
* @param schemaName Cache name.
* @param tableName Table name.
* @param columnName Column name.
* @param dataType Data type.
*/
public OdbcColumnMeta(String schemaName, String tableName, String columnName, Class<?> dataType) {
- this.schemaName = AddQuotationMarksIfNeeded(schemaName);
+ this.schemaName = OdbcUtils.addQuotationMarksIfNeeded(schemaName);
this.tableName = tableName;
this.columnName = columnName;
this.dataType = dataType;
@@ -72,7 +59,7 @@ public class OdbcColumnMeta {
* @param info Field metadata.
*/
public OdbcColumnMeta(GridQueryFieldMetadata info) {
- this.schemaName = AddQuotationMarksIfNeeded(info.schemaName());
+ this.schemaName = OdbcUtils.addQuotationMarksIfNeeded(info.schemaName());
this.tableName = info.typeName();
this.columnName = info.fieldName();
http://git-wip-us.apache.org/repos/asf/ignite/blob/07104c40/modules/core/src/main/java/org/apache/ignite/internal/processors/odbc/OdbcQueryExecuteRequest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/odbc/OdbcQueryExecuteRequest.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/odbc/OdbcQueryExecuteRequest.java
index dd45f77..5cb80c3 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/odbc/OdbcQueryExecuteRequest.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/odbc/OdbcQueryExecuteRequest.java
@@ -17,6 +17,8 @@
package org.apache.ignite.internal.processors.odbc;
+import org.jetbrains.annotations.Nullable;
+
/**
* ODBC query execute request.
*/
@@ -60,7 +62,7 @@ public class OdbcQueryExecuteRequest extends OdbcRequest {
/**
* @return Cache name.
*/
- public String cacheName() {
+ @Nullable public String cacheName() {
return cacheName;
}
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/07104c40/modules/core/src/main/java/org/apache/ignite/internal/processors/odbc/OdbcQueryGetColumnsMetaRequest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/odbc/OdbcQueryGetColumnsMetaRequest.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/odbc/OdbcQueryGetColumnsMetaRequest.java
index 74da181..35ce418 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/odbc/OdbcQueryGetColumnsMetaRequest.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/odbc/OdbcQueryGetColumnsMetaRequest.java
@@ -17,6 +17,8 @@
package org.apache.ignite.internal.processors.odbc;
+import org.jetbrains.annotations.Nullable;
+
/**
* ODBC query get columns meta request.
*/
@@ -46,7 +48,7 @@ public class OdbcQueryGetColumnsMetaRequest extends OdbcRequest {
/**
* @return Cache name.
*/
- public String cacheName() {
+ @Nullable public String cacheName() {
return cacheName;
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/07104c40/modules/core/src/main/java/org/apache/ignite/internal/processors/odbc/OdbcTableMeta.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/odbc/OdbcTableMeta.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/odbc/OdbcTableMeta.java
index fb64389..775cd24 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/odbc/OdbcTableMeta.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/odbc/OdbcTableMeta.java
@@ -38,19 +38,6 @@ public class OdbcTableMeta {
private final String tableType;
/**
- * Add quotation marks at the beginning and end of the string.
- *
- * @param str Input string.
- * @return String surrounded with quotation marks.
- */
- private String AddQuotationMarksIfNeeded(String str) {
- if (!str.startsWith("\"") && !str.isEmpty())
- return "\"" + str + "\"";
-
- return str;
- }
-
- /**
* @param catalog Catalog name.
* @param schema Schema name.
* @param table Table name.
@@ -58,22 +45,30 @@ public class OdbcTableMeta {
*/
public OdbcTableMeta(String catalog, String schema, String table, String tableType) {
this.catalog = catalog;
- this.schema = AddQuotationMarksIfNeeded(schema);
+ this.schema = OdbcUtils.addQuotationMarksIfNeeded(schema);
this.table = table;
this.tableType = tableType;
}
/** {@inheritDoc} */
- @Override public boolean equals(Object o)
- {
+ @Override public int hashCode() {
+ int hash = catalog.hashCode();
+
+ hash = 31 * hash + schema.hashCode();
+ hash = 31 * hash + table.hashCode();
+ hash = 31 * hash + tableType.hashCode();
+
+ return hash;
+ }
+
+ /** {@inheritDoc} */
+ @Override public boolean equals(Object o) {
if (!(o instanceof OdbcTableMeta))
return false;
OdbcTableMeta another = (OdbcTableMeta)o;
- return catalog.equals(another.catalog) &&
- schema.equals(another.schema) &&
- table.equals(another.table) &&
+ return catalog.equals(another.catalog) && schema.equals(another.schema) && table.equals(another.table) &&
tableType.equals(another.tableType);
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/07104c40/modules/core/src/main/java/org/apache/ignite/internal/processors/odbc/OdbcUtils.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/odbc/OdbcUtils.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/odbc/OdbcUtils.java
new file mode 100644
index 0000000..7bb4758
--- /dev/null
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/odbc/OdbcUtils.java
@@ -0,0 +1,43 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ignite.internal.processors.odbc;
+
+/**
+ * Various ODBC utility methods.
+ */
+public class OdbcUtils {
+ /**
+ * Add quotation marks at the beginning and end of the string.
+ *
+ * @param str Input string.
+ * @return String surrounded with quotation marks.
+ */
+ public static String addQuotationMarksIfNeeded(String str) {
+ if (!str.startsWith("\"") && !str.isEmpty())
+ return "\"" + str + "\"";
+
+ return str;
+ }
+
+ /**
+ * Private constructor.
+ */
+ private OdbcUtils() {
+ // No-op.
+ }
+}