Re: Implementing Frontend/Backend Protocol - Mailing list pgsql-interfaces

From Raimon Fernandez
Subject Re: Implementing Frontend/Backend Protocol
Date
Msg-id E084987E-A212-4B70-8CFF-D83AA00629C5@montx.com
Whole thread Raw
In response to Re: Implementing Frontend/Backend Protocol  (John DeSoi <desoi@pgedit.com>)
List pgsql-interfaces
Hello,


We're investigating again the idea of creating a directly connection
between our app and postgresql, using TCP/IP.

I found some examples in src/interfaces/libpq but they are in C, and
also found interesting the ones from Lisp.

But I can't figure it out almost nothing ...

:-)

So, maybe a practical example would be better:

I can start a connection, but I'm getting an error when I send the
start up sequence.





StartupMessage (F)
Int32
Length of message contents in bytes, including self.

** The total length including the total string => 33


Int32(196608)
The protocol version number. The most significant 16 bits are the
major version number (3
for the protocol described here). The least significant 16 bits are
the minor version number
(0 for the protocol described here).

** 300

The protocol version number is followed by one or more pairs of
parameter name and value
strings. A zero byte is required as a terminator after the last name/
value pair. Parameters can
appear in any order. user is required, others are optional. Each
parameter is specified as:
String
The parameter name. Currently recognized names are:
user
The database user name to connect as. Required; there is no default.
database
The database to connect to. Defaults to the user name.
options
Command-line arguments for the backend. (This is deprecated in favor
of setting indi-
vidual run-time parameters.)
In addition to the above, any run-time parameter that can be set at
backend start time might
be listed. Such settings will be applied during backend start (after
parsing the command-line
options if any). The values will act as session defaults.
String
The parameter value.


Ok, I can't see how I have to separate the name/value, maybe with a
slash / ?

And how I have to separate the next name/value ?

I understand that I have to add a byte 0 at the end of the last name/
value but not between them ?


user/postgresdatabase/scann0


this is what I send:

33300user/postgresdatabase/scann0


thanks,


regards,


r.


On 19/04/2007, at 4:03, John DeSoi wrote:

> It takes a bit of work to implement, but it is not too difficult.
> What is your target implementation language?
>
> Here is source library for Lisp:
>
> http://common-lisp.net/project/postmodern/
>
> John
>
>
>
> On Apr 17, 2007, at 5:22 AM, Raimon Fernandez wrote:
>
>> We want to implement, or at least, investigate how difficult will
>> be to talk directly with PostgreSQL via TCP/IP.
>>
>> We have the original documentation, and in chapter 43 there is some
>> info.
>>
>> Do you know where can we find examples (code) to start the project ?
>>
>> We found some but where not related to TCP/IP.
>
>
>
> John DeSoi, Ph.D.
> http://pgedit.com/
> Power Tools for PostgreSQL
>
>
> ---------------------------(end of
> broadcast)---------------------------
> TIP 9: In versions below 8.0, the planner will ignore your desire to
>      choose an index scan if your joining column's datatypes do not
>      match
>




pgsql-interfaces by date:

Previous
From: Piaff33z
Date:
Subject: Re: problem on test perlu trigger function.
Next
From: Mark Richardson
Date:
Subject: Upgrading databases