[pgadmin-hackers] CVS Commit by dpage: Fix aggregate SQL generation per James Prichard

2005-03-04 Thread cvs
Log Message:
---
Fix aggregate SQL generation per James Prichard

Modified Files:
--
pgadmin3:
CHANGELOG.txt (r1.188 - r1.189)
pgadmin3/src/include:
dlgProperty.h (r1.45 - r1.46)
pgadmin3/src/schema:
pgAggregate.cpp (r1.26 - r1.27)
pgadmin3/src/ui:
dlgAggregate.cpp (r1.22 - r1.23)
dlgProperty.cpp (r1.114 - r1.115)

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 @@
 /ul
 br
 ul
+li2005-03-04 DPFix aggregate SQL generation per James Prichard
 li2005-03-03 APgraphical EXPLAIN
 li2005-03-03 APpgAgent fixes (jobId)
+li2005-03-02 DPRewritie pgAgent browser codee to use pgCollection
 li2005-02-25 APsome more Slony-I stuff
 li2005-02-24 APsome Slony-I stuff
 li2005-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

[pgadmin-hackers] CVS Commit by dpage: Fix aggregate SQL generation per James Prichard

2005-03-04 Thread cvs
Log Message:
---
Fix aggregate SQL generation per James Prichard

Tags:

REL-1_2_0_PATCHES

Modified Files:
--
pgadmin3:
CHANGELOG.txt (r1.171.2.3 - r1.171.2.4)
pgadmin3/src/include:
dlgProperty.h (r1.41.2.1 - r1.41.2.2)
pgadmin3/src/schema:
pgAggregate.cpp (r1.25.2.1 - r1.25.2.2)
pgadmin3/src/ui:
dlgAggregate.cpp (r1.21.2.1 - r1.21.2.2)
dlgProperty.cpp (r1.106.2.1 - r1.106.2.2)

Index: CHANGELOG.txt
===
RCS file: /projects/pgadmin3/CHANGELOG.txt,v
retrieving revision 1.171.2.3
retrieving revision 1.171.2.4
diff -LCHANGELOG.txt -LCHANGELOG.txt -u -w -r1.171.2.3 -r1.171.2.4
--- CHANGELOG.txt
+++ CHANGELOG.txt
@@ -17,6 +17,7 @@
 /ul
 br
 ul
+li2005-03-04 DP  1.2.1 Fix aggregate SQL generation per James Prichard
 li2005-02-07 AHP 1.2.1 fix libpq/ssl library detection
 li2005-01-13 DP  1.2.1 fix EXPLICIT CAST sql generation (r: Merlin 
Moncure)
 li2004-12-06 AP  1.2.1 Fix tablespace reference in namespace
Index: dlgProperty.h
===
RCS file: /projects/pgadmin3/src/include/dlgProperty.h,v
retrieving revision 1.41.2.1
retrieving revision 1.41.2.2
diff -Lsrc/include/dlgProperty.h -Lsrc/include/dlgProperty.h -u -w -r1.41.2.1 
-r1.41.2.2
--- src/include/dlgProperty.h
+++ src/include/dlgProperty.h
@@ -56,7 +56,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.25.2.1
retrieving revision 1.25.2.2
diff -Lsrc/schema/pgAggregate.cpp -Lsrc/schema/pgAggregate.cpp -u -w -r1.25.2.1 
-r1.25.2.2
--- 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.106.2.1
retrieving revision 1.106.2.2
diff -Lsrc/ui/dlgProperty.cpp -Lsrc/ui/dlgProperty.cpp -u -w -r1.106.2.1 
-r1.106.2.2
--- src/ui/dlgProperty.cpp
+++ src/ui/dlgProperty.cpp
@@ -251,14 +251,23 @@
 }
 
 
-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