#include <locale.h>

exec sql whenever sqlerror sqlprint;

exec sql include sqlca;

int
main ()
{
EXEC SQL BEGIN DECLARE SECTION;
	int i = 1;
	int a[10] = {9,8,7,6,5,4,3,2,1,0};
	double f;
EXEC SQL END DECLARE SECTION;
	FILE *dbgs;

	setlocale(LC_ALL, "de_DE");
        
	if ((dbgs = fopen("log", "w")) != NULL)
                ECPGdebug(1, dbgs);

        EXEC SQL CONNECT TO mm;

	EXEC SQL SET AUTOCOMMIT = ON;

 	EXEC SQL BEGIN WORK;

/*	EXEC SQL CREATE TABLE test (f decimal(8,2), i int, a int[10]);*/
	EXEC SQL CREATE TABLE test (f float, i int, a int[10]);

	EXEC SQL INSERT INTO test(f,i,a) VALUES(404.90,1,'{0,1,2,3,4,5,6,7,8,9}');

/*	EXEC SQL INSERT INTO test(f,i,a) VALUES(140787.0,2,:a);*/

	EXEC SQL COMMIT;

	EXEC SQL BEGIN WORK; 

	EXEC SQL SELECT f
         INTO :f
         FROM test
         WHERE i = :i;

	printf("Found f=%f\n", f);

	EXEC SQL SELECT i
	 INTO :i
	 FROM test
	 WHERE f = :f;

	printf("Found i=%d\n", i);

	EXEC SQL DROP TABLE test;

	EXEC SQL COMMIT;

	EXEC SQL DISCONNECT;

	if (dbgs != NULL)
                fclose(dbgs);

	return (0);
}
