/* Copyright (C) 2005 MySQL AB This program is free software; you can redistribute it and/or modify it under the terms of version 2 of the GNU General Public License as published by the Free Software Foundation. There are special exceptions to the terms and conditions of the GPL as it is applied to this software. View the full text of the exception in file EXCEPTIONS-CONNECTOR-J in the directory of this software distribution. This program 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 this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ import java.sql.Connection; import java.sql.Statement; import java.util.ArrayList; import java.util.HashMap; import java.util.Iterator; import java.util.List; import java.util.Locale; import java.util.Map; import java.util.Properties; import java.sql.SQLException; import java.sql.*; import testsuite.BaseTestCase; public class bug27915_2 extends BaseTestCase { public bug27915_2(String name) { super(name); // TODO Auto-generated constructor stub dbUrl = "jdbc:mysql://127.0.0.1:3351/test?user=root"; } public static void main(String[] args) { junit.textui.TestRunner.run(bug27915_2.class); } public void testBug3753() throws SQLException { String[] reqColumns = {"TABLE_CAT", "TABLE_SCHEM", "TABLE_NAME", "COLUMN_NAME", "DATA_TYPE", "TYPE_NAME", "COLUMN_SIZE", "BUFFER_LENGTH", "DECIMAL_DIGITS", "NUM_PREC_RADIX", "NULLABLE", "REMARKS", "COLUMN_DEF", "SQL_DATA_TYPE", "SQL_DATETIME_SUB", "CHAR_OCTET_LENGTH", "ORDINAL_POSITION", "IS_NULLABLE", "SCOPE_CATLOG", "SCOPE_SCHEMA", "SCOPE_TABLE", "SOURCE_DATA_TYPE"/* , "IS_AUTOINCREMENT" */}; String[] rsColumns = new String[reqColumns.length]; DatabaseMetaData dbmt = this.conn.getMetaData(); ResultSet rs = dbmt.getColumns("mysql",null,"user","%"); ResultSetMetaData rsmt = rs.getMetaData(); for (int i = 1; i <= rsmt.getColumnCount();i++) { rsColumns[i - 1] = rsmt.getColumnName(i); } assertTrue("Wrong count of required fields", reqColumns.length == rsmt.getColumnCount()); assertTrue("All required fields are not filled correctly", compareSringArrays(reqColumns, rsColumns)); } public boolean compareSringArrays(String[] expecteds, String[] actuals) { for (int i = 0; i < expecteds.length;i++) { if (expecteds[i] != actuals[i]) { System.out.println(expecteds[i] = ", " + actuals[i]); return false; } } return true; } }