From 2583f616d9a081131516c87a95f1551fdcbb307e Mon Sep 17 00:00:00 2001 From: lsv Date: Wed, 18 Mar 2026 09:09:01 +0500 Subject: [PATCH] fix warning clang --- db/pgConn.cpp | 5 +---- include/ctl/ctlSQLGrid.h | 2 +- utils/FormatterSQL.cpp | 15 +++++++++------ 3 files changed, 11 insertions(+), 11 deletions(-) diff --git a/db/pgConn.cpp b/db/pgConn.cpp index a86ce72..e3e72f3 100644 --- a/db/pgConn.cpp +++ b/db/pgConn.cpp @@ -1047,9 +1047,6 @@ bool pgConn::IsAlive() int pgConn::GetStatus() const { - if (!this) - return PGCONN_BAD; - if (conn) ((pgConn *)this)->connStatus = PQstatus(conn); @@ -1246,7 +1243,7 @@ bool pgConn::TableHasColumn(wxString schemaname, wxString tblname, const wxStrin if (schemaname.IsEmpty()) schemaname = wxT("public"); - if (this && GetStatus() == PGCONN_OK) + if (GetStatus() == PGCONN_OK) { tblname.Replace(wxT("\\"), wxT("\\\\")); tblname.Replace(wxT("'"), wxT("''")); diff --git a/include/ctl/ctlSQLGrid.h b/include/ctl/ctlSQLGrid.h index c8be854..4be5005 100644 --- a/include/ctl/ctlSQLGrid.h +++ b/include/ctl/ctlSQLGrid.h @@ -220,7 +220,7 @@ wxSize GetBestSize(wxGrid& grid, public: void Draw(wxGrid& grid, wxGridCellAttr& attr, wxDC& dc, - const wxRect& rect, int row, int col, bool isSelected); + const wxRect& rect, int row, int col, bool isSelected) wxOVERRIDE; CursorCellRenderer(int thous_pixel_sep); private: int thousands_pixel_sep; diff --git a/utils/FormatterSQL.cpp b/utils/FormatterSQL.cpp index 2393200..7070d38 100644 --- a/utils/FormatterSQL.cpp +++ b/utils/FormatterSQL.cpp @@ -972,16 +972,16 @@ int FormatterSQL::ParseSql(int flags) { vi.txt = tmp; vi.type = keyword; vi.flags = flg; - if (tmp == "from" && i2 >= 2) { + if (tmp == "from" && i2 >= 2) { // special case "distinct from" this no "from" wxString s = items[items.size() - 2].txt; if (s.Len() >= 8 && s.substr(s.Len() - 8).CmpNoCase("distinct") == 0) { vi.flags = 0; } } - if (keyEntities[n].name == "case") { + if (strcmp(keyEntities[n].name,"case") == 0) { bracket.push(items.size()); } - else if (keyEntities[n].name == "end") { + else if (strcmp(keyEntities[n].name,"end") == 0) { int idx = -1; if (bracket.size() > 0) { idx = bracket.top(); @@ -994,14 +994,17 @@ int FormatterSQL::ParseSql(int flags) { vi.endlevel = idx; if (idx != -1) items[idx].endlevel = items.size(); - } else if (keyEntities[n].name == "then"|| - keyEntities[n].name == "loop" ) { // for plpgsql + } else if (strcmp(keyEntities[n].name, "then")== 0 || + strcmp(keyEntities[n].name,"loop") == 0 ) { // for plpgsql query without ";" // if ... then // while ... loop or for .. in query loop + + // special break parse query ONLY recurse level == 0 if (bracket.size() == 0) { - i=i+tmp.Len()-1; + i=i+tmp.Len()-1; // skip stop keyword break; } + // } } i += tmp.Len() - 1;