Re: sendLong in custom communication doesn't work

From: Robert Haas <robertmhaas(at)gmail(dot)com>
To: Krystian Piećko <krystian(dot)piecko(at)gmail(dot)com>
Cc: "pgsql-hackers(at)postgresql(dot)org" <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: sendLong in custom communication doesn't work
Date: 2014-07-28 17:43:12
Message-ID: CA+TgmoZUpyMbz0BUG-NEXC9Q5Uu9D7A5v9T-Hro=ZQ6DXPd_Mg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Fri, Jul 25, 2014 at 5:53 AM, Krystian Piećko
<krystian(dot)piecko(at)gmail(dot)com> wrote:
> I’m implementing the functionality that will pass all the queries native to
> postgresql (that asks about structures and versions) to the hidden
> postgresql and other queries I would like to parse myself. I have a big
> problem with outputing PG_TYPE_INT[248] value. I’m doing it because in my
> system I would like to provide the method to send by jdbc XML messages that
> would be resolved by my software and other queries would be answered by
> PostgreSQL. I don’t mind the speed and the double processing I just want to
> learn how to do it.
> Outputing texts works fine.
>
> So when I receive native query like (select * from pg_class) I have active
> JDBC connection to hidden postgresql (9.3) and this query is executed on
> that server. When I get ResultSet from the hidden postgresql I try to output
> the results in postgres form to the output. Example communication that
> returns current date in long (in my opinion) should look like this:
>
> //Example code that outputs current date in long format
> public void sendExampleResponse() {
> server.trace("Query");
> String query = readString();
> System.out.println("query = " + query);
[ ...and there's more... ]

I don't think you're going to get much help writing Java code here; if
you want to discuss the pgsql-jdbc code, you should use that mailing
list rather than this one. This mailing list would be the right place
for discussions about the wire protocol itself, though, so maybe
someone could give you some advice on that if you were more specific
about what problem you're having. From the provided information it's
hard to be sure what's going wrong.

--
Robert Haas
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Peter Geoghegan 2014-07-28 17:43:18 Re: Making joins involving ctid work for the benefit of UPSERT
Previous Message Andres Freund 2014-07-28 17:29:46 Re: [RFC] Should smgrtruncate() avoid sending sinval message for temp relations