Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commiteec08cd

Browse files
committed
Great, here is a context diff of CVS for implementing the get/setCatalog methods
in Connection - note: I've updated setCatalog(String catalog) from my previousdiff so it checks whether it is already connected to the specified catalog.Jason Davies
1 parentff21a8e commiteec08cd

File tree

3 files changed

+33
-51
lines changed

3 files changed

+33
-51
lines changed

‎src/interfaces/jdbc/org/postgresql/Connection.java

Lines changed: 31 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
importorg.postgresql.core.Encoding;
1212

1313
/**
14-
* $Id: Connection.java,v 1.19 2001/07/21 18:52:10 momjian Exp $
14+
* $Id: Connection.java,v 1.20 2001/07/21 18:56:17 momjian Exp $
1515
*
1616
* This abstract class is used by org.postgresql.Driver to open either the JDBC1 or
1717
* JDBC2 versions of the Connection class.
@@ -790,6 +790,36 @@ private void initObjectTypes()
790790

791791
publicabstractvoidclose()throwsSQLException;
792792

793+
/**
794+
* A sub-space of this Connection's database may be selected by
795+
* setting a catalog name. If the driver does not support catalogs,
796+
* it will silently ignore this request
797+
*
798+
* @exception SQLException if a database access error occurs
799+
*/
800+
publicvoidsetCatalog(Stringcatalog)throwsSQLException
801+
{
802+
if(catalog!=null && !catalog.equals(PG_DATABASE)) {
803+
close();
804+
Propertiesinfo=newProperties();
805+
info.setProperty("user",PG_USER);
806+
info.setProperty("password",PG_PASSWORD);
807+
openConnection(PG_HOST,PG_PORT,info,catalog,this_url,this_driver);
808+
}
809+
}
810+
811+
/**
812+
* Return the connections current catalog name, or null if no
813+
* catalog name is set, or we dont support catalogs.
814+
*
815+
* @return the current catalog name or null
816+
* @exception SQLException if a database access error occurs
817+
*/
818+
publicStringgetCatalog()throwsSQLException
819+
{
820+
returnPG_DATABASE;
821+
}
822+
793823
/**
794824
* Overides finalize(). If called, it closes the connection.
795825
*

‎src/interfaces/jdbc/org/postgresql/jdbc1/Connection.java

Lines changed: 1 addition & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
importorg.postgresql.util.*;
1818

1919
/**
20-
* $Id: Connection.java,v 1.5 2001/01/18 17:37:13 peter Exp $
20+
* $Id: Connection.java,v 1.6 2001/07/21 18:56:17 momjian Exp $
2121
*
2222
* A Connection represents a session with a specific database. Within the
2323
* context of a Connection, SQL statements are executed and results are
@@ -272,30 +272,6 @@ public boolean isReadOnly() throws SQLException
272272
returnreadOnly;
273273
}
274274

275-
/**
276-
* A sub-space of this Connection's database may be selected by
277-
* setting a catalog name. If the driver does not support catalogs,
278-
* it will silently ignore this request
279-
*
280-
* @exception SQLException if a database access error occurs
281-
*/
282-
publicvoidsetCatalog(Stringcatalog)throwsSQLException
283-
{
284-
// No-op
285-
}
286-
287-
/**
288-
* Return the connections current catalog name, or null if no
289-
* catalog name is set, or we dont support catalogs.
290-
*
291-
* @return the current catalog name or null
292-
* @exception SQLException if a database access error occurs
293-
*/
294-
publicStringgetCatalog()throwsSQLException
295-
{
296-
returnnull;
297-
}
298-
299275
/**
300276
* You can call this method to try to change the transaction
301277
* isolation level using one of the TRANSACTION_* values.

‎src/interfaces/jdbc/org/postgresql/jdbc2/Connection.java

Lines changed: 1 addition & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
importorg.postgresql.util.*;
1818

1919
/**
20-
* $Id: Connection.java,v 1.7 2001/02/13 16:39:02 peter Exp $
20+
* $Id: Connection.java,v 1.8 2001/07/21 18:56:17 momjian Exp $
2121
*
2222
* A Connection represents a session with a specific database. Within the
2323
* context of a Connection, SQL statements are executed and results are
@@ -355,30 +355,6 @@ public boolean isReadOnly() throws SQLException
355355
returnreadOnly;
356356
}
357357

358-
/**
359-
* A sub-space of this Connection's database may be selected by
360-
* setting a catalog name. If the driver does not support catalogs,
361-
* it will silently ignore this request
362-
*
363-
* @exception SQLException if a database access error occurs
364-
*/
365-
publicvoidsetCatalog(Stringcatalog)throwsSQLException
366-
{
367-
// No-op
368-
}
369-
370-
/**
371-
* Return the connections current catalog name, or null if no
372-
* catalog name is set, or we dont support catalogs.
373-
*
374-
* @return the current catalog name or null
375-
* @exception SQLException if a database access error occurs
376-
*/
377-
publicStringgetCatalog()throwsSQLException
378-
{
379-
returnnull;
380-
}
381-
382358
/**
383359
* You can call this method to try to change the transaction
384360
* isolation level using one of the TRANSACTION_* values.

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp