Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
P
Postgres FD Implementation
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Abuhujair Javed
Postgres FD Implementation
Commits
4da51bfd
Commit
4da51bfd
authored
Apr 16, 2002
by
Dave Cramer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added some rudimentary table and column tests
added a setup/teardown to create and drop the connection, and table
parent
710a711a
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
35 additions
and
25 deletions
+35
-25
src/interfaces/jdbc/org/postgresql/test/jdbc2/DatabaseMetaDataTest.java
.../jdbc/org/postgresql/test/jdbc2/DatabaseMetaDataTest.java
+35
-25
No files found.
src/interfaces/jdbc/org/postgresql/test/jdbc2/DatabaseMetaDataTest.java
View file @
4da51bfd
...
...
@@ -9,12 +9,13 @@ import java.sql.*;
*
* PS: Do you know how difficult it is to type on a train? ;-)
*
* $Id: DatabaseMetaDataTest.java,v 1.
4 2001/11/19 22:33:39 momjian
Exp $
* $Id: DatabaseMetaDataTest.java,v 1.
5 2002/04/16 15:25:17 davec
Exp $
*/
public
class
DatabaseMetaDataTest
extends
TestCase
{
private
Connection
con
;
/*
* Constructor
*/
...
...
@@ -23,6 +24,17 @@ public class DatabaseMetaDataTest extends TestCase
super
(
name
);
}
protected
void
setUp
()
throws
Exception
{
con
=
JDBC2Tests
.
openDB
();
JDBC2Tests
.
createTable
(
con
,
"testmetadata"
,
"id int4, name text, updated timestamp"
);
}
protected
void
tearDown
()
throws
Exception
{
JDBC2Tests
.
dropTable
(
con
,
"testmetadata"
);
JDBC2Tests
.
closeDB
(
con
);
}
/*
* The spec says this may return null, but we always do!
*/
...
...
@@ -30,12 +42,32 @@ public class DatabaseMetaDataTest extends TestCase
{
try
{
Connection
con
=
JDBC2Tests
.
openDB
();
DatabaseMetaData
dbmd
=
con
.
getMetaData
();
assertNotNull
(
dbmd
);
JDBC2Tests
.
closeDB
(
con
);
ResultSet
rs
=
dbmd
.
getTables
(
null
,
null
,
"test%"
,
new
String
[]
{
"TABLE"
});
assertTrue
(
rs
.
next
()
);
assertTrue
(
rs
.
getString
(
"TABLE_NAME"
).
equals
(
"testmetadata"
)
);
rs
.
close
();
rs
=
dbmd
.
getColumns
(
""
,
""
,
"test%"
,
"%"
);
assertTrue
(
rs
.
next
()
);
assertTrue
(
rs
.
getString
(
"TABLE_NAME"
).
equals
(
"testmetadata"
)
);
assertTrue
(
rs
.
getString
(
"COLUMN_NAME"
).
equals
(
"id"
)
);
assertTrue
(
rs
.
getInt
(
"DATA_TYPE"
)
==
java
.
sql
.
Types
.
INTEGER
);
assertTrue
(
rs
.
next
()
);
assertTrue
(
rs
.
getString
(
"TABLE_NAME"
).
equals
(
"testmetadata"
)
);
assertTrue
(
rs
.
getString
(
"COLUMN_NAME"
).
equals
(
"name"
)
);
assertTrue
(
rs
.
getInt
(
"DATA_TYPE"
)
==
java
.
sql
.
Types
.
VARCHAR
);
assertTrue
(
rs
.
next
()
);
assertTrue
(
rs
.
getString
(
"TABLE_NAME"
).
equals
(
"testmetadata"
)
);
assertTrue
(
rs
.
getString
(
"COLUMN_NAME"
).
equals
(
"updated"
)
);
assertTrue
(
rs
.
getInt
(
"DATA_TYPE"
)
==
java
.
sql
.
Types
.
TIMESTAMP
);
}
catch
(
SQLException
ex
)
{
...
...
@@ -50,7 +82,6 @@ public class DatabaseMetaDataTest extends TestCase
{
try
{
Connection
con
=
JDBC2Tests
.
openDB
();
DatabaseMetaData
dbmd
=
con
.
getMetaData
();
assertNotNull
(
dbmd
);
...
...
@@ -76,7 +107,6 @@ public class DatabaseMetaDataTest extends TestCase
assertTrue
(!
dbmd
.
supportsIntegrityEnhancementFacility
());
JDBC2Tests
.
closeDB
(
con
);
}
catch
(
SQLException
ex
)
{
...
...
@@ -89,7 +119,6 @@ public class DatabaseMetaDataTest extends TestCase
{
try
{
Connection
con
=
JDBC2Tests
.
openDB
();
DatabaseMetaData
dbmd
=
con
.
getMetaData
();
assertNotNull
(
dbmd
);
...
...
@@ -98,7 +127,6 @@ public class DatabaseMetaDataTest extends TestCase
assertTrue
(
dbmd
.
supportsFullOuterJoins
());
assertTrue
(
dbmd
.
supportsLimitedOuterJoins
());
JDBC2Tests
.
closeDB
(
con
);
}
catch
(
SQLException
ex
)
{
...
...
@@ -110,7 +138,6 @@ public class DatabaseMetaDataTest extends TestCase
{
try
{
Connection
con
=
JDBC2Tests
.
openDB
();
DatabaseMetaData
dbmd
=
con
.
getMetaData
();
assertNotNull
(
dbmd
);
...
...
@@ -118,7 +145,6 @@ public class DatabaseMetaDataTest extends TestCase
assertTrue
(!
dbmd
.
supportsPositionedDelete
());
assertTrue
(!
dbmd
.
supportsPositionedUpdate
());
JDBC2Tests
.
closeDB
(
con
);
}
catch
(
SQLException
ex
)
{
...
...
@@ -130,7 +156,6 @@ public class DatabaseMetaDataTest extends TestCase
{
try
{
Connection
con
=
JDBC2Tests
.
openDB
();
DatabaseMetaData
dbmd
=
con
.
getMetaData
();
assertNotNull
(
dbmd
);
...
...
@@ -151,7 +176,6 @@ public class DatabaseMetaDataTest extends TestCase
assertTrue
(
dbmd
.
supportsNonNullableColumns
());
JDBC2Tests
.
closeDB
(
con
);
}
catch
(
SQLException
ex
)
{
...
...
@@ -163,7 +187,6 @@ public class DatabaseMetaDataTest extends TestCase
{
try
{
Connection
con
=
JDBC2Tests
.
openDB
();
DatabaseMetaData
dbmd
=
con
.
getMetaData
();
assertNotNull
(
dbmd
);
...
...
@@ -171,7 +194,6 @@ public class DatabaseMetaDataTest extends TestCase
assertTrue
(!
dbmd
.
usesLocalFilePerTable
());
assertTrue
(!
dbmd
.
usesLocalFiles
());
JDBC2Tests
.
closeDB
(
con
);
}
catch
(
SQLException
ex
)
{
...
...
@@ -183,7 +205,6 @@ public class DatabaseMetaDataTest extends TestCase
{
try
{
Connection
con
=
JDBC2Tests
.
openDB
();
DatabaseMetaData
dbmd
=
con
.
getMetaData
();
assertNotNull
(
dbmd
);
...
...
@@ -200,7 +221,6 @@ public class DatabaseMetaDataTest extends TestCase
assertTrue
(
dbmd
.
getIdentifierQuoteString
().
equals
(
"\""
));
JDBC2Tests
.
closeDB
(
con
);
}
catch
(
SQLException
ex
)
{
...
...
@@ -212,7 +232,6 @@ public class DatabaseMetaDataTest extends TestCase
{
try
{
Connection
con
=
JDBC2Tests
.
openDB
();
DatabaseMetaData
dbmd
=
con
.
getMetaData
();
assertNotNull
(
dbmd
);
...
...
@@ -223,7 +242,6 @@ public class DatabaseMetaDataTest extends TestCase
// we can't drop columns (yet)
assertTrue
(!
dbmd
.
supportsAlterTableWithDropColumn
());
JDBC2Tests
.
closeDB
(
con
);
}
catch
(
SQLException
ex
)
{
...
...
@@ -235,7 +253,6 @@ public class DatabaseMetaDataTest extends TestCase
{
try
{
Connection
con
=
JDBC2Tests
.
openDB
();
DatabaseMetaData
dbmd
=
con
.
getMetaData
();
assertNotNull
(
dbmd
);
...
...
@@ -254,7 +271,6 @@ public class DatabaseMetaDataTest extends TestCase
assertTrue
(
dbmd
.
supportsGroupByUnrelated
());
assertTrue
(
dbmd
.
supportsGroupByBeyondSelect
());
// needs checking
JDBC2Tests
.
closeDB
(
con
);
}
catch
(
SQLException
ex
)
{
...
...
@@ -266,7 +282,6 @@ public class DatabaseMetaDataTest extends TestCase
{
try
{
Connection
con
=
JDBC2Tests
.
openDB
();
DatabaseMetaData
dbmd
=
con
.
getMetaData
();
assertNotNull
(
dbmd
);
...
...
@@ -274,7 +289,6 @@ public class DatabaseMetaDataTest extends TestCase
assertTrue
(
dbmd
.
getURL
().
equals
(
JDBC2Tests
.
getURL
()));
assertTrue
(
dbmd
.
getUserName
().
equals
(
JDBC2Tests
.
getUser
()));
JDBC2Tests
.
closeDB
(
con
);
}
catch
(
SQLException
ex
)
{
...
...
@@ -286,7 +300,6 @@ public class DatabaseMetaDataTest extends TestCase
{
try
{
Connection
con
=
JDBC2Tests
.
openDB
();
assertTrue
(
con
instanceof
org
.
postgresql
.
Connection
);
org
.
postgresql
.
Connection
pc
=
(
org
.
postgresql
.
Connection
)
con
;
...
...
@@ -297,7 +310,6 @@ public class DatabaseMetaDataTest extends TestCase
assertTrue
(
dbmd
.
getDatabaseProductVersion
().
startsWith
(
Integer
.
toString
(
pc
.
this_driver
.
getMajorVersion
())
+
"."
+
Integer
.
toString
(
pc
.
this_driver
.
getMinorVersion
())));
assertTrue
(
dbmd
.
getDriverName
().
equals
(
"PostgreSQL Native Driver"
));
JDBC2Tests
.
closeDB
(
con
);
}
catch
(
SQLException
ex
)
{
...
...
@@ -309,7 +321,6 @@ public class DatabaseMetaDataTest extends TestCase
{
try
{
Connection
con
=
JDBC2Tests
.
openDB
();
assertTrue
(
con
instanceof
org
.
postgresql
.
Connection
);
org
.
postgresql
.
Connection
pc
=
(
org
.
postgresql
.
Connection
)
con
;
...
...
@@ -321,7 +332,6 @@ public class DatabaseMetaDataTest extends TestCase
assertTrue
(
dbmd
.
getDriverMinorVersion
()
==
pc
.
this_driver
.
getMinorVersion
());
JDBC2Tests
.
closeDB
(
con
);
}
catch
(
SQLException
ex
)
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment