chore: refactore

This commit is contained in:
dancingCycle 2023-04-05 15:20:10 +02:00
parent 6b2d8fed66
commit 1faf78f9d0
5 changed files with 13 additions and 16 deletions

View File

@ -22,7 +22,7 @@ int main(int argc, char **argv) {
printf("main() argv[1]: %s\n", argv[1]);
conninfo = argv[1];
}else{
printf("call ./main <connection info>\n");
fprintf(stderr, "Usage: %s <connection info>\n", argv[0]);
return 1;
}

View File

@ -18,8 +18,8 @@ int main(int argc, char **argv) {
printf("main() argv[1]: %s\n", argv[1]);
conninfo = argv[1];
}else{
printf("call ./main <connection info>\n");
return 1;
fprintf(stderr, "Usage: %s <connection info>\n", argv[0]);
exit(1);
}
/*connect to database*/

View File

@ -1,23 +1,19 @@
* build
* install dependencies on Debian Bullseye
```
sudo apt install libpq-dev --no-install-recommends
```
* build
```
make
```
* run
```
./main 'postgresql://begerad:secret@localhost:5432/sib00_vbn_gtfs'
./main 'postgresql://<user>:<secret>@<host>:<port>/<database>'
```
* or run
```
./main 'postgresql://begerad:secret@localhost:5432/vbn_data'
./main "host=<host> port=<port> user=<user> password=<<secret>> dbname=<database>"
```
* or run
```
./main "host=localhost port=5432 user=begerad password=<secret> dbname=vbn_data"
```

View File

@ -15,7 +15,7 @@ int main(int argc, char *argv[]) {
printf("main() Started...\n");
if (argc != 3) {
fprintf(stderr, "Usage: ./main <row id> <connection info>\n");
fprintf(stderr, "Usage: %s <row id> <connection info>\n", argv[0]);
exit(1);
}
@ -63,6 +63,7 @@ int main(int argc, char *argv[]) {
printf("main() connection status NOT known\n");
}
/*SQL statement*/
char *stm = "SELECT * FROM cars_cleanup WHERE Id=$1";
/*create prepared statement*/

View File

@ -18,7 +18,7 @@ int main(int argc, char **argv) {
printf("main() argv[1]: %s\n", argv[1]);
conninfo = argv[1];
}else{
printf("call ./main <connection info>\n");
fprintf(stderr, "Usage: %s <connection info>\n", argv[0]);
return 1;
}