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
697f9f09
Commit
697f9f09
authored
Aug 07, 2003
by
Bruce Momjian
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add iteration option to thread test program.
parent
c7fda55c
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
15 additions
and
5 deletions
+15
-5
src/interfaces/ecpg/test/test_thread.pgc
src/interfaces/ecpg/test/test_thread.pgc
+15
-5
No files found.
src/interfaces/ecpg/test/test_thread.pgc
View file @
697f9f09
...
...
@@ -5,12 +5,14 @@
#include <pthread.h>
#include <stdlib.h>
void ins1(void);
void ins2(void);
EXEC SQL BEGIN DECLARE SECTION;
char *dbname;
int iterations = 10;
EXEC SQL END DECLARE SECTION;
int
...
...
@@ -22,13 +24,21 @@ EXEC SQL BEGIN DECLARE SECTION;
int rows;
EXEC SQL END DECLARE SECTION;
if (argc
!= 2
)
if (argc
< 2 || argc > 3
)
{
fprintf(stderr, "Usage: %s dbname\n", argv[0]);
fprintf(stderr, "Usage: %s dbname
[iterations]
\n", argv[0]);
return 1;
}
dbname = argv[1];
if (argc == 3)
iterations = atoi(argv[2]);
if (iterations % 2 != 0)
{
fprintf(stderr, "iterations must be an even number\n");
return 1;
}
EXEC SQL CONNECT TO:dbname AS test0;
/* DROP might fail */
...
...
@@ -47,7 +57,7 @@ EXEC SQL END DECLARE SECTION;
EXEC SQL AT test3 COMMIT WORK;
EXEC SQL DISCONNECT test3;
if (rows ==
10
)
if (rows ==
iterations
)
printf("Success.\n");
else
printf("Failure.\n");
...
...
@@ -61,7 +71,7 @@ ins1(void)
EXEC SQL WHENEVER sqlerror sqlprint;
EXEC SQL CONNECT TO:dbname AS test1;
for (i = 0; i <
5
; i++)
for (i = 0; i <
iterations / 2
; i++)
{
printf("thread 1 : inserting\n");
EXEC SQL AT test1 INSERT INTO test_thread VALUES('thread1');
...
...
@@ -82,7 +92,7 @@ ins2(void)
EXEC SQL WHENEVER sqlerror sqlprint;
EXEC SQL CONNECT TO:dbname AS test2;
for (i = 0; i <
5
; i++)
for (i = 0; i <
iterations / 2
; i++)
{
printf("thread 2: inserting\n");
EXEC SQL AT test2 INSERT INTO test_thread VALUES('thread2');
...
...
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