Internet

From: Nombre y Apellidos <100000450(at)alumnos(dot)uc3m(dot)es>
To: pgsql-interfaces(at)postgresql(dot)org
Subject: Internet
Date: 2000-01-18 22:35:37
Message-ID: 200001181634.RAA10000@alumnos.uc3m.es
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-interfaces

Michael Meskes:
> On Wed, Jan 12, 2000 at 07:10:57PM -0500, Nombre y Apellidos wrote:
> > In my program in C with embedded SQL, I am trying to use a cursor for
> > a query.
> > The new syntax of FETCH is :
> > EXEC SQL FETCH FROM cursor_name INTO :variable_name
> >
> > But I receive the following message of error when I execute my program:
> > Segmentation default
>
> Ouch. Segmentation fault means the program tries to access invalid memory.
> You can get it for instance if the variable is not correctly defined.
>
> > When I worked with a previous version I wrote:
> > EXEC SQL FETCH cursor_name INTO :variable_name
>
> Yes, this syntax was supported and may be supported again in the future.
> Right now our parser does not like it due to shift/reduce conflicts. But I'm
> working on it.
>
> > What is the correct syntax?
>
> Using FROM is and will be correct.
>
> > How can I use the command FETCH?
>
> The above mentioned statement ie correct given that you did declare the
> cursor in advance. Please check the test file in the source tree for some
> examples.
>
> > Is always neccessary to include the embedded SQL commands in
> > transaction blocks?
>
> Yes and No. It depends on what you mean exactly. ECPG by default starts a
> transaction every time the connection starts resp. the open transcation is
> committed or rolled back.
>
> What you can do is start ecpg with option '-t' or issue an exec sql set
> autocommit=on to disable that feature. Then you have to manually start a
> transaction if you need one. However, you cannot work without a transaction
> since the backend executes statements only if they are embedded in a
> transaction. If you do not have an open transaction the backend will start
> one prior to executing your command and immediately after finishing this
> transaction will be committed.
>
> Hope this helps.
>
> 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(at)Fam-Meskes(dot)De | Use PostgreSQL!
>

Browse pgsql-interfaces by date

  From Date Subject
Next Message Dave Page 2000-01-19 16:26:47 RE: [INTERFACES] Setup of PGAdmin
Previous Message Dave Page 2000-01-18 16:40:22 RE: [INTERFACES] Setup of PGAdmin