setMaxFieldSize (and getMaxFieldSize)

From: snpe <snpe(at)snpe(dot)co(dot)yu>
To: <pgsql-jdbc(at)postgresql(dot)org>
Subject: setMaxFieldSize (and getMaxFieldSize)
Date: 2003-04-03 20:48:54
Message-ID: 200304032048.55088.snpe@snpe.co.yu
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-jdbc

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;
}

/*

Responses

Browse pgsql-jdbc by date

  From Date Subject
Next Message Ryan Christianson 2003-04-04 00:02:27 fireConnectionFatalError never called
Previous Message Scot P. Floess 2003-04-03 17:33:53 Re: abstract method error while using rs.beforeFirst() ???