pg.ddx.io  pgsql-interfaces@postgresql.org mailing list archive  
help / color / mirror / Atom feed
libpqxx testers needed!
4+ messages / 2 participants
[nested] [flat]

* libpqxx testers needed!
@ 2002-12-03 01:09 Jeroen T. Vermeulen <jtv@xs4all.nl>
  2002-12-03 17:08 ` Re: libpqxx testers needed! Llew Sion Goodstadt <leo.goodstadt@human-anatomy.oxford.ac.uk>
  2002-12-03 18:25 ` Re: libpqxx testers needed! Llew Sion Goodstadt <leo.goodstadt@human-anatomy.oxford.ac.uk>
  0 siblings, 2 replies; 4+ messages in thread

From: Jeroen T. Vermeulen @ 2002-12-03 01:09 UTC (permalink / raw)
  To: pgsql-interfaces

The latest version of libpqxx, 1.2.2, introduces a new class
"CachedResult" that makes large result sets easier to handle by fetching
rows on-demand and caching them internally.  I've added some tests for
this new feature, but the code is fairly complex and I'm sure it can be
broken in ways I haven't thought of.

Is anyone out there willing to give it a whirl?  It's far from finished
now (it doesn't evict blocks yet if the cache gets too large, and there
are going to be some internal changes before I can implement iterators)
but I suspect this class may be fairly useful already.

Download it at

  ftp://gborg.postgresql.org/pub/libpqxx/stable/libpqxx-1.2.2.tar.gz


Jeroen




^ permalink  raw  reply  [nested|flat] 4+ messages in thread

* Re: libpqxx testers needed!
  2002-12-03 01:09 libpqxx testers needed! Jeroen T. Vermeulen <jtv@xs4all.nl>
@ 2002-12-03 17:08 ` Llew Sion Goodstadt <leo.goodstadt@human-anatomy.oxford.ac.uk>
  1 sibling, 0 replies; 4+ messages in thread

From: Llew Sion Goodstadt @ 2002-12-03 17:08 UTC (permalink / raw)
  To: pgsql-interfaces

One thing I am curious about is why strings are passed by value instead
of by constant reference.
Even granted that many standard library vendors *in the past* used
COW reference counting implementations of std::string to minimize the
cost of copying, this surely is still an unwarranted additional cost.


E.g. libpqxx-1.2.2\src\connection.cxx:427

Instead of:
void pqxx::Connection::BeginCopyRead(string Table)

Should be:
void pqxx::Connection::BeginCopyRead(const string& Table)
{
  Result R( Exec(("COPY " + Table + " TO STDOUT").c_str()) );
  R.CheckStatus();
}


Of course if you are going to change the string anyway inside the body
of the function, pass by const
reference is misleading for both the compiler and the user, so pass
by value would be justified. E.g. if the above example had been 
something like

void pqxx::Connection::BeginCopyRead(string Table)
{
  Table = "COPY " + Table + " TO STDOUT";
  Result R( Exec(Table.c_str()) );
  R.CheckStatus();
}

I have found few of these cases in libpqxx.



Leo Goodstadt
MRC Functional Genetics Unit
OXFORD
OX1 3QX




^ permalink  raw  reply  [nested|flat] 4+ messages in thread

* Re: libpqxx testers needed!
  2002-12-03 01:09 libpqxx testers needed! Jeroen T. Vermeulen <jtv@xs4all.nl>
@ 2002-12-03 18:25 ` Llew Sion Goodstadt <leo.goodstadt@human-anatomy.oxford.ac.uk>
  2002-12-03 20:27   ` Re: libpqxx testers needed! Jeroen T. Vermeulen <jtv@xs4all.nl>
  1 sibling, 1 reply; 4+ messages in thread

From: Llew Sion Goodstadt @ 2002-12-03 18:25 UTC (permalink / raw)
  To: pgsql-interfaces

One thing I am curious about is why strings are passed by value instead
of by constant reference.
Even granted that many standard library vendors *in the past* used
COW reference counting implementations of std::string to minimize the
cost of copying, this surely is still an unwarranted additional cost.


E.g. libpqxx-1.2.2\src\connection.cxx:427

Instead of:
void pqxx::Connection::BeginCopyRead(string Table)

Should be:
void pqxx::Connection::BeginCopyRead(const string& Table)
{
  Result R( Exec(("COPY " + Table + " TO STDOUT").c_str()) );
  R.CheckStatus();
}


Of course if you are going to change the string anyway inside the body
of the function, pass by const
reference is misleading for both the compiler and the user, so pass
by value would be justified. E.g. if the above example had been 
something like

void pqxx::Connection::BeginCopyRead(string Table)
{
  Table = "COPY " + Table + " TO STDOUT";
  Result R( Exec(Table.c_str()) );
  R.CheckStatus();
}

I have found few of these cases in libpqxx.



Leo Goodstadt
MRC Functional Genetics Unit
OXFORD
OX1 3QX




^ permalink  raw  reply  [nested|flat] 4+ messages in thread

* Re: libpqxx testers needed!
  2002-12-03 01:09 libpqxx testers needed! Jeroen T. Vermeulen <jtv@xs4all.nl>
  2002-12-03 18:25 ` Re: libpqxx testers needed! Llew Sion Goodstadt <leo.goodstadt@human-anatomy.oxford.ac.uk>
@ 2002-12-03 20:27   ` Jeroen T. Vermeulen <jtv@xs4all.nl>
  0 siblings, 0 replies; 4+ messages in thread

From: Jeroen T. Vermeulen @ 2002-12-03 20:27 UTC (permalink / raw)
  To: lg@ndirect.co.uk; +Cc: pgsql-interfaces

On Tue, Dec 03, 2002 at 06:25:57PM -0000, Llew Sion Goodstadt wrote:
> One thing I am curious about is why strings are passed by value instead
> of by constant reference.
 
Mostly because I didn't want any clutter in the early stages.  I think
of this as an optimization issue.  IIRC I've changed some of these 
instances to const std::string &, but not all of them yet.  I'll get 
back to this particular job when I have time.

 
Jeroen




^ permalink  raw  reply  [nested|flat] 4+ messages in thread


end of thread, other threads:[~2002-12-03 20:27 UTC | newest]

Thread overview: 4+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2002-12-03 01:09 libpqxx testers needed! Jeroen T. Vermeulen <jtv@xs4all.nl>
2002-12-03 17:08 ` Llew Sion Goodstadt <leo.goodstadt@human-anatomy.oxford.ac.uk>
2002-12-03 18:25 ` Llew Sion Goodstadt <leo.goodstadt@human-anatomy.oxford.ac.uk>
2002-12-03 20:27   ` Jeroen T. Vermeulen <jtv@xs4all.nl>

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox