Re: prepared statement call fails

Поиск
Список
Период
Сортировка
Искать
От
Thomas Hallgren
Тема
Re: prepared statement call fails
Дата
Msg-id
thhal-0vv6OAs+HcC4bv5Tf2D5MH8fUmr8Wr9@mailblocks.com
Ответ на
Список
Дерево обсуждения
prepared statement call fails Larry White <ljw1001@gmail.com>
Re: prepared statement call fails Thomas Hallgren <thhal@mailblocks.com>
Re: prepared statement call fails Oliver Jowett <oliver@opencloud.com>
Re: prepared statement call fails Larry White <ljw1001@gmail.com>
Re: prepared statement call fails Thomas Hallgren <thhal@mailblocks.com>
Re: prepared statement call fails Oliver Jowett <oliver@opencloud.com>
Re: prepared statement call fails Thomas Hallgren <thhal@mailblocks.com>
Re: prepared statement call fails Oliver Jowett <oliver@opencloud.com>
Re: prepared statement call fails Larry White <ljw1001@gmail.com>
Larry White wrote:

>Thanks Thomas.  I'll try it your way to see what happens, but
>according to the Postgresql documentation, it should support callable
>statements.   I posted the relevent text from the JDBC section of the
>online docs below:
>
>     
>           PostgreSQL's JDBC driver fully supports calling PostgreSQL
>stored functions.
>
>          Example 31-4. Calling a built in stored function
>
>          This example shows how to call a PostgreSQL built in
>function, upper, which simply               converts the supplied
>string argument to uppercase.
>
>          // Turn transactions off.
>         con.setAutoCommit(false);
>          // Procedure call.
>          CallableStatement upperProc = con.prepareCall("{ ? = call
>upper( ? ) }");
>         upperProc.registerOutParameter(1, Types.VARCHAR);
>         upperProc.setString(2, "lowercase to uppercase");
>         upperProc.execute();
>         String upperCased = upperProc.getString(1);
>         upperProc.close();
>
>  
>
Ok, I did write AFAIK. Apparently my knowlegde didn't extend far enough :-)

The JDBC driver must do some trick then, and make an attempt to convert 
what you wrote into what I suggested. With some risk of getting flogged, 
I must admin that I disagree with that implementation since the 
interface doc's for JDBC mandates that the CallableStatement is for 
Stored Procedures only. Patching it so that it can call functions will 
cause future problems once the backend really do implement stored 
procedures correctly.

My advice would be to stick with prepared statements until that happens. 
I know for certain that it works.

Regards,
Thomas Hallgren



В списке pgsql-jdbc по дате отправления
От: Larry White
Дата:
От: Larry White
Дата:
FAQ