summaryrefslogtreecommitdiff
path: root/src/interfaces/jdbc/org/postgresql/jdbc2/AbstractJdbc2DatabaseMetaData.java
blob: 3cbd96f3ba71bf969734939f3cf2e4ea6a152229 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
package org.postgresql.jdbc2;

import org.postgresql.jdbc1.AbstractJdbc1ResultSet;
import java.sql.*;
import java.util.*;

import org.postgresql.Driver;
import org.postgresql.core.Field;
import org.postgresql.util.PSQLException;

public abstract class AbstractJdbc2DatabaseMetaData extends org.postgresql.jdbc1.AbstractJdbc1DatabaseMetaData
{

	public AbstractJdbc2DatabaseMetaData(AbstractJdbc2Connection conn)
	{
		super(conn);
	}



	// ** JDBC 2 Extensions **

	/*
	 * Does the database support the given result set type?
	 *
	 * @param type - defined in java.sql.ResultSet
	 * @return true if so; false otherwise
	 * @exception SQLException - if a database access error occurs
	 */
	public boolean supportsResultSetType(int type) throws SQLException
	{
		// The only type we don't support
		return type != java.sql.ResultSet.TYPE_SCROLL_SENSITIVE;
	}


	/*
	 * Does the database support the concurrency type in combination
	 * with the given result set type?
	 *
	 * @param type - defined in java.sql.ResultSet
	 * @param concurrency - type defined in java.sql.ResultSet
	 * @return true if so; false otherwise
	 * @exception SQLException - if a database access error occurs
	*/
	public boolean supportsResultSetConcurrency(int type, int concurrency) throws SQLException
	{
		// These combinations are not supported!
		if (type == java.sql.ResultSet.TYPE_SCROLL_SENSITIVE)
			return false;

		// We do support Updateable ResultSets
		if (concurrency == java.sql.ResultSet.CONCUR_UPDATABLE)
			return true;

		// Everything else we do
		return true;
	}


	/* lots of unsupported stuff... */
	public boolean ownUpdatesAreVisible(int type) throws SQLException
	{
		return true;
	}

	public boolean ownDeletesAreVisible(int type) throws SQLException
	{
		return true;
	}

	public boolean ownInsertsAreVisible(int type) throws SQLException
	{
		// indicates that
		return true;
	}

	public boolean othersUpdatesAreVisible(int type) throws SQLException
	{
		return false;
	}

	public boolean othersDeletesAreVisible(int i) throws SQLException
	{
		return false;
	}

	public boolean othersInsertsAreVisible(int type) throws SQLException
	{
		return false;
	}

	public boolean updatesAreDetected(int type) throws SQLException
	{
		return false;
	}

	public boolean deletesAreDetected(int i) throws SQLException
	{
		return false;
	}

	public boolean insertsAreDetected(int type) throws SQLException
	{
		return false;
	}

	/*
	 * Indicates whether the driver supports batch updates.
	 */
	public boolean supportsBatchUpdates() throws SQLException
	{
		return true;
	}

	/*
	 * Return user defined types in a schema
	 */
	public java.sql.ResultSet getUDTs(String catalog,
									  String schemaPattern,
									  String typeNamePattern,
									  int[] types
									 ) throws SQLException
	{
		throw org.postgresql.Driver.notImplemented();
	}


	/*
	 * Retrieves the connection that produced this metadata object.
	 *
	 * @return the connection that produced this metadata object
	 */
	public java.sql.Connection getConnection() throws SQLException
	{
		return (java.sql.Connection)connection;
	}

	/* I don't find these in the spec!?! */

	public boolean rowChangesAreDetected(int type) throws SQLException
	{
		return false;
	}

	public boolean rowChangesAreVisible(int type) throws SQLException
	{
		return false;
	}
}