Skip site navigation (1) Skip section navigation (2)

Re: patch for passing the cts

From: Oliver Jowett <oliver(at)opencloud(dot)com>
To: Dave Cramer <pg(at)fastcrypt(dot)com>
Cc: List <pgsql-jdbc(at)postgresql(dot)org>
Subject: Re: patch for passing the cts
Date: 2005-06-15 04:46:09
Message-ID: (view raw, whole thread or download thread mbox)
Lists: pgsql-jdbc
Dave Cramer wrote:

> Do you have any suggestions ?

Also, the parser for {call} is going to have to get a lot smarter. A
first cut at what it needs to do..

Extract this information from the query:

- Name of the called function
- Number of ? parameter placeholders
- Text of each function argument
- Mapping from parameter index to function argument (many-to-one)
- Eligibility of each parameter for being an OUT parameter (this can be
determined from the text the parameter maps to -- if it's a bare "?"
then it's eligible)

On execute, you reassemble a query from the IN function arguments text only.

e.g. for the query "{call f(?+?,?)}" you'll get:

 function = "f"
 3 parameters
 2 function arguments:
   argument 1 = "?+?"
   argument 2 = "?"
 parameter 1 maps to function arg 1 and can't be OUT
 parameter 2 maps to function arg 1 and can't be OUT
 parameter 3 maps to function arg 2 and can be OUT

If you set all 3 parameters as IN parameters, it assembles a SELECT
including all function arguments:

  "select * from f(?+?,?) as result"

and gives it to the query executor which executes:

  "select * from f($1+$2,$3) as result"

If you set parameter 3 to OUT, it excludes the corresponding function
argument (argument 2) when assembling the SELECT:

  "select * from f(?+?) as result"

resulting in the actual query:

  "select * from f($1+$2) as result"

Hmm.. perhaps you could get a similar effect by doing the normal query
fragmentation then stripping a comma (only) from one of the adjacent
fragments to an OUT parameter, then merging the two adjacent fragments
as you remove the parameter; but that seem pretty hairy..


In response to


pgsql-jdbc by date

Next:From: Dave CramerDate: 2005-06-15 10:45:04
Subject: Re: patch for passing the cts
Previous:From: Oliver JowettDate: 2005-06-15 01:58:43
Subject: Re: patch for passing the cts

Privacy Policy | About PostgreSQL
Copyright © 1996-2017 The PostgreSQL Global Development Group