Обсуждение: Use of Stored Procedures and

От:
Marcos
Дата:

Hi,

I already read the documentation for to use the SPI_PREPARE and
SPI_EXEC... but sincerely I don't understand how I will use this
resource in my statements.

I looked for examples, but I din't good examples :(..

Somebody can help me?

Thanks.

Marcos.




От:
Michael Fuhr
Дата:

On Tue, Jan 17, 2006 at 09:04:53AM +0000, Marcos wrote:
> I already read the documentation for to use the SPI_PREPARE and
> SPI_EXEC... but sincerely I don't understand how I will use this
> resource in my statements.

What statements?  What problem are you trying to solve?

--
Michael Fuhr

От:
Marcos
Дата:

> What statements?

Sorry. Statements is my code.

> What problem are you trying to solve?

I want know how I make to use a prepared plan
( http://www.postgresql.org/docs/8.1/static/sql-prepare.html ). I read
that I need to use the SPI_PREPARE and SPI_EXEC in my code, but I didn't
understand how make it.

Thanks


От:
Markus Schaber
Дата:

Hi, Marcos,

Marcos wrote:

>>What problem are you trying to solve?
>
> I want know how I make to use a prepared plan
> ( http://www.postgresql.org/docs/8.1/static/sql-prepare.html ). I read
> that I need to use the SPI_PREPARE and SPI_EXEC in my code, but I didn't
> understand how make it.

Which interface are you using to connect to PostgreSQL? libpq, libpqxx,
pgjdbc, python-popy?

E. G. PGJDBC handles prepared plans transparently by using the
PreparedStatement class.

If you use command line PSQL, you can use the PREPARE commands.

Markus

--
Markus Schaber | Logical Tracking&Tracing International AG
Dipl. Inf.     | Software Development GIS

Fight against software patents in EU! www.ffii.org www.nosoftwarepatents.org

От:
Marcos
Дата:

> Which interface are you using to connect to PostgreSQL? libpq, libpqxx,
> pgjdbc, python-popy?
>
> E. G. PGJDBC handles prepared plans transparently by using the
> PreparedStatement class.
>
> If you use command line PSQL, you can use the PREPARE commands.

I'm using the adodb to call the stored procedure (plpgsql).

Thanks..


От:
Markus Schaber
Дата:

Hi, Marcos,

Marcos wrote:
>>Which interface are you using to connect to PostgreSQL? libpq, libpqxx,
>>pgjdbc, python-popy?
>>
>>E. G. PGJDBC handles prepared plans transparently by using the
>>PreparedStatement class.
>>
>>If you use command line PSQL, you can use the PREPARE commands.
>
> I'm using the adodb to call the stored procedure (plpgsql).

So your statements are inside a plpgsql stored procedure, important to
know that.

AFAIK, plpgsql uses prepared statements internally, so it should not be
necessary to use them explicitly.

Markus
--
Markus Schaber | Logical Tracking&Tracing International AG
Dipl. Inf.     | Software Development GIS

Fight against software patents in EU! www.ffii.org www.nosoftwarepatents.org