1010import org .postgresql .util .*;
1111import org .postgresql .core .*;
1212
13- /**
14- * $Id: Connection.java,v 1.35 2001/11/12 19:11:56 barry Exp $
13+ /*
14+ * $Id: Connection.java,v 1.36 2001/11/19 22:33:37 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.
@@ -30,7 +30,7 @@ public abstract class Connection
3030private boolean PG_STATUS ;
3131private String compatible ;
3232
33- /**
33+ /*
3434 *The encoding to use for this connection.
3535 */
3636private Encoding encoding =Encoding .defaultEncoding ();
@@ -63,7 +63,7 @@ public abstract class Connection
6363private static final int AUTH_REQ_KRB5 =2 ;
6464private static final int AUTH_REQ_PASSWORD =3 ;
6565private static final int AUTH_REQ_CRYPT =4 ;
66- private static final int AUTH_REQ_MD5 =5 ;
66+ private static final int AUTH_REQ_MD5 =5 ;
6767
6868// New for 6.3, salt value for crypt authorisation
6969private String salt ;
@@ -76,7 +76,7 @@ public abstract class Connection
7676// Now handle notices as warnings, so things like "show" now work
7777public SQLWarning firstWarning =null ;
7878
79- /**
79+ /*
8080 * Cache of the current isolation level
8181 */
8282private int isolationLevel =java .sql .Connection .TRANSACTION_READ_COMMITTED ;
@@ -85,13 +85,13 @@ public abstract class Connection
8585public int pid ;
8686public int ckey ;
8787
88- /**
88+ /*
8989 * This is called by Class.forName() from within org.postgresql.Driver
9090 */
9191public Connection ()
9292{}
9393
94- /**
94+ /*
9595 * This method actually opens the connection. It is called by Driver.
9696 *
9797 * @param host the hostname of the database back end
@@ -115,7 +115,7 @@ protected void openConnection(String host, int port, Properties info, String dat
115115this_url =url ;
116116PG_DATABASE =database ;
117117PG_USER =info .getProperty ("user" );
118- PG_PASSWORD =info .getProperty ("password" ,"" );
118+ PG_PASSWORD =info .getProperty ("password" ,"" );
119119PG_PORT =port ;
120120PG_HOST =host ;
121121PG_STATUS =CONNECTION_BAD ;
@@ -335,7 +335,7 @@ protected void openConnection(String host, int port, Properties info, String dat
335335// are common to all implementations (JDBC1 or 2), they are placed here.
336336// This should make it easy to maintain the two specifications.
337337
338- /**
338+ /*
339339 * This adds a warning to the warning chain.
340340 * @param msg message to add
341341 */
@@ -355,17 +355,17 @@ public void addWarning(String msg)
355355// technique again, we'll know where to place it.
356356//
357357// This is generated by the SQL "show datestyle"
358- //if(msg.startsWith("NOTICE:") && msg.indexOf("DateStyle")>0) {
358+ //if (msg.startsWith("NOTICE:") && msg.indexOf("DateStyle")>0) {
359359//// 13 is the length off "DateStyle is "
360360//msg = msg.substring(msg.indexOf("DateStyle is ")+13);
361361//
362362//for(int i=0;i<dateStyles.length;i+=2)
363- //if(msg.startsWith(dateStyles[i]))
363+ //if (msg.startsWith(dateStyles[i]))
364364//currentDateStyle=i+1; // this is the index of the format
365365//}
366366}
367367
368- /**
368+ /*
369369 * Send a query to the backend. Returns one of the ResultSet
370370 * objects.
371371 *
@@ -381,7 +381,7 @@ public java.sql.ResultSet ExecSQL(String sql) throws SQLException
381381return ExecSQL (sql ,null );
382382}
383383
384- /**
384+ /*
385385 * Send a query to the backend. Returns one of the ResultSet
386386 * objects.
387387 *
@@ -398,7 +398,7 @@ public java.sql.ResultSet ExecSQL(String sql, java.sql.Statement stat) throws SQ
398398return new QueryExecutor (sql ,stat ,pg_stream ,this ).execute ();
399399}
400400
401- /**
401+ /*
402402 * In SQL, a result table can be retrieved through a cursor that
403403 * is named. The current row of a result can be updated or deleted
404404 * using a positioned update/delete statement that references the
@@ -416,7 +416,7 @@ public void setCursorName(String cursor) throws SQLException
416416this .cursor =cursor ;
417417}
418418
419- /**
419+ /*
420420 * getCursorName gets the cursor name.
421421 *
422422 * @return the current cursor name
@@ -427,7 +427,7 @@ public String getCursorName() throws SQLException
427427return cursor ;
428428}
429429
430- /**
430+ /*
431431 * We are required to bring back certain information by
432432 * the DatabaseMetaData class.These functions do that.
433433 *
@@ -441,7 +441,7 @@ public String getURL() throws SQLException
441441return this_url ;
442442}
443443
444- /**
444+ /*
445445 * Method getUserName() brings back the User Name (again, we
446446 * saved it)
447447 *
@@ -453,15 +453,15 @@ public String getUserName() throws SQLException
453453return PG_USER ;
454454}
455455
456- /**
456+ /*
457457 * Get the character encoding to use for this connection.
458458 */
459459public Encoding getEncoding ()throws SQLException
460460{
461461return encoding ;
462462}
463463
464- /**
464+ /*
465465 * This returns the Fastpath API for the current connection.
466466 *
467467 * <p><b>NOTE:</b> This is not part of JDBC, but allows access to
@@ -493,7 +493,7 @@ public Fastpath getFastpathAPI() throws SQLException
493493// This holds a reference to the Fastpath API if already open
494494private Fastpath fastpath =null ;
495495
496- /**
496+ /*
497497 * This returns the LargeObject API for the current connection.
498498 *
499499 * <p><b>NOTE:</b> This is not part of JDBC, but allows access to
@@ -522,7 +522,7 @@ public LargeObjectManager getLargeObjectAPI() throws SQLException
522522// This holds a reference to the LargeObject API if already open
523523private LargeObjectManager largeobject =null ;
524524
525- /**
525+ /*
526526 * This method is used internally to return an object based around
527527 * org.postgresql's more unique data types.
528528 *
@@ -594,7 +594,7 @@ public Object getObject(String type, String value) throws SQLException
594594return null ;
595595}
596596
597- /**
597+ /*
598598 * This stores an object into the database.
599599 * @param o Object to store
600600 * @return OID of the new rectord
@@ -639,7 +639,7 @@ public int putObject(Object o) throws SQLException
639639}
640640}
641641
642- /**
642+ /*
643643 * This allows client code to add a handler for one of org.postgresql's
644644 * more unique data types.
645645 *
@@ -693,13 +693,13 @@ private void initObjectTypes()
693693// These are required by other common classes
694694public abstract java .sql .Statement createStatement ()throws SQLException ;
695695
696- /**
696+ /*
697697 * This returns a resultset. It must be overridden, so that the correct
698698 * version (from jdbc1 or jdbc2) are returned.
699699 */
700700public abstract java .sql .ResultSet getResultSet (org .postgresql .Connection conn ,java .sql .Statement stat ,Field []fields ,Vector tuples ,String status ,int updateCount ,int insertOID ,boolean binaryCursor )throws SQLException ;
701701
702- /**
702+ /*
703703 * In some cases, it is desirable to immediately release a Connection's
704704 * database and JDBC resources instead of waiting for them to be
705705 * automatically released (cant think why off the top of my head)
@@ -726,7 +726,7 @@ public void close() throws SQLException
726726}
727727}
728728
729- /**
729+ /*
730730 * A driver may convert the JDBC sql grammar into its system's
731731 * native SQL grammar prior to sending it; nativeSQL returns the
732732 * native form of the statement that the driver would have sent.
@@ -741,7 +741,7 @@ public String nativeSQL(String sql) throws SQLException
741741return sql ;
742742}
743743
744- /**
744+ /*
745745 * The first warning reported by calls on this Connection is
746746 * returned.
747747 *
@@ -756,7 +756,7 @@ public SQLWarning getWarnings() throws SQLException
756756return firstWarning ;
757757}
758758
759- /**
759+ /*
760760 * After this call, getWarnings returns null until a new warning
761761 * is reported for this connection.
762762 *
@@ -768,7 +768,7 @@ public void clearWarnings() throws SQLException
768768}
769769
770770
771- /**
771+ /*
772772 * You can put a connection in read-only mode as a hunt to enable
773773 * database optimizations
774774 *
@@ -783,7 +783,7 @@ public void setReadOnly(boolean readOnly) throws SQLException
783783this .readOnly =readOnly ;
784784}
785785
786- /**
786+ /*
787787 * Tests to see if the connection is in Read Only Mode. Note that
788788 * we cannot really put the database in read only mode, but we pretend
789789 * we can by returning the value of the readOnly flag
@@ -796,7 +796,7 @@ public boolean isReadOnly() throws SQLException
796796return readOnly ;
797797}
798798
799- /**
799+ /*
800800 * If a connection is in auto-commit mode, than all its SQL
801801 * statements will be executed and committed as individual
802802 * transactions. Otherwise, its SQL statements are grouped
@@ -835,7 +835,7 @@ public void setAutoCommit(boolean autoCommit) throws SQLException
835835this .autoCommit =autoCommit ;
836836}
837837
838- /**
838+ /*
839839 * gets the current auto-commit state
840840 *
841841 * @return Current state of the auto-commit mode
@@ -847,7 +847,7 @@ public boolean getAutoCommit() throws SQLException
847847return this .autoCommit ;
848848}
849849
850- /**
850+ /*
851851 * The method commit() makes all changes made since the previous
852852 * commit/rollback permanent and releases any database locks currently
853853 * held by the Connection.This method should only be used when
@@ -873,7 +873,7 @@ public void commit() throws SQLException
873873}
874874}
875875
876- /**
876+ /*
877877 * The method rollback() drops all changes made since the previous
878878 * commit/rollback and releases any database locks currently held by
879879 * the Connection.
@@ -897,7 +897,7 @@ public void rollback() throws SQLException
897897}
898898}
899899
900- /**
900+ /*
901901 * Get this Connection's current transaction isolation mode.
902902 *
903903 * @return the current TRANSACTION_* mode value
@@ -925,7 +925,7 @@ else if (message.indexOf("SERIALIZABLE") != -1)
925925return java .sql .Connection .TRANSACTION_READ_COMMITTED ;
926926}
927927
928- /**
928+ /*
929929 * You can call this method to try to change the transaction
930930 * isolation level using one of the TRANSACTION_* values.
931931 *
@@ -972,7 +972,7 @@ public void setTransactionIsolation(int level) throws SQLException
972972ExecSQL (isolationLevelSQL );
973973}
974974
975- /**
975+ /*
976976 * Helper method used by setTransactionIsolation(), commit(), rollback()
977977 * and setAutoCommit(). This returns the SQL string needed to
978978 * set the isolation level for a transaction. In 7.1 and later it
@@ -1007,7 +1007,7 @@ protected String getIsolationLevelSQL() throws SQLException
10071007return sb .toString ();
10081008}
10091009
1010- /**
1010+ /*
10111011 * A sub-space of this Connection's database may be selected by
10121012 * setting a catalog name.If the driver does not support catalogs,
10131013 * it will silently ignore this request
@@ -1019,7 +1019,7 @@ public void setCatalog(String catalog) throws SQLException
10191019//no-op
10201020}
10211021
1022- /**
1022+ /*
10231023 * Return the connections current catalog name, or null if no
10241024 * catalog name is set, or we dont support catalogs.
10251025 *
@@ -1031,7 +1031,7 @@ public String getCatalog() throws SQLException
10311031return PG_DATABASE ;
10321032}
10331033
1034- /**
1034+ /*
10351035 * Overides finalize(). If called, it closes the connection.
10361036 *
10371037 * This was done at the request of Rachel Greenham
@@ -1051,7 +1051,7 @@ private static String extractVersionNumber(String fullVersionString)
10511051return versionParts .nextToken ();/* "X.Y.Z" */
10521052}
10531053
1054- /**
1054+ /*
10551055 * Get server version number
10561056 */
10571057public String getDBVersionNumber ()
@@ -1064,7 +1064,7 @@ public boolean haveMinimumServerVersion(String ver) throws SQLException
10641064return (getDBVersionNumber ().compareTo (ver ) >=0 );
10651065}
10661066
1067- /**
1067+ /*
10681068 * This method returns true if the compatible level set in the connection
10691069 * (which can be passed into the connection or specified in the URL)
10701070 * is at least the value passed to this method. This is used to toggle
@@ -1082,7 +1082,7 @@ public boolean haveMinimumCompatibleVersion(String ver) throws SQLException
10821082}
10831083
10841084
1085- /**
1085+ /*
10861086 * This returns the java.sql.Types type for a PG type oid
10871087 *
10881088 * @param oid PostgreSQL type oid
@@ -1111,15 +1111,15 @@ public int getSQLType(int oid) throws SQLException
11111111return sqlType .intValue ();
11121112}
11131113
1114- /**
1114+ /*
11151115 * This returns the java.sql.Types type for a PG type
11161116 *
11171117 * @param pgTypeName PostgreSQL type name
11181118 * @return the java.sql.Types type
11191119 */
11201120public abstract int getSQLType (String pgTypeName );
11211121
1122- /**
1122+ /*
11231123 * This returns the oid for a given PG data type
11241124 * @param typeName PostgreSQL type name
11251125 * @return PostgreSQL oid value for a field of this type
@@ -1150,7 +1150,7 @@ public int getOID(String typeName) throws SQLException
11501150return oid ;
11511151}
11521152
1153- /**
1153+ /*
11541154 * We also need to get the PG type name as returned by the back end.
11551155 *
11561156 * @return the String representation of the type of this field