Permalink
Browse files

style: reformat with Eclipse

Notable differences: Eclipse does not like for loops without increment part, thus rewritten it to while.
Eclipse formats: for(int i=0; i<10;), and it somehow misses space after the latest ';'

closes #467, closes #295
see also #441
  • Loading branch information...
vlsi committed Dec 29, 2015
1 parent 8f1c9d7 commit 2d5e7fa57045a47887de4ea300a743a160ae4f86
Showing with 3,524 additions and 3,538 deletions.
  1. +63 −55 pgjdbc/src/main/java/org/postgresql/Driver.java
  2. +18 −14 pgjdbc/src/main/java/org/postgresql/PGConnection.java
  3. +25 −27 pgjdbc/src/main/java/org/postgresql/PGProperty.java
  4. +3 −3 pgjdbc/src/main/java/org/postgresql/PGRefCursorResultSet.java
  5. +9 −5 pgjdbc/src/main/java/org/postgresql/PGStatement.java
  6. +2 −2 pgjdbc/src/main/java/org/postgresql/copy/CopyIn.java
  7. +16 −16 pgjdbc/src/main/java/org/postgresql/copy/CopyManager.java
  8. +1 −1 pgjdbc/src/main/java/org/postgresql/copy/PGCopyInputStream.java
  9. +9 −8 pgjdbc/src/main/java/org/postgresql/core/BaseConnection.java
  10. +7 −7 pgjdbc/src/main/java/org/postgresql/core/BaseStatement.java
  11. +20 −18 pgjdbc/src/main/java/org/postgresql/core/ConnectionFactory.java
  12. +22 −20 pgjdbc/src/main/java/org/postgresql/core/Field.java
  13. +1 −2 pgjdbc/src/main/java/org/postgresql/core/NativeQuery.java
  14. +1 −1 pgjdbc/src/main/java/org/postgresql/core/Oid.java
  15. +21 −20 pgjdbc/src/main/java/org/postgresql/core/PGStream.java
  16. +16 −12 pgjdbc/src/main/java/org/postgresql/core/ParameterList.java
  17. +2 −2 pgjdbc/src/main/java/org/postgresql/core/ProtocolConnection.java
  18. +13 −10 pgjdbc/src/main/java/org/postgresql/core/Query.java
  19. +62 −64 pgjdbc/src/main/java/org/postgresql/core/QueryExecutor.java
  20. +19 −16 pgjdbc/src/main/java/org/postgresql/core/ResultHandler.java
  21. +14 −16 pgjdbc/src/main/java/org/postgresql/core/ServerVersion.java
  22. +1 −1 pgjdbc/src/main/java/org/postgresql/core/SetupQueryRunner.java
  23. +4 −4 pgjdbc/src/main/java/org/postgresql/core/TypeInfo.java
  24. +8 −9 pgjdbc/src/main/java/org/postgresql/core/UTF8Encoding.java
  25. +20 −25 pgjdbc/src/main/java/org/postgresql/core/Utils.java
  26. +4 −4 pgjdbc/src/main/java/org/postgresql/core/VisibleBufferedInputStream.java
  27. +37 −31 pgjdbc/src/main/java/org/postgresql/core/v2/ConnectionFactoryImpl.java
  28. +8 −4 pgjdbc/src/main/java/org/postgresql/core/v2/FastpathParameterList.java
  29. +29 −38 pgjdbc/src/main/java/org/postgresql/core/v2/QueryExecutorImpl.java
  30. +14 −8 pgjdbc/src/main/java/org/postgresql/core/v2/SimpleParameterList.java
  31. +3 −1 pgjdbc/src/main/java/org/postgresql/core/v2/SocketFactoryFactory.java
  32. +2 −1 pgjdbc/src/main/java/org/postgresql/core/v3/CompositeParameterList.java
  33. +44 −49 pgjdbc/src/main/java/org/postgresql/core/v3/ConnectionFactoryImpl.java
  34. +197 −220 pgjdbc/src/main/java/org/postgresql/core/v3/QueryExecutorImpl.java
  35. +8 −7 pgjdbc/src/main/java/org/postgresql/core/v3/SimpleParameterList.java
  36. +5 −7 pgjdbc/src/main/java/org/postgresql/core/v3/SimpleQuery.java
  37. +1 −1 pgjdbc/src/main/java/org/postgresql/core/v3/V3ParameterList.java
  38. +1 −1 pgjdbc/src/main/java/org/postgresql/core/v3/V3Query.java
  39. +20 −16 pgjdbc/src/main/java/org/postgresql/ds/PGConnectionPoolDataSource.java
  40. +34 −35 pgjdbc/src/main/java/org/postgresql/ds/PGPooledConnection.java
  41. +52 −48 pgjdbc/src/main/java/org/postgresql/ds/PGPoolingDataSource.java
  42. +3 −2 pgjdbc/src/main/java/org/postgresql/ds/PGSimpleDataSource.java
  43. +17 −22 pgjdbc/src/main/java/org/postgresql/ds/common/BaseDataSource.java
  44. +3 −2 pgjdbc/src/main/java/org/postgresql/ds/common/PGObjectFactory.java
  45. +33 −24 pgjdbc/src/main/java/org/postgresql/fastpath/Fastpath.java
  46. +3 −3 pgjdbc/src/main/java/org/postgresql/geometric/PGbox.java
  47. +1 −1 pgjdbc/src/main/java/org/postgresql/geometric/PGpath.java
  48. +1 −0 pgjdbc/src/main/java/org/postgresql/gss/GSSCallbackHandler.java
  49. +4 −4 pgjdbc/src/main/java/org/postgresql/gss/MakeGSS.java
  50. +3 −3 pgjdbc/src/main/java/org/postgresql/hostchooser/GlobalHostStatusTracker.java
  51. +4 −3 pgjdbc/src/main/java/org/postgresql/hostchooser/MultiHostChooser.java
  52. +4 −5 pgjdbc/src/main/java/org/postgresql/jdbc/AbstractBlobClob.java
  53. +2 −4 pgjdbc/src/main/java/org/postgresql/jdbc/BatchResultHandler.java
  54. +1 −1 pgjdbc/src/main/java/org/postgresql/jdbc/CallableBatchResultHandler.java
  55. +7 −9 pgjdbc/src/main/java/org/postgresql/jdbc/EscapedFunctions.java
  56. +72 −55 pgjdbc/src/main/java/org/postgresql/jdbc/PgArray.java
  57. +54 −73 pgjdbc/src/main/java/org/postgresql/jdbc/PgCallableStatement.java
  58. +50 −58 pgjdbc/src/main/java/org/postgresql/jdbc/PgConnection.java
  59. +232 −236 pgjdbc/src/main/java/org/postgresql/jdbc/PgDatabaseMetaData.java
  60. +3 −2 pgjdbc/src/main/java/org/postgresql/jdbc/PgParameterMetaData.java
  61. +66 −62 pgjdbc/src/main/java/org/postgresql/jdbc/PgPreparedStatement.java
  62. +212 −269 pgjdbc/src/main/java/org/postgresql/jdbc/PgResultSet.java
  63. +73 −37 pgjdbc/src/main/java/org/postgresql/jdbc/PgResultSetMetaData.java
  64. +12 −9 pgjdbc/src/main/java/org/postgresql/jdbc/PgSQLXML.java
  65. +61 −79 pgjdbc/src/main/java/org/postgresql/jdbc/PgStatement.java
  66. +60 −49 pgjdbc/src/main/java/org/postgresql/jdbc/TimestampUtils.java
  67. +27 −24 pgjdbc/src/main/java/org/postgresql/jdbc/TypeInfoCache.java
  68. +2 −2 pgjdbc/src/main/java/org/postgresql/jdbc2/ArrayAssistant.java
  69. +14 −11 pgjdbc/src/main/java/org/postgresql/largeobject/BlobInputStream.java
  70. +1 −1 pgjdbc/src/main/java/org/postgresql/largeobject/BlobOutputStream.java
  71. +40 −34 pgjdbc/src/main/java/org/postgresql/largeobject/LargeObject.java
  72. +44 −24 pgjdbc/src/main/java/org/postgresql/largeobject/LargeObjectManager.java
  73. +1 −2 pgjdbc/src/main/java/org/postgresql/osgi/PGBundleActivator.java
  74. +3 −4 pgjdbc/src/main/java/org/postgresql/osgi/PGDataSourceFactory.java
  75. +11 −14 pgjdbc/src/main/java/org/postgresql/ssl/DbKeyStoreSocketFactory.java
  76. +9 −7 pgjdbc/src/main/java/org/postgresql/ssl/MakeSSL.java
  77. +3 −4 pgjdbc/src/main/java/org/postgresql/ssl/NonValidatingFactory.java
  78. +123 −33 pgjdbc/src/main/java/org/postgresql/ssl/SingleCertValidatingFactory.java
  79. +2 −1 pgjdbc/src/main/java/org/postgresql/ssl/WrappedFactory.java
  80. +32 −27 pgjdbc/src/main/java/org/postgresql/ssl/jdbc4/LazyKeyManager.java
  81. +32 −28 pgjdbc/src/main/java/org/postgresql/ssl/jdbc4/LibPQFactory.java
  82. +8 −11 pgjdbc/src/main/java/org/postgresql/sspi/NTDSAPI.java
  83. +8 −11 pgjdbc/src/main/java/org/postgresql/sspi/NTDSAPIWrapper.java
  84. +25 −36 pgjdbc/src/main/java/org/postgresql/sspi/SSPIClient.java
  85. +139 −121 pgjdbc/src/main/java/org/postgresql/util/Base64.java
  86. +16 −18 pgjdbc/src/main/java/org/postgresql/util/ByteConverter.java
  87. +2 −2 pgjdbc/src/main/java/org/postgresql/util/GT.java
  88. +6 −4 pgjdbc/src/main/java/org/postgresql/util/HStoreConverter.java
  89. +2 −2 pgjdbc/src/main/java/org/postgresql/util/HostSpec.java
  90. +6 −4 pgjdbc/src/main/java/org/postgresql/util/LruCache.java
  91. +4 −4 pgjdbc/src/main/java/org/postgresql/util/MD5Digest.java
  92. +10 −11 pgjdbc/src/main/java/org/postgresql/util/ObjectFactory.java
  93. +3 −3 pgjdbc/src/main/java/org/postgresql/util/PGBinaryObject.java
  94. +23 −33 pgjdbc/src/main/java/org/postgresql/util/PGInterval.java
  95. +7 −10 pgjdbc/src/main/java/org/postgresql/util/PGJDBCMain.java
  96. +4 −5 pgjdbc/src/main/java/org/postgresql/util/PGTime.java
  97. +11 −11 pgjdbc/src/main/java/org/postgresql/util/PGTimestamp.java
  98. +15 −15 pgjdbc/src/main/java/org/postgresql/util/PGbytea.java
  99. +2 −1 pgjdbc/src/main/java/org/postgresql/util/PGobject.java
  100. +6 −5 pgjdbc/src/main/java/org/postgresql/util/PGtokenizer.java
  101. +2 −2 pgjdbc/src/main/java/org/postgresql/util/PSQLDriverVersion.java
  102. +1 −1 pgjdbc/src/main/java/org/postgresql/util/PSQLState.java
  103. +17 −18 pgjdbc/src/main/java/org/postgresql/util/ServerErrorMessage.java
  104. +7 −6 pgjdbc/src/main/java/org/postgresql/util/StreamWrapper.java
  105. +18 −12 pgjdbc/src/main/java/org/postgresql/util/UnixCrypt.java
  106. +39 −41 pgjdbc/src/main/java/org/postgresql/xa/PGXAConnection.java
  107. +4 −6 pgjdbc/src/main/java/org/postgresql/xa/PGXADataSource.java
  108. +5 −4 pgjdbc/src/main/java/org/postgresql/xa/PGXADataSourceFactory.java
  109. +2 −1 pgjdbc/src/main/java/org/postgresql/xa/RecoveredXid.java
  110. +26 −35 pgjdbc/src/test/java/org/postgresql/test/TestUtil.java
  111. +2 −2 pgjdbc/src/test/java/org/postgresql/test/hostchooser/MultiHostTestSuite.java
  112. +1 −1 pgjdbc/src/test/java/org/postgresql/test/hostchooser/MultiHostsConnectionTest.java
  113. +1 −2 pgjdbc/src/test/java/org/postgresql/test/jdbc2/ANTTest.java
  114. +4 −5 pgjdbc/src/test/java/org/postgresql/test/jdbc2/ArrayTest.java
  115. +1 −1 pgjdbc/src/test/java/org/postgresql/test/jdbc2/BaseTest.java
  116. +81 −89 pgjdbc/src/test/java/org/postgresql/test/jdbc2/BatchExecuteTest.java
  117. +7 −8 pgjdbc/src/test/java/org/postgresql/test/jdbc2/BlobTest.java
  118. +9 −8 pgjdbc/src/test/java/org/postgresql/test/jdbc2/BlobTransactionTest.java
  119. +6 −5 pgjdbc/src/test/java/org/postgresql/test/jdbc2/CallableStmtTest.java
  120. +25 −38 pgjdbc/src/test/java/org/postgresql/test/jdbc2/ColumnSanitiserDisabledTest.java
  121. +19 −34 pgjdbc/src/test/java/org/postgresql/test/jdbc2/ColumnSanitiserEnabledTest.java
  122. +15 −19 pgjdbc/src/test/java/org/postgresql/test/jdbc2/ConnectionTest.java
  123. +6 −5 pgjdbc/src/test/java/org/postgresql/test/jdbc2/CopyLargeFileTest.java
  124. +6 −5 pgjdbc/src/test/java/org/postgresql/test/jdbc2/CopyTest.java
  125. +37 −37 pgjdbc/src/test/java/org/postgresql/test/jdbc2/CursorFetchTest.java
  126. +21 −25 pgjdbc/src/test/java/org/postgresql/test/jdbc2/DatabaseEncodingTest.java
  127. +5 −7 pgjdbc/src/test/java/org/postgresql/test/jdbc2/DatabaseMetaDataPropertiesTest.java
  128. +48 −29 pgjdbc/src/test/java/org/postgresql/test/jdbc2/DatabaseMetaDataTest.java
  129. +3 −3 pgjdbc/src/test/java/org/postgresql/test/jdbc2/DateTest.java
  130. +8 −12 pgjdbc/src/test/java/org/postgresql/test/jdbc2/DriverTest.java
  131. +2 −4 pgjdbc/src/test/java/org/postgresql/test/jdbc2/EncodingTest.java
  132. +17 −26 pgjdbc/src/test/java/org/postgresql/test/jdbc2/GeometricTest.java
  133. +2 −4 pgjdbc/src/test/java/org/postgresql/test/jdbc2/GetXXXTest.java
  134. +6 −11 pgjdbc/src/test/java/org/postgresql/test/jdbc2/IntervalTest.java
  135. +2 −4 pgjdbc/src/test/java/org/postgresql/test/jdbc2/JBuilderTest.java
  136. +0 −2 pgjdbc/src/test/java/org/postgresql/test/jdbc2/LoginTimeoutTest.java
  137. +2 −2 pgjdbc/src/test/java/org/postgresql/test/jdbc2/MiscTest.java
  138. +1 −1 pgjdbc/src/test/java/org/postgresql/test/jdbc2/OID74Test.java
  139. +12 −17 pgjdbc/src/test/java/org/postgresql/test/jdbc2/PGPropertyTest.java
  140. +9 −9 pgjdbc/src/test/java/org/postgresql/test/jdbc2/PGTimeTest.java
  141. +4 −4 pgjdbc/src/test/java/org/postgresql/test/jdbc2/PGTimestampTest.java
  142. +44 −27 pgjdbc/src/test/java/org/postgresql/test/jdbc2/PreparedStatementTest.java
  143. +3 −5 pgjdbc/src/test/java/org/postgresql/test/jdbc2/RefCursorTest.java
  144. +2 −1 pgjdbc/src/test/java/org/postgresql/test/jdbc2/ResultSetMetaDataTest.java
  145. +33 −48 pgjdbc/src/test/java/org/postgresql/test/jdbc2/ResultSetTest.java
  146. +2 −2 pgjdbc/src/test/java/org/postgresql/test/jdbc2/SearchPathLookupTest.java
  147. +12 −10 pgjdbc/src/test/java/org/postgresql/test/jdbc2/ServerCursorTest.java
  148. +1 −2 pgjdbc/src/test/java/org/postgresql/test/jdbc2/ServerErrorTest.java
  149. +11 −11 pgjdbc/src/test/java/org/postgresql/test/jdbc2/ServerPreparedStmtTest.java
  150. +41 −35 pgjdbc/src/test/java/org/postgresql/test/jdbc2/StatementTest.java
  151. +7 −8 pgjdbc/src/test/java/org/postgresql/test/jdbc2/TimeTest.java
  152. +16 −20 pgjdbc/src/test/java/org/postgresql/test/jdbc2/TimestampTest.java
  153. +175 −191 pgjdbc/src/test/java/org/postgresql/test/jdbc2/TimezoneTest.java
  154. +12 −14 pgjdbc/src/test/java/org/postgresql/test/jdbc2/UpdateableResultTest.java
  155. +6 −6 pgjdbc/src/test/java/org/postgresql/test/jdbc2/optional/BaseDataSourceTest.java
  156. +11 −17 pgjdbc/src/test/java/org/postgresql/test/jdbc2/optional/CaseOptimiserDataSourceTest.java
  157. +27 −27 pgjdbc/src/test/java/org/postgresql/test/jdbc2/optional/ConnectionPoolTest.java
  158. +1 −1 pgjdbc/src/test/java/org/postgresql/test/jdbc2/optional/OptionalTestSuite.java
  159. +1 −1 pgjdbc/src/test/java/org/postgresql/test/jdbc2/optional/PoolingDataSourceTest.java
  160. +4 −5 pgjdbc/src/test/java/org/postgresql/test/jdbc3/CompositeQueryParseTest.java
  161. +5 −8 pgjdbc/src/test/java/org/postgresql/test/jdbc3/Jdbc3BlobTest.java
  162. +9 −4 pgjdbc/src/test/java/org/postgresql/test/jdbc3/Jdbc3CallableStatementTest.java
  163. +1 −1 pgjdbc/src/test/java/org/postgresql/test/jdbc3/SendRecvBufferSizeTest.java
  164. +8 −8 pgjdbc/src/test/java/org/postgresql/test/jdbc4/ArrayTest.java
  165. +3 −6 pgjdbc/src/test/java/org/postgresql/test/jdbc4/BinaryStreamTest.java
  166. +3 −3 pgjdbc/src/test/java/org/postgresql/test/jdbc4/BinaryTest.java
  167. +4 −4 pgjdbc/src/test/java/org/postgresql/test/jdbc4/BlobTest.java
  168. +3 −6 pgjdbc/src/test/java/org/postgresql/test/jdbc4/IsValidTest.java
  169. +1 −0 pgjdbc/src/test/java/org/postgresql/test/jdbc4/XmlTest.java
  170. +2 −1 pgjdbc/src/test/java/org/postgresql/test/jdbc4/jdbc41/AbortTest.java
  171. +1 −2 pgjdbc/src/test/java/org/postgresql/test/jdbc4/jdbc41/CloseOnCompletionTest.java
  172. +1 −1 pgjdbc/src/test/java/org/postgresql/test/jdbc4/jdbc41/SchemaTest.java
  173. +3 −6 pgjdbc/src/test/java/org/postgresql/test/jdbc42/CustomizeDefaultFetchSizeTest.java
  174. +9 −16 pgjdbc/src/test/java/org/postgresql/test/osgi/PGDataSourceFactoryTest.java
  175. +1 −0 pgjdbc/src/test/java/org/postgresql/test/socketfactory/CustomSocketFactory.java
  176. +4 −4 pgjdbc/src/test/java/org/postgresql/test/socketfactory/SocketFactoryTestSuite.java
  177. +11 −20 pgjdbc/src/test/java/org/postgresql/test/ssl/SingleCertValidatingFactoryTestSuite.java
  178. +27 −31 pgjdbc/src/test/java/org/postgresql/test/ssl/SslTest.java
  179. +2 −2 pgjdbc/src/test/java/org/postgresql/test/util/BufferGenerator.java
  180. +21 −8 pgjdbc/src/test/java/org/postgresql/test/util/LruCacheTest.java
  181. +6 −8 pgjdbc/src/test/java/org/postgresql/test/util/MiniJndiContext.java
  182. +3 −3 pgjdbc/src/test/java/org/postgresql/test/util/MiniJndiContextFactory.java
  183. +4 −4 pgjdbc/src/test/java/org/postgresql/test/util/StrangeInputStream.java
  184. +41 −51 pgjdbc/src/test/java/org/postgresql/test/xa/XADataSourceTest.java
  185. +1 −1 pgjdbc/src/test/resources/test-file.xml
@@ -32,16 +32,19 @@
import java.util.Properties;
/**
* The Java SQL framework allows for multiple database drivers. Each driver should supply a class
* The Java SQL framework allows for multiple database drivers. Each driver should supply a class
* that implements the Driver interface
*
* <p>The DriverManager will try to load as many drivers as it can find and then for any given
* <p>
* The DriverManager will try to load as many drivers as it can find and then for any given
* connection request, it will ask each driver in turn to try to connect to the target URL.
*
* <p>It is strongly recommended that each Driver class should be small and standalone so that the
* <p>
* It is strongly recommended that each Driver class should be small and standalone so that the
* Driver class can be loaded and queried without bringing in vast quantities of supporting code.
*
* <p>When a Driver class is loaded, it should create an instance of itself and register it with the
* <p>
* When a Driver class is loaded, it should create an instance of itself and register it with the
* DriverManager. This means that a user can load and register a driver by doing
* Class.forName("foo.bah.Driver")
*
@@ -149,7 +152,7 @@ private Properties loadDefaultProperties() throws IOException {
// When loading the driver config files we don't want settings found
// in later files in the classpath to override settings specified in
// earlier files. To do this we've got to read the returned
// earlier files. To do this we've got to read the returned
// Enumeration into temporary storage.
ArrayList<URL> urls = new ArrayList<URL>();
Enumeration<URL> urlEnum = cl.getResources("org/postgresql/driverconfig.properties");
@@ -176,36 +179,43 @@ private Properties loadDefaultProperties() throws IOException {
* when the JDBC driverManager is asked to connect to a given URL, it passes the URL to each
* loaded driver in turn.
*
* <p>The driver should raise an SQLException if it is the right driver to connect to the given
* URL, but has trouble connecting to the database.
* <p>
* The driver should raise an SQLException if it is the right driver to connect to the given URL,
* but has trouble connecting to the database.
*
* <p>The java.util.Properties argument can be used to pass arbitrary string tag/value pairs as
* <p>
* The java.util.Properties argument can be used to pass arbitrary string tag/value pairs as
* connection arguments.
*
* user - (required) The user to connect as password - (optional) The password for the user ssl -
* (optional) Use SSL when connecting to the server readOnly - (optional) Set connection to
* read-only by default charSet - (optional) The character set to be used for converting to/from
* the database to unicode. If multibyte is enabled on the server then the character set of the
* the database to unicode. If multibyte is enabled on the server then the character set of the
* database is used as the default, otherwise the jvm character encoding is used as the default.
* This value is only used when connecting to a 7.2 or older server. loglevel - (optional) Enable
* logging of messages from the driver. The value is an integer from 0 to 2 where: OFF = 0, INFO =
* 1, DEBUG = 2 The output is sent to DriverManager.getPrintWriter() if set, otherwise it is sent
* to System.out. compatible - (optional) This is used to toggle between different functionality
* as it changes across different releases of the jdbc driver code. The values here are versions
* of the jdbc client and not server versions. For example in 7.1 get/setBytes worked on
* LargeObject values, in 7.2 these methods were changed to work on bytea values. This change in
* as it changes across different releases of the jdbc driver code. The values here are versions
* of the jdbc client and not server versions. For example in 7.1 get/setBytes worked on
* LargeObject values, in 7.2 these methods were changed to work on bytea values. This change in
* functionality could be disabled by setting the compatible level to be "7.1", in which case the
* driver will revert to the 7.1 functionality.
*
* <p>Normally, at least "user" and "password" properties should be included in the properties.
* For a list of supported character encoding , see http://java.sun.com/products/jdk/1.2/docs/guide/internat/encoding.doc.html
* Note that you will probably want to have set up the Postgres database itself to use the same
* encoding, with the {@code -E <encoding>} argument to createdb.
* <p>
* Normally, at least "user" and "password" properties should be included in the properties. For a
* list of supported character encoding , see
* http://java.sun.com/products/jdk/1.2/docs/guide/internat/encoding.doc.html Note that you will
* probably want to have set up the Postgres database itself to use the same encoding, with the
* {@code -E <encoding>} argument to createdb.
*
* Our protocol takes the forms: <PRE> jdbc:postgresql://host:port/database?param1=val1&amp;...
* Our protocol takes the forms:
*
* <PRE>
* jdbc:postgresql://host:port/database?param1=val1&amp;...
* </PRE>
*
* @param url the URL of the database to connect to
* @param url the URL of the database to connect to
* @param info a list of arbitrary tag/value pairs as connection arguments
* @return a connection to the URL or null if it isnt us
* @throws SQLException if a database access error occurs
@@ -228,7 +238,8 @@ private Properties loadDefaultProperties() throws IOException {
// override defaults with provided properties
Properties props = new Properties(defaults);
if (info != null) {
for (Enumeration<?> e = info.propertyNames(); e.hasMoreElements(); ) {
Enumeration<?> e = info.propertyNames();
while (e.hasMoreElements()) {
String propName = (String) e.nextElement();
String propValue = info.getProperty(propName);
if (propValue == null) {
@@ -274,13 +285,15 @@ private Properties loadDefaultProperties() throws IOException {
// org.postgresql.unusual error will be returned instead.
throw ex1;
} catch (java.security.AccessControlException ace) {
throw new PSQLException(GT.tr(
"Your security policy has prevented the connection from being attempted. You probably need to grant the connect java.net.SocketPermission to the database server host and port that you wish to connect to."),
throw new PSQLException(
GT.tr(
"Your security policy has prevented the connection from being attempted. You probably need to grant the connect java.net.SocketPermission to the database server host and port that you wish to connect to."),
PSQLState.UNEXPECTED_ERROR, ace);
} catch (Exception ex2) {
logger.debug("Unexpected connection error:", ex2);
throw new PSQLException(GT.tr(
"Something unusual has occurred to cause the driver to fail. Please report this exception."),
throw new PSQLException(
GT.tr(
"Something unusual has occurred to cause the driver to fail. Please report this exception."),
PSQLState.UNEXPECTED_ERROR, ex2);
}
}
@@ -344,8 +357,9 @@ public Connection getResult(long timeout) throws SQLException {
resultException.fillInStackTrace();
throw (SQLException) resultException;
} else {
throw new PSQLException(GT.tr(
"Something unusual has occurred to cause the driver to fail. Please report this exception."),
throw new PSQLException(
GT.tr(
"Something unusual has occurred to cause the driver to fail. Please report this exception."),
PSQLState.UNEXPECTED_ERROR, resultException);
}
}
@@ -383,21 +397,19 @@ public Connection getResult(long timeout) throws SQLException {
* Create a connection from URL and properties. Always does the connection work in the current
* thread without enforcing a timeout, regardless of any timeout specified in the properties.
*
* @param url the original URL
* @param url the original URL
* @param props the parsed/defaulted connection properties
* @return a new connection
* @throws SQLException if the connection could not be made
*/
private static Connection makeConnection(String url, Properties props) throws SQLException {
return new PgConnection(hostSpecs(props),
user(props), database(props),
props, url);
return new PgConnection(hostSpecs(props), user(props), database(props), props, url);
}
/**
* Returns true if the driver thinks it can open a connection to the given URL. Typically,
* drivers will return true if they understand the subprotocol specified in the URL and false if
* they don't. Our protocols start with jdbc:postgresql:
* Returns true if the driver thinks it can open a connection to the given URL. Typically, drivers
* will return true if they understand the subprotocol specified in the URL and false if they
* don't. Our protocols start with jdbc:postgresql:
*
* @param url the URL of the driver
* @return true if this driver accepts the given URL
@@ -414,13 +426,14 @@ public boolean acceptsURL(String url) {
* The getPropertyInfo method is intended to allow a generic GUI tool to discover what properties
* it should prompt a human for in order to get enough information to connect to a database.
*
* <p>Note that depending on the values the human has supplied so far, additional values may
* become necessary, so it may be necessary to iterate through several calls to getPropertyInfo
* <p>
* Note that depending on the values the human has supplied so far, additional values may become
* necessary, so it may be necessary to iterate through several calls to getPropertyInfo
*
* @param url the Url of the database to connect to
* @param url the Url of the database to connect to
* @param info a proposed list of tag/value pairs that will be sent on connect open.
* @return An array of DriverPropertyInfo objects describing possible properties. This array may
* be an empty array if no properties are required
* @return An array of DriverPropertyInfo objects describing possible properties. This array may
* be an empty array if no properties are required
* @see java.sql.Driver#getPropertyInfo
*/
public DriverPropertyInfo[] getPropertyInfo(String url, Properties info) {
@@ -440,10 +453,7 @@ public boolean acceptsURL(String url) {
}
public static final int MAJORVERSION =
//#if false
9
//#endif
/*$mvn.project.property.parsedversion.majorversion$*/;
/*$mvn.project.property.parsedversion.majorversion+";"$*//*-*/9;
/**
* Gets the drivers major version number
@@ -455,10 +465,7 @@ public int getMajorVersion() {
}
public static final int MINORVERSION =
//#if false
4
//#endif
/*$mvn.project.property.parsedversion.minorversion$*/;
/*$mvn.project.property.parsedversion.minorversion+";"$*//*-*/4;
/**
* Get the drivers minor version number
@@ -479,11 +486,12 @@ public static String getVersion() {
}
/**
* Report whether the driver is a genuine JDBC compliant driver. A driver may only report "true"
* here if it passes the JDBC compliance tests, otherwise it is required to return false. JDBC
* Report whether the driver is a genuine JDBC compliant driver. A driver may only report "true"
* here if it passes the JDBC compliance tests, otherwise it is required to return false. JDBC
* compliance requires full support for the JDBC API and full support for SQL 92 Entry Level.
*
* <p>For PostgreSQL, this is not yet possible, as we are not SQL92 compliant (yet).
* <p>
* For PostgreSQL, this is not yet possible, as we are not SQL92 compliant (yet).
*/
public boolean jdbcCompliant() {
return false;
@@ -494,7 +502,7 @@ public boolean jdbcCompliant() {
/**
* Constructs a new DriverURL, splitting the specified URL into its component parts
*
* @param url JDBC URL to parse
* @param url JDBC URL to parse
* @param defaults Default properties
* @return Properties with elements added from the url
*/
@@ -556,7 +564,7 @@ public static Properties parseURL(String url, Properties defaults) {
urlProps.setProperty("PGDBNAME", l_urlServer);
}
//parse the args part of the url
// parse the args part of the url
String[] args = l_urlArgs.split("&");
for (int i = 0; i < args.length; ++i) {
String token = args[i];
@@ -626,10 +634,10 @@ private static long timeout(Properties props) {
* keep the overall driver size down. It now requires the call Class and the function name to help
* when the driver is used with closed software that don't report the stack strace
*
* @param callClass the call Class
* @param callClass the call Class
* @param functionName the name of the unimplemented function with the type of its arguments
* @return PSQLException with a localized message giving the complete description of the
* unimplemeted function
* unimplemeted function
*/
public static SQLFeatureNotSupportedException notImplemented(Class<?> callClass,
String functionName) {
@@ -643,7 +651,7 @@ public static SQLFeatureNotSupportedException notImplemented(Class<?> callClass,
* ie org.postgresql.Driver.setLogLevel()
*
* @param logLevel sets the level which logging will respond to OFF turn off logging INFO being
* almost no messages DEBUG most verbose
* almost no messages DEBUG most verbose
*/
public static void setLogLevel(int logLevel) {
synchronized (Driver.class) {
@@ -672,7 +680,7 @@ public static SharedTimer getSharedTimer() {
* method.
*
* @throws IllegalStateException if the driver is already registered
* @throws SQLException if registering the driver fails
* @throws SQLException if registering the driver fails
*/
public static void register() throws SQLException {
if (isRegistered()) {
@@ -690,7 +698,7 @@ public static void register() throws SQLException {
* class can be gc'ed if necessary.
*
* @throws IllegalStateException if the driver is not registered
* @throws SQLException if deregistering the driver fails
* @throws SQLException if deregistering the driver fails
*/
public static void deregister() throws SQLException {
if (!isRegistered()) {
@@ -62,45 +62,49 @@
* This allows client code to add a handler for one of org.postgresql's more unique data types. It
* is approximately equivalent to <code>addDataType(type, Class.forName(name))</code>.
*
* @param type JDBC type name
* @param type JDBC type name
* @param className class name
* @throws RuntimeException if the type cannot be registered (class not found, etc).
* @deprecated As of 8.0, replaced by {@link #addDataType(String, Class)}. This deprecated method
* does not work correctly for registering classes that cannot be directly loaded by the JDBC
* driver's classloader.
* does not work correctly for registering classes that cannot be directly loaded by
* the JDBC driver's classloader.
*/
public void addDataType(String type, String className);
/**
* This allows client code to add a handler for one of org.postgresql's more unique data types.
*
* <p><b>NOTE:</b> This is not part of JDBC, but an extension.
* <p>
* <b>NOTE:</b> This is not part of JDBC, but an extension.
*
* <p>The best way to use this is as follows:
* <p>
* The best way to use this is as follows:
*
* <pre>
* ...
* ((org.postgresql.PGConnection)myconn).addDataType("mytype", my.class.name.class);
* ...
* </pre>
*
* <p>where myconn is an open Connection to org.postgresql.
* <p>
* where myconn is an open Connection to org.postgresql.
*
* <p>The handling class must extend org.postgresql.util.PGobject
* <p>
* The handling class must extend org.postgresql.util.PGobject
*
* @param type the PostgreSQL type to register
* @param type the PostgreSQL type to register
* @param klass the class implementing the Java representation of the type; this class must
* implement {@link org.postgresql.util.PGobject}).
* @throws SQLException if <code>klass</code> does not implement {@link org.postgresql.util.PGobject}).
* implement {@link org.postgresql.util.PGobject}).
* @throws SQLException if <code>klass</code> does not implement
* {@link org.postgresql.util.PGobject}).
* @see org.postgresql.util.PGobject
* @since 8.0
*/
public void addDataType(String type, Class<? extends PGobject> klass)
throws SQLException;
public void addDataType(String type, Class<? extends PGobject> klass) throws SQLException;
/**
* Set the default statement reuse threshold before enabling server-side prepare. See {@link
* org.postgresql.PGStatement#setPrepareThreshold(int)} for details.
* Set the default statement reuse threshold before enabling server-side prepare. See
* {@link org.postgresql.PGStatement#setPrepareThreshold(int)} for details.
*
* @param threshold the new threshold
* @since build 302
Oops, something went wrong.

0 comments on commit 2d5e7fa

Please sign in to comment.