Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

table column metadata not returned when table name contains lowercase letters [JDBC106] #145

Closed
firebird-automations opened this issue Oct 24, 2007 · 3 comments

Comments

@firebird-automations
Copy link

Submitted by: Slawomir Mezyk (slawekme)

Assigned to: Roman Rokytskyy (rrokytskyy)

When table name contains lower case letters, metadata information about table columns is not returned from the driver. Below is code that illustrates the problem:

public class GetColumnsTest {

public static void main\(String\[\] args\) throws Exception \{

	// connection parameters
	String databaseURL = "jdbc:firebirdsql:test01";

	String user = "sysdba";

	String password = "masterkey";

	String driverName = "org\.firebirdsql\.jdbc\.FBDriver";


	String TableName = "TestTable";

	// connect to database
	Class\.forName\(driverName\);
	java\.sql\.Connection c = java\.sql\.DriverManager\.getConnection \(databaseURL, user, password\);

	// create table 
	c\.createStatement\(\)\.execute\("CREATE TABLE \\"" \+ TableName \+ "\\" \(\\"Id\\" INT, \\"Name\\" VARCHAR\(20\)\)"\);

	// retrieve table column info
	java\.sql\.DatabaseMetaData md = c\.getMetaData\(\);
	java\.sql\.ResultSet rs = md\.getColumns\("", "", TableName, "%"\);

	// show results \(nothing shown if table name has lowercase letters\)
	while\(rs\.next\(\)\) \{
		System\.out\.println\(rs\.getString\(4\) \+ "\\t" \+ rs\.getString\(6\)\);
	\}
\}

}

This is because table name is always converted to uppercase in function AbstractDatabaseMetadata.stripQuotes when there's no quotation marks to remove. The line 5802 of file src/main/org/firebirdsql/jdbc/AbstractDatabaseMetadata.java should be

        return pattern;

instead of

        return pattern\.toUpperCase\(\);

Commits: f1d278e

@firebird-automations
Copy link
Author

Commented by: Roman Rokytskyy (rrokytskyy)

Fixed

@firebird-automations
Copy link
Author

Modified by: Roman Rokytskyy (rrokytskyy)

status: Open [ 1 ] => Resolved [ 5 ]

resolution: Fixed [ 1 ]

Fix Version: Jaybird 2.1.3 [ 10252 ]

Fix Version: Jaybird 2.2 [ 10053 ]

@firebird-automations
Copy link
Author

Modified by: @mrotteveel

status: Resolved [ 5 ] => Closed [ 6 ]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment