Here you can find the source of hasGeometryField(ResultSet resultSet)
Parameter | Description |
---|---|
resultSet | a parameter |
Parameter | Description |
---|---|
SQLException | an exception |
public static boolean hasGeometryField(ResultSet resultSet) throws SQLException
//package com.java2s; /*/*w w w . j ava2 s.co m*/ * h2spatial is a library that brings spatial support to the H2 Java database. * * h2spatial is distributed under GPL 3 license. It is produced by the "Atelier SIG" * team of the IRSTV Institute <http://www.irstv.fr/> CNRS FR 2488. * * Copyright (C) 2007-2014 IRSTV (FR CNRS 2488) * * h2patial is free software: you can redistribute it and/or modify it under the * terms of the GNU General Public License as published by the Free Software * Foundation, either version 3 of the License, or (at your option) any later * version. * * h2spatial is distributed in the hope that it will be useful, but WITHOUT ANY * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR * A PARTICULAR PURPOSE. See the GNU General Public License for more details. * * You should have received a copy of the GNU General Public License along with * h2spatial. If not, see <http://www.gnu.org/licenses/>. * * For more information, please consult: <http://www.orbisgis.org/> * or contact directly: * info_at_ orbisgis.org */ import java.sql.ResultSet; import java.sql.ResultSetMetaData; import java.sql.SQLException; public class Main { /** * Check if the resultset contains a geometry field * * @param resultSet * @return true if the resultset contains one geometry field * @throws SQLException */ public static boolean hasGeometryField(ResultSet resultSet) throws SQLException { ResultSetMetaData meta = resultSet.getMetaData(); int columnCount = meta.getColumnCount(); for (int i = 1; i <= columnCount; i++) { if (meta.getColumnTypeName(i).equalsIgnoreCase("geometry")) { return true; } } return false; } }