Re: [JDBC] JDBC and Binary protocol error, for some statements

From: Radosław Smogura <rsmogura(at)softperience(dot)eu>
To: Maciek Sakrejda <msakrejda(at)truviso(dot)com>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, PG Hackers <pgsql-hackers(at)postgresql(dot)org>, PostgreSQL JDBC List <pgsql-jdbc(at)postgresql(dot)org>
Subject: Re: [JDBC] JDBC and Binary protocol error, for some statements
Date: 2010-11-25 20:46:47
Message-ID: f5d0ec72cec2e0fa1c3e048bff2395d9@smogura-softworks.eu
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers pgsql-jdbc

Hm... I moved Bind before Describe, I now have
// Construct a new portal if needed.
Portal portal = null;
if (usePortal)
{
String portalName = "C_" + (nextUniqueID++);
portal = new Portal(query, portalName);
}

sendBind(query, params, portal, noBinaryTransfer);

if (describeStatement) {
sendDescribeStatement(query, params, describeOnly);
if (describeOnly)
return;
}
still nothing
21:43:02.263 (26) simple execute,
handler=org(dot)postgresql(dot)jdbc2(dot)AbstractJdbc2Statement$StatementResultHandler(at)337ec9f7,
maxRows=0, fetchSize=0, flags=16
21:43:02.264 (26) FE=> Parse(stmt=S_1,query="SELECT $1::int",oids={0})
21:43:02.264 (26) FE=> Bind(stmt=S_1,portal=null,$1=<'2'>)
21:43:02.264 (26) FE=> Describe(statement=S_1)
21:43:02.264 (26) FE=> Execute(portal=null,limit=0)
21:43:02.265 (26) FE=> Sync
21:43:02.265 (26) <=BE ParseComplete [S_1]
21:43:02.265 (26) <=BE BindComplete [null]
21:43:02.266 (26) <=BE ParameterDescription
21:43:02.266 (26) <=BE RowDescription(1)
21:43:02.266 (26) Field(,INT4,4,T)
21:43:02.266 (26) <=BE DataRow(len=4)
21:43:02.267 (26) <=BE CommandStatus(SELECT 1)
21:43:02.267 (26) <=BE ReadyForQuery(I)
If I've understood well I should get proper result after 1st bind...?

On Thu, 25 Nov 2010 12:21:39 -0800, Maciek Sakrejda
<msakrejda(at)truviso(dot)com>
wrote:
>> OTOH, it seems possible that the JDBC driver might behave differently
>> depending on whether parameter types were prespecified or not --- it
>> might issue Describe earlier in order to get the parameter types,
>> perhaps.
>
> Ah. Bingo:
>
> boolean describeStatement = describeOnly || (!oneShot &&
> paramsHasUnknown && queryHasUnknown && !query.isStatementDescribed());
>
>
> ---
> Maciek Sakrejda | System Architect | Truviso
>
> 1065 E. Hillsdale Blvd., Suite 215
> Foster City, CA 94404
> (650) 242-3500 Main
> www.truviso.com

--
----------
Radosław Smogura
http://www.softperience.eu

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Steve Singer 2010-11-25 20:58:40 Re: Patch to add a primary key using an existing index
Previous Message Maciek Sakrejda 2010-11-25 20:21:39 Re: [JDBC] JDBC and Binary protocol error, for some statements

Browse pgsql-jdbc by date

  From Date Subject
Next Message Maciek Sakrejda 2010-11-25 20:59:53 Re: [JDBC] JDBC and Binary protocol error, for some statements
Previous Message Maciek Sakrejda 2010-11-25 20:21:39 Re: [JDBC] JDBC and Binary protocol error, for some statements