Обсуждение: ESQL/C Docs: Request for code

Поиск
Список
Период
Сортировка

ESQL/C Docs: Request for code

От
Martin Jackson
Дата:
Hello all,

I am looking for examples of working ECPG code.  Partly I would like to
see for myself how it works, but I would also be willing to write some
documentation on it, which I would be willing to submit to the CVS tree.

I do not understand, for example, how to handle cursors in ECPG because
I have not found any examples of doing so in the documentation I have. 
Others have probably had the same problem.

I am familiar with the Informix ESQL/C implementation, if that matters.

Would anyone be willing to email me some working code, along with the
appropriate table definitions?  It need not be too elaborate, but I
would like to know the following\ things:

1)  How do you set up a fetch operation?  Is there a nicer way to do it
in EC without a cursor?  That is,
DECLARE foo CURSOR FOR    SELECT * FROM bar    WHERE baz = :bazval
{time passes}
FETCH foo INTO :bletch, :foo2;

2)  Can you PREPARE (i.e. cache) statements for later execution?EXEC SQL DELETE FROM foo    WHERE baz = ?

3)  Does Postgres directly support placeholders (?)?  I've used them in
DBI, but I don't know whether that's some hack by the Postgres driver
author or if it's an actual Postgres feature?

4)  What kind of scope do declared cursors have?

5) (META-QUESTION):  Is ECPG suitable for a large system, i.e. an
accounting system for a small business?

-- 
====================================
Martin Jackson: mhjacks@nwa.quik.com
====================================
Are you running Linux yet?


Re: [INTERFACES] ESQL/C Docs: Request for code

От
Michael Meskes
Дата:
On Sat, Dec 11, 1999 at 02:25:10PM -0600, Martin Jackson wrote:
> I am looking for examples of working ECPG code.  Partly I would like to

There are some in the source code under test/.

> see for myself how it works, but I would also be willing to write some
> documentation on it, which I would be willing to submit to the CVS tree.

Great. :-)

> I do not understand, for example, how to handle cursors in ECPG because
> I have not found any examples of doing so in the documentation I have. 
> Others have probably had the same problem.

Cursors are used in the test examples.

> I am familiar with the Informix ESQL/C implementation, if that matters.

It should be the same for the most part. I'm interested in hearing about all
differences you find.

> 1)  How do you set up a fetch operation?  Is there a nicer way to do it
> in EC without a cursor?  That is,
> 
>     DECLARE foo CURSOR FOR
>         SELECT * FROM bar
>         WHERE baz = :bazval
> 
>     {time passes}
> 
>     FETCH foo INTO :bletch, :foo2;

SELECT * INTO :bletch, :Bazval FROM bar where baz = :bazval

> 2)  Can you PREPARE (i.e. cache) statements for later execution?
>     EXEC SQL DELETE FROM foo
>         WHERE baz = ?

Yes.

> 3)  Does Postgres directly support placeholders (?)?  I've used them in
> DBI, but I don't know whether that's some hack by the Postgres driver
> author or if it's an actual Postgres feature?

Yes. You can use it directly in statements you prepare.

> 4)  What kind of scope do declared cursors have?

I'm not exactly sure but I think it has to be the module i.e. source file.

> 5) (META-QUESTION):  Is ECPG suitable for a large system, i.e. an
> accounting system for a small business?

It should yes. If there is a problem ECPG will be fixed.

Michael
-- 
Michael Meskes                         | Go SF 49ers!
Th.-Heuss-Str. 61, D-41812 Erkelenz    | Go Rhein Fire!
Tel.: (+49) 2431/72651                 | Use Debian GNU/Linux!
Email: Michael@Fam-Meskes.De           | Use PostgreSQL!


Re: [INTERFACES] ESQL/C Docs: Request for code

От
Craig Orsinger
Дата:
On 12-Dec-99 Michael Meskes wrote:
> Cursors are used in the test examples.
>
>> I am familiar with the Informix ESQL/C implementation, if that matters.
>
> It should be the same for the most part. I'm interested in hearing about all
> differences you find.

        Unfortunately, cursors are considerably different. The PostgreSQL
cursors conform to the SQL92 standard (pretty much), but Informix seems
to support SQL89 only with some extensions of their own (???). We had a
discussion about this in this group back in June, 1999.
You might want to check the archives. The title was something
like "ecpg documentation" or something like that. I saved part of the
discussion as a Unix text file, which is attached.

----------------------------------
Date: 13-Dec-99  Time: 12:42:50

Craig Orsinger                  (email: <orsingerc@epg-gw1.lewis.army.mil>)
Logicon RDA
Bldg. 8B28                      "Just another megalomaniac with ideas above his
6th & F Streets                 station. The Universe is full of them."
Ft. Lewis, WA   98433                   - The Doctor
----------------------------------

Вложения