Rupert Kittinger-Sereinig | 20 Oct 2007 10:03
Picon

Re: [old-libpqxx-general] Any decision on implicit conversion to std::string or at least operator== ?

Hi everybody,

I would also like to see some enhancement in this issue. I think it is 
mainly a question of style, but my codebase is full of calls to c_str() 
for this reason.

I do not like the idea of configuring at compile time, this will just 
add some preprocessor acrobatics to the headers.

I would prefer to have all the comparison operators that are provided 
for std::strings, and I would implement them as free functions that live 
in a different header file. Those who do not want them need not #include 
them.

cheers,
Rupert

> 
> 
> So, to summarize my new proposal: in case you don't have a
> decision, or that you're inclined not to include it, may I propose
> that you include these features as *optional* features that could
> be enabled at configure-time?   I'm talking about:
> 
> ./configure --enable-implicit-string
> 
> or
> 
> ./configure --enable-operator==string
> 
(Continue reading)

Geeky Jim | 14 Sep 2007 17:06
Picon

How to compile libpqxx as 32bit library on 64bit x86_64 systems?

Dear list members,

I am having difficulties creating libpqxx 2.6.9 as a 32bit library on 64bit x86_64 systems. 

I am running FC7 using  gcc -v
Using built-in specs.
Target: x86_64-redhat-linux
Thread model: posix
gcc version 4.1.2 20070502 (Red Hat 4.1.2-12)

uname -m
x86_64

I am still new to GNU's buildtools.  I tried to insert these flags in Makefile.am but it did not help.

CFLAGS += -m32
AM_CXXFLAGS += -m32

Any pointers?

Thanks,
Jim

_______________________________________________
Libpqxx-general mailing list
Libpqxx-general@...
http://gborg.postgresql.org/mailman/listinfo/libpqxx-general
Shannon Allen | 5 Sep 2007 00:03
Picon

lostream to a file

I am trying to get comfortable using the lostream class for large 
objects.  I have a large binary file that I am storing in a BLOB that I 
can get back out using largeobjectaccess and then use the to_file(file) 
method to write it back out and that works fine.  However, I want to 
give users streaming functionality, but I need to know how to do it 
first :-) .

What I would like to do first is stream this back out to a file, similar 
to what I've already done with largeobjectaccess::to_file(file), but 
instead I want to use lostream.

Given this code, what do I need to do next?

...
   pqxx::work w(*atr->getConn(),me);
   pqxx::ilostream s(w, id5);

   ofstream file("test.seqb", ios::out | ios::binary | ios::trunc);
   cout << "Streaming blob into a file " << endl;

   //This isn't right
   if(s.good())
   {
      file << s;
   }
   cout << "Done Streaming blob into a file " << endl;
   file.close();
...
Jeroen T. Vermeulen | 14 Aug 2007 21:10
Picon
Picon
Favicon

Re: PQCancel

On Mon, August 13, 2007 15:55, rclemley@... wrote:

>>One problem is, all this asynchronous stuff requires locking.  We don't
>> do
>>that right now, and it's a pretty big step to take.
>
> I think that the cancellation methods could be added to pqxx without
> implementing locking.  One of my biggest concerns in implementing
> request cancellation in pqxx was how to implement the tests.

I can imagine, yes.  It's not perfect, but perhaps the pg_sleep() function
could help here.  One thread can do a "select pg_sleep(60)" while another
can wait 5 seconds (or whatever you feel is long enough that it won't fail
just because the test system happens to be busy) and then cancel the
query.

> I am preparing to replace all of our home-brew database objects'
> implementations with libpqxx.  The program is multi-threaded so we
> already handle locking issues in other ways at higher-levels.

That's the general policy for libpqxx at the moment anyway, so whoever
follows that should be okay.

> Statement cancellation is the only thing we need that's missing in pqxx.

Thanks for working on this!

Jeroen
Jeroen T. Vermeulen | 13 Aug 2007 09:22
Picon
Picon
Favicon

Moving mailing lists

Hello all,

This mailing list is moving!

The site that has been hosting this mailing list, GBorg, is being
decommissioned.  The libpqxx-general and libpqxx-announce mailing lists
are moving to its replacement, pgFoundry:

    http://pgfoundry.org/mailman/admin/libpqxx-announce
    http://pgfoundry.org/mailman/listinfo/libpqxx-general

The main project page, however, remains at http://pqxx.org/

I don't know exactly when the list you are getting this from will
disappear, but I expect it to be soon.  So please, if you wish to continue
reading either or both of these lists, please go over there now and
subscribe!

Starting now, all new threads on libpqxx-general will be directed to the
new list.  I hope you will accept my apologies for this inconvenience, and
join us on the other side.

Jeroen
Rob Lemley | 10 Aug 2007 18:50
Favicon

PQCancel

I am interested in adding PQCancel (and friends) support to libpqxx.

I've found one mention of it in the TODO
(http://pqxx.org/development/libpqxx/changeset/825)
but it seems to have been removed from the current TODO.

Currently we use PQrequestCancel() to stop long running queries
when our application server (ie postgresql client) must shutdown.

Before I go further, I was wondering anyone has insights
about using PQCancel (PQrequestCancel is deprecated),
and/or implementing a cancel function in libpqxx (presumably
as a member of the connection_base class).

Comments?

Thanks,
Rob
Denis Dzyubenko | 10 Aug 2007 14:38
Picon
Gravatar

problem with writing large floating point values to postgres

Hello,

I have a problem with writing values of type double in pqxx. I've
already created a ticket (#116), but received no feedback. Maybe the
ticket was unclear, so I'll try to explain my problem.

The problem is that when writing large double values to iostream, it
is displayed in exponential form, omitting last digits. So, when this
number in exponental form converted back to double, it gets rounded
and significant digits is lost.

For example, if I do this:

std::cout << 12345678;

I'll get '1.23457e+007' on screen, and as you see - last two digits
were omitted and in fact, the number is rounded to '12345700'.
This can be fixed by specifying the precision to iostream library:

std::cout.precision(41);
std::cout << 12345678;

And this time, I'll get on screen the number I expected '12345678'.

Since pqxx::to_string/from_string uses std::stringstream for
converting double values, we face the problem that when I try to write
large 'double' to postgres, the number that is actually written is the
rounded one.

Here is the test application that uses pqxx::to_string/from_string

#include <iostream>
#include <string>
#include <pqxx/pqxx>

int main(int, char**)
{
  std::stringstream ss;

  const double orig_value = 12345678;
  double value;

  // converting double to string and vice versa
  std::string str_value = pqxx::to_string(orig_value);
  pqxx::from_string(str_value, value);

  // using C-function
  printf("printf:\n \torig = %f \n\tnew  = %f\n", orig_value, value);

  // using iostream with default params
  std::cout << std::endl << "cout: " << std::endl
            << "\torig = " << orig_value << std::endl
            << "\tnew  = " << value << std::endl;

  // using iostream and manually specifying the floating value precision
  std::cout.precision(41);
  std::cout << std::endl << "cout with precision: " << std::endl
            << "\torig = " << orig_value << std::endl
            << "\tnew  = " << value << std::endl;
  return 0;
}

And its output:

printf:
        orig = 12345678.000000
        new  = 12345700.000000

cout:
        orig = 1.23457e+007
        new  = 1.23457e+007

cout with precision:
        orig = 12345678
        new  = 12345700

As you can see, after using to_string/from_string the number becomes incorrect.

This problem can be fixed by adding the following line to function
'to_string_fallback' in util.cxx

template<typename T> inline string to_string_fallback(T Obj)
{
  stringstream S;
#ifdef PQXX_HAVE_IMBUE
  S.imbue(locale("C"));
#endif
  S.precision(41); // ADD THIS LINE
  S << Obj;
  string R;
  S >> R;
  return R;
}

--

-- 
Denis.
xmpp:shad@...
Rilson Nascimento | 10 Aug 2007 05:24
Picon

connection in TIME_WAIT with pqxx

Hi there,

I am using pqxx in a multi-threaded server that connects to a PostgreSQL database. I'm experiencing a problem in which my server leaves a bunch of TIME_WAIT socket connection with the PostgreSQL server when it is running.

When I run 'netstat -tcp' I see literally hundreds of connections from my server to PgSQL in TIME_WAIT state (see below), even after a short period of server activity:
tcp     0     0  localhost:38727       localhost:5432         TIME_WAIT
...

I'm using pqxx's lazyconnection. Actually there is only ONE client running in a loop sending transactions to the server (via tcp socket), which in turn connects to the PgSQL database via a lazyconnection (I tried with the usual connection object too).

I guess this is an effect of poor networking programming (socket programming) and/or poor pqxx programming.
Whatever, What should I do to realize this is not a problem related with misusing of pqxx? I mean, I want to be sure I am using pqxx in the right fashion to ensure this problem is not caused by pqxx.

Thanks for your help,

-Ron


_______________________________________________
Libpqxx-general mailing list
Libpqxx-general@...
http://gborg.postgresql.org/mailman/listinfo/libpqxx-general
Jacob Rief | 9 Aug 2007 09:57
Picon
Picon

Solution for "array in a result query"

Hello,
in February there was a request about retrieving binary data from table rows containing array-data.
Jeroen T. Vermeulen replyed that array support will be integrated. I now worked on that same matter and I
found a solution, which is a bit tricky, but it works. I even wrote a template class to implement this feature.
If there is any interrest, I would like to publish this workarround on the wiki. Where shall I post this?
Jacob
--

-- 
GMX FreeMail: 1 GB Postfach, 5 E-Mail-Adressen, 10 Free SMS.
Alle Infos und kostenlose Anmeldung: http://www.gmx.net/de/go/freemail
DALE PEDERSEN | 26 Jul 2007 23:00
Picon

m.pedersen@...: Re: pqxx-config script

is this you?
 
_______________________________________________
Libpqxx-general mailing list
Libpqxx-general@...
http://gborg.postgresql.org/mailman/listinfo/libpqxx-general
dalejames | 25 Jul 2007 20:43
Picon

(no subject)

Hey

i think this is the tv you were talking about last night

 Sharp LC-37D62U 37" AQUOS Flat-Panel LCD HDTV

is it 37" across?

Gmane