From 36ceb2335f0ec9d46e3c7e224c2ae3db65accebe Mon Sep 17 00:00:00 2001 From: marcin Date: Fri, 19 Apr 2019 16:50:33 +0200 Subject: [PATCH] initial commit --- postres_cpp/Makefile | 5 +++ postres_cpp/postgres_connector | Bin 0 -> 66568 bytes postres_cpp/postgres_connector.cpp | 57 +++++++++++++++++++++++++++++ 3 files changed, 62 insertions(+) create mode 100644 postres_cpp/Makefile create mode 100755 postres_cpp/postgres_connector create mode 100644 postres_cpp/postgres_connector.cpp diff --git a/postres_cpp/Makefile b/postres_cpp/Makefile new file mode 100644 index 0000000..80150ab --- /dev/null +++ b/postres_cpp/Makefile @@ -0,0 +1,5 @@ +postgres_connector: postgres_connector.cpp + g++ -o postgres_connector postgres_connector.cpp -lpqxx -lpq + +clean: + -rm postgres_connector \ No newline at end of file diff --git a/postres_cpp/postgres_connector b/postres_cpp/postgres_connector new file mode 100755 index 0000000000000000000000000000000000000000..73b924c9d08925bd50e1c2f4236ba7b61939ed52 GIT binary patch literal 66568 zcmeHw4}4VBmH!J#Fe*Z{YN=8k5h?zQnUFxR+9n}`6A2KLfQWw{lbL~xOfqpYfq;J+ z3v`K?O0BxAYq!+0UFy1)ZI!at)u{Xot8R?DrJiqhP3DjEw2 zM>e|x|EhdH-RD_5_krbqtcpJV>$`7>-*?=o^IFEtd^E4^$Lnrh`F~!&Y2k!ZH;$Rv zeaekbf!*=SMM0-HP&UJ`PWXRu;lCdZ@5FxtD&T~l;UecvRMv_A?@lm`i4J!SZf@P8-yt6(1|{8AVGJePL) zo{RqXyV&go7x@>t)azy!J4|(vzuZO7u`c`(7dyP*V$VOj=o50$|JyEdUU9M8w_Nmm z%*B5`?PAYsT;zPsR1Ea^z zjC7q#yT9zB&v+NRwYtQm`&{Hd4f!WK=u-)t#{pmGf~WD6R!hYA90}(z z-m^xg3mJa_^e6cTd0wH$*SkR{eYSs5@`oibzQ^U-_1}zkp>q4VUP}IYv7 zpeYKPxwIwLYPKf=@q}qgR%gaVa~l%gX=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DATABASE "fabryka_sprzetu_it" +#define SQL "SELECT * FROM PC;" + +#define COL_W 15 //if some table contetnts have too much characters/numbers in it, change this value. + +using namespace std; +using namespace pqxx; + +int main() { + //welcome message & prompt + cout << "Welcome to MySQL connector. \nYou are trying to connect to host: " << HOST << "\nType your credentials to connect:\n"; + string username, password; + cout << "User: "; + cin >> username; + cout << "Password: "; + cin >> password; + + //prases the text to match the connection typedef input arg + stringstream stream; + stream << "dbname = " << DATABASE << " user = " << username << " password = " << password << " \ + hostaddr = " << HOST << " port = 5432"; + + try { + connection C(stream.str()); + if (!C.is_open()) return 1; //closes the program if there's an issue with connection + + nontransaction N(C); + result R(N.exec(SQL)); + + //print result of last used query + cout << SQL << endl; + + //print column names + for(int i=0; i<(int)R[0].size(); i++) + cout << right << setw(COL_W) << R.column_name(i); + cout << endl; + //print table contents + for (result::const_iterator r = R.begin(); r!=R.end(); r++){ + for(int i=0; i<(int)R[0].size(); i++) + cout << right << setw(COL_W) << r[i].as(); + cout << endl; + } + + //end connection + C.disconnect(); + } catch (const exception &e) { + cerr << e.what() << std::endl; + return 1; + } +} \ No newline at end of file