Remove abandoned libpq and libpqxx ports

Fix #175
This commit is contained in:
Stefan Kalkowski
2019-06-07 10:44:01 +02:00
committed by Christian Helmuth
parent b2eef37312
commit 5da85325d4
43 changed files with 0 additions and 3559 deletions

View File

@@ -1,30 +0,0 @@
/*
* \brief Dummy implementations
* \author Reinier Millo Sánchez
* \author Alexy Gallardo Segura
* \date 2015-11-15
*/
/*
* Copyright (C) 2015 Genode Labs GmbH
*
* This file is part of the Genode OS framework, which is distributed
* under the terms of the GNU General Public License version 2.
*/
#include <signal.h>
int sigpending(sigset_t *set)
{
//*sig = SIGQUIT;
return 0;
}
int sigwait(const sigset_t *set, int *sig)
{
*sig = SIGQUIT;
return 0;
}

View File

@@ -1,121 +0,0 @@
/**
* This example was taken of the article "PostgreSQL C tutorial" on the url next.
* URL=http://zetcode.com/db/postgresqlc/
*/
#include <stdio.h>
#include <stdlib.h>
#include <libpq-fe.h>
void do_exit(PGconn *conn, PGresult *res) {
fprintf(stderr, "%s\n", PQerrorMessage(conn));
PQclear(res);
PQfinish(conn);
exit(1);
}
int main(int argc, char **argv) {
const char *conninfo;
if (argc > 0)
conninfo = argv[0];
else
conninfo = "dbname=postgres";
PGconn *conn = PQconnectdb(conninfo);
if (PQstatus(conn) == CONNECTION_BAD) {
fprintf(stderr, "Connection to database failed: %s\n",
PQerrorMessage(conn));
PQfinish(conn);
exit(1);
}
PGresult *res = PQexec(conn, "DROP TABLE IF EXISTS Cars");
if (PQresultStatus(res) != PGRES_COMMAND_OK) {
do_exit(conn, res);
}
PQclear(res);
res = PQexec(conn, "CREATE TABLE Cars(Id INTEGER PRIMARY KEY," \
"Name VARCHAR(20), Price INT)");
if (PQresultStatus(res) != PGRES_COMMAND_OK) {
do_exit(conn, res);
}
PQclear(res);
res = PQexec(conn, "INSERT INTO Cars VALUES(1,'Audi',52642)");
if (PQresultStatus(res) != PGRES_COMMAND_OK)
do_exit(conn, res);
PQclear(res);
res = PQexec(conn, "INSERT INTO Cars VALUES(2,'Mercedes',57127)");
if (PQresultStatus(res) != PGRES_COMMAND_OK) {
do_exit(conn, res);
}
PQclear(res);
res = PQexec(conn, "INSERT INTO Cars VALUES(3,'Skoda',9000)");
if (PQresultStatus(res) != PGRES_COMMAND_OK) {
do_exit(conn, res);
}
PQclear(res);
res = PQexec(conn, "INSERT INTO Cars VALUES(4,'Volvo',29000)");
if (PQresultStatus(res) != PGRES_COMMAND_OK) {
do_exit(conn, res);
}
PQclear(res);
res = PQexec(conn, "INSERT INTO Cars VALUES(5,'Bentley',350000)");
if (PQresultStatus(res) != PGRES_COMMAND_OK) {
do_exit(conn, res);
}
PQclear(res);
res = PQexec(conn, "INSERT INTO Cars VALUES(6,'Citroen',21000)");
if (PQresultStatus(res) != PGRES_COMMAND_OK) {
do_exit(conn, res);
}
PQclear(res);
res = PQexec(conn, "INSERT INTO Cars VALUES(7,'Hummer',41400)");
if (PQresultStatus(res) != PGRES_COMMAND_OK) {
do_exit(conn, res);
}
PQclear(res);
res = PQexec(conn, "INSERT INTO Cars VALUES(8,'Volkswagen',21600)");
if (PQresultStatus(res) != PGRES_COMMAND_OK) {
do_exit(conn, res);
}
PQclear(res);
PQfinish(conn);
return 0;
}

View File

@@ -1,5 +0,0 @@
TARGET = test-libpq_create
SRC_CC = main.cc
LIBS += base stdcxx libc-net lwip libc_lwip libc_lwip_nic_dhcp libc_lwip_loopback libc libpq config_args
CC_CXX_WARN_STRICT =

View File

@@ -1,49 +0,0 @@
/**
* This example was taken of the article "PostgreSQL C tutorial" on the url next.
* URL=http://zetcode.com/db/postgresqlc/
*/
#include <stdio.h>
#include <stdlib.h>
#include <libpq-fe.h>
void do_exit(PGconn *conn, PGresult *res) {
fprintf(stderr, "%s\n", PQerrorMessage(conn));
PQclear(res);
PQfinish(conn);
exit(1);
}
int main(int argc, char **argv) {
const char *conninfo;
if (argc > 0)
conninfo = argv[0];
else
conninfo = "dbname=postgres";
PGconn *conn = PQconnectdb(conninfo);
if (PQstatus(conn) == CONNECTION_BAD) {
fprintf(stderr, "Connection to database failed: %s\n",
PQerrorMessage(conn));
PQfinish(conn);
exit(1);
}
PGresult *res = PQexec(conn, "CREATE DATABASE baseDBTest;");
if (PQresultStatus(res) != PGRES_COMMAND_OK) {
do_exit(conn, res);
}
PQclear(res);
PQfinish(conn);
return 0;
}

View File

@@ -1,5 +0,0 @@
TARGET = test-libpq_createdb
SRC_CC = main.cc
LIBS += base stdcxx libc-net lwip libc_lwip libc_lwip_nic_dhcp libc_lwip_loopback libc libpq config_args
CC_CXX_WARN_STRICT =

View File

@@ -1,129 +0,0 @@
/*
* testlibpq.c
*
* Test the C version of libpq, the PostgreSQL frontend library.
*
* This example is taken of official documentation web of Postgres for using libpq.
*
* URL=http://www.postgresql.org/docs/9.1/static/libpq-example.html
*/
#include <base/printf.h>
#include <stdio.h>
#include <stdlib.h>
#include <libpq-fe.h>
static void
exit_nicely(PGconn *conn)
{
PQfinish(conn);
exit(1);
}
int
main(int argc, char **argv)
{
const char *conninfo;
PGconn *conn;
PGresult *res;
int nFields;
int i,
j;
/*
* If the user supplies a parameter on the command line, use it as the
* conninfo string; otherwise default to setting dbname=postgres and using
* environment variables or defaults for all other connection parameters.
*/
if (argc > 0)
conninfo = argv[0];
else
conninfo = "dbname=postgres";
/* Make a connection to the database */
conn = PQconnectdb(conninfo);
/* Check to see that the backend connection was successfully made */
if (PQstatus(conn) != CONNECTION_OK)
{
fprintf(stderr, "Connection to database failed: %s",
PQerrorMessage(conn));
exit_nicely(conn);
}
/*
* Our test case here involves using a cursor, for which we must be inside
* a transaction block. We could do the whole thing with a single
* PQexec() of "select * from pg_database", but that's too trivial to make
* a good example.
*/
/* Start a transaction block */
res = PQexec(conn, "BEGIN");
if (PQresultStatus(res) != PGRES_COMMAND_OK)
{
fprintf(stderr, "BEGIN command failed: %s", PQerrorMessage(conn));
PQclear(res);
exit_nicely(conn);
}
/*
* Should PQclear PGresult whenever it is no longer needed to avoid memory
* leaks
*/
PQclear(res);
/*
* Fetch rows from pg_database, the system catalog of databases
*/
res = PQexec(conn, "DECLARE myportal CURSOR FOR select * from pg_database");
if (PQresultStatus(res) != PGRES_COMMAND_OK)
{
fprintf(stderr, "DECLARE CURSOR failed: %s", PQerrorMessage(conn));
PQclear(res);
exit_nicely(conn);
}
PQclear(res);
res = PQexec(conn, "FETCH ALL in myportal");
if (PQresultStatus(res) != PGRES_TUPLES_OK)
{
fprintf(stderr, "FETCH ALL failed: %s", PQerrorMessage(conn));
PQclear(res);
exit_nicely(conn);
}
/* first, print out the attribute names */
nFields = PQnfields(res);
for (i = 0; i < nFields; i++)
printf("%-15s", PQfname(res, i));
printf("\n\n");
/* next, print out the rows */
for (i = 0; i < PQntuples(res); i++)
{
for (j = 0; j < nFields; j++)
printf("%-15s", PQgetvalue(res, i, j));
printf("\n");
}
PQclear(res);
/* close the portal ... we don't bother to check for errors ... */
res = PQexec(conn, "CLOSE myportal");
PQclear(res);
/* end the transaction */
res = PQexec(conn, "END");
PQclear(res);
/* close the connection to the database and cleanup */
PQfinish(conn);
return 0;
}

View File

@@ -1,5 +0,0 @@
TARGET = test-libpq_list_db
SRC_CC = main.cc
LIBS += base stdcxx lwip libc_lwip libc_lwip_nic_dhcp libc_lwip_loopback libpq libc config_args
CC_CXX_WARN_STRICT =

View File

@@ -1,77 +0,0 @@
/**
* This example was taken of the article "PostgreSQL C tutorial" on the url next.
* URL=http://zetcode.com/db/postgresqlc/
*/
#include <stdio.h>
#include <stdlib.h>
#include <libpq-fe.h>
void do_exit(PGconn *conn) {
PQfinish(conn);
exit(1);
}
int main(int argc, char **argv) {
const char *conninfo;
if (argc > 0)
conninfo = argv[0];
else
conninfo = "dbname=postgres";
PGconn *conn = PQconnectdb(conninfo);
if (PQstatus(conn) == CONNECTION_BAD) {
fprintf(stderr, "Connection to database failed: %s\n",
PQerrorMessage(conn));
PQfinish(conn);
exit(1);
}
PGresult *res = PQexec(conn, "BEGIN");
if (PQresultStatus(res) != PGRES_COMMAND_OK) {
printf("BEGIN command failed\n");
PQclear(res);
do_exit(conn);
}
PQclear(res);
res = PQexec(conn, "UPDATE Cars SET Price=23700 WHERE Id=8");
if (PQresultStatus(res) != PGRES_COMMAND_OK) {
printf("UPDATE command failed\n");
PQclear(res);
do_exit(conn);
}
res = PQexec(conn, "INSERT INTO Cars VALUES(9,'Mazda',27770)");
if (PQresultStatus(res) != PGRES_COMMAND_OK) {
printf("INSERT command failed\n");
PQclear(res);
do_exit(conn);
}
res = PQexec(conn, "COMMIT");
if (PQresultStatus(res) != PGRES_COMMAND_OK) {
printf("COMMIT command failed\n");
PQclear(res);
do_exit(conn);
}
PQclear(res);
PQfinish(conn);
return 0;
}

View File

@@ -1,5 +0,0 @@
TARGET = test-libpq_update
SRC_CC = main.cc
LIBS += base stdcxx libc-net lwip libc_lwip libc_lwip_nic_dhcp libc_lwip_loopback libc libpq config_args
CC_CXX_WARN_STRICT =

View File

@@ -1,40 +0,0 @@
/**
* This example was taken of the article "PostgreSQL - C/C++ Interface" on the url next.
* URL=http://www.tutorialspoint.com/postgresql/postgresql_c_cpp.htm
*/
#include <iostream>
#include <pqxx/pqxx>
#include <timer_session/connection.h>
using namespace std;
using namespace pqxx;
int main()
{
try{
connection C("dbname=postgres user=postgres password=ok \
hostaddr=10.12.119.178 port=5432");
if (C.is_open()) {
cout << "Opened database successfully: " << C.dbname() << endl;
} else {
cout << "Can't open database" << endl;
return 1;
}
Timer::Connection timer;
timer.usleep(100000);
C.disconnect ();
}catch (const std::exception &e){
cerr << e.what() << std::endl;
return 1;
}
return 0;
}

View File

@@ -1,5 +0,0 @@
TARGET = test-conection
SRC_CC = main.cc
LIBS += base stdcxx libc-net lwip libc_lwip libc_lwip_nic_dhcp libc_lwip_loopback libc libpq libpqxx config_args
CC_CXX_WARN_STRICT =

View File

@@ -1,52 +0,0 @@
/**
* This example was taken of the article "PostgreSQL - C/C++ Interface" on the url next.
* URL=http://www.tutorialspoint.com/postgresql/postgresql_c_cpp.htm
*/
#include <iostream>
#include <pqxx/pqxx>
using namespace std;
using namespace pqxx;
int main(int argc, char* argv[])
{
char * sql;
try{
connection C("dbname=testdb user=postgres password=ok \
hostaddr=10.12.119.178 port=5432");
if (C.is_open()) {
cout << "Opened database successfully: " << C.dbname() << endl;
} else {
cout << "Can't open database" << endl;
return 1;
}
/* Create SQL statement */
sql = "CREATE TABLE COMPANY(" \
"ID INT PRIMARY KEY NOT NULL," \
"NAME TEXT NOT NULL," \
"AGE INT NOT NULL," \
"ADDRESS CHAR(50)," \
"SALARY REAL );";
/* Create a transactional object. */
work W(C);
/* Execute SQL query */
W.exec( sql );
W.commit();
cout << "Table created successfully" << endl;
C.disconnect ();
}catch (const std::exception &e){
cerr << e.what() << std::endl;
return 1;
}
return 0;
}

View File

@@ -1,5 +0,0 @@
TARGET = test-creation_table
SRC_CC = main.cc
LIBS += base stdcxx libc-net lwip libc_lwip libc_lwip_nic_dhcp libc_lwip_loopback libc libpq libpqxx config_args
CC_CXX_WARN_STRICT =

View File

@@ -1,62 +0,0 @@
/**
* This example was taken of the article "PostgreSQL - C/C++ Interface" on the url next.
* URL=http://www.tutorialspoint.com/postgresql/postgresql_c_cpp.htm
*/
#include <iostream>
#include <pqxx/pqxx>
using namespace std;
using namespace pqxx;
int main(int argc, char* argv[])
{
char * sql;
try{
connection C("dbname=testdb user=postgres password=ok \
hostaddr=10.12.119.178 port=5432");
if (C.is_open()) {
cout << "Opened database successfully: " << C.dbname() << endl;
} else {
cout << "Can't open database" << endl;
return 1;
}
/* Create a transactional object. */
work W(C);
/* Create SQL DELETE statement */
sql = "DELETE from COMPANY where ID = 2";
/* Execute SQL query */
W.exec( sql );
W.commit();
cout << "Records deleted successfully" << endl;
/* Create SQL SELECT statement */
sql = "SELECT * from COMPANY";
/* Create a non-transactional object. */
nontransaction N(C);
/* Execute SQL query */
result R( N.exec( sql ));
/* List down all the records */
for (result::const_iterator c = R.begin(); c != R.end(); ++c) {
cout << "ID = " << c[0].as<int>() << endl;
cout << "Name = " << c[1].as<string>() << endl;
cout << "Age = " << c[2].as<int>() << endl;
cout << "Address = " << c[3].as<string>() << endl;
cout << "Salary = " << c[4].as<float>() << endl;
}
cout << "Operation done successfully" << endl;
C.disconnect ();
}catch (const std::exception &e){
cerr << e.what() << std::endl;
return 1;
}
return 0;
}

View File

@@ -1,5 +0,0 @@
TARGET = test-delete_operation
SRC_CC = main.cc
LIBS += base stdcxx libc-net lwip libc_lwip libc_lwip_nic_dhcp libc_lwip_loopback libc libpq libpqxx config_args
CC_CXX_WARN_STRICT =

View File

@@ -1,53 +0,0 @@
/**
* This example was taken of the article "PostgreSQL - C/C++ Interface" on the url next.
* URL=http://www.tutorialspoint.com/postgresql/postgresql_c_cpp.htm
*/
#include <iostream>
#include <pqxx/pqxx>
using namespace std;
using namespace pqxx;
int main(int argc, char* argv[])
{
char * sql;
try{
connection C("dbname=testdb user=postgres password=ok \
hostaddr=10.12.119.178 port=5432");
if (C.is_open()) {
cout << "Opened database successfully: " << C.dbname() << endl;
} else {
cout << "Can't open database" << endl;
return 1;
}
/* Create SQL statement */
sql = "INSERT INTO COMPANY (ID,NAME,AGE,ADDRESS,SALARY) " \
"VALUES (1, 'Paul', 32, 'California', 20000.00 ); " \
"INSERT INTO COMPANY (ID,NAME,AGE,ADDRESS,SALARY) " \
"VALUES (2, 'Allen', 25, 'Texas', 15000.00 ); " \
"INSERT INTO COMPANY (ID,NAME,AGE,ADDRESS,SALARY)" \
"VALUES (3, 'Teddy', 23, 'Norway', 20000.00 );" \
"INSERT INTO COMPANY (ID,NAME,AGE,ADDRESS,SALARY)" \
"VALUES (4, 'Mark', 25, 'Rich-Mond ', 65000.00 );";
/* Create a transactional object. */
work W(C);
/* Execute SQL query */
W.exec( sql );
W.commit();
cout << "Records created successfully" << endl;
C.disconnect ();
}catch (const std::exception &e){
cerr << e.what() << std::endl;
return 1;
}
return 0;
}

View File

@@ -1,5 +0,0 @@
TARGET = test-insert_operation
SRC_CC = main.cc
LIBS += base stdcxx libc-net lwip libc_lwip libc_lwip_nic_dhcp libc_lwip_loopback libc libpq libpqxx config_args
CC_CXX_WARN_STRICT =

View File

@@ -1,55 +0,0 @@
/**
* This example was taken of the article "PostgreSQL - C/C++ Interface" on the url next.
* URL=http://www.tutorialspoint.com/postgresql/postgresql_c_cpp.htm
*/
#include <iostream>
#include <pqxx/pqxx>
using namespace std;
using namespace pqxx;
int main(int argc, char* argv[])
{
char * sql;
try{
connection C("dbname=testdb user=postgres password=ok \
hostaddr=10.12.119.178 port=5432");
if (C.is_open()) {
cout << "Opened database successfully: " << C.dbname() << endl;
} else {
cout << "Can't open database" << endl;
return 1;
}
/* Create SQL statement */
sql = "SELECT * from COMPANY";
/* Create a non-transactional object. */
nontransaction N(C);
/* Execute SQL query */
result R( N.exec( sql ));
/* List down all the records */
for (result::const_iterator c = R.begin(); c != R.end(); ++c) {
cout << "ID = " << c[0].as<int>() << endl;
cout << "Name = " << c[1].as<string>() << endl;
cout << "Age = " << c[2].as<int>() << endl;
cout << "Address = " << c[3].as<string>() << endl;
cout << "Salary = " << c[4].as<float>() << endl;
}
cout << "Operation done successfully" << endl;
C.disconnect ();
}catch (const std::exception &e){
cerr << e.what() << std::endl;
return 1;
}
return 0;
}

View File

@@ -1,5 +0,0 @@
TARGET = test-select_operation
SRC_CC = main.cc
LIBS += base stdcxx libc-net lwip libc_lwip libc_lwip_nic_dhcp libc_lwip_loopback libc libpq libpqxx config_args
CC_CXX_WARN_STRICT =

View File

@@ -1,61 +0,0 @@
/**
* This example was taken of the article "PostgreSQL - C/C++ Interface" on the url next.
* URL=http://www.tutorialspoint.com/postgresql/postgresql_c_cpp.htm
*/
#include <iostream>
#include <pqxx/pqxx>
using namespace std;
using namespace pqxx;
int main(int argc, char* argv[])
{
char * sql;
try{
connection C("dbname=testdb user=postgres password=ok \
hostaddr=10.12.119.178 port=5432");
if (C.is_open()) {
cout << "Opened database successfully: " << C.dbname() << endl;
} else {
cout << "Can't open database" << endl;
return 1;
}
/* Create a transactional object. */
work W(C);
/* Create SQL UPDATE statement */
sql = "UPDATE COMPANY set SALARY = 25000.00 where ID=1";
/* Execute SQL query */
W.exec( sql );
W.commit();
cout << "Records updated successfully" << endl;
/* Create SQL SELECT statement */
sql = "SELECT * from COMPANY";
/* Create a non-transactional object. */
nontransaction N(C);
/* Execute SQL query */
result R( N.exec( sql ));
/* List down all the records */
for (result::const_iterator c = R.begin(); c != R.end(); ++c) {
cout << "ID = " << c[0].as<int>() << endl;
cout << "Name = " << c[1].as<string>() << endl;
cout << "Age = " << c[2].as<int>() << endl;
cout << "Address = " << c[3].as<string>() << endl;
cout << "Salary = " << c[4].as<float>() << endl;
}
cout << "Operation done successfully" << endl;
C.disconnect ();
}catch (const std::exception &e){
cerr << e.what() << std::endl;
return 1;
}
return 0;
}

View File

@@ -1,5 +0,0 @@
TARGET = test-update_operation
SRC_CC = main.cc
LIBS += base stdcxx libc-net lwip libc_lwip libc_lwip_nic_dhcp libc_lwip_loopback libc libpq libpqxx config_args
CC_CXX_WARN_STRICT =