Thread: patches for jdbc1 (fwd)

patches for jdbc1 (fwd)

From
Peter Eisentraut
Date:
Peter M., can you examine this patch?

--
Peter Eisentraut      peter_e@gmx.net       http://yi.org/peter-e/

Index: contrib/retep/build.xml
===================================================================
RCS file: /home/projects/pgsql/cvsroot/pgsql/contrib/retep/build.xml,v
retrieving revision 1.4
diff -c -r1.4 build.xml
*** contrib/retep/build.xml    2001/03/11 11:06:59    1.4
--- contrib/retep/build.xml    2001/03/20 21:26:48
***************
*** 22,27 ****
--- 22,32 ----
      <available property="xml" classname="org.xml.sax.Parser" />
    </target>

+   <target name="warning" depends="checks" unless="jdk1.2+">
+     <echo message="WARNING -- contributed retep tools need jdk1.2 or later -- compilation NOT done." />
+   </target>
+
+
    <!-- Prepares the build by creating a directory to place the class files -->
    <target name="prepare">
      <mkdir dir="${dest}" />
***************
*** 35,41 ****
    </target>

    <!-- Builds the XML Tools -->
!   <target name="compile" depends="checks,prepare">
      <javac srcdir="${src}" destdir="${dest}">
        <include name="${package}/**" />
      </javac>
--- 40,46 ----
    </target>

    <!-- Builds the XML Tools -->
!   <target name="compile" depends="checks,prepare,warning" if="jdk1.2+">
      <javac srcdir="${src}" destdir="${dest}">
        <include name="${package}/**" />
      </javac>
Index: src/interfaces/jdbc/build.xml
===================================================================
RCS file: /home/projects/pgsql/cvsroot/pgsql/src/interfaces/jdbc/build.xml,v
retrieving revision 1.8
diff -c -r1.8 build.xml
*** src/interfaces/jdbc/build.xml    2001/03/11 11:07:00    1.8
--- src/interfaces/jdbc/build.xml    2001/03/20 21:26:59
***************
*** 120,125 ****
--- 120,126 ----
      <javac srcdir="${src}" destdir="${dest}">
        <include name="example/**" />
        <exclude name="example/corba/**"/>
+       <exclude name="example/blobtest.java" unless="jdk1.2+" />
      </javac>
    </target>

Index: src/interfaces/jdbc/org/postgresql/jdbc1/ResultSet.java
===================================================================
RCS file: /home/projects/pgsql/cvsroot/pgsql/src/interfaces/jdbc/org/postgresql/jdbc1/ResultSet.java,v
retrieving revision 1.9
diff -c -r1.9 ResultSet.java
*** src/interfaces/jdbc/org/postgresql/jdbc1/ResultSet.java    2001/01/24 23:41:04    1.9
--- src/interfaces/jdbc/org/postgresql/jdbc1/ResultSet.java    2001/03/20 21:27:04
***************
*** 227,233 ****
     */
    public short getShort(int columnIndex) throws SQLException
    {
!     String s = getString(columnIndex);

      if (s != null)
        {
--- 227,233 ----
     */
    public short getShort(int columnIndex) throws SQLException
    {
!     String s = getFixedString(columnIndex);

      if (s != null)
        {
***************
*** 250,256 ****
     */
    public int getInt(int columnIndex) throws SQLException
    {
!     String s = getString(columnIndex);

      if (s != null)
        {
--- 250,256 ----
     */
    public int getInt(int columnIndex) throws SQLException
    {
!     String s = getFixedString(columnIndex);

      if (s != null)
        {
***************
*** 273,279 ****
     */
    public long getLong(int columnIndex) throws SQLException
    {
!     String s = getString(columnIndex);

      if (s != null)
        {
--- 273,279 ----
     */
    public long getLong(int columnIndex) throws SQLException
    {
!     String s = getFixedString(columnIndex);

      if (s != null)
        {
***************
*** 296,302 ****
     */
    public float getFloat(int columnIndex) throws SQLException
    {
!     String s = getString(columnIndex);

      if (s != null)
        {
--- 296,302 ----
     */
    public float getFloat(int columnIndex) throws SQLException
    {
!     String s = getFixedString(columnIndex);

      if (s != null)
        {
***************
*** 319,325 ****
     */
    public double getDouble(int columnIndex) throws SQLException
    {
!     String s = getString(columnIndex);

      if (s != null)
        {
--- 319,325 ----
     */
    public double getDouble(int columnIndex) throws SQLException
    {
!     String s = getFixedString(columnIndex);

      if (s != null)
        {
***************
*** 344,350 ****
     */
    public BigDecimal getBigDecimal(int columnIndex, int scale) throws SQLException
    {
!     String s = getString(columnIndex);
      BigDecimal val;

      if (s != null)
--- 344,350 ----
     */
    public BigDecimal getBigDecimal(int columnIndex, int scale) throws SQLException
    {
!     String s = getFixedString(columnIndex);
      BigDecimal val;

      if (s != null)
***************
*** 412,425 ****
      String s = getString(columnIndex);
      if(s==null)
        return null;
!     SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd");
!     try {
!       return new java.sql.Date(df.parse(s).getTime());
!     } catch (ParseException e) {
!       throw new PSQLException("postgresql.res.baddate",new Integer(e.getErrorOffset()),s);
!     }
    }
!
    /**
     * Get the value of a column in the current row as a java.sql.Time
     * object
--- 412,422 ----
      String s = getString(columnIndex);
      if(s==null)
        return null;
!
!     return java.sql.Date.valueOf(s);
    }
!
!
    /**
     * Get the value of a column in the current row as a java.sql.Time
     * object
Index: src/interfaces/jdbc/org/postgresql/jdbc1/Statement.java
===================================================================
RCS file: /home/projects/pgsql/cvsroot/pgsql/src/interfaces/jdbc/org/postgresql/jdbc1/Statement.java,v
retrieving revision 1.7
diff -c -r1.7 Statement.java
*** src/interfaces/jdbc/org/postgresql/jdbc1/Statement.java    2001/01/31 09:23:45    1.7
--- src/interfaces/jdbc/org/postgresql/jdbc1/Statement.java    2001/03/20 21:27:05
***************
*** 22,28 ****
   * @see java.sql.Statement
   * @see ResultSet
   */
! public class Statement implements java.sql.Statement
  {
      Connection connection;        // The connection who created us
      java.sql.ResultSet result = null;    // The current results
--- 22,28 ----
   * @see java.sql.Statement
   * @see ResultSet
   */
! public class Statement extends org.postgresql.Statement implements java.sql.Statement
  {
      Connection connection;        // The connection who created us
      java.sql.ResultSet result = null;    // The current results
***************
*** 288,294 ****
       */
      public java.sql.ResultSet getResultSet() throws SQLException
      {
!           if (result != null) && ((org.postgresql.ResultSet)result.reallyResultSet())
              return result;
            return null;
      }
--- 288,294 ----
       */
      public java.sql.ResultSet getResultSet() throws SQLException
      {
!           if ((result != null) && ((org.postgresql.ResultSet)result).reallyResultSet())
              return result;
            return null;
      }




Re: patches for jdbc1 (fwd)

From
Peter T Mount
Date:
Quoting Peter Eisentraut <peter_e@gmx.net>:

> Peter M., can you examine this patch?

Hmmm, looks ok although I'm not sure by reading this if the warning target gets
executed if jdk1.2+ is not set, because of the if="jdk1.2+" in the compile
target.

I'll have to try it with ant, but I think ant may skip the depends list if the
if fails (which I think it should do).

> Index: src/interfaces/jdbc/org/postgresql/jdbc1/ResultSet.java

This lot's ok. I couldn't fix much on the JDBC1.2 driver because not having
jdk1.1.8 is a slight problem :)

> Index: src/interfaces/jdbc/org/postgresql/jdbc1/Statement.java
> ===================================================================

This one is ok also (same reason above).

Peter

--
Peter Mount peter@retep.org.uk
PostgreSQL JDBC Driver: http://www.retep.org.uk/postgres/
RetepPDF PDF library for Java: http://www.retep.org.uk/pdf/

Re: patches for jdbc1 (fwd)

From
Bruce Momjian
Date:
Patch applied.  Seems it backpatches jdbc2 fixes into jdbc1, plus ANT
fixes.  Thanks.


> Peter M., can you examine this patch?
>
> --
> Peter Eisentraut      peter_e@gmx.net       http://yi.org/peter-e/
>
> Index: contrib/retep/build.xml
> ===================================================================
> RCS file: /home/projects/pgsql/cvsroot/pgsql/contrib/retep/build.xml,v
> retrieving revision 1.4
> diff -c -r1.4 build.xml
> *** contrib/retep/build.xml    2001/03/11 11:06:59    1.4
> --- contrib/retep/build.xml    2001/03/20 21:26:48
> ***************
> *** 22,27 ****
> --- 22,32 ----
>       <available property="xml" classname="org.xml.sax.Parser" />
>     </target>
>
> +   <target name="warning" depends="checks" unless="jdk1.2+">
> +     <echo message="WARNING -- contributed retep tools need jdk1.2 or later -- compilation NOT done." />
> +   </target>
> +
> +
>     <!-- Prepares the build by creating a directory to place the class files -->
>     <target name="prepare">
>       <mkdir dir="${dest}" />
> ***************
> *** 35,41 ****
>     </target>
>
>     <!-- Builds the XML Tools -->
> !   <target name="compile" depends="checks,prepare">
>       <javac srcdir="${src}" destdir="${dest}">
>         <include name="${package}/**" />
>       </javac>
> --- 40,46 ----
>     </target>
>
>     <!-- Builds the XML Tools -->
> !   <target name="compile" depends="checks,prepare,warning" if="jdk1.2+">
>       <javac srcdir="${src}" destdir="${dest}">
>         <include name="${package}/**" />
>       </javac>
> Index: src/interfaces/jdbc/build.xml
> ===================================================================
> RCS file: /home/projects/pgsql/cvsroot/pgsql/src/interfaces/jdbc/build.xml,v
> retrieving revision 1.8
> diff -c -r1.8 build.xml
> *** src/interfaces/jdbc/build.xml    2001/03/11 11:07:00    1.8
> --- src/interfaces/jdbc/build.xml    2001/03/20 21:26:59
> ***************
> *** 120,125 ****
> --- 120,126 ----
>       <javac srcdir="${src}" destdir="${dest}">
>         <include name="example/**" />
>         <exclude name="example/corba/**"/>
> +       <exclude name="example/blobtest.java" unless="jdk1.2+" />
>       </javac>
>     </target>
>
> Index: src/interfaces/jdbc/org/postgresql/jdbc1/ResultSet.java
> ===================================================================
> RCS file: /home/projects/pgsql/cvsroot/pgsql/src/interfaces/jdbc/org/postgresql/jdbc1/ResultSet.java,v
> retrieving revision 1.9
> diff -c -r1.9 ResultSet.java
> *** src/interfaces/jdbc/org/postgresql/jdbc1/ResultSet.java    2001/01/24 23:41:04    1.9
> --- src/interfaces/jdbc/org/postgresql/jdbc1/ResultSet.java    2001/03/20 21:27:04
> ***************
> *** 227,233 ****
>      */
>     public short getShort(int columnIndex) throws SQLException
>     {
> !     String s = getString(columnIndex);
>
>       if (s != null)
>         {
> --- 227,233 ----
>      */
>     public short getShort(int columnIndex) throws SQLException
>     {
> !     String s = getFixedString(columnIndex);
>
>       if (s != null)
>         {
> ***************
> *** 250,256 ****
>      */
>     public int getInt(int columnIndex) throws SQLException
>     {
> !     String s = getString(columnIndex);
>
>       if (s != null)
>         {
> --- 250,256 ----
>      */
>     public int getInt(int columnIndex) throws SQLException
>     {
> !     String s = getFixedString(columnIndex);
>
>       if (s != null)
>         {
> ***************
> *** 273,279 ****
>      */
>     public long getLong(int columnIndex) throws SQLException
>     {
> !     String s = getString(columnIndex);
>
>       if (s != null)
>         {
> --- 273,279 ----
>      */
>     public long getLong(int columnIndex) throws SQLException
>     {
> !     String s = getFixedString(columnIndex);
>
>       if (s != null)
>         {
> ***************
> *** 296,302 ****
>      */
>     public float getFloat(int columnIndex) throws SQLException
>     {
> !     String s = getString(columnIndex);
>
>       if (s != null)
>         {
> --- 296,302 ----
>      */
>     public float getFloat(int columnIndex) throws SQLException
>     {
> !     String s = getFixedString(columnIndex);
>
>       if (s != null)
>         {
> ***************
> *** 319,325 ****
>      */
>     public double getDouble(int columnIndex) throws SQLException
>     {
> !     String s = getString(columnIndex);
>
>       if (s != null)
>         {
> --- 319,325 ----
>      */
>     public double getDouble(int columnIndex) throws SQLException
>     {
> !     String s = getFixedString(columnIndex);
>
>       if (s != null)
>         {
> ***************
> *** 344,350 ****
>      */
>     public BigDecimal getBigDecimal(int columnIndex, int scale) throws SQLException
>     {
> !     String s = getString(columnIndex);
>       BigDecimal val;
>
>       if (s != null)
> --- 344,350 ----
>      */
>     public BigDecimal getBigDecimal(int columnIndex, int scale) throws SQLException
>     {
> !     String s = getFixedString(columnIndex);
>       BigDecimal val;
>
>       if (s != null)
> ***************
> *** 412,425 ****
>       String s = getString(columnIndex);
>       if(s==null)
>         return null;
> !     SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd");
> !     try {
> !       return new java.sql.Date(df.parse(s).getTime());
> !     } catch (ParseException e) {
> !       throw new PSQLException("postgresql.res.baddate",new Integer(e.getErrorOffset()),s);
> !     }
>     }
> !
>     /**
>      * Get the value of a column in the current row as a java.sql.Time
>      * object
> --- 412,422 ----
>       String s = getString(columnIndex);
>       if(s==null)
>         return null;
> !
> !     return java.sql.Date.valueOf(s);
>     }
> !
> !
>     /**
>      * Get the value of a column in the current row as a java.sql.Time
>      * object
> Index: src/interfaces/jdbc/org/postgresql/jdbc1/Statement.java
> ===================================================================
> RCS file: /home/projects/pgsql/cvsroot/pgsql/src/interfaces/jdbc/org/postgresql/jdbc1/Statement.java,v
> retrieving revision 1.7
> diff -c -r1.7 Statement.java
> *** src/interfaces/jdbc/org/postgresql/jdbc1/Statement.java    2001/01/31 09:23:45    1.7
> --- src/interfaces/jdbc/org/postgresql/jdbc1/Statement.java    2001/03/20 21:27:05
> ***************
> *** 22,28 ****
>    * @see java.sql.Statement
>    * @see ResultSet
>    */
> ! public class Statement implements java.sql.Statement
>   {
>       Connection connection;        // The connection who created us
>       java.sql.ResultSet result = null;    // The current results
> --- 22,28 ----
>    * @see java.sql.Statement
>    * @see ResultSet
>    */
> ! public class Statement extends org.postgresql.Statement implements java.sql.Statement
>   {
>       Connection connection;        // The connection who created us
>       java.sql.ResultSet result = null;    // The current results
> ***************
> *** 288,294 ****
>        */
>       public java.sql.ResultSet getResultSet() throws SQLException
>       {
> !           if (result != null) && ((org.postgresql.ResultSet)result.reallyResultSet())
>               return result;
>             return null;
>       }
> --- 288,294 ----
>        */
>       public java.sql.ResultSet getResultSet() throws SQLException
>       {
> !           if ((result != null) && ((org.postgresql.ResultSet)result).reallyResultSet())
>               return result;
>             return null;
>       }
>
>
>
>
> ---------------------------(end of broadcast)---------------------------
> TIP 2: you can get off all lists at once with the unregister command
>     (send "unregister YourEmailAddressHere" to majordomo@postgresql.org)
>

--
  Bruce Momjian                        |  http://candle.pha.pa.us
  pgman@candle.pha.pa.us               |  (610) 853-3000
  +  If your life is a hard drive,     |  830 Blythe Avenue
  +  Christ can be your backup.        |  Drexel Hill, Pennsylvania 19026