Received: from smtp1.kolumbus.fi (smtp1.kolumbus.fi [193.229.0.36]) by hub.org (8.10.1/8.10.1) with ESMTP id e5AEr3T98649 for ; Sat, 10 Jun 2000 10:53:03 -0400 (EDT) Received: from alpha.hut.fi (tobelix.atk.hpy.fi [192.102.34.211]) by smtp1.kolumbus.fi (8.9.0/8.9.0) with ESMTP id RAA12049 for ; Sat, 10 Jun 2000 17:52:56 +0300 (EET DST) Message-ID: <39425586.2E418BAC@alpha.hut.fi> Date: Sat, 10 Jun 2000 17:49:42 +0300 From: "Jorma O. =?iso-8859-1?Q?T=E4htinen?=" X-Mailer: Mozilla 4.73 [en] (X11; U; Linux 2.2.16 i686) X-Accept-Language: en MIME-Version: 1.0 To: pgsql-interfaces@postgresql.org Subject: ecpg: how select/insert n rows (array) in one query Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Archive-Number: 200006/59 Hello I'm new postgres user (currenly converting db application with quite large database from mysql to postgres, hopefully pg is not too slow but I really need triggers and views). Anyway could somebody please explain how multiple row select/insert should be used in embedded sql (ecpg) 1) select - this is simple (well documented) EXEC SQL BEGIN DECLARE SECTION; struct data_t { char md5[100][32]; int size[100]; } data; struct ind_t { short md5,size } ind; EXEC SQL END DECLARE SECTION; EXEC SQL BEGIN TRANSACTION; EXEC SQL DECLARE cur CURSOR FOR select md5,size FROM filetable; EXEC SQL OPEN cur; EXEC SQL WHENEVER NOT FOUND DO break; while(1) { EXEC SQL FETCH 1000 FROM cur INTO :data:ind; for(n=0;n