1
0
mirror of https://github.com/postgres/postgres.git synced 2025-11-07 19:06:32 +03:00
Files
postgres/src/interfaces/ecpg/test/sql/insupd.pgc
Peter Eisentraut 001e114b8d Fix whitespace issues found by git diff --check, add gitattributes
Set per file type attributes in .gitattributes to fine-tune whitespace
checks.  With the associated cleanups, the tree is now clean for git
2013-11-10 14:48:29 -05:00

37 lines
1014 B
Plaintext

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
EXEC SQL INCLUDE ../regression;
int main() {
EXEC SQL BEGIN DECLARE SECTION;
int i1[3], i2[3], i3[3], i4;
EXEC SQL END DECLARE SECTION;
ECPGdebug(1, stderr);
EXEC SQL CONNECT TO REGRESSDB1;
EXEC SQL WHENEVER SQLWARNING SQLPRINT;
EXEC SQL WHENEVER SQLERROR SQLPRINT;
EXEC SQL CREATE TABLE insupd_test(a int, b int);
EXEC SQL INSERT INTO insupd_test (a,b) values (1, 1);
EXEC SQL INSERT INTO insupd_test (a,b) values (2, 2);
EXEC SQL INSERT INTO insupd_test (a,b) values (3, 3) returning a into :i4;
EXEC SQL UPDATE insupd_test set a=a+1 returning a into :i3;
EXEC SQL UPDATE insupd_test set (a,b)=(5,5) where a = 4;
EXEC SQL UPDATE insupd_test set a=4 where a=3;;
EXEC SQL SELECT a,b into :i1,:i2 from insupd_test order by a;
printf("changes\n%d %d %d %d\n", i3[0], i3[1], i3[2], i4);
printf("test\na b\n%d %d\n%d %d\n%d %d\n", i1[0], i2[0], i1[1], i2[1], i1[2], i2[2]);
EXEC SQL DISCONNECT ALL;
return 0;
}