#define ECPGdebug(X,Y) ECPGdebug((X)+100,(Y))
#line 1 "alloc.pgc"
+#include <stdint.h>
#include <stdlib.h>
#include "ecpg_config.h"
#endif
-#line 25 "alloc.pgc"
+#line 26 "alloc.pgc"
#line 1 "regression.h"
-#line 26 "alloc.pgc"
+#line 27 "alloc.pgc"
/* exec sql whenever sqlerror sqlprint ; */
-#line 28 "alloc.pgc"
+#line 29 "alloc.pgc"
/* exec sql whenever not found sqlprint ; */
-#line 29 "alloc.pgc"
+#line 30 "alloc.pgc"
#ifdef WIN32
-#line 40 "alloc.pgc"
+#line 41 "alloc.pgc"
int value ;
-#line 41 "alloc.pgc"
+#line 42 "alloc.pgc"
char name [ 100 ] ;
-#line 42 "alloc.pgc"
+#line 43 "alloc.pgc"
char ** r = NULL ;
/* exec sql end declare section */
-#line 43 "alloc.pgc"
+#line 44 "alloc.pgc"
- value = (long)arg;
+ value = (intptr_t) arg;
sprintf(name, "Connection: %d", value);
{ ECPGconnect(__LINE__, 0, "ecpg1_regression" , NULL, NULL , name, 0);
-#line 48 "alloc.pgc"
+#line 49 "alloc.pgc"
if (sqlca.sqlcode < 0) sqlprint();}
-#line 48 "alloc.pgc"
+#line 49 "alloc.pgc"
{ ECPGsetcommit(__LINE__, "on", NULL);
-#line 49 "alloc.pgc"
+#line 50 "alloc.pgc"
if (sqlca.sqlcode < 0) sqlprint();}
-#line 49 "alloc.pgc"
+#line 50 "alloc.pgc"
for (i = 1; i <= REPEATS; ++i)
{
{ ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select relname from pg_class where relname = 'pg_class'", ECPGt_EOIT,
ECPGt_char,&(r),(long)0,(long)0,(1)*sizeof(char),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);
-#line 52 "alloc.pgc"
+#line 53 "alloc.pgc"
if (sqlca.sqlcode == ECPG_NOT_FOUND) sqlprint();
-#line 52 "alloc.pgc"
+#line 53 "alloc.pgc"
if (sqlca.sqlcode < 0) sqlprint();}
-#line 52 "alloc.pgc"
+#line 53 "alloc.pgc"
free(r);
r = NULL;
}
{ ECPGdisconnect(__LINE__, name);
-#line 56 "alloc.pgc"
+#line 57 "alloc.pgc"
if (sqlca.sqlcode < 0) sqlprint();}
-#line 56 "alloc.pgc"
+#line 57 "alloc.pgc"
return 0;
int main ()
{
- int i;
+ intptr_t i;
#ifdef WIN32
HANDLE threads[THREADS];
#else
CloseHandle(threads[i]);
#else
for (i = 0; i < THREADS; ++i)
- pthread_create(&threads[i], NULL, fn, (void *) (long) i);
+ pthread_create(&threads[i], NULL, fn, (void *) i);
for (i = 0; i < THREADS; ++i)
pthread_join(threads[i], NULL);
#endif
#define ECPGdebug(X,Y) ECPGdebug((X)+100,(Y))
#line 1 "prep.pgc"
+#include <stdint.h>
#include <stdlib.h>
#include "ecpg_config.h"
#endif
-#line 25 "prep.pgc"
+#line 26 "prep.pgc"
#line 1 "regression.h"
-#line 26 "prep.pgc"
+#line 27 "prep.pgc"
/* exec sql whenever sqlerror sqlprint ; */
-#line 28 "prep.pgc"
+#line 29 "prep.pgc"
/* exec sql whenever not found sqlprint ; */
-#line 29 "prep.pgc"
+#line 30 "prep.pgc"
#ifdef WIN32
-#line 40 "prep.pgc"
+#line 41 "prep.pgc"
int value ;
-#line 41 "prep.pgc"
+#line 42 "prep.pgc"
char name [ 100 ] ;
-#line 42 "prep.pgc"
+#line 43 "prep.pgc"
char query [ 256 ] = "INSERT INTO T VALUES ( ? )" ;
/* exec sql end declare section */
-#line 43 "prep.pgc"
+#line 44 "prep.pgc"
- value = (long)arg;
+ value = (intptr_t) arg;
sprintf(name, "Connection: %d", value);
{ ECPGconnect(__LINE__, 0, "ecpg1_regression" , NULL, NULL , name, 0);
-#line 48 "prep.pgc"
+#line 49 "prep.pgc"
if (sqlca.sqlcode < 0) sqlprint();}
-#line 48 "prep.pgc"
+#line 49 "prep.pgc"
{ ECPGsetcommit(__LINE__, "on", NULL);
-#line 49 "prep.pgc"
+#line 50 "prep.pgc"
if (sqlca.sqlcode < 0) sqlprint();}
-#line 49 "prep.pgc"
+#line 50 "prep.pgc"
for (i = 1; i <= REPEATS; ++i)
{
{ ECPGprepare(__LINE__, NULL, 0, "i", query);
-#line 52 "prep.pgc"
+#line 53 "prep.pgc"
if (sqlca.sqlcode < 0) sqlprint();}
-#line 52 "prep.pgc"
+#line 53 "prep.pgc"
{ ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_execute, "i",
ECPGt_int,&(value),(long)1,(long)1,sizeof(int),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);
-#line 53 "prep.pgc"
+#line 54 "prep.pgc"
if (sqlca.sqlcode == ECPG_NOT_FOUND) sqlprint();
-#line 53 "prep.pgc"
+#line 54 "prep.pgc"
if (sqlca.sqlcode < 0) sqlprint();}
-#line 53 "prep.pgc"
+#line 54 "prep.pgc"
}
{ ECPGdeallocate(__LINE__, 0, NULL, "i");
-#line 55 "prep.pgc"
+#line 56 "prep.pgc"
if (sqlca.sqlcode < 0) sqlprint();}
-#line 55 "prep.pgc"
+#line 56 "prep.pgc"
{ ECPGdisconnect(__LINE__, name);
-#line 56 "prep.pgc"
+#line 57 "prep.pgc"
if (sqlca.sqlcode < 0) sqlprint();}
-#line 56 "prep.pgc"
+#line 57 "prep.pgc"
return 0;
int main ()
{
- int i;
+ intptr_t i;
#ifdef WIN32
HANDLE threads[THREADS];
#else
#endif
{ ECPGconnect(__LINE__, 0, "ecpg1_regression" , NULL, NULL , NULL, 0);
-#line 70 "prep.pgc"
-
-if (sqlca.sqlcode < 0) sqlprint();}
-#line 70 "prep.pgc"
-
- { ECPGsetcommit(__LINE__, "on", NULL);
#line 71 "prep.pgc"
if (sqlca.sqlcode < 0) sqlprint();}
#line 71 "prep.pgc"
- { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "drop table if exists T", ECPGt_EOIT, ECPGt_EORT);
+ { ECPGsetcommit(__LINE__, "on", NULL);
#line 72 "prep.pgc"
if (sqlca.sqlcode < 0) sqlprint();}
#line 72 "prep.pgc"
- { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "create table T ( i int )", ECPGt_EOIT, ECPGt_EORT);
+ { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "drop table if exists T", ECPGt_EOIT, ECPGt_EORT);
#line 73 "prep.pgc"
if (sqlca.sqlcode < 0) sqlprint();}
#line 73 "prep.pgc"
- { ECPGdisconnect(__LINE__, "CURRENT");
+ { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "create table T ( i int )", ECPGt_EOIT, ECPGt_EORT);
#line 74 "prep.pgc"
if (sqlca.sqlcode < 0) sqlprint();}
#line 74 "prep.pgc"
+ { ECPGdisconnect(__LINE__, "CURRENT");
+#line 75 "prep.pgc"
+
+if (sqlca.sqlcode < 0) sqlprint();}
+#line 75 "prep.pgc"
+
#ifdef WIN32
for (i = 0; i < THREADS; ++i)
CloseHandle(threads[i]);
#else
for (i = 0; i < THREADS; ++i)
- pthread_create(&threads[i], NULL, fn, (void *) (long) i);
+ pthread_create(&threads[i], NULL, fn, (void *) i);
for (i = 0; i < THREADS; ++i)
pthread_join(threads[i], NULL);
#endif
* Thread test program
* by Philip Yarra & Lee Kindness.
*/
+#include <stdint.h>
#include <stdlib.h>
#include "ecpg_config.h"
-#line 23 "thread.pgc"
+#line 24 "thread.pgc"
void *test_thread(void *arg);
#else
HANDLE *threads;
#endif
- int n;
+ intptr_t n;
/* exec sql begin declare section */
-#line 39 "thread.pgc"
+#line 40 "thread.pgc"
int l_rows ;
/* exec sql end declare section */
-#line 40 "thread.pgc"
+#line 41 "thread.pgc"
/* Do not switch on debug output for regression tests. The threads get executed in
/* setup test_thread table */
{ ECPGconnect(__LINE__, 0, "ecpg1_regression" , NULL, NULL , NULL, 0); }
-#line 47 "thread.pgc"
+#line 48 "thread.pgc"
{ ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "drop table test_thread", ECPGt_EOIT, ECPGt_EORT);}
-#line 48 "thread.pgc"
+#line 49 "thread.pgc"
/* DROP might fail */
{ ECPGtrans(__LINE__, NULL, "commit");}
-#line 49 "thread.pgc"
+#line 50 "thread.pgc"
{ ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "create table test_thread ( tstamp timestamp not null default cast ( timeofday ( ) as timestamp ) , thread text not null , iteration integer not null , primary key ( thread , iteration ) )", ECPGt_EOIT, ECPGt_EORT);}
-#line 54 "thread.pgc"
+#line 55 "thread.pgc"
{ ECPGtrans(__LINE__, NULL, "commit");}
-#line 55 "thread.pgc"
+#line 56 "thread.pgc"
{ ECPGdisconnect(__LINE__, "CURRENT");}
-#line 56 "thread.pgc"
+#line 57 "thread.pgc"
/* create, and start, threads */
for( n = 0; n < nthreads; n++ )
{
#ifndef WIN32
- pthread_create(&threads[n], NULL, test_thread, (void *) (long) (n + 1));
+ pthread_create(&threads[n], NULL, test_thread, (void *) (n + 1));
#else
threads[n] = CreateThread(NULL, 0, (LPTHREAD_START_ROUTINE)test_thread, (void *) (n + 1), 0, NULL);
#endif
/* and check results */
{ ECPGconnect(__LINE__, 0, "ecpg1_regression" , NULL, NULL , NULL, 0); }
-#line 86 "thread.pgc"
+#line 87 "thread.pgc"
{ ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select count ( * ) from test_thread", ECPGt_EOIT,
ECPGt_int,&(l_rows),(long)1,(long)1,sizeof(int),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);}
-#line 87 "thread.pgc"
+#line 88 "thread.pgc"
{ ECPGtrans(__LINE__, NULL, "commit");}
-#line 88 "thread.pgc"
+#line 89 "thread.pgc"
{ ECPGdisconnect(__LINE__, "CURRENT");}
-#line 89 "thread.pgc"
+#line 90 "thread.pgc"
if( l_rows == (nthreads * iterations) )
printf("Success.\n");
void *test_thread(void *arg)
{
- long threadnum = (long)arg;
+ long threadnum = (intptr_t) arg;
/* exec sql begin declare section */
-#line 103 "thread.pgc"
+#line 104 "thread.pgc"
int l_i ;
-#line 104 "thread.pgc"
+#line 105 "thread.pgc"
char l_connection [ 128 ] ;
/* exec sql end declare section */
-#line 105 "thread.pgc"
+#line 106 "thread.pgc"
/* build up connection name, and connect to database */
_snprintf(l_connection, sizeof(l_connection), "thread_%03ld", threadnum);
#endif
/* exec sql whenever sqlerror sqlprint ; */
-#line 113 "thread.pgc"
+#line 114 "thread.pgc"
{ ECPGconnect(__LINE__, 0, "ecpg1_regression" , NULL, NULL , l_connection, 0);
-#line 114 "thread.pgc"
+#line 115 "thread.pgc"
if (sqlca.sqlcode < 0) sqlprint();}
-#line 114 "thread.pgc"
+#line 115 "thread.pgc"
if( sqlca.sqlcode != 0 )
{
return NULL;
}
{ ECPGtrans(__LINE__, l_connection, "begin");
-#line 120 "thread.pgc"
+#line 121 "thread.pgc"
if (sqlca.sqlcode < 0) sqlprint();}
-#line 120 "thread.pgc"
+#line 121 "thread.pgc"
/* insert into test_thread table */
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L,
ECPGt_int,&(l_i),(long)1,(long)1,sizeof(int),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);
-#line 125 "thread.pgc"
+#line 126 "thread.pgc"
if (sqlca.sqlcode < 0) sqlprint();}
-#line 125 "thread.pgc"
+#line 126 "thread.pgc"
if( sqlca.sqlcode != 0 )
printf("%s: ERROR: insert failed!\n", l_connection);
/* all done */
{ ECPGtrans(__LINE__, l_connection, "commit");
-#line 131 "thread.pgc"
+#line 132 "thread.pgc"
if (sqlca.sqlcode < 0) sqlprint();}
-#line 131 "thread.pgc"
+#line 132 "thread.pgc"
{ ECPGdisconnect(__LINE__, l_connection);
-#line 132 "thread.pgc"
+#line 133 "thread.pgc"
if (sqlca.sqlcode < 0) sqlprint();}
-#line 132 "thread.pgc"
+#line 133 "thread.pgc"
return NULL;
}
* Thread test program
* by Lee Kindness.
*/
-
+#include <stdint.h>
#include <stdlib.h>
#include "ecpg_config.h"
#else
HANDLE *threads;
#endif
- int n;
+ intptr_t n;
/* exec sql begin declare section */
for( n = 0; n < nthreads; n++ )
{
#ifndef WIN32
- pthread_create(&threads[n], NULL, test_thread, (void *) (long) (n + 1));
+ pthread_create(&threads[n], NULL, test_thread, (void *) (n + 1));
#else
threads[n] = CreateThread(NULL, 0, (LPTHREAD_START_ROUTINE) test_thread, (void *) (n+1), 0, NULL);
#endif
void *test_thread(void *arg)
{
- long threadnum = (long)arg;
+ long threadnum = (intptr_t) arg;
/* exec sql begin declare section */
+#include <stdint.h>
#include <stdlib.h>
#include "ecpg_config.h"
char **r = NULL;
EXEC SQL END DECLARE SECTION;
- value = (long)arg;
+ value = (intptr_t) arg;
sprintf(name, "Connection: %d", value);
EXEC SQL CONNECT TO REGRESSDB1 AS :name;
int main ()
{
- int i;
+ intptr_t i;
#ifdef WIN32
HANDLE threads[THREADS];
#else
CloseHandle(threads[i]);
#else
for (i = 0; i < THREADS; ++i)
- pthread_create(&threads[i], NULL, fn, (void *) (long) i);
+ pthread_create(&threads[i], NULL, fn, (void *) i);
for (i = 0; i < THREADS; ++i)
pthread_join(threads[i], NULL);
#endif
+#include <stdint.h>
#include <stdlib.h>
#include "ecpg_config.h"
char query[256] = "INSERT INTO T VALUES ( ? )";
EXEC SQL END DECLARE SECTION;
- value = (long)arg;
+ value = (intptr_t) arg;
sprintf(name, "Connection: %d", value);
EXEC SQL CONNECT TO REGRESSDB1 AS :name;
int main ()
{
- int i;
+ intptr_t i;
#ifdef WIN32
HANDLE threads[THREADS];
#else
CloseHandle(threads[i]);
#else
for (i = 0; i < THREADS; ++i)
- pthread_create(&threads[i], NULL, fn, (void *) (long) i);
+ pthread_create(&threads[i], NULL, fn, (void *) i);
for (i = 0; i < THREADS; ++i)
pthread_join(threads[i], NULL);
#endif
* Thread test program
* by Philip Yarra & Lee Kindness.
*/
+#include <stdint.h>
#include <stdlib.h>
#include "ecpg_config.h"
#else
HANDLE *threads;
#endif
- int n;
+ intptr_t n;
EXEC SQL BEGIN DECLARE SECTION;
int l_rows;
EXEC SQL END DECLARE SECTION;
for( n = 0; n < nthreads; n++ )
{
#ifndef WIN32
- pthread_create(&threads[n], NULL, test_thread, (void *) (long) (n + 1));
+ pthread_create(&threads[n], NULL, test_thread, (void *) (n + 1));
#else
threads[n] = CreateThread(NULL, 0, (LPTHREAD_START_ROUTINE)test_thread, (void *) (n + 1), 0, NULL);
#endif
void *test_thread(void *arg)
{
- long threadnum = (long)arg;
+ long threadnum = (intptr_t) arg;
EXEC SQL BEGIN DECLARE SECTION;
int l_i;
* Thread test program
* by Lee Kindness.
*/
-
+#include <stdint.h>
#include <stdlib.h>
#include "ecpg_config.h"
#else
HANDLE *threads;
#endif
- int n;
+ intptr_t n;
EXEC SQL BEGIN DECLARE SECTION;
int l_rows;
EXEC SQL END DECLARE SECTION;
for( n = 0; n < nthreads; n++ )
{
#ifndef WIN32
- pthread_create(&threads[n], NULL, test_thread, (void *) (long) (n + 1));
+ pthread_create(&threads[n], NULL, test_thread, (void *) (n + 1));
#else
threads[n] = CreateThread(NULL, 0, (LPTHREAD_START_ROUTINE) test_thread, (void *) (n+1), 0, NULL);
#endif
void *test_thread(void *arg)
{
- long threadnum = (long)arg;
+ long threadnum = (intptr_t) arg;
EXEC SQL BEGIN DECLARE SECTION;
int l_i;