pg.ddx.io  pgsql-odbc@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Gary Doades <gpd@gpdnet.co.uk>
To: pgsql-odbc@postgresql.org
Subject: ODBC int2 Paremeters to PostgreSQL functions
Date: Fri, 12 Mar 2004 08:04:04 -0000
Message-ID: <40516EF4.2445.73F5669B@localhost> (raw)

I have a problem with passing parameters to a PostgreSQL function
using the ODBC driver.

I have delcared a PostgreSQL function as:

function 
GENERATE_TIMESHEETS(timestamp,timestamp,smallint,smallint)
....

I have a .NET program that uses the following:
cmd.CommandText = "SELECT GENERATE_TIMESHEETS(?,?,?,?)";
cmd.Parameters.Add("DATE_FROM",OdbcType.DateTime,8);
cmd.Parameters.Add("DATE_TO",OdbcType.DateTime,8);
cmd.Parameters.Add("TIME_FROM",OdbcType.SmallInt,2);
cmd.Parameters.Add("TIME_TO",OdbcType.SmallInt,2);

I then assign the parameter values and execute the statement.

PostgreSQL returns an error stating
GENERATE_TIMESHEETS(timestamp,timestamp,int4,int4) cannot be 
found

It appears that the ODBC driver is not typecasting the smallint (int2)
parameters correctly for the function call.

Can anyone shed any light on this?

Thanks
Gary.

Message-ID: <40516EF4.2445.73F5669B@localhost>
Permalink:  ../40516EF4.2445.73F5669B@localhost/
Also on:    postgresql.org/message-id/40516EF4.2445.73F5669B@localhost

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-odbc@postgresql.org
  Cc: gpd@gpdnet.co.uk
  Subject: Re: ODBC int2 Paremeters to PostgreSQL functions
  In-Reply-To: <40516EF4.2445.73F5669B@localhost>
  References: <40516EF4.2445.73F5669B@localhost>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox