Index: CHANGELOG.txt
===================================================================
RCS file: /projects/pgadmin3/CHANGELOG.txt,v
retrieving revision 1.188
retrieving revision 1.189
diff -LCHANGELOG.txt -LCHANGELOG.txt -u -w -r1.188 -r1.189
--- CHANGELOG.txt
+++ CHANGELOG.txt
@@ -17,8 +17,10 @@
+ - 2005-03-04 DP Fix aggregate SQL generation per James Prichard
- 2005-03-03 AP graphical EXPLAIN
- 2005-03-03 AP pgAgent fixes (jobId)
+
- 2005-03-02 DP Rewritie pgAgent browser codee to use pgCollection
- 2005-02-25 AP some more Slony-I stuff
- 2005-02-24 AP some Slony-I stuff
- 2005-02-24 AP 1.2.1 require unicode to compile utffile.cpp
Index: dlgProperty.h
===================================================================
RCS file: /projects/pgadmin3/src/include/dlgProperty.h,v
retrieving revision 1.45
retrieving revision 1.46
diff -Lsrc/include/dlgProperty.h -Lsrc/include/dlgProperty.h -u -w -r1.45 -r1.46
--- src/include/dlgProperty.h
+++ src/include/dlgProperty.h
@@ -57,7 +57,7 @@
void CheckValid(bool &enable, const bool condition, const wxString &msg);
static dlgProperty *CreateDlg(frmMain *frame, pgObject *node, bool asNew, int type=-1);
- void AppendNameChange(wxString &sql);
+ void AppendNameChange(wxString &sql, const wxString &objname=wxEmptyString);
void AppendOwnerChange(wxString &sql, const wxString &objName=wxEmptyString);
void AppendOwnerNew(wxString &sql, const wxString &objname);
void AppendComment(wxString &sql, const wxString &objType, pgSchema *schema, pgObject *obj);
Index: pgAggregate.cpp
===================================================================
RCS file: /projects/pgadmin3/src/schema/pgAggregate.cpp,v
retrieving revision 1.26
retrieving revision 1.27
diff -Lsrc/schema/pgAggregate.cpp -Lsrc/schema/pgAggregate.cpp -u -w -r1.26 -r1.27
--- src/schema/pgAggregate.cpp
+++ src/schema/pgAggregate.cpp
@@ -31,7 +31,7 @@
bool pgAggregate::DropObject(wxFrame *frame, wxTreeCtrl *browser)
{
- return GetDatabase()->ExecuteVoid(wxT("DROP AGGREGATE ") + GetQuotedFullIdentifier() + wxT("(") + GetInputType() + wxT(")"));
+ return GetDatabase()->ExecuteVoid(wxT("DROP AGGREGATE ") + GetQuotedFullIdentifier() + wxT("(") + GetInputType() + wxT(");"));
}
wxString pgAggregate::GetSql(wxTreeCtrl *browser)
@@ -39,16 +39,18 @@
if (sql.IsNull())
{
sql = wxT("-- Aggregate: ") + GetQuotedFullIdentifier() + wxT("\n\n")
- + wxT("-- DROP AGGREGATE ") + GetQuotedFullIdentifier() + wxT("(") + GetInputType() + wxT(")")
+ + wxT("-- DROP AGGREGATE ") + GetQuotedFullIdentifier() + wxT("(") + GetInputType() + wxT(");")
+ wxT("\n\nCREATE AGGREGATE ") + GetQuotedFullIdentifier()
+ wxT("(\n BASETYPE=") + GetInputType()
+ wxT(",\n SFUNC=") + GetStateFunction()
+ wxT(",\n STYPE=") + GetStateType();
- AppendIfFilled(sql, wxT(",\n FFUNC="), qtIdent(GetFinalFunction()));
+ AppendIfFilled(sql, wxT(",\n FINALFUNC="), qtIdent(GetFinalFunction()));
if (GetInitialCondition().length() > 0)
sql += wxT(",\n INITCOND=") + qtString(GetInitialCondition());
sql += wxT("\n);\n")
- + GetOwnerSql(8, 0);
+ + GetOwnerSql(8, 0, wxT("AGGREGATE ") + GetQuotedFullIdentifier()
+ + wxT("(") + qtIdent(GetInputType())
+ + wxT(")"));
if (!GetComment().IsNull())
{
Index: dlgProperty.cpp
===================================================================
RCS file: /projects/pgadmin3/src/ui/dlgProperty.cpp,v
retrieving revision 1.114
retrieving revision 1.115
diff -Lsrc/ui/dlgProperty.cpp -Lsrc/ui/dlgProperty.cpp -u -w -r1.114 -r1.115
--- src/ui/dlgProperty.cpp
+++ src/ui/dlgProperty.cpp
@@ -262,14 +262,21 @@
}
-void dlgProperty::AppendNameChange(wxString &sql)
+void dlgProperty::AppendNameChange(wxString &sql, const wxString &objName)
{
if (GetObject()->GetName() != GetName())
+ if (objName.Length() > 0)
+ {
+ sql += wxT("ALTER ") + objName
+ + wxT(" RENAME TO ") + qtIdent(GetName())
+ + wxT(";\n");
+ } else {
sql += wxT("ALTER ") + GetObject()->GetTypeName()
+ wxT(" ") + GetObject()->GetQuotedFullIdentifier()
+ wxT(" RENAME TO ") + qtIdent(GetName())
+ wxT(";\n");
}
+}
void dlgProperty::AppendOwnerChange(wxString &sql, const wxString &objName)
Index: dlgAggregate.cpp
===================================================================
RCS file: /projects/pgadmin3/src/ui/dlgAggregate.cpp,v
retrieving revision 1.22
retrieving revision 1.23
diff -Lsrc/ui/dlgAggregate.cpp -Lsrc/ui/dlgAggregate.cpp -u -w -r1.22 -r1.23
--- src/ui/dlgAggregate.cpp
+++ src/ui/dlgAggregate.cpp
@@ -210,8 +210,10 @@
if (aggregate)
{
// edit mode
- AppendNameChange(sql);
- AppendOwnerChange(sql, wxT("AGGREGATE ") + schema->GetQuotedPrefix() + qtIdent(name));
+ AppendNameChange(sql, wxT("AGGREGATE ") + schema->GetQuotedPrefix() + qtIdent(aggregate->GetName()) +
+ wxT("(") + GetQuotedTypename(cbBaseType->GetGuessedSelection()) + wxT(")"));
+ AppendOwnerChange(sql, wxT("AGGREGATE ") + schema->GetQuotedPrefix() + qtIdent(GetName()) +
+ wxT("(") + GetQuotedTypename(cbBaseType->GetGuessedSelection()) + wxT(")"));
}
else
{
@@ -233,7 +235,8 @@
sql += wxT(");\n");
- AppendOwnerNew(sql, wxT("AGGREGATE ") + schema->GetQuotedPrefix() + qtIdent(name));
+ AppendOwnerNew(sql, wxT("AGGREGATE ") + schema->GetQuotedPrefix() + qtIdent(name)+
+ wxT("(") + GetQuotedTypename(cbBaseType->GetGuessedSelection()) + wxT(")"));
}
AppendComment(sql, wxT("AGGREGATE ") + schema->GetQuotedPrefix() + qtIdent(name)
+ wxT("(") + GetQuotedTypename(cbBaseType->GetGuessedSelection())