pg.ddx.io  pgsql-odbc@postgresql.org mailing list archive  
help / color / mirror / Atom feed
Output parameters
4+ messages / 2 participants
[nested] [flat]

* Output parameters
@ 2006-05-17 08:46 Bart Samwel <bart@samwel.tk>
  2006-05-17 12:46 ` Re: Output parameters Hiroshi Inoue <inoue@tpf.co.jp>
  0 siblings, 1 reply; 4+ messages in thread

From: Bart Samwel @ 2006-05-17 08:46 UTC (permalink / raw)
  To: pgsql-odbc

Hi there,

I've got a situation with the experimental enhanced branch driver 
(version 7.03.02.66), PostgreSQL 8.1 backend. I'm executing a query such as:

SELECT myproc(?,?,?,?,?,?,?)

where a number of the parameters are output parameters. I've bound 
buffers to the output parameters, but when I read the values, they 
contain garbage (uninitialized data, to be precise -- 0xcdcdcdcd). The 
first result row then contains the output parameter values. I'd expect 
the result row, as this is how PostgreSQL implements output parameters, 
but does anybody have any clue why the bound buffers for the output 
parameters aren't filled?

Thanks in advance for your help!

Cheers,
Bart




^ permalink  raw  reply  [nested|flat] 4+ messages in thread

* Re: Output parameters
  2006-05-17 08:46 Output parameters Bart Samwel <bart@samwel.tk>
@ 2006-05-17 12:46 ` Hiroshi Inoue <inoue@tpf.co.jp>
  2006-05-17 23:32   ` Re: Output parameters Hiroshi Inoue <inoue@tpf.co.jp>
  0 siblings, 1 reply; 4+ messages in thread

From: Hiroshi Inoue @ 2006-05-17 12:46 UTC (permalink / raw)
  To: Bart Samwel <bart@samwel.tk>; +Cc: pgsql-odbc

Bart Samwel wrote:
> Hi there,
>
> I've got a situation with the experimental enhanced branch driver 
> (version 7.03.02.66), PostgreSQL 8.1 backend. I'm executing a query 
> such as:
>
> SELECT myproc(?,?,?,?,?,?,?)
>
> where a number of the parameters are output parameters. I've bound 
> buffers to the output parameters, but when I read the values, they 
> contain garbage (uninitialized data, to be precise -- 0xcdcdcdcd). 

What kind of tool are you using and how do you execute the above example 
concretely ?

regards,
Hiroshi Inoue



^ permalink  raw  reply  [nested|flat] 4+ messages in thread

* Re: Output parameters
  2006-05-17 08:46 Output parameters Bart Samwel <bart@samwel.tk>
  2006-05-17 12:46 ` Re: Output parameters Hiroshi Inoue <inoue@tpf.co.jp>
@ 2006-05-17 23:32   ` Hiroshi Inoue <inoue@tpf.co.jp>
  2006-05-18 09:33     ` Re: Output parameters Bart Samwel <bart@samwel.tk>
  0 siblings, 1 reply; 4+ messages in thread

From: Hiroshi Inoue @ 2006-05-17 23:32 UTC (permalink / raw)
  To: Bart Samwel <bart@samwel.tk>; +Cc: pgsql-odbc

Bart Samwel wrote:
> Hiroshi Inoue wrote:
>> Bart Samwel wrote:
>>> Hiroshi Inoue wrote:
>>>> Bart Samwel wrote:
>>>>> Hi there,
>>>>>
>>>>> I've got a situation with the experimental enhanced branch driver 
>>>>> (version 7.03.02.66), PostgreSQL 8.1 backend. I'm executing a query 
>>>>> such as:
>>>>>
>>>>> SELECT myproc(?,?,?,?,?,?,?)
>>>>>
>>>>> where a number of the parameters are output parameters. I've bound 
>>>>> buffers to the output parameters, but when I read the values, they 
>>>>> contain garbage (uninitialized data, to be precise -- 0xcdcdcdcd). 
>>>>
>>>> What kind of tool are you using and how do you execute the above 
>>>> example concretely ?
>>>
>>> I'm using our own ODBC front end library, freshly written from spec. 
>>> The same code works like a charm on Oracle to retrieve output 
>>> parameters. I could figure out the exact sequence of calls if you 
>>> want, there's quite a lot of wrapper code around it but It'd probably 
>>> be possible.
>>
>> Could you send me the Mylog output ?
> 
> Yes, it's attached. Please read on for some extra context information. :-)
> 
> Anyway, it turns out that I misinterpreted the way PostgreSQL implements 
> output parameters -- apparently, they are nothing but a convenient way 
> to make PostgreSQL create a complex return type for a function. In 
> PL/pgSQL, however, I can't specify the output parameters in the 
> parameter list, while with the ODBC driver I can.

Please use ODBC's standard syntax to execute functions or procedures.

	{[?=]call procedure-name[([?][,[?]]...)]}

For example, please execute {CALL baz(?, ?)} in your case.

regards,
Hiroshi Inoue



^ permalink  raw  reply  [nested|flat] 4+ messages in thread

* Re: Output parameters
  2006-05-17 08:46 Output parameters Bart Samwel <bart@samwel.tk>
  2006-05-17 12:46 ` Re: Output parameters Hiroshi Inoue <inoue@tpf.co.jp>
  2006-05-17 23:32   ` Re: Output parameters Hiroshi Inoue <inoue@tpf.co.jp>
@ 2006-05-18 09:33     ` Bart Samwel <bart@samwel.tk>
  0 siblings, 0 replies; 4+ messages in thread

From: Bart Samwel @ 2006-05-18 09:33 UTC (permalink / raw)
  To: Hiroshi Inoue <inoue@tpf.co.jp>; +Cc: pgsql-odbc

Hiroshi Inoue wrote:
> Bart Samwel wrote:
>> Hiroshi Inoue wrote:
>>> Bart Samwel wrote:
>>>> Hiroshi Inoue wrote:
>>>>> Bart Samwel wrote:
>>>>>> Hi there,
>>>>>>
>>>>>> I've got a situation with the experimental enhanced branch driver 
>>>>>> (version 7.03.02.66), PostgreSQL 8.1 backend. I'm executing a 
>>>>>> query such as:
>>>>>>
>>>>>> SELECT myproc(?,?,?,?,?,?,?)
>>>>>>
>>>>>> where a number of the parameters are output parameters. I've bound 
>>>>>> buffers to the output parameters, but when I read the values, they 
>>>>>> contain garbage (uninitialized data, to be precise -- 0xcdcdcdcd). 
>>>>>
>>>>> What kind of tool are you using and how do you execute the above 
>>>>> example concretely ?
>>>>
>>>> I'm using our own ODBC front end library, freshly written from spec. 
>>>> The same code works like a charm on Oracle to retrieve output 
>>>> parameters. I could figure out the exact sequence of calls if you 
>>>> want, there's quite a lot of wrapper code around it but It'd 
>>>> probably be possible.
>>>
>>> Could you send me the Mylog output ?
>>
>> Yes, it's attached. Please read on for some extra context information. 
>> :-)
>>
>> Anyway, it turns out that I misinterpreted the way PostgreSQL 
>> implements output parameters -- apparently, they are nothing but a 
>> convenient way to make PostgreSQL create a complex return type for a 
>> function. In PL/pgSQL, however, I can't specify the output parameters 
>> in the parameter list, while with the ODBC driver I can.
> 
> Please use ODBC's standard syntax to execute functions or procedures.
> 
>     {[?=]call procedure-name[([?][,[?]]...)]}
> 
> For example, please execute {CALL baz(?, ?)} in your case.

Ah, that did the trick! I wasn't aware of this standard syntax, we've 
only recently started to use *real* ODBC instead of just using it as an 
easy way of getting the same SQL into different databases through one 
interface. I guess we'll have to start using more of these ODBC 
constructs. Thanks very much for your explanation!

Cheers,
Bart



^ permalink  raw  reply  [nested|flat] 4+ messages in thread


end of thread, other threads:[~2006-05-18 09:33 UTC | newest]

Thread overview: 4+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2006-05-17 08:46 Output parameters Bart Samwel <bart@samwel.tk>
2006-05-17 12:46 ` Hiroshi Inoue <inoue@tpf.co.jp>
2006-05-17 23:32   ` Hiroshi Inoue <inoue@tpf.co.jp>
2006-05-18 09:33     ` Bart Samwel <bart@samwel.tk>

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