Hi,

Please find the attachments.

I try to make a enhancement to sequence.
As my understanding, add a property item to properties pane.
The nextValue is lastValue + increment;

Is it right?

Regards,

Quan Zongliang


diff --git a/pgadmin/schema/pgSequence.cpp b/pgadmin/schema/pgSequence.cpp
index 870cf2f..d30fe58 100644
--- a/pgadmin/schema/pgSequence.cpp
+++ b/pgadmin/schema/pgSequence.cpp
@@ -126,6 +126,7 @@ void pgSequence::UpdateValues()
                maxValue = sequence->GetLongLong(wxT("max_value"));
                cacheValue = sequence->GetLongLong(wxT("cache_value"));
                increment = sequence->GetLongLong(wxT("increment_by"));
+               nextValue = lastValue + increment;
                cycled = sequence->GetBool(wxT("is_cycled"));
                called = sequence->GetBool(wxT("is_called"));
 
@@ -150,7 +151,7 @@ wxString pgSequence::GetSql(ctlTree *browser)
                if (GetCycled())
                        sql += wxT("\n  CYCLE");
                sql += wxT(";\n")
-                      + GetOwnerSql(7, 3, wxT("TABLE ") + 
GetQuotedFullIdentifier());
+                      + GetOwnerSql(7, 3, wxT("SEQUENCE ") + 
GetQuotedFullIdentifier());
 
                if (!GetConnection()->BackendMinimumVersion(8, 2))
                        sql += GetGrant(wxT("arwdRxt"), wxT("TABLE ") + 
GetQuotedFullIdentifier());
@@ -178,6 +179,7 @@ void pgSequence::ShowTreeDetail(ctlTree *browser, frmMain 
*form, ctlListView *pr
                properties->AppendItem(_("Owner"), GetOwner());
                properties->AppendItem(_("ACL"), GetAcl());
                properties->AppendItem(_("Current value"), GetLastValue());
+               properties->AppendItem(_("Next value"), GetNextValue());
                properties->AppendItem(_("Minimum"), GetMinValue());
                properties->AppendItem(_("Maximum"), GetMaxValue());
                properties->AppendItem(_("Increment"), GetIncrement());
diff --git a/pgadmin/include/schema/pgSequence.h 
b/pgadmin/include/schema/pgSequence.h
index f7ed96d..5433e26 100644
--- a/pgadmin/include/schema/pgSequence.h
+++ b/pgadmin/include/schema/pgSequence.h
@@ -51,6 +51,10 @@ public:
        {
                return lastValue;
        }
+       wxLongLong GetNextValue() const
+       {
+               return nextValue;
+       }
        wxLongLong GetMinValue() const
        {
                return minValue;
@@ -94,7 +98,7 @@ public:
        }
 
 private:
-       wxLongLong lastValue, minValue, maxValue, cacheValue, increment;
+       wxLongLong lastValue, nextValue, minValue, maxValue, cacheValue, 
increment;
        bool cycled, called, isReplicated;
 };
 
-- 
Sent via pgadmin-hackers mailing list (pgadmin-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgadmin-hackers

Reply via email to