Thread: C++ interfaces
ok, I think I have sufficient reason to go ahead with a complete rewrite of the libpq++ libs. First the connection functions in libpq are defined as static which makes them unsafe in a threaded environment. In addition, I think a complete rewrite will allow us to implement the ability to manage multiple concurrent sql commands more effectively than with relying on the libpq lib. I'm currently looking at the packet structures that the back-end and clients must use. I've found that many packets are terminated with 0x5A. The docs don't mention this so I was wondering if anyone could suggest why. An example is the packet which sends the backend key data. Every time I have psql connect to postmaster, the postmaster sends a packet with the secret key upon validation with 0x5A as the final byte. Any ideas? As far as maintaining both libpq and libpq++, the latter could use some of the header files in libpq, such as pqcomm.h, to maintain consistency of protocol defs across the backend and frontends. That's where I am at right now. Anyone have advice/suggestions? Cheers, Randy Jonasz Software Engineer Click2net Inc. Web: http://www.click2net.com Phone: (905) 271-3550 "You cannot possibly pay a philosopher what he's worth, but try your best" -- Aristotle
Randy Jonasz <rjonasz@click2net.com> writes: > I'm currently looking at the packet structures that the back-end and > clients must use. I've found that many packets are terminated with > 0x5A. The docs don't mention this so I was wondering if anyone could > suggest why. I suspect you are confusing the logically-separate ReadyForQuery message (which is a single byte 'Z') with the preceding data message. See http://www.postgresql.org/docs/postgres/protocol.htm, particularly the description of the basic Query cycle: : A Query cycle is initiated by the frontend sending a Query message to : the backend. The backend then sends one or more response messages : depending on the contents of the query command string, and finally a : ReadyForQuery response message. ReadyForQuery informs the frontend that : it may safely send a new query or function call. regards, tom lane
Thanks for the info! I've managed to look at all of the packets the back-end and front end send to each other and have a fairly good idea of what is expected. Now for the hard part ... On Sat, 7 Oct 2000, Tom Lane wrote: > Randy Jonasz <rjonasz@click2net.com> writes: > > I'm currently looking at the packet structures that the back-end and > > clients must use. I've found that many packets are terminated with > > 0x5A. The docs don't mention this so I was wondering if anyone could > > suggest why. > > I suspect you are confusing the logically-separate ReadyForQuery > message (which is a single byte 'Z') with the preceding data message. > See http://www.postgresql.org/docs/postgres/protocol.htm, particularly > the description of the basic Query cycle: > > : A Query cycle is initiated by the frontend sending a Query message to > : the backend. The backend then sends one or more response messages > : depending on the contents of the query command string, and finally a > : ReadyForQuery response message. ReadyForQuery informs the frontend that > : it may safely send a new query or function call. > > regards, tom lane > > Randy Jonasz Software Engineer Click2net Inc. Web: http://www.click2net.com Phone: (905) 271-3550 "You cannot possibly pay a philosopher what he's worth, but try your best" -- Aristotle