mirror of
https://github.com/postgres/postgres.git
synced 2025-05-21 00:02:53 -04:00
Indent jdbc case labels using pgjindent.
This commit is contained in:
parent
6c8120d68c
commit
09634eafe1
@ -291,7 +291,6 @@ public class ImageViewer implements ItemListener
|
|||||||
|
|
||||||
public void run()
|
public void run()
|
||||||
{
|
{
|
||||||
|
|
||||||
// Now the real import stuff
|
// Now the real import stuff
|
||||||
if (name != null && dir != null)
|
if (name != null && dir != null)
|
||||||
{
|
{
|
||||||
|
@ -6,7 +6,7 @@ import java.text.*;
|
|||||||
|
|
||||||
/*
|
/*
|
||||||
*
|
*
|
||||||
* $Id: basic.java,v 1.9 2001/11/19 22:43:13 momjian Exp $
|
* $Id: basic.java,v 1.10 2001/11/19 23:16:44 momjian Exp $
|
||||||
*
|
*
|
||||||
* This example tests the basic components of the JDBC driver, and shows
|
* This example tests the basic components of the JDBC driver, and shows
|
||||||
* how even the simplest of queries can be implemented.
|
* how even the simplest of queries can be implemented.
|
||||||
@ -137,6 +137,7 @@ public class basic
|
|||||||
// Now run the query again, showing a more efficient way of getting the
|
// Now run the query again, showing a more efficient way of getting the
|
||||||
// result if you don't know what column number a value is in
|
// result if you don't know what column number a value is in
|
||||||
|
|
||||||
|
|
||||||
System.out.println("performing another query");
|
System.out.println("performing another query");
|
||||||
rs = st.executeQuery("select * from basic where b>1");
|
rs = st.executeQuery("select * from basic where b>1");
|
||||||
if (rs != null)
|
if (rs != null)
|
||||||
@ -163,6 +164,7 @@ public class basic
|
|||||||
|
|
||||||
// Now test maxrows by setting it to 3 rows
|
// Now test maxrows by setting it to 3 rows
|
||||||
|
|
||||||
|
|
||||||
st.setMaxRows(3);
|
st.setMaxRows(3);
|
||||||
System.out.println("performing a query limited to " + st.getMaxRows());
|
System.out.println("performing a query limited to " + st.getMaxRows());
|
||||||
rs = st.executeQuery("select a, b from basic");
|
rs = st.executeQuery("select a, b from basic");
|
||||||
|
@ -61,7 +61,6 @@ public class blobtest
|
|||||||
System.out.println("Now closing the connection");
|
System.out.println("Now closing the connection");
|
||||||
s.close();
|
s.close();
|
||||||
db.close();
|
db.close();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -171,7 +170,6 @@ public class blobtest
|
|||||||
lobj.unlink(oid);
|
lobj.unlink(oid);
|
||||||
}
|
}
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
// This tests the Blob interface of the JDBC 2.0 specification
|
// This tests the Blob interface of the JDBC 2.0 specification
|
||||||
public void jdbc2api(int oid) throws SQLException, IOException
|
public void jdbc2api(int oid) throws SQLException, IOException
|
||||||
{
|
{
|
||||||
@ -218,8 +216,6 @@ public class blobtest
|
|||||||
db.setAutoCommit(false);
|
db.setAutoCommit(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
|
|
||||||
public static void instructions()
|
public static void instructions()
|
||||||
{
|
{
|
||||||
System.err.println("java example.blobtest jdbc-url user password [debug]");
|
System.err.println("java example.blobtest jdbc-url user password [debug]");
|
||||||
|
@ -9,7 +9,7 @@ import org.omg.CosNaming.*;
|
|||||||
*
|
*
|
||||||
* It has no GUI, just a text frontend to keep it simple.
|
* It has no GUI, just a text frontend to keep it simple.
|
||||||
*
|
*
|
||||||
* $Id: StockClient.java,v 1.3 2001/11/19 22:43:13 momjian Exp $
|
* $Id: StockClient.java,v 1.4 2001/11/19 23:16:45 momjian Exp $
|
||||||
*/
|
*/
|
||||||
public class StockClient
|
public class StockClient
|
||||||
{
|
{
|
||||||
|
@ -9,7 +9,6 @@ import java.text.*;
|
|||||||
*
|
*
|
||||||
* To use this example, you need a database to be in existence. This example
|
* To use this example, you need a database to be in existence. This example
|
||||||
* will create a table called datestyle.
|
* will create a table called datestyle.
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
public class datestyle
|
public class datestyle
|
||||||
@ -105,7 +104,6 @@ public class datestyle
|
|||||||
ps.setDate(1, standard);
|
ps.setDate(1, standard);
|
||||||
ps.executeUpdate();
|
ps.executeUpdate();
|
||||||
ps.close();
|
ps.close();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -218,7 +218,6 @@ public class metadata
|
|||||||
{
|
{
|
||||||
if (line.startsWith("\\d"))
|
if (line.startsWith("\\d"))
|
||||||
{
|
{
|
||||||
|
|
||||||
if (line.startsWith("\\d "))
|
if (line.startsWith("\\d "))
|
||||||
{
|
{
|
||||||
// Display details about a table
|
// Display details about a table
|
||||||
|
@ -50,7 +50,7 @@ public class psql
|
|||||||
// Now the main loop.
|
// Now the main loop.
|
||||||
int tt = 0, lineno = 1;
|
int tt = 0, lineno = 1;
|
||||||
while (tt != StreamTokenizer.TT_EOF && ! done)
|
while (tt != StreamTokenizer.TT_EOF && ! done)
|
||||||
{ // done added by CWJ to permit \q command
|
{
|
||||||
System.out.print("[" + lineno + "] ");
|
System.out.print("[" + lineno + "] ");
|
||||||
System.out.flush();
|
System.out.flush();
|
||||||
|
|
||||||
@ -72,7 +72,6 @@ public class psql
|
|||||||
System.out.println("Now closing the connection");
|
System.out.println("Now closing the connection");
|
||||||
st.close();
|
st.close();
|
||||||
db.close();
|
db.close();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -53,7 +53,6 @@ public class threadsafe
|
|||||||
System.out.println("Now closing the connection");
|
System.out.println("Now closing the connection");
|
||||||
st.close();
|
st.close();
|
||||||
db.close();
|
db.close();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -108,7 +107,6 @@ public class threadsafe
|
|||||||
System.out.println("Waiting for threads to run");
|
System.out.println("Waiting for threads to run");
|
||||||
while (thread1.isAlive() || thread2.isAlive() || thread3.isAlive())
|
while (thread1.isAlive() || thread2.isAlive() || thread3.isAlive())
|
||||||
thread0.yield();
|
thread0.yield();
|
||||||
|
|
||||||
}
|
}
|
||||||
finally
|
finally
|
||||||
{
|
{
|
||||||
|
@ -11,7 +11,7 @@ import org.postgresql.util.*;
|
|||||||
import org.postgresql.core.*;
|
import org.postgresql.core.*;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* $Id: Connection.java,v 1.36 2001/11/19 22:33:37 momjian Exp $
|
* $Id: Connection.java,v 1.37 2001/11/19 23:16:45 momjian Exp $
|
||||||
*
|
*
|
||||||
* This abstract class is used by org.postgresql.Driver to open either the JDBC1 or
|
* This abstract class is used by org.postgresql.Driver to open either the JDBC1 or
|
||||||
* JDBC2 versions of the Connection class.
|
* JDBC2 versions of the Connection class.
|
||||||
@ -1166,6 +1166,5 @@ public abstract class Connection
|
|||||||
}
|
}
|
||||||
return pgType;
|
return pgType;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -10,7 +10,7 @@ import org.postgresql.core.*;
|
|||||||
import org.postgresql.util.*;
|
import org.postgresql.util.*;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* $Id: PG_Stream.java,v 1.15 2001/11/19 22:33:37 momjian Exp $
|
* $Id: PG_Stream.java,v 1.16 2001/11/19 23:16:45 momjian Exp $
|
||||||
*
|
*
|
||||||
* This class is used by Connection & PGlobj for communicating with the
|
* This class is used by Connection & PGlobj for communicating with the
|
||||||
* backend.
|
* backend.
|
||||||
@ -371,5 +371,4 @@ public class PG_Stream
|
|||||||
pg_input.close();
|
pg_input.close();
|
||||||
connection.close();
|
connection.close();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -40,7 +40,7 @@
|
|||||||
*
|
*
|
||||||
* Copyright 1999 (C) Exoffice Technologies Inc. All Rights Reserved.
|
* Copyright 1999 (C) Exoffice Technologies Inc. All Rights Reserved.
|
||||||
*
|
*
|
||||||
* $Id: PostgresqlDataSource.java,v 1.4 2001/11/19 22:33:37 momjian Exp $
|
* $Id: PostgresqlDataSource.java,v 1.5 2001/11/19 23:16:45 momjian Exp $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
@ -133,38 +133,32 @@ public class PostgresqlDataSource
|
|||||||
*/
|
*/
|
||||||
private int _loginTimeout;
|
private int _loginTimeout;
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Holds the user's account name.
|
* Holds the user's account name.
|
||||||
*/
|
*/
|
||||||
private String _user;
|
private String _user;
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Holds the database password.
|
* Holds the database password.
|
||||||
*/
|
*/
|
||||||
private String _password;
|
private String _password;
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Holds the name of the particular database on the server.
|
* Holds the name of the particular database on the server.
|
||||||
*/
|
*/
|
||||||
private String _databaseName;
|
private String _databaseName;
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Description of this datasource.
|
* Description of this datasource.
|
||||||
*/
|
*/
|
||||||
private String _description = "PostgreSQL DataSource";
|
private String _description = "PostgreSQL DataSource";
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Holds the database server name. If null, this is
|
* Holds the database server name. If null, this is
|
||||||
* assumed to be the localhost.
|
* assumed to be the localhost.
|
||||||
*/
|
*/
|
||||||
private String _serverName;
|
private String _serverName;
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Holds the port number where a server is listening.
|
* Holds the port number where a server is listening.
|
||||||
* The default value will open a connection with an
|
* The default value will open a connection with an
|
||||||
@ -172,7 +166,6 @@ public class PostgresqlDataSource
|
|||||||
*/
|
*/
|
||||||
private int _portNumber = DEFAULT_PORT;
|
private int _portNumber = DEFAULT_PORT;
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* The default port number. Since we open the connection
|
* The default port number. Since we open the connection
|
||||||
* without specifying the port if it's the default one,
|
* without specifying the port if it's the default one,
|
||||||
@ -180,7 +173,6 @@ public class PostgresqlDataSource
|
|||||||
*/
|
*/
|
||||||
private static final int DEFAULT_PORT = 0;
|
private static final int DEFAULT_PORT = 0;
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Holds the log writer to which all messages should be
|
* Holds the log writer to which all messages should be
|
||||||
* printed. The default writer is obtained from the driver
|
* printed. The default writer is obtained from the driver
|
||||||
@ -189,7 +181,6 @@ public class PostgresqlDataSource
|
|||||||
*/
|
*/
|
||||||
private transient PrintWriter _logWriter;
|
private transient PrintWriter _logWriter;
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Each datasource maintains it's own driver, in case of
|
* Each datasource maintains it's own driver, in case of
|
||||||
* driver-specific setup (e.g. pools, log writer).
|
* driver-specific setup (e.g. pools, log writer).
|
||||||
@ -197,9 +188,6 @@ public class PostgresqlDataSource
|
|||||||
// FIXME
|
// FIXME
|
||||||
// private transient postgresql.Driver _driver;
|
// private transient postgresql.Driver _driver;
|
||||||
private transient org.postgresql.Driver _driver;
|
private transient org.postgresql.Driver _driver;
|
||||||
//---------
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public PostgresqlDataSource()
|
public PostgresqlDataSource()
|
||||||
{
|
{
|
||||||
@ -233,12 +221,10 @@ public class PostgresqlDataSource
|
|||||||
// FIXME
|
// FIXME
|
||||||
// _driver = new postgresql.Driver();
|
// _driver = new postgresql.Driver();
|
||||||
_driver = new org.postgresql.Driver();
|
_driver = new org.postgresql.Driver();
|
||||||
//-----------
|
|
||||||
|
|
||||||
//FIXME
|
//FIXME
|
||||||
// _driver.setLogWriter( _logWriter );
|
// _driver.setLogWriter( _logWriter );
|
||||||
// Method seems to be unavailable. Just commented it out.
|
// Method seems to be unavailable. Just commented it out.
|
||||||
//----------
|
|
||||||
}
|
}
|
||||||
catch ( SQLException except )
|
catch ( SQLException except )
|
||||||
{
|
{
|
||||||
@ -282,7 +268,6 @@ public class PostgresqlDataSource
|
|||||||
// if ( ! ( conn instanceof postgresql.jdbc2.Connection ) ) {
|
// if ( ! ( conn instanceof postgresql.jdbc2.Connection ) ) {
|
||||||
if ( ! ( conn instanceof org.postgresql.jdbc2.Connection ) )
|
if ( ! ( conn instanceof org.postgresql.jdbc2.Connection ) )
|
||||||
{
|
{
|
||||||
//--------
|
|
||||||
if ( _logWriter != null )
|
if ( _logWriter != null )
|
||||||
_logWriter.println( "DataSource: JDBC 1 connections not supported" );
|
_logWriter.println( "DataSource: JDBC 1 connections not supported" );
|
||||||
throw new PSQLException( "postgresql.ds.onlyjdbc2" );
|
throw new PSQLException( "postgresql.ds.onlyjdbc2" );
|
||||||
@ -317,7 +302,6 @@ public class PostgresqlDataSource
|
|||||||
// FIXME
|
// FIXME
|
||||||
// _driver.setLogWriter( writer );
|
// _driver.setLogWriter( writer );
|
||||||
// Method seems to be unavailable. Commented it out.
|
// Method seems to be unavailable. Commented it out.
|
||||||
//----------
|
|
||||||
_logWriter = writer;
|
_logWriter = writer;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -617,7 +601,5 @@ public class PostgresqlDataSource
|
|||||||
else
|
else
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -6,7 +6,6 @@ package org.postgresql.core;
|
|||||||
*/
|
*/
|
||||||
public class BytePoolDim1
|
public class BytePoolDim1
|
||||||
{
|
{
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* The maximum size of the array we manage.
|
* The maximum size of the array we manage.
|
||||||
*/
|
*/
|
||||||
|
@ -13,7 +13,7 @@ import org.postgresql.util.PSQLException;
|
|||||||
* <p>The lifetime of a QueryExecutor object is from sending the query
|
* <p>The lifetime of a QueryExecutor object is from sending the query
|
||||||
* until the response has been received from the backend.
|
* until the response has been received from the backend.
|
||||||
*
|
*
|
||||||
* $Id: QueryExecutor.java,v 1.4 2001/11/19 22:33:37 momjian Exp $
|
* $Id: QueryExecutor.java,v 1.5 2001/11/19 23:16:45 momjian Exp $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
public class QueryExecutor
|
public class QueryExecutor
|
||||||
@ -162,7 +162,6 @@ public class QueryExecutor
|
|||||||
*/
|
*/
|
||||||
private void receiveCommandStatus() throws SQLException
|
private void receiveCommandStatus() throws SQLException
|
||||||
{
|
{
|
||||||
|
|
||||||
status = pg_stream.ReceiveString(connection.getEncoding());
|
status = pg_stream.ReceiveString(connection.getEncoding());
|
||||||
|
|
||||||
try
|
try
|
||||||
|
@ -61,7 +61,6 @@ public class Fastpath
|
|||||||
// added Oct 7 1998 to give us thread safety
|
// added Oct 7 1998 to give us thread safety
|
||||||
synchronized (stream)
|
synchronized (stream)
|
||||||
{
|
{
|
||||||
|
|
||||||
// send the function call
|
// send the function call
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
@ -148,5 +148,4 @@ public class PGpath extends PGobject implements Serializable, Cloneable
|
|||||||
{
|
{
|
||||||
open = true;
|
open = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -13,7 +13,7 @@ import org.postgresql.util.PSQLException;
|
|||||||
/*
|
/*
|
||||||
* This class provides information about the database as a whole.
|
* This class provides information about the database as a whole.
|
||||||
*
|
*
|
||||||
* $Id: DatabaseMetaData.java,v 1.39 2001/11/19 22:33:38 momjian Exp $
|
* $Id: DatabaseMetaData.java,v 1.40 2001/11/19 23:16:45 momjian Exp $
|
||||||
*
|
*
|
||||||
* <p>Many of the methods here return lists of information in ResultSets. You
|
* <p>Many of the methods here return lists of information in ResultSets. You
|
||||||
* can use the normal ResultSet methods such as getString and getInt to
|
* can use the normal ResultSet methods such as getString and getInt to
|
||||||
@ -2307,34 +2307,46 @@ public class DatabaseMetaData implements java.sql.DatabaseMetaData
|
|||||||
);
|
);
|
||||||
Vector tuples = new Vector();
|
Vector tuples = new Vector();
|
||||||
short seq = 0;
|
short seq = 0;
|
||||||
if (rs.next()) {
|
if (rs.next())
|
||||||
|
{
|
||||||
boolean hasMore;
|
boolean hasMore;
|
||||||
do {
|
do
|
||||||
|
{
|
||||||
byte tuple[][] = new byte[14][0];
|
byte tuple[][] = new byte[14][0];
|
||||||
for (int k = 0;k < 14;k++)
|
for (int k = 0;k < 14;k++)
|
||||||
tuple[k] = null;
|
tuple[k] = null;
|
||||||
|
|
||||||
String fKeyName = rs.getString(3);
|
String fKeyName = rs.getString(3);
|
||||||
boolean foundRule = false;
|
boolean foundRule = false;
|
||||||
do {
|
do
|
||||||
|
{
|
||||||
String proname = rs.getString(9);
|
String proname = rs.getString(9);
|
||||||
if (proname!=null && proname.startsWith("RI_FKey_")) {
|
if (proname != null && proname.startsWith("RI_FKey_"))
|
||||||
|
{
|
||||||
int col = -1;
|
int col = -1;
|
||||||
if (proname.endsWith("_upd")) col=9; // UPDATE_RULE
|
if (proname.endsWith("_upd"))
|
||||||
else if (proname.endsWith("_del")) col=10; // DELETE_RULE
|
col = 9; // UPDATE_RULE
|
||||||
if (col>-1) {
|
else if (proname.endsWith("_del"))
|
||||||
|
col = 10; // DELETE_RULE
|
||||||
|
if (col > -1)
|
||||||
|
{
|
||||||
String rule = proname.substring(8, proname.length() - 4);
|
String rule = proname.substring(8, proname.length() - 4);
|
||||||
int action = importedKeyNoAction;
|
int action = importedKeyNoAction;
|
||||||
if ("cascade".equals(rule)) action=importedKeyCascade;
|
if ("cascade".equals(rule))
|
||||||
else if ("setnull".equals(rule)) action=importedKeySetNull;
|
action = importedKeyCascade;
|
||||||
else if ("setdefault".equals(rule)) action=importedKeySetDefault;
|
else if ("setnull".equals(rule))
|
||||||
|
action = importedKeySetNull;
|
||||||
|
else if ("setdefault".equals(rule))
|
||||||
|
action = importedKeySetDefault;
|
||||||
tuple[col] = Integer.toString(action).getBytes();
|
tuple[col] = Integer.toString(action).getBytes();
|
||||||
foundRule = true;
|
foundRule = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} while ((hasMore=rs.next()) && fKeyName.equals(rs.getString(3)));
|
}
|
||||||
|
while ((hasMore = rs.next()) && fKeyName.equals(rs.getString(3)));
|
||||||
|
|
||||||
if (foundRule) {
|
if (foundRule)
|
||||||
|
{
|
||||||
tuple[2] = rs.getBytes(2); //PKTABLE_NAME
|
tuple[2] = rs.getBytes(2); //PKTABLE_NAME
|
||||||
tuple[6] = rs.getBytes(1); //FKTABLE_NAME
|
tuple[6] = rs.getBytes(1); //FKTABLE_NAME
|
||||||
|
|
||||||
@ -2344,15 +2356,21 @@ public class DatabaseMetaData implements java.sql.DatabaseMetaData
|
|||||||
int numColumns = (rs.getInt(7) >> 1) - 2;
|
int numColumns = (rs.getInt(7) >> 1) - 2;
|
||||||
String s = rs.getString(8);
|
String s = rs.getString(8);
|
||||||
int pos = s.lastIndexOf("\\000");
|
int pos = s.lastIndexOf("\\000");
|
||||||
for(int c=0;c<numColumns;c++) {
|
for (int c = 0;c < numColumns;c++)
|
||||||
if (pos>-1) {
|
{
|
||||||
|
if (pos > -1)
|
||||||
|
{
|
||||||
int pos2 = s.lastIndexOf("\\000", pos - 1);
|
int pos2 = s.lastIndexOf("\\000", pos - 1);
|
||||||
if (pos2>-1) {
|
if (pos2 > -1)
|
||||||
if (fkeyColumns.length()>0) fkeyColumns.insert(0, ',');
|
{
|
||||||
|
if (fkeyColumns.length() > 0)
|
||||||
|
fkeyColumns.insert(0, ',');
|
||||||
fkeyColumns.insert(0, s.substring(pos2 + 4, pos)); //FKCOLUMN_NAME
|
fkeyColumns.insert(0, s.substring(pos2 + 4, pos)); //FKCOLUMN_NAME
|
||||||
pos = s.lastIndexOf("\\000", pos2 - 1);
|
pos = s.lastIndexOf("\\000", pos2 - 1);
|
||||||
if (pos>-1) {
|
if (pos > -1)
|
||||||
if (pkeyColumns.length()>0) pkeyColumns.insert(0, ',');
|
{
|
||||||
|
if (pkeyColumns.length() > 0)
|
||||||
|
pkeyColumns.insert(0, ',');
|
||||||
pkeyColumns.insert(0, s.substring(pos + 4, pos2)); //PKCOLUMN_NAME
|
pkeyColumns.insert(0, s.substring(pos + 4, pos2)); //PKCOLUMN_NAME
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -2369,7 +2387,8 @@ public class DatabaseMetaData implements java.sql.DatabaseMetaData
|
|||||||
int deferrability = importedKeyNotDeferrable;
|
int deferrability = importedKeyNotDeferrable;
|
||||||
boolean deferrable = rs.getBoolean(5);
|
boolean deferrable = rs.getBoolean(5);
|
||||||
boolean initiallyDeferred = rs.getBoolean(6);
|
boolean initiallyDeferred = rs.getBoolean(6);
|
||||||
if (deferrable) {
|
if (deferrable)
|
||||||
|
{
|
||||||
if (initiallyDeferred)
|
if (initiallyDeferred)
|
||||||
deferrability = importedKeyInitiallyDeferred;
|
deferrability = importedKeyInitiallyDeferred;
|
||||||
else
|
else
|
||||||
@ -2379,7 +2398,8 @@ public class DatabaseMetaData implements java.sql.DatabaseMetaData
|
|||||||
|
|
||||||
tuples.addElement(tuple);
|
tuples.addElement(tuple);
|
||||||
}
|
}
|
||||||
} while (hasMore);
|
}
|
||||||
|
while (hasMore);
|
||||||
}
|
}
|
||||||
|
|
||||||
return new ResultSet(connection, f, tuples, "OK", 1);
|
return new ResultSet(connection, f, tuples, "OK", 1);
|
||||||
|
@ -447,9 +447,12 @@ public class ResultSet extends org.postgresql.ResultSet implements java.sql.Resu
|
|||||||
return null;
|
return null;
|
||||||
// length == 10: SQL Date
|
// length == 10: SQL Date
|
||||||
// length > 10: SQL Timestamp, assumes PGDATESTYLE=ISO
|
// length > 10: SQL Timestamp, assumes PGDATESTYLE=ISO
|
||||||
try {
|
try
|
||||||
|
{
|
||||||
return java.sql.Date.valueOf((s.length() == 10) ? s : s.substring(0, 10));
|
return java.sql.Date.valueOf((s.length() == 10) ? s : s.substring(0, 10));
|
||||||
} catch (NumberFormatException e) {
|
}
|
||||||
|
catch (NumberFormatException e)
|
||||||
|
{
|
||||||
throw new PSQLException("postgresql.res.baddate", s);
|
throw new PSQLException("postgresql.res.baddate", s);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -15,7 +15,7 @@ import org.postgresql.util.PSQLException;
|
|||||||
/*
|
/*
|
||||||
* This class provides information about the database as a whole.
|
* This class provides information about the database as a whole.
|
||||||
*
|
*
|
||||||
* $Id: DatabaseMetaData.java,v 1.46 2001/11/19 22:33:39 momjian Exp $
|
* $Id: DatabaseMetaData.java,v 1.47 2001/11/19 23:16:46 momjian Exp $
|
||||||
*
|
*
|
||||||
* <p>Many of the methods here return lists of information in ResultSets. You
|
* <p>Many of the methods here return lists of information in ResultSets. You
|
||||||
* can use the normal ResultSet methods such as getString and getInt to
|
* can use the normal ResultSet methods such as getString and getInt to
|
||||||
@ -2256,7 +2256,8 @@ public class DatabaseMetaData implements java.sql.DatabaseMetaData
|
|||||||
|
|
||||||
// This is taken direct from the psql source
|
// This is taken direct from the psql source
|
||||||
java.sql.ResultSet r = connection.ExecSQL("SELECT relname, relacl FROM pg_class, pg_user WHERE ( relkind = 'r' OR relkind = 'i') and relname !~ '^pg_' and relname !~ '^xin[vx][0-9]+' and usesysid = relowner and relname like '" + tableNamePattern.toLowerCase() + "' ORDER BY relname");
|
java.sql.ResultSet r = connection.ExecSQL("SELECT relname, relacl FROM pg_class, pg_user WHERE ( relkind = 'r' OR relkind = 'i') and relname !~ '^pg_' and relname !~ '^xin[vx][0-9]+' and usesysid = relowner and relname like '" + tableNamePattern.toLowerCase() + "' ORDER BY relname");
|
||||||
while (r.next()) {
|
while (r.next())
|
||||||
|
{
|
||||||
byte[][] tuple = new byte[8][0];
|
byte[][] tuple = new byte[8][0];
|
||||||
tuple[0] = tuple[1] = "".getBytes();
|
tuple[0] = tuple[1] = "".getBytes();
|
||||||
DriverManager.println("relname=\"" + r.getString(1) + "\" relacl=\"" + r.getString(2) + "\"");
|
DriverManager.println("relname=\"" + r.getString(1) + "\" relacl=\"" + r.getString(2) + "\"");
|
||||||
@ -2434,34 +2435,46 @@ public class DatabaseMetaData implements java.sql.DatabaseMetaData
|
|||||||
);
|
);
|
||||||
Vector tuples = new Vector();
|
Vector tuples = new Vector();
|
||||||
short seq = 0;
|
short seq = 0;
|
||||||
if (rs.next()) {
|
if (rs.next())
|
||||||
|
{
|
||||||
boolean hasMore;
|
boolean hasMore;
|
||||||
do {
|
do
|
||||||
|
{
|
||||||
byte tuple[][] = new byte[14][0];
|
byte tuple[][] = new byte[14][0];
|
||||||
for (int k = 0;k < 14;k++)
|
for (int k = 0;k < 14;k++)
|
||||||
tuple[k] = null;
|
tuple[k] = null;
|
||||||
|
|
||||||
String fKeyName = rs.getString(3);
|
String fKeyName = rs.getString(3);
|
||||||
boolean foundRule = false;
|
boolean foundRule = false;
|
||||||
do {
|
do
|
||||||
|
{
|
||||||
String proname = rs.getString(9);
|
String proname = rs.getString(9);
|
||||||
if (proname!=null && proname.startsWith("RI_FKey_")) {
|
if (proname != null && proname.startsWith("RI_FKey_"))
|
||||||
|
{
|
||||||
int col = -1;
|
int col = -1;
|
||||||
if (proname.endsWith("_upd")) col=9; // UPDATE_RULE
|
if (proname.endsWith("_upd"))
|
||||||
else if (proname.endsWith("_del")) col=10; // DELETE_RULE
|
col = 9; // UPDATE_RULE
|
||||||
if (col>-1) {
|
else if (proname.endsWith("_del"))
|
||||||
|
col = 10; // DELETE_RULE
|
||||||
|
if (col > -1)
|
||||||
|
{
|
||||||
String rule = proname.substring(8, proname.length() - 4);
|
String rule = proname.substring(8, proname.length() - 4);
|
||||||
int action = importedKeyNoAction;
|
int action = importedKeyNoAction;
|
||||||
if ("cascade".equals(rule)) action=importedKeyCascade;
|
if ("cascade".equals(rule))
|
||||||
else if ("setnull".equals(rule)) action=importedKeySetNull;
|
action = importedKeyCascade;
|
||||||
else if ("setdefault".equals(rule)) action=importedKeySetDefault;
|
else if ("setnull".equals(rule))
|
||||||
|
action = importedKeySetNull;
|
||||||
|
else if ("setdefault".equals(rule))
|
||||||
|
action = importedKeySetDefault;
|
||||||
tuple[col] = Integer.toString(action).getBytes();
|
tuple[col] = Integer.toString(action).getBytes();
|
||||||
foundRule = true;
|
foundRule = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} while ((hasMore=rs.next()) && fKeyName.equals(rs.getString(3)));
|
}
|
||||||
|
while ((hasMore = rs.next()) && fKeyName.equals(rs.getString(3)));
|
||||||
|
|
||||||
if (foundRule) {
|
if (foundRule)
|
||||||
|
{
|
||||||
tuple[2] = rs.getBytes(2); //PKTABLE_NAME
|
tuple[2] = rs.getBytes(2); //PKTABLE_NAME
|
||||||
tuple[6] = rs.getBytes(1); //FKTABLE_NAME
|
tuple[6] = rs.getBytes(1); //FKTABLE_NAME
|
||||||
|
|
||||||
@ -2471,15 +2484,21 @@ public class DatabaseMetaData implements java.sql.DatabaseMetaData
|
|||||||
int numColumns = (rs.getInt(7) >> 1) - 2;
|
int numColumns = (rs.getInt(7) >> 1) - 2;
|
||||||
String s = rs.getString(8);
|
String s = rs.getString(8);
|
||||||
int pos = s.lastIndexOf("\\000");
|
int pos = s.lastIndexOf("\\000");
|
||||||
for(int c=0;c<numColumns;c++) {
|
for (int c = 0;c < numColumns;c++)
|
||||||
if (pos>-1) {
|
{
|
||||||
|
if (pos > -1)
|
||||||
|
{
|
||||||
int pos2 = s.lastIndexOf("\\000", pos - 1);
|
int pos2 = s.lastIndexOf("\\000", pos - 1);
|
||||||
if (pos2>-1) {
|
if (pos2 > -1)
|
||||||
if (fkeyColumns.length()>0) fkeyColumns.insert(0, ',');
|
{
|
||||||
|
if (fkeyColumns.length() > 0)
|
||||||
|
fkeyColumns.insert(0, ',');
|
||||||
fkeyColumns.insert(0, s.substring(pos2 + 4, pos)); //FKCOLUMN_NAME
|
fkeyColumns.insert(0, s.substring(pos2 + 4, pos)); //FKCOLUMN_NAME
|
||||||
pos = s.lastIndexOf("\\000", pos2 - 1);
|
pos = s.lastIndexOf("\\000", pos2 - 1);
|
||||||
if (pos>-1) {
|
if (pos > -1)
|
||||||
if (pkeyColumns.length()>0) pkeyColumns.insert(0, ',');
|
{
|
||||||
|
if (pkeyColumns.length() > 0)
|
||||||
|
pkeyColumns.insert(0, ',');
|
||||||
pkeyColumns.insert(0, s.substring(pos + 4, pos2)); //PKCOLUMN_NAME
|
pkeyColumns.insert(0, s.substring(pos + 4, pos2)); //PKCOLUMN_NAME
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -2496,7 +2515,8 @@ public class DatabaseMetaData implements java.sql.DatabaseMetaData
|
|||||||
int deferrability = importedKeyNotDeferrable;
|
int deferrability = importedKeyNotDeferrable;
|
||||||
boolean deferrable = rs.getBoolean(5);
|
boolean deferrable = rs.getBoolean(5);
|
||||||
boolean initiallyDeferred = rs.getBoolean(6);
|
boolean initiallyDeferred = rs.getBoolean(6);
|
||||||
if (deferrable) {
|
if (deferrable)
|
||||||
|
{
|
||||||
if (initiallyDeferred)
|
if (initiallyDeferred)
|
||||||
deferrability = importedKeyInitiallyDeferred;
|
deferrability = importedKeyInitiallyDeferred;
|
||||||
else
|
else
|
||||||
@ -2506,7 +2526,8 @@ public class DatabaseMetaData implements java.sql.DatabaseMetaData
|
|||||||
|
|
||||||
tuples.addElement(tuple);
|
tuples.addElement(tuple);
|
||||||
}
|
}
|
||||||
} while (hasMore);
|
}
|
||||||
|
while (hasMore);
|
||||||
}
|
}
|
||||||
|
|
||||||
return new ResultSet(connection, f, tuples, "OK", 1);
|
return new ResultSet(connection, f, tuples, "OK", 1);
|
||||||
|
@ -1565,9 +1565,12 @@ public class ResultSet extends org.postgresql.ResultSet implements java.sql.Resu
|
|||||||
return null;
|
return null;
|
||||||
// length == 10: SQL Date
|
// length == 10: SQL Date
|
||||||
// length > 10: SQL Timestamp, assumes PGDATESTYLE=ISO
|
// length > 10: SQL Timestamp, assumes PGDATESTYLE=ISO
|
||||||
try {
|
try
|
||||||
|
{
|
||||||
return java.sql.Date.valueOf((s.length() == 10) ? s : s.substring(0, 10));
|
return java.sql.Date.valueOf((s.length() == 10) ? s : s.substring(0, 10));
|
||||||
} catch (NumberFormatException e) {
|
}
|
||||||
|
catch (NumberFormatException e)
|
||||||
|
{
|
||||||
throw new PSQLException("postgresql.res.baddate", s);
|
throw new PSQLException("postgresql.res.baddate", s);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1578,9 +1581,12 @@ public class ResultSet extends org.postgresql.ResultSet implements java.sql.Resu
|
|||||||
return null; // SQL NULL
|
return null; // SQL NULL
|
||||||
// length == 8: SQL Time
|
// length == 8: SQL Time
|
||||||
// length > 8: SQL Timestamp
|
// length > 8: SQL Timestamp
|
||||||
try {
|
try
|
||||||
|
{
|
||||||
return java.sql.Time.valueOf((s.length() == 8) ? s : s.substring(11, 19));
|
return java.sql.Time.valueOf((s.length() == 8) ? s : s.substring(11, 19));
|
||||||
} catch (NumberFormatException e) {
|
}
|
||||||
|
catch (NumberFormatException e)
|
||||||
|
{
|
||||||
throw new PSQLException("postgresql.res.badtime", s);
|
throw new PSQLException("postgresql.res.badtime", s);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1639,7 +1645,9 @@ public class ResultSet extends org.postgresql.ResultSet implements java.sql.Resu
|
|||||||
{
|
{
|
||||||
resultSet.sbuf.append("GMT").append(s.substring(s.length() - 3)).append(":00");
|
resultSet.sbuf.append("GMT").append(s.substring(s.length() - 3)).append(":00");
|
||||||
}
|
}
|
||||||
} else if (sub == ':') {
|
}
|
||||||
|
else if (sub == ':')
|
||||||
|
{
|
||||||
//we may have found timezone info of format +/-HH:MM, or there is no
|
//we may have found timezone info of format +/-HH:MM, or there is no
|
||||||
//timezone info at all and this is the : preceding the seconds
|
//timezone info at all and this is the : preceding the seconds
|
||||||
char sub2 = resultSet.sbuf.charAt(resultSet.sbuf.length() - 5);
|
char sub2 = resultSet.sbuf.charAt(resultSet.sbuf.length() - 5);
|
||||||
@ -1650,10 +1658,14 @@ public class ResultSet extends org.postgresql.ResultSet implements java.sql.Resu
|
|||||||
if (subsecond)
|
if (subsecond)
|
||||||
{
|
{
|
||||||
resultSet.sbuf.append('0').append("GMT").append(s.substring(s.length() - 5));
|
resultSet.sbuf.append('0').append("GMT").append(s.substring(s.length() - 5));
|
||||||
} else {
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
resultSet.sbuf.append("GMT").append(s.substring(s.length() - 5));
|
resultSet.sbuf.append("GMT").append(s.substring(s.length() - 5));
|
||||||
}
|
}
|
||||||
} else if (subsecond) {
|
}
|
||||||
|
else if (subsecond)
|
||||||
|
{
|
||||||
resultSet.sbuf.append('0');
|
resultSet.sbuf.append('0');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -8,7 +8,7 @@ import java.sql.*;
|
|||||||
import org.postgresql.largeobject.*;
|
import org.postgresql.largeobject.*;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* $Id: BlobTest.java,v 1.4 2001/11/19 22:33:39 momjian Exp $
|
* $Id: BlobTest.java,v 1.5 2001/11/19 23:16:46 momjian Exp $
|
||||||
*
|
*
|
||||||
* Some simple tests based on problems reported by users. Hopefully these will
|
* Some simple tests based on problems reported by users. Hopefully these will
|
||||||
* help prevent previous problems from re-occuring ;-)
|
* help prevent previous problems from re-occuring ;-)
|
||||||
|
@ -77,6 +77,7 @@ public class PGtokenizer
|
|||||||
|
|
||||||
// Don't forget the last token ;-)
|
// Don't forget the last token ;-)
|
||||||
|
|
||||||
|
|
||||||
if (s < string.length())
|
if (s < string.length())
|
||||||
tokens.addElement(string.substring(s));
|
tokens.addElement(string.substring(s));
|
||||||
|
|
||||||
|
@ -40,7 +40,7 @@
|
|||||||
*
|
*
|
||||||
* Copyright 1999 (C) Exoffice Technologies Inc. All Rights Reserved.
|
* Copyright 1999 (C) Exoffice Technologies Inc. All Rights Reserved.
|
||||||
*
|
*
|
||||||
* $Id: XADataSourceImpl.java,v 1.3 2001/11/19 22:33:39 momjian Exp $
|
* $Id: XADataSourceImpl.java,v 1.4 2001/11/19 23:16:46 momjian Exp $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
@ -379,6 +379,7 @@ public abstract class XADataSourceImpl
|
|||||||
// Look for all connections inside a transaction that
|
// Look for all connections inside a transaction that
|
||||||
// should have timed out by now.
|
// should have timed out by now.
|
||||||
|
|
||||||
|
|
||||||
timeout = System.currentTimeMillis();
|
timeout = System.currentTimeMillis();
|
||||||
enum = _txConnections.elements();
|
enum = _txConnections.elements();
|
||||||
while ( enum.hasMoreElements() )
|
while ( enum.hasMoreElements() )
|
||||||
|
@ -16,7 +16,7 @@ fi
|
|||||||
|
|
||||||
for FILE
|
for FILE
|
||||||
do
|
do
|
||||||
astyle --style=java -b -p -j < "$FILE" >/tmp/$$ 2>/tmp/$$a
|
astyle --style=java -b -p -j -S < "$FILE" >/tmp/$$ 2>/tmp/$$a
|
||||||
if [ "$?" -ne 0 -o -s /tmp/$$a ]
|
if [ "$?" -ne 0 -o -s /tmp/$$a ]
|
||||||
then echo "$FILE"
|
then echo "$FILE"
|
||||||
cat /tmp/$$a
|
cat /tmp/$$a
|
||||||
|
Loading…
x
Reference in New Issue
Block a user