Re: Parameters.Refresh error. - Mailing list pgsql-odbc

From Campbell, Greg
Subject Re: Parameters.Refresh error.
Date
Msg-id 43C18F52.4040100@us.michelin.com
Whole thread Raw
In response to Re: Parameters.Refresh error.  (Adam Biser <adambiser@gmail.com>)
List pgsql-odbc
Thanks for clarifying.

I too have used the Parametrization with command.Parameters collection in ADO with Jet/Access and MS SQL.
I haven't personnaly used it with Oracle. I have never gotten it to work with PostgreSQL through any
driver, although I saw a post once about it working with Npgsql for ADO.NET,..although when I tested it
did not seem to work either. My test case was emulating MS stored procedures (Jet parameter queries) using
the user defined function (alias stored procedures) in PostgreSQL. PostgreSQL seems to stubbornly like the
"SELECT stored_proc_name(param1, param2,..)" format,..so...

cmd.CommandText = "stored_proc_name"
cmd.CommandType = adStoredProc
cmd.Parameters.Append param
cmd.Execute

doesn't seem to work.

Further,
on Parameters
there is "lazy" way and an OCD way.
The lazy way is to set the statement...call cmd.Refresh,..to populate all the data types, and data sizes,
then just provide the values to the parameters and execute. This way calls for an "extra" data round trip
to the server to get and populate the parameters with just metadata. I'm not sure this works in pgodbc.

The OCD way of course, is to... for each parameter, populate the data type and data size, and the data
value. This is one less round-trip to the server, and is recommended for scaling and speed. Again, I
haven't gotten this to work for stored procedures. I pass stored procedures/user defined
functions,..command strings that I construct on the client "SELECT stored_proc_name(params)"

My question on whether any one was doing this the parameterized way, was to try to dig out of the woodwork
any of our more experience PG/ADO coders who might have stock routines for this stuff in the utility belts.







Adam Biser wrote:

> Campbell, Greg wrote:
>
>> Yes there is from the VB, data accees techniques side,..
>> or yes from the I or somebody I know has done this with pgodbc side?
>
>
> ADO supports parameterized SQL and DB2, which I normally work with,
> recommends them when executing  multiple statements where only the data
> values change because it improves performance.  So the only thing I can
> say is that I use them with the AS/400 and that, by Googling for
> "parameterized sql", others appear to use them on other systems.
> However, I can't get this to work with pgodbc.
>
> I will post code tomorrow so you and all can see what I mean.
>
> ---------------------------(end of broadcast)---------------------------
> TIP 2: Don't 'kill -9' the postmaster

Attachment

pgsql-odbc by date:

Previous
From: "Campbell, Greg"
Date:
Subject: Re: Parameters.Refresh error.
Next
From: Zoltan Boszormenyi
Date:
Subject: PsqlODBC slow on UNION queries