Log Message: ----------- Use PostgreSQL's list of keywords for syntax highlighting Fix adding columns with constraints using table properties on 7.3 and 7.4
Modified Files: -------------- pgadmin3: CHANGELOG.txt (r1.140 -> r1.141) pgadmin3/src/include: ctlSQLBox.h (r1.9 -> r1.10) misc.h (r1.45 -> r1.46) pgadmin3/src/schema: pgObject.cpp (r1.73 -> r1.74) pgadmin3/src/ui: ctlSQLBox.cpp (r1.23 -> r1.24) dlgTable.cpp (r1.44 -> r1.45) pgadmin3/src/ui/af_ZA: wxstd.mo (r1.1 -> r1.2) wxstd.po (r1.1 -> r1.2) pgadmin3/src/utils: misc.cpp (r1.59 -> r1.60)
Index: CHANGELOG.txt =================================================================== RCS file: /projects/pgadmin3/CHANGELOG.txt,v retrieving revision 1.140 retrieving revision 1.141 diff -LCHANGELOG.txt -LCHANGELOG.txt -u -w -r1.140 -r1.141 --- CHANGELOG.txt +++ CHANGELOG.txt @@ -17,6 +17,8 @@ </ul> <br> <ul> + <li>2004-10-05 AP 1.2B3 Use PostgreSQL's list of keywords for syntax highlighting + <li>2004-10-05 AP 1.2B3 Fix adding columns with constraints using table properties on 7.3 and 7.4 <li>2004-10-05 DP 1.2B3 Drop rows correctly when selected in reverse in the edit grid. Also, confirm drop first. <li>2004-09-27 DP 1.2B3 Dynamically link libpq/OpenSSL for sensible installation with Win32 PostgreSQL <li>2004-09-18 DP 1.2B2 Prevent dropped servers reappearing after View System Objects change. Index: misc.h =================================================================== RCS file: /projects/pgadmin3/src/include/misc.h,v retrieving revision 1.45 retrieving revision 1.46 diff -Lsrc/include/misc.h -Lsrc/include/misc.h -u -w -r1.45 -r1.46 --- src/include/misc.h +++ src/include/misc.h @@ -104,6 +104,8 @@ // string build helper void AppendIfFilled(wxString &str, const wxString &delimiter, const wxString &what); +// Create keyword list from PostgreSQL list +void FillKeywords(wxString &str); // Fill array, splitting the string separated by commas (maybe quoted elements) void FillArray(wxArrayString &array, const wxString &str); Index: ctlSQLBox.h =================================================================== RCS file: /projects/pgadmin3/src/include/ctlSQLBox.h,v retrieving revision 1.9 retrieving revision 1.10 diff -Lsrc/include/ctlSQLBox.h -Lsrc/include/ctlSQLBox.h -u -w -r1.9 -r1.10 --- src/include/ctlSQLBox.h +++ src/include/ctlSQLBox.h @@ -24,6 +24,8 @@ // Class declarations class ctlSQLBox : public wxStyledTextCtrl { + static wxString sqlKeywords; + public: ctlSQLBox(wxWindow *parent, wxWindowID id = -1, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, long style = 0); ctlSQLBox(); Index: pgObject.cpp =================================================================== RCS file: /projects/pgadmin3/src/schema/pgObject.cpp,v retrieving revision 1.73 retrieving revision 1.74 diff -Lsrc/schema/pgObject.cpp -Lsrc/schema/pgObject.cpp -u -w -r1.73 -r1.74 --- src/schema/pgObject.cpp +++ src/schema/pgObject.cpp @@ -206,7 +206,6 @@ wxString typestr=set->GetVal(wxT("type")); int id; - bool dontQuote=false; switch (typestr.c_str()[0]) { Index: dlgTable.cpp =================================================================== RCS file: /projects/pgadmin3/src/ui/dlgTable.cpp,v retrieving revision 1.44 retrieving revision 1.45 diff -Lsrc/ui/dlgTable.cpp -Lsrc/ui/dlgTable.cpp -u -w -r1.44 -r1.45 --- src/ui/dlgTable.cpp +++ src/ui/dlgTable.cpp @@ -303,14 +303,11 @@ if (table) { int pos; - int index; + int index=-1; wxString definition; wxArrayString tmpDef=previousColumns; - AppendNameChange(sql); - AppendOwnerChange(sql); - for (pos=0; pos < lstColumns->GetItemCount() ; pos++) { definition = lstColumns->GetText(pos, 3); @@ -319,7 +316,7 @@ definition=qtIdent(lstColumns->GetText(pos)) + wxT(" ") + lstColumns->GetText(pos, 1); index=tmpDef.Index(definition); if (index < 0) - sql += wxT("ALTER TABLE ") + tabname + sql += wxT("ALTER TABLE ") + table->GetQuotedFullIdentifier() + wxT(" ADD COLUMN ") + definition + wxT(";\n"); } else @@ -327,13 +324,19 @@ sql += definition; pgColumn *column=(pgColumn*) StrToLong(lstColumns->GetText(pos, 4)); + if (column) + { index=tmpDef.Index(column->GetQuotedIdentifier() + wxT(" ") + column->GetDefinition()); } + } if (index >= 0) tmpDef.RemoveAt(index); } + AppendNameChange(sql); + AppendOwnerChange(sql); + for (index=0 ; index < (int)tmpDef.GetCount() ; index++) { definition = tmpDef.Item(index); @@ -604,7 +607,11 @@ col.CenterOnParent(); col.SetDatabase(database); if (col.Go(true) >= 0) - lstColumns->AppendItem(PGICON_COLUMN, col.GetName(), col.GetDefinition()); + { + long pos = lstColumns->AppendItem(PGICON_COLUMN, col.GetName(), col.GetDefinition()); + if (table && !connection->BackendMinimumVersion(8, 0)) + lstColumns->SetItem(pos, 3, col.GetSql()); + } CheckChange(); } Index: ctlSQLBox.cpp =================================================================== RCS file: /projects/pgadmin3/src/ui/ctlSQLBox.cpp,v retrieving revision 1.23 retrieving revision 1.24 diff -Lsrc/ui/ctlSQLBox.cpp -Lsrc/ui/ctlSQLBox.cpp -u -w -r1.23 -r1.24 --- src/ui/ctlSQLBox.cpp +++ src/ui/ctlSQLBox.cpp @@ -21,20 +21,7 @@ #include "menu.h" -// Maximum string length exceeded for VC6... -const wxString keywords1= - wxT("ABORT ADD AGGREGATE ALL ALTER ANALYZE AND AS ASC ASCENDING AUTHORIZATION BEGIN BY ") - wxT("CASCADE CASE CAST CHECK CHECKPOINT CLASS CLOSE CLUSTER COLUMN COMMENT COMMIT CONVERSION CONSTRAINT COPY CREATE CURSOR ") - wxT("DATABASE DEALLOCATE DECLARE DEFAULT DELETE DESC DESCENDING DO DOMAIN DROP EACH ELSE END EXPLAIN ") - wxT("FETCH FOR FOREIGN FREEZE FROM FULL FUNCTION GRANT GROUP "); - -const wxString keywords2= - wxT("HAVING ILIKE IMMUTABLE IMPLICIT IN INDEX INHERITS INNER INSERT INSTEAD INTO IS JOIN KEY LANGUAGE LIKE LISTEN LOAD LOCK MOVE NO NOT NOTHING NOTIFY NULL ") - wxT("OFF OIDS ON OPERATOR OPTION OR ORDER OUTER PLAIN PREPARE PRIMARY PROCEDURE REINDEX REFERENCES RENAME REPLACE RESET RESTART RESTRICT RETURN RETURNS REVOKE ROLLBACK ROW RULE ") - wxT("SCHEMA SELECT SET SEQUENCE SESSION SHOW STABLE STATEMENT STORAGE STRICT TABLE THEN TO TRIGGER TRUNCATE TYPE ") - wxT("UNION UNIQUE UNLISTEN UPDATE USER USING VACUUM VALUE VALUES VIEW VOLATILE WHEN WHERE WITH WITHOUT"); - -wxString SQL_KEYWORDS= keywords1+keywords2; +wxString ctlSQLBox::sqlKeywords; #if 0 @@ -365,8 +352,10 @@ // SQL Lexer and keywords. // SetLexer(lmPostgreSQL.GetLanguage()); + if (sqlKeywords.IsEmpty()) + FillKeywords(sqlKeywords); SetLexer(wxSTC_LEX_SQL); - SetKeyWords(0, SQL_KEYWORDS.MakeLower()); + SetKeyWords(0, sqlKeywords); wxAcceleratorEntry entries[1]; entries[0].Set(wxACCEL_CTRL, (int)'F', MNU_FIND); Index: wxstd.po =================================================================== RCS file: /projects/pgadmin3/src/ui/af_ZA/wxstd.po,v retrieving revision 1.1 retrieving revision 1.2 diff -Lsrc/ui/af_ZA/wxstd.po -Lsrc/ui/af_ZA/wxstd.po -u -w -r1.1 -r1.2 --- src/ui/af_ZA/wxstd.po +++ src/ui/af_ZA/wxstd.po @@ -2,7 +2,7 @@ msgstr "" "Project-Id-Version: wxWidgets-2.5.2\n" "POT-Creation-Date: 2004-05-07 14:03+0200\n" -"PO-Revision-Date: 2004-09-15 11:52+0100\n" +"PO-Revision-Date: 2004-09-28 13:43+0100\n" "Last-Translator: <>\n" "Language-Team: wxWidgets translators <[EMAIL PROTECTED]>\n" "MIME-Version: 1.0\n" @@ -76,9 +76,9 @@ msgstr "%s Waarskuwing" #: ../src/common/fldlgcmn.cpp:74 -#, fuzzy, c-format +#, c-format msgid "%s files (%s)|%s" -msgstr "Lêers (%s)|%s" +msgstr "%s lêers (%s)|%s" #: ../src/common/msgout.cpp:188 #, c-format @@ -122,9 +122,8 @@ msgstr "&Besonderhede" #: ../src/html/helpfrm.cpp:276 -#, fuzzy msgid "&File" -msgstr "Lêer" +msgstr "&Lêer" #: ../src/generic/fdrepdlg.cpp:162 msgid "&Find" @@ -288,7 +287,7 @@ #: ../src/html/helpfrm.cpp:944 #: ../src/html/helpfrm.cpp:1572 msgid "(bookmarks)" -msgstr "(favorieten)" +msgstr "(gunstelinge)" #: ../src/generic/dirctrlg.cpp:679 #: ../src/generic/filedlgg.cpp:732 @@ -429,9 +428,9 @@ msgstr "Alles" #: ../src/common/fldlgcmn.cpp:57 -#, fuzzy, c-format +#, c-format msgid "All files (%s)|%s" -msgstr "Alle lêers (*)|*" +msgstr "Alle lêers (%s)|%s" #: ../include/wx/defs.h:1975 msgid "All files (*)|*" @@ -701,9 +700,9 @@ msgstr "Kan registersleutel '%s' nie open nie" #: ../src/common/zstream.cpp:166 -#, fuzzy, c-format +#, c-format msgid "Can't read from inflate stream: %s" -msgstr "kan nie lees van opblaasstroom lees nie %s\n" +msgstr "Kan nie van opblaasstroom lees nie: %s" #: ../src/common/zstream.cpp:159 msgid "Can't read inflate stream: unexpected EOF in underlying stream." @@ -742,9 +741,9 @@ msgstr "Kan waarde van '%s' nie verstel nie" #: ../src/common/zstream.cpp:316 -#, fuzzy, c-format +#, c-format msgid "Can't write to deflate stream: %s" -msgstr "Kan nie skryf na afblaasstroom nie: %s\n" +msgstr "Kan nie skryf na afblaasstroom nie: %s" #: ../src/common/dlgcmn.cpp:240 #: ../src/generic/dirdlgg.cpp:155 @@ -973,7 +972,7 @@ #: ../src/common/strconv.cpp:947 #, c-format msgid "Conversion to charset '%s' doesn't work." -msgstr "Omskakeling na na karakterstel '%s' werk nie." +msgstr "Omskakeling na karakterstel '%s' werk nie." #: ../src/html/htmlwin.cpp:782 #, c-format @@ -1761,7 +1760,7 @@ #: ../src/common/dlgcmn.cpp:224 msgid "Forward" -msgstr "Voorentoe" +msgstr "Vorentoe" #: ../src/common/xtixml.cpp:235 msgid "Forward hrefs are not supported" @@ -2070,9 +2069,8 @@ msgstr "KOI8-R" #: ../src/common/fmapbase.cpp:119 -#, fuzzy msgid "KOI8-U" -msgstr "KOI8-R" +msgstr "KOI8-U" #: ../src/generic/prntdlgg.cpp:428 #: ../src/generic/prntdlgg.cpp:638 @@ -2319,7 +2317,7 @@ #: ../src/gtk/fontdlg.cpp:141 #: ../src/html/helpfrm.cpp:1073 msgid "OK" -msgstr "OK" +msgstr "Goed" #: ../src/common/xtixml.cpp:263 msgid "Objects must have an id attribute" @@ -2839,7 +2837,7 @@ #: ../src/generic/fontdlgg.cpp:224 msgid "Swiss" -msgstr "Swiss" +msgstr "Switsers" #: ../src/common/imagtiff.cpp:232 #: ../src/common/imagtiff.cpp:243 Index: misc.cpp =================================================================== RCS file: /projects/pgadmin3/src/utils/misc.cpp,v retrieving revision 1.59 retrieving revision 1.60 diff -Lsrc/utils/misc.cpp -Lsrc/utils/misc.cpp -u -w -r1.59 -r1.60 --- src/utils/misc.cpp +++ src/utils/misc.cpp @@ -250,6 +250,21 @@ } +void FillKeywords(wxString &str) +{ + // unfortunately, the keyword list is static. + // If the first or the last word change, these both need to get updated. + const ScanKeyword *keyword=ScanKeywordLookup("abort"); + const ScanKeyword *last=ScanKeywordLookup("zone"); + + wxASSERT(keyword && last); + + str = wxString::FromAscii(keyword->name); + + while (keyword++ < last) + str += wxT(" ") + wxString::FromAscii(keyword->name); +} + static bool needsQuoting(wxString& value, bool forTypes) {
---------------------------(end of broadcast)--------------------------- TIP 5: Have you checked our extensive FAQ? http://www.postgresql.org/docs/faqs/FAQ.html