Bookmarks

Yahoo Gmail Google Facebook Delicious Twitter Reddit Stumpleupon Myspace Digg

Search queries

Use of assignment to $[ is deprecated at /usr/local/sbin/apxs line 86. , wwwxxx vim, mysql closing table and opening table, 800c5000, setgid operation not permitted, pciehp: acpi_pciehprm on IBM, WWWXXX.DBF, 078274121, info0a ip, should prodicers of software_based services be held liable or not liable for economic injuries

Links

XODOX
Impressum

#1: ODBC int2 Paremeters to PostgreSQL functions

Posted on 2004-03-12 09:04:04 by Gary Doades

--Alt-Boundary-823.1945462427
Content-type: text/plain; charset=US-ASCII
Content-transfer-encoding: 7BIT
Content-description: Mail message body

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.


--Alt-Boundary-823.1945462427
Content-type: text/html; charset=US-ASCII
Content-transfer-encoding: 7BIT
Content-description: Mail message body

<?xml version="1.0" ?><html>
<head>
<title></title>
</head>
<body>
<div align="left"><font face="Arial"><span style="font-size:10pt">I have a problem with passing parameters to a PostgreSQL function</span></font></div>
<div align="left"><font face="Arial"><span style="font-size:10pt">using the ODBC driver.</span></font></div>
<div align="left"><br/>
</div>
<div align="left"><font face="Arial"><span style="font-size:10pt">I have delcared a PostgreSQL function as:</span></font></div>
<div align="left"><br/>
</div>
<div align="left"><font face="Arial"><span style="font-size:10pt">function
GENERATE_TIMESHEETS(timestamp,timestamp,smallint,smallint)</span></font></div>
<div align="left"><font face="Arial"><span style="font-size:10pt">....</span></font></div>
<div align="left"><br/>
</div>
<div align="left"><font face="Arial"><span style="font-size:10pt">I have a .NET program that uses the following:</span></font></div>
<div align="left"><font face="Arial"><span style="font-size:10pt">cmd.CommandText = &quot;SELECT GENERATE_TIMESHEETS(?,?,?,?)&quot;;</span></font></div>
<div align="left"><font face="Arial"><span style="font-size:10pt">cmd.Parameters.Add(&quot;DATE_FROM&quot;,OdbcType.DateTime,8);</span></font></div>
<div align="left"><font face="Arial"><span style="font-size:10pt">cmd.Parameters.Add(&quot;DATE_TO&quot;,OdbcType.DateTime,8);</span></font></div>
<div align="left"><font face="Arial"><span style="font-size:10pt">cmd.Parameters.Add(&quot;TIME_FROM&quot;,OdbcType.SmallInt,2);</span></font></div>
<div align="left"><font face="Arial"><span style="font-size:10pt">cmd.Parameters.Add(&quot;TIME_TO&quot;,OdbcType.SmallInt,2);</span></font></div>
<div align="left"><br/>
</div>
<div align="left"><font face="Arial"><span style="font-size:10pt">I then assign the parameter values and execute the statement.</span></font></div>
<div align="left"><br/>
</div>
<div align="left"><font face="Arial"><span style="font-size:10pt">PostgreSQL returns an error stating</span></font></div>
<div align="left"><font face="Arial"><span style="font-size:10pt">GENERATE_TIMESHEETS(timestamp,timestamp,int4,int4) cannot be
found</span></font></div>
<div align="left"><br/>
</div>
<div align="left"><font face="Arial"><span style="font-size:10pt">It appears that the ODBC driver is not typecasting the smallint (int2)</span></font></div>
<div align="left"><font face="Arial"><span style="font-size:10pt">parameters correctly for the function call.</span></font></div>
<div align="left"><br/>
</div>
<div align="left"><font face="Arial"><span style="font-size:10pt">Can anyone shed any light on this?</span></font></div>
<div align="left"><br/>
</div>
<div align="left"><font face="Arial"><span style="font-size:10pt">Thanks</span></font></div>
<div align="left"><font face="Arial"><span style="font-size:10pt">Gary.</span></font></div>
<div align="left"></div>
</body>
</html>

--Alt-Boundary-823.1945462427--

Report this message