SVN Commit by dpage: r4245 - in trunk/pgadmin3: src/agent xtra/pgagent xtra/pgagent/include

From: svn(at)pgadmin(dot)org
To: pgadmin-hackers(at)postgresql(dot)org
Subject: SVN Commit by dpage: r4245 - in trunk/pgadmin3: src/agent xtra/pgagent xtra/pgagent/include
Date: 2005-05-24 14:21:56
Message-ID: 200505241421.j4OELuko006043@developer.pgadmin.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgadmin-hackers

Author: dpage
Date: 2005-05-24 15:21:55 +0100 (Tue, 24 May 2005)
New Revision: 4245

Modified:
trunk/pgadmin3/src/agent/dlgStep.cpp
trunk/pgadmin3/xtra/pgagent/connection.cpp
trunk/pgadmin3/xtra/pgagent/include/connection.h
trunk/pgadmin3/xtra/pgagent/job.cpp
Log:
Misc agent related tweaks

Modified: trunk/pgadmin3/src/agent/dlgStep.cpp
===================================================================
--- trunk/pgadmin3/src/agent/dlgStep.cpp 2005-05-24 13:18:55 UTC (rev 4244)
+++ trunk/pgadmin3/src/agent/dlgStep.cpp 2005-05-24 14:21:55 UTC (rev 4245)
@@ -219,7 +219,7 @@
if (!cbDatabase->GetSelection())
vars.Append(wxT("jstdbname=NULL"));
else
- vars.Append(wxT("jstdbname=") + qtString(cbDatabase->GetValue()) + wxT(")"));
+ vars.Append(wxT("jstdbname=") + qtString(cbDatabase->GetValue()));
}
if (rbxKind->GetSelection() != wxString(wxT("sb")).Find(step->GetKindChar()))
{

Modified: trunk/pgadmin3/xtra/pgagent/connection.cpp
===================================================================
--- trunk/pgadmin3/xtra/pgagent/connection.cpp 2005-05-24 13:18:55 UTC (rev 4244)
+++ trunk/pgadmin3/xtra/pgagent/connection.cpp 2005-05-24 14:21:55 UTC (rev 4245)
@@ -15,9 +15,9 @@
wxString DBconn::basicConnectString;
static wxMutex s_PoolLock;

-DBconn::DBconn(const wxString &name)
+DBconn::DBconn(const wxString &db)
{
- dbname = name;
+ dbname = db;
inUse = false;
next=0;
prev=0;
@@ -25,9 +25,9 @@
}


-DBconn::DBconn(const wxString &connectString, const wxString &name)
+DBconn::DBconn(const wxString &connectString, const wxString &db)
{
- dbname = name;
+ dbname = db;
inUse = false;
next=0;
prev=0;
@@ -97,8 +97,14 @@
}


-DBconn *DBconn::Get(const wxString &dbname)
+DBconn *DBconn::Get(const wxString &db)
{
+ if (db.IsEmpty())
+ {
+ LogMessage(_("Cannot allocate connection - no database specified!"), LOG_WARNING);
+ return NULL;
+ }
+
wxMutexLocker lock(s_PoolLock);

DBconn *thisConn = primaryConn, *testConn;
@@ -106,7 +112,7 @@
// find an existing connection
do
{
- if (dbname == thisConn->dbname && !thisConn->inUse)
+ if (db == thisConn->dbname && !thisConn->inUse)
{
LogMessage(_("Allocating existing connection to database ") + thisConn->dbname, LOG_DEBUG);
thisConn->inUse = true;
@@ -121,7 +127,7 @@


// No suitable connection was found, so create a new one.
- DBconn *newConn=new DBconn(dbname);
+ DBconn *newConn=new DBconn(db);
if (newConn->conn)
{
LogMessage(_("Allocating new connection to database ") + newConn->dbname, LOG_DEBUG);
@@ -130,7 +136,10 @@
thisConn->next = newConn;
}
else
- LogMessage(_("Failed to create new connection to database: ") + dbname, LOG_ERROR);
+ {
+ LogMessage(_("Failed to create new connection to database: ") + db, LOG_WARNING);
+ return NULL;
+ }

return newConn;
}

Modified: trunk/pgadmin3/xtra/pgagent/include/connection.h
===================================================================
--- trunk/pgadmin3/xtra/pgagent/include/connection.h 2005-05-24 13:18:55 UTC (rev 4244)
+++ trunk/pgadmin3/xtra/pgagent/include/connection.h 2005-05-24 14:21:55 UTC (rev 4245)
@@ -21,12 +21,12 @@
class DBconn
{
protected:
- DBconn(const wxString &dbname);
- DBconn(const wxString &connectString, const wxString &name);
+ DBconn(const wxString &db);
+ DBconn(const wxString &connectString, const wxString &db);
~DBconn();

public:
- static DBconn *Get(const wxString &dbname);
+ static DBconn *Get(const wxString &db);
static DBconn *InitConnection(const wxString &connectString);

static void ClearConnections(bool allIncludingPrimary=false);

Modified: trunk/pgadmin3/xtra/pgagent/job.cpp
===================================================================
--- trunk/pgadmin3/xtra/pgagent/job.cpp 2005-05-24 13:18:55 UTC (rev 4244)
+++ trunk/pgadmin3/xtra/pgagent/job.cpp 2005-05-24 14:21:55 UTC (rev 4245)
@@ -20,7 +20,6 @@
#define pclose _pclose
#endif

-wxSemaphore *getDb;

Job::Job(DBconn *conn, const wxString &jid)
{
@@ -138,8 +137,12 @@
stepConn->Return();
}
else
+ {
+ output = _("Couldn't get a connection to the database!");
rc=-1;
+ }

+
break;
}
case 'b':
@@ -151,8 +154,8 @@
wxString dirname = wxFileName::CreateTempFileName(wxT("pga_"));
if (dirname.Length() == 0)
{
- output = wxT("Couldn't get a temporary filename!");
- LogMessage(wxT("Couldn't get a temporary filename!"), LOG_WARNING);
+ output = _("Couldn't get a temporary filename!");
+ LogMessage(_("Couldn't get a temporary filename!"), LOG_WARNING);
rc=-1;
break;
}
@@ -160,16 +163,16 @@
;
if (!wxRemoveFile(dirname))
{
- output = wxT("Couldn't remove temporary file: ") + dirname;
- LogMessage(wxT("Couldn't remove temporary file: ") + dirname, LOG_WARNING);
+ output = _("Couldn't remove temporary file: ") + dirname;
+ LogMessage(_("Couldn't remove temporary file: ") + dirname, LOG_WARNING);
rc=-1;
break;
}

if (!wxMkdir(dirname, 0700))
{
- output = wxT("Couldn't create temporary directory: ") + dirname;
- LogMessage(wxT("Couldn't create temporary directory: ") + dirname, LOG_WARNING);
+ output = _("Couldn't create temporary directory: ") + dirname;
+ LogMessage(_("Couldn't create temporary directory: ") + dirname, LOG_WARNING);
rc=-1;
break;
}
@@ -185,16 +188,16 @@

if (!file->Create(filename, true, wxS_IRUSR | wxS_IWUSR | wxS_IXUSR))
{
- output = wxT("Couldn't create temporary script file: ") + filename;
- LogMessage(wxT("Couldn't create temporary script file: ") + filename, LOG_WARNING);
+ output = _("Couldn't create temporary script file: ") + filename;
+ LogMessage(_("Couldn't create temporary script file: ") + filename, LOG_WARNING);
rc=-1;
break;
}

if (!file->Open(filename, wxFile::write))
{
- output = wxT("Couldn't open temporary script file: ") + filename;
- LogMessage(wxT("Couldn't open temporary script file: ") + filename, LOG_WARNING);
+ output = _("Couldn't open temporary script file: ") + filename;
+ LogMessage(_("Couldn't open temporary script file: ") + filename, LOG_WARNING);
wxRemoveFile(filename);
wxRmdir(dirname);
rc=-1;
@@ -212,8 +215,8 @@

if (!file->Write(code))
{
- output = wxT("Couldn't write to temporary script file: ") + filename;
- LogMessage(wxT("Couldn't write to temporary script file: ") + filename, LOG_WARNING);
+ output = _("Couldn't write to temporary script file: ") + filename;
+ LogMessage(_("Couldn't write to temporary script file: ") + filename, LOG_WARNING);
wxRemoveFile(filename);
wxRmdir(dirname);
rc=-1;
@@ -229,8 +232,8 @@
fp_script = popen(filename.mb_str(wxConvUTF8), "r");
if (!fp_script)
{
- output = wxT("Couldn't execute script: ") + filename;
- LogMessage(wxT("Couldn't execute script: ") + filename, LOG_WARNING);
+ output = _("Couldn't execute script: ") + filename;
+ LogMessage(_("Couldn't execute script: ") + filename, LOG_WARNING);
wxRemoveFile(filename);
wxRmdir(dirname);
rc=-1;
@@ -249,14 +252,14 @@
// Delete the file/directory. If we fail, don't overwrite the script output in the log, just throw warnings.
if (!wxRemoveFile(filename))
{
- LogMessage(wxT("Couldn't remove temporary script file: ") + filename, LOG_WARNING);
+ LogMessage(_("Couldn't remove temporary script file: ") + filename, LOG_WARNING);
wxRmdir(dirname);
break;
}

if (!wxRmdir(dirname))
{
- LogMessage(wxT("Couldn't remove temporary directory: ") + dirname, LOG_WARNING);
+ LogMessage(_("Couldn't remove temporary directory: ") + dirname, LOG_WARNING);
break;
}

@@ -265,6 +268,7 @@
}
default:
{
+ output = _("Invalid step type!");
status=wxT("i");
return -1;
}

Browse pgadmin-hackers by date

  From Date Subject
Next Message ow 2005-05-24 14:30:24 Can't build wxWigets/pgadmin3 on Debian sarge
Previous Message svn 2005-05-24 13:18:56 SVN Commit by dpage: r4244 - trunk/pgadmin3/xtra/pgagent