Re: libpq++: combined patches based on 7.1b5 - Mailing list pgsql-interfaces

From Bruce Momjian
Subject Re: libpq++: combined patches based on 7.1b5
Date
Msg-id 200105091745.f49HjhU14550@candle.pha.pa.us
Whole thread Raw
In response to libpq++: combined patches based on 7.1b5  ("J. T. Vermeulen" <jtv@cistron-office.nl>)
List pgsql-interfaces
> > Here's a version of my suggested diffs transplanted to 7.1 beta 5.  I'm still
> > looking at the best way to integrate Tom Vijlbrief's fixes (insofar as they're
> > still needed); would 7.2 be a suitable time for incompatible API changes?
> >
>
> As far as changes, 7.2 would be fine for changing the API, if there is a
> good reason to do it.  For example, I see getLength returns a short.
> With 7.1's new longer tuples, that should now be changed to int, at
> least.  (I have updated libpq++/TODO to mention this.)

I was wrong.  It was not getLength, but FieldSize that was the problem.

OK, I thought, how hard can it be to change, and indeed, it was quite
easy.  Patch attached and applied.  Seems we have to break the API to
allow long field values.  Max field length is now 1GB.

--
  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
Index: doc/src/sgml/libpq++.sgml
===================================================================
RCS file: /home/projects/pgsql/cvsroot/pgsql/doc/src/sgml/libpq++.sgml,v
retrieving revision 1.29
diff -c -r1.29 libpq++.sgml
*** doc/src/sgml/libpq++.sgml    2001/05/09 17:29:09    1.29
--- doc/src/sgml/libpq++.sgml    2001/05/09 17:43:20
***************
*** 430,436 ****
         Returns the size in bytes of the field associated with the given
         field index. Field indices start at 0.
         <synopsis>
!     short PgDatabase::FieldSize(int field_num) const
         </synopsis>
         Returns the space allocated for this field in a database tuple given
         the field number. In other words the size of the server's binary
--- 430,436 ----
         Returns the size in bytes of the field associated with the given
         field index. Field indices start at 0.
         <synopsis>
!     int PgDatabase::FieldSize(int field_num) const
         </synopsis>
         Returns the space allocated for this field in a database tuple given
         the field number. In other words the size of the server's binary
***************
*** 444,450 ****
         Returns the size in bytes of the field associated with the given
         field index. Field indices start at 0.
         <synopsis>
!     short PgDatabase::FieldSize(const char *field_name) const
         </synopsis>
         Returns the space allocated for this field in a database tuple given
         the field name. In other words the size of the server's binary
--- 444,450 ----
         Returns the size in bytes of the field associated with the given
         field index. Field indices start at 0.
         <synopsis>
!     int PgDatabase::FieldSize(const char *field_name) const
         </synopsis>
         Returns the space allocated for this field in a database tuple given
         the field name. In other words the size of the server's binary
Index: src/interfaces/libpq++/TODO
===================================================================
RCS file: /home/projects/pgsql/cvsroot/pgsql/src/interfaces/libpq++/TODO,v
retrieving revision 1.3
diff -c -r1.3 TODO
*** src/interfaces/libpq++/TODO    2001/05/09 17:37:17    1.3
--- src/interfaces/libpq++/TODO    2001/05/09 17:43:25
***************
*** 1,5 ****

  *    Implement exceptions
  *    Many other things I have yet to discover
- *    fix getLength to return an int and not a short

--- 1,4 ----
Index: src/interfaces/libpq++/pgdatabase.cc
===================================================================
RCS file: /home/projects/pgsql/cvsroot/pgsql/src/interfaces/libpq++/pgdatabase.cc,v
retrieving revision 1.10
diff -c -r1.10 pgdatabase.cc
*** src/interfaces/libpq++/pgdatabase.cc    2001/05/09 17:29:10    1.10
--- src/interfaces/libpq++/pgdatabase.cc    2001/05/09 17:43:25
***************
*** 106,118 ****
  }


! short PgDatabase::FieldSize(int field_num) const
  {
  return PQfsize(pgResult, field_num);
  }


! short PgDatabase::FieldSize(const char* field_name) const
  {
  return PQfsize(pgResult, FieldNum(field_name));
  }
--- 106,118 ----
  }


! int PgDatabase::FieldSize(int field_num) const
  {
  return PQfsize(pgResult, field_num);
  }


! int PgDatabase::FieldSize(const char* field_name) const
  {
  return PQfsize(pgResult, FieldNum(field_name));
  }
Index: src/interfaces/libpq++/pgdatabase.h
===================================================================
RCS file: /home/projects/pgsql/cvsroot/pgsql/src/interfaces/libpq++/pgdatabase.h,v
retrieving revision 1.10
diff -c -r1.10 pgdatabase.h
*** src/interfaces/libpq++/pgdatabase.h    2001/05/09 17:29:10    1.10
--- src/interfaces/libpq++/pgdatabase.h    2001/05/09 17:43:25
***************
*** 51,58 ****
    int FieldNum(const char* field_name) const;
    Oid FieldType(int field_num) const;
    Oid FieldType(const char* field_name) const;
!   short FieldSize(int field_num) const;
!   short FieldSize(const char* field_name) const;
    const char* GetValue(size_type tup_num, int field_num) const;
    const char* GetValue(size_type tup_num, const char* field_name) const;
    bool GetIsNull(size_type tup_num, int field_num) const;
--- 51,58 ----
    int FieldNum(const char* field_name) const;
    Oid FieldType(int field_num) const;
    Oid FieldType(const char* field_name) const;
!   int FieldSize(int field_num) const;
!   int FieldSize(const char* field_name) const;
    const char* GetValue(size_type tup_num, int field_num) const;
    const char* GetValue(size_type tup_num, const char* field_name) const;
    bool GetIsNull(size_type tup_num, int field_num) const;

pgsql-interfaces by date:

Previous
From: "Poul L. Christiansen"
Date:
Subject: Re: Postgres and php4
Next
From: Bruce Momjian
Date:
Subject: Re: libpq++: combined patches based on 7.1b5