PostgreSQLDirect and pg logging

Discussion of open issues, suggestions and bugs regarding ADO.NET provider for PostgreSQL
Post Reply
Guest

PostgreSQLDirect and pg logging

Post by Guest » Thu 22 Dec 2005 05:14

When using PostgreSQLDirect.NET to talk to postgres, I use code of this nature:

dbCmd = New PgSqlCommand("INSERT INTO seriesEntry(id,dateOf,kindOf,amount)" & _
" VALUES (@id,@dateOf,@kindOf,@amount);", dbCon)
dbCmd.Parameters.Add("@id", mId)
dbCmd.Parameters.Add("@dateOf", entry.dateOf)
dbCmd.Parameters.Add("@kindOf", entry.kindOf)
dbCmd.Parameters.Add("@amount", entry.amount)
'dbCmd.Parameters.Add("@indexOf", entry.indexOf)
'dbCmd.Parameters.Add("@apy", entry.apy)
dbCmd.ExecuteNonQuery()

etc. When I look at my postgres log files, I see:

2005-12-22 04:05:59 LOG: statement: INSERT INTO seriesEntry(id,dateOf,kindOf,amount) VALUES ($1,$2,$3,$4);

How can I get the log file to show the actual parameter values, instead of the placeholders $1,$2,$3,$4 ???

SecureGen
Devart Team
Posts: 133
Joined: Thu 08 Sep 2005 06:27

Post by SecureGen » Thu 22 Dec 2005 08:29

You should switch to text protocol in order to see parameter values. It can be done using protocol=2 parameter in connection string.

jsiegel5
Posts: 1
Joined: Thu 22 Dec 2005 05:10

Post by jsiegel5 » Fri 23 Dec 2005 06:03

SecureGen wrote:You should switch to text protocol in order to see parameter values. It can be done using protocol=2 parameter in connection string.
Tried this and it does work. However, I'm uncomfortable with having to use an older protocol version to communicate with the database. Is there no way to get postgres to log the parameters when using the current (v3.0) protocol?

Regards,
Jeff

SecureGen
Devart Team
Posts: 133
Joined: Thu 08 Sep 2005 06:27

Post by SecureGen » Fri 23 Dec 2005 10:32

DBMonitor shows SQL statements exactly as they are sent to server. In the binary protocol parameters are attached to query using binding mechanism. So in the case of binary protocol you see SQL statements with parameter placeholders. You can see values of parameters in the corresponding tab, which is located at the bottom of DBMonitor application.

Post Reply