-
-
Notifications
You must be signed in to change notification settings - Fork 23
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
JDBC-426 DatabaseMetadata.getColumn returns 0 for DECIMAL_DIGITS for …
…NUMERIC(15,2) in dialect 1
- Loading branch information
1 parent
f8c4c94
commit bd224c1
Showing
4 changed files
with
99 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
81 changes: 81 additions & 0 deletions
81
src/test/org/firebirdsql/jdbc/TestFBDatabaseMetaDataDialect1.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,81 @@ | ||
/* | ||
* Firebird Open Source JavaEE Connector - JDBC Driver | ||
* | ||
* Distributable under LGPL license. | ||
* You may obtain a copy of the License at http://www.gnu.org/copyleft/lgpl.html | ||
* | ||
* 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 | ||
* LGPL License for more details. | ||
* | ||
* This file was created by members of the firebird development team. | ||
* All individual contributions remain the Copyright (C) of those | ||
* individuals. Contributors to this file are either listed here or | ||
* can be obtained from a source control history command. | ||
* | ||
* All rights reserved. | ||
*/ | ||
package org.firebirdsql.jdbc; | ||
|
||
import org.firebirdsql.common.DdlHelper; | ||
import org.firebirdsql.management.FBManager; | ||
import org.junit.After; | ||
import org.junit.Before; | ||
import org.junit.Test; | ||
|
||
import java.sql.*; | ||
import java.util.Properties; | ||
|
||
import static org.firebirdsql.common.FBTestProperties.*; | ||
import static org.junit.Assert.assertEquals; | ||
import static org.junit.Assert.assertTrue; | ||
|
||
/** | ||
* Tests for database metadata in dialect 1. | ||
* | ||
* @author <a href="mailto:mrotteveel@users.sourceforge.net">Mark Rotteveel</a> | ||
*/ | ||
public class TestFBDatabaseMetaDataDialect1 { | ||
|
||
protected FBManager fbManager = null; | ||
|
||
/** | ||
* Basic setup of the test database. | ||
* | ||
* @throws Exception | ||
*/ | ||
@Before | ||
public void basicSetUp() throws Exception { | ||
fbManager = createFBManager(); | ||
fbManager.setDialect(1); | ||
defaultDatabaseSetUp(fbManager); | ||
} | ||
|
||
/** | ||
* Basic teardown of the test database | ||
* | ||
* @throws Exception | ||
*/ | ||
@After | ||
public void basicTearDown() throws Exception { | ||
defaultDatabaseTearDown(fbManager); | ||
fbManager = null; | ||
} | ||
|
||
@Test | ||
public void testLargeNumeric() throws Exception { | ||
Properties props = getDefaultPropertiesForConnection(); | ||
props.setProperty("sqlDialect", "1"); | ||
try (Connection connection = DriverManager.getConnection(getUrl(), props)) { | ||
DdlHelper.executeCreateTable(connection, "CREATE TABLE x (col NUMERIC(15,2))"); | ||
final DatabaseMetaData md = connection.getMetaData(); | ||
final ResultSet columns = md.getColumns(null, null, "X", "COL"); | ||
assertTrue(columns.next()); | ||
assertEquals("NUMERIC", columns.getString("TYPE_NAME")); | ||
assertEquals(Types.NUMERIC, columns.getInt("DATA_TYPE")); | ||
assertEquals(2, columns.getInt("DECIMAL_DIGITS")); | ||
} | ||
} | ||
|
||
} |