Thread: setMaxFieldSize (and getMaxFieldSize)

setMaxFieldSize (and getMaxFieldSize)

From
snpe
Date:
Hello,
  JDBC driver have limit 8192 for maxFieldSize (AbstractJdbc1Statement.java)
Limit for 8k row is gone.in 7.1
I think that we can now define method setMaxFiledSize, too


regards
Haris Peco

Patch :

--- /u1/pgsqlcvs/pgsql/src/interfaces/jdbc/org/postgresql/jdbc1/AbstractJdbc1Statement.java    2003-03-08
13:11:26.000000000+0000 
+++ org/postgresql/jdbc1/AbstractJdbc1Statement.java    2003-04-03 20:31:40.000000000 +0000
@@ -21,6 +21,13 @@
 public abstract class AbstractJdbc1Statement implements BaseStatement
 {

+    // 1GB for > 7.1, 8192 before
+    final static int MAXFIELDSIZE_71 = 1073741824;
+    final static int MAXFIELDSIZE = 8192;
+
+    // max field size (set in 8192, but we can set to 1GB for > 7.1)
+    protected int maxFieldSize = 8192;
+
     // The connection who created us
     protected BaseConnection connection;

@@ -654,7 +661,7 @@
      */
     public int getMaxFieldSize() throws SQLException
     {
-        return 8192;        // We cannot change this
+        return maxFieldSize;
     }

     /*
@@ -664,9 +671,18 @@
      * @param max the new max column size limit; zero means unlimited
      * @exception SQLException if a database access error occurs
      */
-    public void setMaxFieldSize(int max) throws SQLException
+    public void setMaxFieldSize(int max) throws SQLException
     {
-        throw new PSQLException("postgresql.stat.maxfieldsize");
+        if (connection.haveMinimumServerVersion("7.1"))
+            if (max > MAXFIELDSIZE_71)
+                maxFieldSize=MAXFIELDSIZE_71;
+            else
+                maxFieldSize=max;
+        else
+            if (max > MAXFIELDSIZE)
+                maxFieldSize=MAXFIELDSIZE;
+            else
+                maxFieldSize=max;
     }

     /*


fireConnectionFatalError never called

From
Ryan Christianson
Date:
It seems like the default pooling implementation does not call
"fireConnectionFatalError".  I did a search in the source code and only
found the declaration of the method. It seems that If a sql exception
occurs, the connection is not removed from the pool. Is this a known issue?

Thanks

||


Re: fireConnectionFatalError never called

From
Dave Cramer
Date:
I committed this patch to cvs a while ago

Dave
On Thu, 2003-04-03 at 19:02, Ryan Christianson wrote:
> It seems like the default pooling implementation does not call
> "fireConnectionFatalError".  I did a search in the source code and only
> found the declaration of the method. It seems that If a sql exception
> occurs, the connection is not removed from the pool. Is this a known issue?
>
> Thanks
>
> ||
>
>
> ---------------------------(end of broadcast)---------------------------
> TIP 4: Don't 'kill -9' the postmaster
--
Dave Cramer <Dave@micro-automation.net>