/** * Removes previous ra/dec index, if it is found. * * @param dbConn database connection * @param tapTableInfo current database information. * @return 'true' if the field has been updated. * @throws DBException */ public static boolean removePrevRaDecIfExists( JDBCPooledFunctions dbConn, TapTableInfo tapTableInfo) throws DBException { String raColumn = null; String decColumn = null; int flags = 0; for (String tableColumnName : tapTableInfo.getTableColumnNames()) { // tapTableInfo contains database current info: flags is an integer in database (it can be // null) flags = Utils.getFlagsFromTapTable(tapTableInfo, tableColumnName); if ((flags & Utils.TAP_COLUMN_TABLE_FLAG_RA) > 0) { raColumn = tableColumnName; continue; } if ((flags & Utils.TAP_COLUMN_TABLE_FLAG_DEC) > 0) { decColumn = tableColumnName; continue; } } if (raColumn == null || decColumn == null) { // wrong ra/dec specification, no index created. return false; } // we have the previous ra/dec indexed columns, remove them dbConn.removeRaAndDecIndexes( tapTableInfo.getSchemaName(), tapTableInfo.getTableName(), raColumn, decColumn, Utils.TAP_TABLE_TYPE_RADEC); return true; }