Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
P
Postgres FD Implementation
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Abuhujair Javed
Postgres FD Implementation
Commits
04fbe0e4
Commit
04fbe0e4
authored
Aug 26, 2017
by
Michael Meskes
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Changed order of statements and added an additiona MSVC safeguard to make ecpg
thread test cases work on Windows.
parent
2073c641
Changes
10
Show whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
124 additions
and
104 deletions
+124
-104
src/interfaces/ecpg/test/expected/thread-alloc.c
src/interfaces/ecpg/test/expected/thread-alloc.c
+19
-17
src/interfaces/ecpg/test/expected/thread-descriptor.c
src/interfaces/ecpg/test/expected/thread-descriptor.c
+6
-4
src/interfaces/ecpg/test/expected/thread-prep.c
src/interfaces/ecpg/test/expected/thread-prep.c
+33
-31
src/interfaces/ecpg/test/expected/thread-thread.c
src/interfaces/ecpg/test/expected/thread-thread.c
+20
-18
src/interfaces/ecpg/test/expected/thread-thread_implicit.c
src/interfaces/ecpg/test/expected/thread-thread_implicit.c
+20
-18
src/interfaces/ecpg/test/thread/alloc.pgc
src/interfaces/ecpg/test/thread/alloc.pgc
+6
-4
src/interfaces/ecpg/test/thread/descriptor.pgc
src/interfaces/ecpg/test/thread/descriptor.pgc
+2
-0
src/interfaces/ecpg/test/thread/prep.pgc
src/interfaces/ecpg/test/thread/prep.pgc
+6
-4
src/interfaces/ecpg/test/thread/thread.pgc
src/interfaces/ecpg/test/thread/thread.pgc
+6
-4
src/interfaces/ecpg/test/thread/thread_implicit.pgc
src/interfaces/ecpg/test/thread/thread_implicit.pgc
+6
-4
No files found.
src/interfaces/ecpg/test/expected/thread-alloc.c
View file @
04fbe0e4
...
...
@@ -128,63 +128,65 @@ static void* fn(void* arg)
{
int
i
;
#ifdef WIN32
_configthreadlocale
(
_ENABLE_PER_THREAD_LOCALE
);
#endif
/* exec sql begin declare section */
#line 4
4
"alloc.pgc"
#line 4
0
"alloc.pgc"
int
value
;
#line 4
5
"alloc.pgc"
#line 4
1
"alloc.pgc"
char
name
[
100
]
;
#line 4
6
"alloc.pgc"
#line 4
2
"alloc.pgc"
char
**
r
=
NULL
;
/* exec sql end declare section */
#line 47 "alloc.pgc"
#line 43 "alloc.pgc"
#ifdef WIN32
#ifdef _MSC_VER
/* requires MSVC */
_configthreadlocale
(
_ENABLE_PER_THREAD_LOCALE
);
#endif
#endif
value
=
(
long
)
arg
;
sprintf
(
name
,
"Connection: %d"
,
value
);
{
ECPGconnect
(
__LINE__
,
0
,
"ecpg1_regression"
,
NULL
,
NULL
,
name
,
0
);
#line 5
2
"alloc.pgc"
#line 5
4
"alloc.pgc"
if
(
sqlca
.
sqlcode
<
0
)
sqlprint
();}
#line 5
2
"alloc.pgc"
#line 5
4
"alloc.pgc"
{
ECPGsetcommit
(
__LINE__
,
"on"
,
NULL
);
#line 5
3
"alloc.pgc"
#line 5
5
"alloc.pgc"
if
(
sqlca
.
sqlcode
<
0
)
sqlprint
();}
#line 5
3
"alloc.pgc"
#line 5
5
"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 5
6
"alloc.pgc"
#line 5
8
"alloc.pgc"
if
(
sqlca
.
sqlcode
==
ECPG_NOT_FOUND
)
sqlprint
();
#line 5
6
"alloc.pgc"
#line 5
8
"alloc.pgc"
if
(
sqlca
.
sqlcode
<
0
)
sqlprint
();}
#line 5
6
"alloc.pgc"
#line 5
8
"alloc.pgc"
free
(
r
);
r
=
NULL
;
}
{
ECPGdisconnect
(
__LINE__
,
name
);
#line 6
0
"alloc.pgc"
#line 6
2
"alloc.pgc"
if
(
sqlca
.
sqlcode
<
0
)
sqlprint
();}
#line 6
0
"alloc.pgc"
#line 6
2
"alloc.pgc"
return
0
;
...
...
src/interfaces/ecpg/test/expected/thread-descriptor.c
View file @
04fbe0e4
...
...
@@ -109,22 +109,24 @@ static void* fn(void* arg)
int
i
;
#ifdef WIN32
#ifdef _MSC_VER
/* requires MSVC */
_configthreadlocale
(
_ENABLE_PER_THREAD_LOCALE
);
#endif
#endif
for
(
i
=
1
;
i
<=
REPEATS
;
++
i
)
{
ECPGallocate_desc
(
__LINE__
,
"mydesc"
);
#line 3
4
"descriptor.pgc"
#line 3
6
"descriptor.pgc"
if
(
sqlca
.
sqlcode
<
0
)
sqlprint
();
#line 3
4
"descriptor.pgc"
#line 3
6
"descriptor.pgc"
ECPGdeallocate_desc
(
__LINE__
,
"mydesc"
);
#line 3
5
"descriptor.pgc"
#line 3
7
"descriptor.pgc"
if
(
sqlca
.
sqlcode
<
0
)
sqlprint
();
#line 3
5
"descriptor.pgc"
#line 3
7
"descriptor.pgc"
}
...
...
src/interfaces/ecpg/test/expected/thread-prep.c
View file @
04fbe0e4
...
...
@@ -128,73 +128,75 @@ static void* fn(void* arg)
{
int
i
;
#ifdef WIN32
_configthreadlocale
(
_ENABLE_PER_THREAD_LOCALE
);
#endif
/* exec sql begin declare section */
#line 4
4
"prep.pgc"
#line 4
0
"prep.pgc"
int
value
;
#line 4
5
"prep.pgc"
#line 4
1
"prep.pgc"
char
name
[
100
]
;
#line 4
6
"prep.pgc"
#line 4
2
"prep.pgc"
char
query
[
256
]
=
"INSERT INTO T VALUES ( ? )"
;
/* exec sql end declare section */
#line 4
7
"prep.pgc"
#line 4
3
"prep.pgc"
#ifdef WIN32
#ifdef _MSC_VER
/* requires MSVC */
_configthreadlocale
(
_ENABLE_PER_THREAD_LOCALE
);
#endif
#endif
value
=
(
long
)
arg
;
sprintf
(
name
,
"Connection: %d"
,
value
);
{
ECPGconnect
(
__LINE__
,
0
,
"ecpg1_regression"
,
NULL
,
NULL
,
name
,
0
);
#line 5
2
"prep.pgc"
#line 5
4
"prep.pgc"
if
(
sqlca
.
sqlcode
<
0
)
sqlprint
();}
#line 5
2
"prep.pgc"
#line 5
4
"prep.pgc"
{
ECPGsetcommit
(
__LINE__
,
"on"
,
NULL
);
#line 5
3
"prep.pgc"
#line 5
5
"prep.pgc"
if
(
sqlca
.
sqlcode
<
0
)
sqlprint
();}
#line 5
3
"prep.pgc"
#line 5
5
"prep.pgc"
for
(
i
=
1
;
i
<=
REPEATS
;
++
i
)
{
{
ECPGprepare
(
__LINE__
,
NULL
,
0
,
"i"
,
query
);
#line 5
6
"prep.pgc"
#line 5
8
"prep.pgc"
if
(
sqlca
.
sqlcode
<
0
)
sqlprint
();}
#line 5
6
"prep.pgc"
#line 5
8
"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 5
7
"prep.pgc"
#line 5
9
"prep.pgc"
if
(
sqlca
.
sqlcode
==
ECPG_NOT_FOUND
)
sqlprint
();
#line 5
7
"prep.pgc"
#line 5
9
"prep.pgc"
if
(
sqlca
.
sqlcode
<
0
)
sqlprint
();}
#line 5
7
"prep.pgc"
#line 5
9
"prep.pgc"
}
{
ECPGdeallocate
(
__LINE__
,
0
,
NULL
,
"i"
);
#line
59
"prep.pgc"
#line
61
"prep.pgc"
if
(
sqlca
.
sqlcode
<
0
)
sqlprint
();}
#line
59
"prep.pgc"
#line
61
"prep.pgc"
{
ECPGdisconnect
(
__LINE__
,
name
);
#line 6
0
"prep.pgc"
#line 6
2
"prep.pgc"
if
(
sqlca
.
sqlcode
<
0
)
sqlprint
();}
#line 6
0
"prep.pgc"
#line 6
2
"prep.pgc"
return
0
;
...
...
@@ -210,34 +212,34 @@ int main ()
#endif
{
ECPGconnect
(
__LINE__
,
0
,
"ecpg1_regression"
,
NULL
,
NULL
,
NULL
,
0
);
#line 7
4
"prep.pgc"
#line 7
6
"prep.pgc"
if
(
sqlca
.
sqlcode
<
0
)
sqlprint
();}
#line 7
4
"prep.pgc"
#line 7
6
"prep.pgc"
{
ECPGsetcommit
(
__LINE__
,
"on"
,
NULL
);
#line 7
5
"prep.pgc"
#line 7
7
"prep.pgc"
if
(
sqlca
.
sqlcode
<
0
)
sqlprint
();}
#line 7
5
"prep.pgc"
#line 7
7
"prep.pgc"
{
ECPGdo
(
__LINE__
,
0
,
1
,
NULL
,
0
,
ECPGst_normal
,
"drop table if exists T"
,
ECPGt_EOIT
,
ECPGt_EORT
);
#line 7
6
"prep.pgc"
#line 7
8
"prep.pgc"
if
(
sqlca
.
sqlcode
<
0
)
sqlprint
();}
#line 7
6
"prep.pgc"
#line 7
8
"prep.pgc"
{
ECPGdo
(
__LINE__
,
0
,
1
,
NULL
,
0
,
ECPGst_normal
,
"create table T ( i int )"
,
ECPGt_EOIT
,
ECPGt_EORT
);
#line 7
7
"prep.pgc"
#line 7
9
"prep.pgc"
if
(
sqlca
.
sqlcode
<
0
)
sqlprint
();}
#line 7
7
"prep.pgc"
#line 7
9
"prep.pgc"
{
ECPGdisconnect
(
__LINE__
,
"CURRENT"
);
#line
78
"prep.pgc"
#line
80
"prep.pgc"
if
(
sqlca
.
sqlcode
<
0
)
sqlprint
();}
#line
78
"prep.pgc"
#line
80
"prep.pgc"
#ifdef WIN32
...
...
src/interfaces/ecpg/test/expected/thread-thread.c
View file @
04fbe0e4
...
...
@@ -140,22 +140,24 @@ void *test_thread(void *arg)
{
long
threadnum
=
(
long
)
arg
;
#ifdef WIN32
_configthreadlocale
(
_ENABLE_PER_THREAD_LOCALE
);
#endif
/* exec sql begin declare section */
#line 10
7
"thread.pgc"
#line 10
3
"thread.pgc"
int
l_i
;
#line 10
8
"thread.pgc"
#line 10
4
"thread.pgc"
char
l_connection
[
128
]
;
/* exec sql end declare section */
#line 109 "thread.pgc"
#line 105 "thread.pgc"
#ifdef WIN32
#ifdef _MSC_VER
/* requires MSVC */
_configthreadlocale
(
_ENABLE_PER_THREAD_LOCALE
);
#endif
#endif
/* build up connection name, and connect to database */
#ifndef _MSC_VER
...
...
@@ -164,13 +166,13 @@ void *test_thread(void *arg)
_snprintf
(
l_connection
,
sizeof
(
l_connection
),
"thread_%03ld"
,
threadnum
);
#endif
/* exec sql whenever sqlerror sqlprint ; */
#line 11
7
"thread.pgc"
#line 11
9
"thread.pgc"
{
ECPGconnect
(
__LINE__
,
0
,
"ecpg1_regression"
,
NULL
,
NULL
,
l_connection
,
0
);
#line 1
18
"thread.pgc"
#line 1
20
"thread.pgc"
if
(
sqlca
.
sqlcode
<
0
)
sqlprint
();}
#line 1
18
"thread.pgc"
#line 1
20
"thread.pgc"
if
(
sqlca
.
sqlcode
!=
0
)
{
...
...
@@ -178,10 +180,10 @@ if (sqlca.sqlcode < 0) sqlprint();}
return
(
NULL
);
}
{
ECPGtrans
(
__LINE__
,
l_connection
,
"begin"
);
#line 12
4
"thread.pgc"
#line 12
6
"thread.pgc"
if
(
sqlca
.
sqlcode
<
0
)
sqlprint
();}
#line 12
4
"thread.pgc"
#line 12
6
"thread.pgc"
/* insert into test_thread table */
...
...
@@ -192,10 +194,10 @@ if (sqlca.sqlcode < 0) sqlprint();}
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 1
29
"thread.pgc"
#line 1
31
"thread.pgc"
if
(
sqlca
.
sqlcode
<
0
)
sqlprint
();}
#line 1
29
"thread.pgc"
#line 1
31
"thread.pgc"
if
(
sqlca
.
sqlcode
!=
0
)
printf
(
"%s: ERROR: insert failed!
\n
"
,
l_connection
);
...
...
@@ -203,16 +205,16 @@ if (sqlca.sqlcode < 0) sqlprint();}
/* all done */
{
ECPGtrans
(
__LINE__
,
l_connection
,
"commit"
);
#line 13
5
"thread.pgc"
#line 13
7
"thread.pgc"
if
(
sqlca
.
sqlcode
<
0
)
sqlprint
();}
#line 13
5
"thread.pgc"
#line 13
7
"thread.pgc"
{
ECPGdisconnect
(
__LINE__
,
l_connection
);
#line 13
6
"thread.pgc"
#line 13
8
"thread.pgc"
if
(
sqlca
.
sqlcode
<
0
)
sqlprint
();}
#line 13
6
"thread.pgc"
#line 13
8
"thread.pgc"
return
(
NULL
);
}
...
...
src/interfaces/ecpg/test/expected/thread-thread_implicit.c
View file @
04fbe0e4
...
...
@@ -141,22 +141,24 @@ void *test_thread(void *arg)
{
long
threadnum
=
(
long
)
arg
;
#ifdef WIN32
_configthreadlocale
(
_ENABLE_PER_THREAD_LOCALE
);
#endif
/* exec sql begin declare section */
#line 10
8
"thread_implicit.pgc"
#line 10
4
"thread_implicit.pgc"
int
l_i
;
#line 10
9
"thread_implicit.pgc"
#line 10
5
"thread_implicit.pgc"
char
l_connection
[
128
]
;
/* exec sql end declare section */
#line 110 "thread_implicit.pgc"
#line 106 "thread_implicit.pgc"
#ifdef WIN32
#ifdef _MSC_VER
/* requires MSVC */
_configthreadlocale
(
_ENABLE_PER_THREAD_LOCALE
);
#endif
#endif
/* build up connection name, and connect to database */
#ifndef _MSC_VER
...
...
@@ -165,13 +167,13 @@ void *test_thread(void *arg)
_snprintf
(
l_connection
,
sizeof
(
l_connection
),
"thread_%03ld"
,
threadnum
);
#endif
/* exec sql whenever sqlerror sqlprint ; */
#line 1
18
"thread_implicit.pgc"
#line 1
20
"thread_implicit.pgc"
{
ECPGconnect
(
__LINE__
,
0
,
"ecpg1_regression"
,
NULL
,
NULL
,
l_connection
,
0
);
#line 1
19
"thread_implicit.pgc"
#line 1
21
"thread_implicit.pgc"
if
(
sqlca
.
sqlcode
<
0
)
sqlprint
();}
#line 1
19
"thread_implicit.pgc"
#line 1
21
"thread_implicit.pgc"
if
(
sqlca
.
sqlcode
!=
0
)
{
...
...
@@ -179,10 +181,10 @@ if (sqlca.sqlcode < 0) sqlprint();}
return
(
NULL
);
}
{
ECPGtrans
(
__LINE__
,
NULL
,
"begin"
);
#line 12
5
"thread_implicit.pgc"
#line 12
7
"thread_implicit.pgc"
if
(
sqlca
.
sqlcode
<
0
)
sqlprint
();}
#line 12
5
"thread_implicit.pgc"
#line 12
7
"thread_implicit.pgc"
/* insert into test_thread table */
...
...
@@ -193,10 +195,10 @@ if (sqlca.sqlcode < 0) sqlprint();}
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 13
0
"thread_implicit.pgc"
#line 13
2
"thread_implicit.pgc"
if
(
sqlca
.
sqlcode
<
0
)
sqlprint
();}
#line 13
0
"thread_implicit.pgc"
#line 13
2
"thread_implicit.pgc"
if
(
sqlca
.
sqlcode
!=
0
)
printf
(
"%s: ERROR: insert failed!
\n
"
,
l_connection
);
...
...
@@ -204,16 +206,16 @@ if (sqlca.sqlcode < 0) sqlprint();}
/* all done */
{
ECPGtrans
(
__LINE__
,
NULL
,
"commit"
);
#line 13
6
"thread_implicit.pgc"
#line 13
8
"thread_implicit.pgc"
if
(
sqlca
.
sqlcode
<
0
)
sqlprint
();}
#line 13
6
"thread_implicit.pgc"
#line 13
8
"thread_implicit.pgc"
{
ECPGdisconnect
(
__LINE__
,
l_connection
);
#line 13
7
"thread_implicit.pgc"
#line 13
9
"thread_implicit.pgc"
if
(
sqlca
.
sqlcode
<
0
)
sqlprint
();}
#line 13
7
"thread_implicit.pgc"
#line 13
9
"thread_implicit.pgc"
return
(
NULL
);
}
...
...
src/interfaces/ecpg/test/thread/alloc.pgc
View file @
04fbe0e4
...
...
@@ -36,16 +36,18 @@ static void* fn(void* arg)
{
int i;
#ifdef WIN32
_configthreadlocale(_ENABLE_PER_THREAD_LOCALE);
#endif
EXEC SQL BEGIN DECLARE SECTION;
int value;
char name[100];
char **r = NULL;
EXEC SQL END DECLARE SECTION;
#ifdef WIN32
#ifdef _MSC_VER /* requires MSVC */
_configthreadlocale(_ENABLE_PER_THREAD_LOCALE);
#endif
#endif
value = (long)arg;
sprintf(name, "Connection: %d", value);
...
...
src/interfaces/ecpg/test/thread/descriptor.pgc
View file @
04fbe0e4
...
...
@@ -26,7 +26,9 @@ static void* fn(void* arg)
int i;
#ifdef WIN32
#ifdef _MSC_VER /* requires MSVC */
_configthreadlocale(_ENABLE_PER_THREAD_LOCALE);
#endif
#endif
for (i = 1; i <= REPEATS; ++i)
...
...
src/interfaces/ecpg/test/thread/prep.pgc
View file @
04fbe0e4
...
...
@@ -36,16 +36,18 @@ static void* fn(void* arg)
{
int i;
#ifdef WIN32
_configthreadlocale(_ENABLE_PER_THREAD_LOCALE);
#endif
EXEC SQL BEGIN DECLARE SECTION;
int value;
char name[100];
char query[256] = "INSERT INTO T VALUES ( ? )";
EXEC SQL END DECLARE SECTION;
#ifdef WIN32
#ifdef _MSC_VER /* requires MSVC */
_configthreadlocale(_ENABLE_PER_THREAD_LOCALE);
#endif
#endif
value = (long)arg;
sprintf(name, "Connection: %d", value);
...
...
src/interfaces/ecpg/test/thread/thread.pgc
View file @
04fbe0e4
...
...
@@ -99,15 +99,17 @@ void *test_thread(void *arg)
{
long threadnum = (long)arg;
#ifdef WIN32
_configthreadlocale(_ENABLE_PER_THREAD_LOCALE);
#endif
EXEC SQL BEGIN DECLARE SECTION;
int l_i;
char l_connection[128];
EXEC SQL END DECLARE SECTION;
#ifdef WIN32
#ifdef _MSC_VER /* requires MSVC */
_configthreadlocale(_ENABLE_PER_THREAD_LOCALE);
#endif
#endif
/* build up connection name, and connect to database */
#ifndef _MSC_VER
snprintf(l_connection, sizeof(l_connection), "thread_%03ld", threadnum);
...
...
src/interfaces/ecpg/test/thread/thread_implicit.pgc
View file @
04fbe0e4
...
...
@@ -100,15 +100,17 @@ void *test_thread(void *arg)
{
long threadnum = (long)arg;
#ifdef WIN32
_configthreadlocale(_ENABLE_PER_THREAD_LOCALE);
#endif
EXEC SQL BEGIN DECLARE SECTION;
int l_i;
char l_connection[128];
EXEC SQL END DECLARE SECTION;
#ifdef WIN32
#ifdef _MSC_VER /* requires MSVC */
_configthreadlocale(_ENABLE_PER_THREAD_LOCALE);
#endif
#endif
/* build up connection name, and connect to database */
#ifndef _MSC_VER
snprintf(l_connection, sizeof(l_connection), "thread_%03ld", threadnum);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment