mirror of
https://github.com/ultimatepp/ultimatepp.git
synced 2026-07-11 22:03:01 -06:00
Added PostgreSQL support to SqlCommander
git-svn-id: svn://ultimatepp.org/upp/trunk@1261 f0d560ea-af0d-0410-9eb7-867de7ffcac7
This commit is contained in:
parent
643eaccfad
commit
16785d418e
4 changed files with 38 additions and 2 deletions
|
|
@ -13,6 +13,11 @@
|
|||
#define HAVE_MYSQL
|
||||
#endif
|
||||
|
||||
#ifndef flagNOPOSTGRESQL
|
||||
#define HAVE_POSTGRESQL
|
||||
#include <PostgreSQL/PostgreSQL.h>
|
||||
#endif
|
||||
|
||||
#if defined(PLATFORM_WIN32) && defined(COMPILER_MSC)
|
||||
#define HAVE_OLEDB
|
||||
#endif
|
||||
|
|
@ -64,6 +69,9 @@ SqlCommanderApp::SqlCommanderApp() {
|
|||
#ifdef HAVE_MYSQL
|
||||
login.connection.Add("MYSQL");
|
||||
#endif
|
||||
#ifdef HAVE_POSTGRESQL
|
||||
login.connection.Add("POSTGRESQL");
|
||||
#endif
|
||||
#ifdef HAVE_SQLLITE
|
||||
login.connection.Add("SQLLITE");
|
||||
#endif
|
||||
|
|
@ -132,6 +140,29 @@ void SqlCommanderApp::Run() {
|
|||
session = -mysql;
|
||||
}
|
||||
#endif
|
||||
#ifdef HAVE_POSTGRESQL
|
||||
if(co == "POSTGRESQL") {
|
||||
One<PostgreSQLSession> postgres = new PostgreSQLSession;
|
||||
String conninfo;
|
||||
conninfo << "user='" << un << "' password='" << pw << "' ";
|
||||
if(!IsNull(sv)) {
|
||||
String port;
|
||||
int f = sv.Find(':');
|
||||
if(f >= 0) {
|
||||
port = sv.Mid(f + 1);
|
||||
sv.Trim(f);
|
||||
}
|
||||
if(!IsNull(sv))
|
||||
conninfo << "host='" << sv << "' ";
|
||||
if(!IsNull(port))
|
||||
conninfo << "port=" << port << ' ';
|
||||
}
|
||||
if(!IsNull(db))
|
||||
conninfo << "dbname='" << db << "' ";
|
||||
postgres->Open(conninfo);
|
||||
session = -postgres;
|
||||
}
|
||||
#endif
|
||||
#ifdef HAVE_SQLLITE
|
||||
if(co == "SQLLITE") {
|
||||
One<Sqlite3Session> sqlite = new Sqlite3Session;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue