From 7f0552ad3646b70e89ac6c301ba654532da6fd9d Mon Sep 17 00:00:00 2001 From: wyaadarsh Date: Wed, 17 May 2017 17:12:18 +0530 Subject: [PATCH] SQLyog 12.4.2.0 --- include/AppInfo.h | 2 +- include/ConnectionCommunity.h | 40 +++++ include/ExportAsSQL.h | 2 +- include/MySQLVersionHelper.h | 3 + include/ObjectBrowser.h | 14 +- include/SQLyog.rc | 57 +++++-- include/Symbols.h | 2 + include/Version.h | 4 +- include/resource.h | 34 ++-- src/ConnectionBase.cpp | 2 +- src/ConnectionCommunity.cpp | 16 +- src/DataView.cpp | 3 + src/ExportAsSQL.cpp | 79 +++++---- src/FrameWindow.cpp | 25 ++- src/GUIHelper.cpp | 20 ++- src/MDIWindow.cpp | 2 +- src/MySQLVersionHelper.cpp | 14 ++ src/ObjectBrowser.cpp | 301 ++++++++++++++++++++++++++++------ src/OtherDialogs.cpp | 2 +- src/TabTable.cpp | 6 +- 20 files changed, 509 insertions(+), 119 deletions(-) diff --git a/include/AppInfo.h b/include/AppInfo.h index 3a8c239..2900dd2 100644 --- a/include/AppInfo.h +++ b/include/AppInfo.h @@ -38,7 +38,7 @@ #define SQLITE_APPVERSION_MAJOR "10" #define SQLITE_APPVERSION_MINOR "5" -#define COMPANY_COPYRIGHT "(c) 2001-2016 Webyog Inc." +#define COMPANY_COPYRIGHT "(c) 2001-2017 Webyog Inc." #define FILEVER MAJOR_VERSION_INT ## , ## MINOR_VERSION_INT ## , ## UPDATE_VERSION_INT ## , ## RELEASE_VERSION_INT #define STRFILEVER MAJOR_VERSION "." MINOR_VERSION "." STRINGIZE(UPDATE_VERSION_INT) "." STRINGIZE(RELEASE_VERSION_INT) diff --git a/include/ConnectionCommunity.h b/include/ConnectionCommunity.h index 25eaf14..2fd609a 100644 --- a/include/ConnectionCommunity.h +++ b/include/ConnectionCommunity.h @@ -416,4 +416,44 @@ class ConnectionCommunity : public ConnectionBase wyBool m_isapclose; }; +class CRegInfoCommunity +{ +public: + CRegInfoCommunity(); + ~CRegInfoCommunity(); + + static INT_PTR CALLBACK DlgProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam); + static LRESULT CALLBACK StaticDlgProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam); + static LRESULT CALLBACK ImageDlgProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam); + + wyInt32 OnWmCtlcolorStatic(WPARAM wparam, LPARAM lparam); + void OnWmInitDlgValues(HWND hwnd); + void OnWmCommand(HWND hwnd, WPARAM wparam); + wyInt32 Show(HWND hwndParent, wyInt32 isRegistered=1); + wyInt32 Registered(); + void InitValues(); + wyInt32 CheckValidEmail(); + wyInt32 GeneratePasscode(); + wyInt32 SendPasscodeRequest(); + wyInt32 SendPasscodeVerifiedStatus(); + wyInt32 PasscodeVerification(); + void ShowPasscodeWindow(); + void ShowEmailWindow(); + wyBool AddVerifiedToRegistry(); + + HWND m_hwnddlg; + HWND m_hwndedit; + HFONT m_hlinkfont; + HFONT m_hlinkfont2; + WNDPROC m_wporigstaticproc; + WNDPROC m_wporigimageproc; + wyBool m_tracking; + wyInt32 m_isRegistered; + wyString m_oldmail; + wyString m_newmail; + wyString m_passcode; + wyString m_httpreqcode; +}; + + #endif diff --git a/include/ExportAsSQL.h b/include/ExportAsSQL.h index abd3244..9d60f5f 100644 --- a/include/ExportAsSQL.h +++ b/include/ExportAsSQL.h @@ -123,7 +123,7 @@ typedef struct __schdextra_options wyBool m_flushlogs; wyBool m_flushmaster; wyBool m_locktableread; - wyBool m_flushslave; + /*wyBool m_flushslave;*/ wyBool m_autocommit; wyBool m_locktablewrite; wyBool m_hextoblob; diff --git a/include/MySQLVersionHelper.h b/include/MySQLVersionHelper.h index eb75f71..c0b9f2f 100644 --- a/include/MySQLVersionHelper.h +++ b/include/MySQLVersionHelper.h @@ -159,6 +159,9 @@ wyBool IsMySQL577(Tunnel * tunnel, PMYSQL mysql); wyBool IsMySQL578(Tunnel * tunnel, PMYSQL mysql); +// For virtual column support check +wyBool IsMySQL576Maria52(Tunnel * tunnel, PMYSQL mysql); + //wyBool IsClusterDb(Tunnel * tunnel, PMYSQL mysql); diff --git a/include/ObjectBrowser.h b/include/ObjectBrowser.h index 7125e12..0fe41a9 100644 --- a/include/ObjectBrowser.h +++ b/include/ObjectBrowser.h @@ -404,6 +404,8 @@ class CQueryObject wyBool IsSelectionOnTable(); + void setIsTruncate(wyBool); + /// Double click manager. /** @param wparam : Unsigned message parameter @@ -904,8 +906,9 @@ class CQueryObject void PaintFilterWindow(HWND hwnd); - - /*void AddToDeleteList(HWND hwnd, TVITEMEX &tvi);*/ + wyBool m_isTruncate; + + /*void AddToDeleteList(HWND hwnd, TVITEMEX &tvi);*/ wyBool m_isClearVisible; @@ -913,6 +916,13 @@ class CQueryObject wyString m_prevString; +#ifndef COMMUNTIY + wyBool m_isRegexChecked; + HWND m_hwndRegex; + HWND m_hwndRegexText; + WNDPROC m_RegexProc; +#endif + wyString m_matchString; wyBool m_OBFilterWorkInProgress; diff --git a/include/SQLyog.rc b/include/SQLyog.rc index 04224fc..629ceff 100644 --- a/include/SQLyog.rc +++ b/include/SQLyog.rc @@ -577,6 +577,7 @@ BEGIN END MENUITEM SEPARATOR MENUITEM "Create Schema For Database In &HTML...\tCtrl+Shift+Alt+S", ID_OBJECT_CREATESCHEMA + /* MENUITEM "Rebuild Tag", ID_DATABASE_REBUILDTAGS*/ END POPUP "T&able" BEGIN @@ -728,7 +729,7 @@ BEGIN BEGIN MENUITEM "Repeatable Read", ID_TRX_REPEATABLEREAD, CHECKED MENUITEM "Read Committed", ID_TRX_READCOMMITED - MENUITEM "Read Uncommitted", ID_TRX_READUNCOMMITED + MENUITEM "Read Uncommitted", ID_TRX_READUNCOMMITED MENUITEM "Serializable", ID_TRX_SERIALIZABLE END MENUITEM SEPARATOR @@ -895,14 +896,14 @@ BEGIN LTEXT "(Use ';' to separate multiple databases. Leave blank to display all)",IDC_COLONST,119,160,242,18,WS_DISABLED CONTROL "Use Co&mpressed Protocol",IDC_COMPRESS,"Button",BS_AUTOCHECKBOX | WS_DISABLED | WS_TABSTOP,119,175,95,10 PUSHBUTTON "?",IDC_COMPRESSHELP,340,175,16,11 - CONTROL "Read-Only Connection",IDC_READONLY,"Button",BS_AUTOCHECKBOX | WS_DISABLED | WS_TABSTOP,228,175,86,10 + CONTROL "Read-Only Connection",IDC_READONLY,"Button",BS_AUTOCHECKBOX | WS_DISABLED | WS_TABSTOP,228,175,86,10 GROUPBOX "Session Idle Timeout",IDC_TIMEOUT,119,188,139,28 CONTROL "De&fault",IDC_TIMEOUTDEF,"Button",BS_AUTORADIOBUTTON | WS_DISABLED | WS_GROUP,124,200,38,10 CONTROL "",IDC_TIMEOUTOPT,"Button",BS_AUTORADIOBUTTON | WS_DISABLED,164,200,12,10 EDITTEXT IDC_TIMEOUTEDIT,176,198,40,12,ES_AUTOHSCROLL | ES_NUMBER | WS_DISABLED LTEXT "(seconds)",IDC_TIMESEC,221,200,33,12 GROUPBOX "&Keep-Alive Interval",IDC_KEEPALIVE,264,188,92,28,WS_DISABLED - LTEXT "Need Help?", IDC_LINK,310,218,44,8, NOT WS_VISIBLE | SS_NOTIFY | SS_CENTERIMAGE + LTEXT "Need Help?",IDC_LINK,310,218,44,8,SS_NOTIFY | SS_CENTERIMAGE | NOT WS_VISIBLE EDITTEXT IDC_PINGINTERVAL,270,198,45,12,ES_AUTOHSCROLL | ES_NUMBER | WS_DISABLED LTEXT "(seconds)",IDC_KEEPALIVESEC,320,200,32,8,WS_DISABLED GROUPBOX "",IDC_TUNNELGRP,117,72,242,154,NOT WS_VISIBLE @@ -1609,6 +1610,26 @@ BEGIN ICON "",IDC_STATICIMG,7,8,21,20 END +IDD_REGISTERSPLASH DIALOGEX 0, 0, 299, 103 +STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | DS_CENTER | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU +EXSTYLE WS_EX_NOPARENTNOTIFY | WS_EX_CONTROLPARENT +CAPTION " SQLyog Community" +FONT 8, "MS Shell Dlg", 0, 0, 0x0 +BEGIN + LTEXT "This is the Community edition of SQLyog",IDC_TRIALSTATIC,4,11,291,8,SS_NOTIFY + LTEXT "Enter email address to start evaluation",IDC_TITLE,4,25,192,8 + EDITTEXT IDC_TRIALEMAIL,183,26,104,12,ES_AUTOHSCROLL + LTEXT "Enter passcode received in mail",IDC_TITLE2,4,26,192,8 + EDITTEXT IDC_PASSCODE,183,26,104,12,ES_AUTOHSCROLL + LTEXT "To know more ",IDC_STATIC,4,67,100,10 + LTEXT "click here",IDC_LINK,63,65,66,12,SS_NOTIFY | SS_CENTERIMAGE,WS_EX_TRANSPARENT + PUSHBUTTON "Next",IDM_NEXT,244,86,51,14 + LTEXT "You will receive a passcode on the email provided above. Click Next to receive passcode",IDC_TRIALNOTESTATIC,5,45,282,19 + PUSHBUTTON "Back",IDM_BACK,134,86,51,14 + PUSHBUTTON "Resend",IDM_RESEND,189,86,51,14 + DEFPUSHBUTTON "Verify",IDM_VERIFY,244,86,51,14 +END + IDD_SHOWIMPORTERR DIALOGEX 0, 0, 249, 83 STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | DS_CENTER | WS_POPUP | WS_CAPTION | WS_SYSMENU CAPTION "SQLyog - SQL Dump Import Error" @@ -1844,7 +1865,7 @@ BEGIN GROUPBOX "Transaction Options",IDC_TRANSACTION,4,185,247,36 CONTROL "Prompt when query causing implicit commit is executed",IDC_PROMPTTRANSACTION, "Button",BS_AUTOCHECKBOX | WS_TABSTOP,9,196,197,10 - CONTROL "Prompt when closing session or program if transaction is active.",IDC_PROMPTCLOSETRANSACTION, + CONTROL "Prompt when closing session or program if transaction is active.",IDC_PROMPTCLOSETRANSACTION, "Button",BS_AUTOCHECKBOX | WS_TABSTOP,9,208,212,10 END @@ -2328,9 +2349,9 @@ IDI_TRUNCDB ICON "..\\include\\bitmaps\\truncated IDI_VIEWDATA ICON "..\\include\\bitmaps\\viewdata.ico" IDI_SORTASC ICON "..\\include\\bitmaps\\sortasc.ico" IDI_DBSYNC ICON "..\\include\\bitmaps\\dbsync.ico" -IDI_COMMIT ICON "..\\include\\bitmaps\\commit.ico" -IDI_ROLLBACK ICON "..\\include\\bitmaps\\rollback.ico" -IDI_START_TRANSACTION ICON "..\\include\\bitmaps\\start_transaction.ico" +IDI_COMMIT ICON "..\\include\\bitmaps\\commit.ico" +IDI_ROLLBACK ICON "..\\include\\bitmaps\\rollback.ico" +IDI_START_TRANSACTION ICON "..\\include\\bitmaps\\start_transaction.ico" IDI_PREF ICON "..\\include\\bitmaps\\preferences.ico" IDI_REORDERCOL ICON "..\\include\\bitmaps\\reordercol.ico" IDI_EMPTYTABLE ICON "..\\include\\bitmaps\\emptytable.ico" @@ -2413,9 +2434,9 @@ IDI_FUNCTION ICON "bitmaps\\function.ico" IDI_CONNECT_16 ICON "bitmaps\\connect_16.ico" IDI_COPYDATABASE_16 ICON "bitmaps\\copy_data_16.ico" IDI_DBSYNC_16 ICON "bitmaps\\dbsync_16.ico" -IDI_COMMIT_16 ICON "bitmaps\\commit_16.ico" -IDI_ROLLBACK_16 ICON "bitmaps\\rollback_16.ico" -IDI_START_TRANSACTION_16 ICON "bitmaps\\start_transaction_16.ico" +IDI_COMMIT_16 ICON "bitmaps\\commit_16.ico" +IDI_ROLLBACK_16 ICON "bitmaps\\rollback_16.ico" +IDI_START_TRANSACTION_16 ICON "bitmaps\\start_transaction_16.ico" IDI_EXECUTEALL_16 ICON "bitmaps\\execall_16.ico" IDI_EXECUTE_16 ICON "bitmaps\\execute_16.ico" IDI_EXECUTEFORUPD_16 ICON "bitmaps\\execforupd_16.ico" @@ -2620,6 +2641,12 @@ BEGIN BOTTOMMARGIN, 51 END + IDD_REGISTERSPLASH, DIALOG + BEGIN + RIGHTMARGIN, 295 + BOTTOMMARGIN, 100 + END + IDD_SHOWIMPORTERR, DIALOG BEGIN LEFTMARGIN, 7 @@ -3493,9 +3520,13 @@ END STRINGTABLE BEGIN - ID_STARTTRANSACTION_WITHNOMODIFIER "Start a new Transaction" - ID_COMMIT_WITHNOMODIFIER "Commit the ongoing transacton" - ID_ROLLBACK_TRANSACTION "Rollback the transaction" + ID_STARTTRANSACTION_WITHNOMODIFIER "Start a new Transaction" +END + +STRINGTABLE +BEGIN + ID_COMMIT_WITHNOMODIFIER "Commit the ongoing transacton" + ID_ROLLBACK_TRANSACTION "Rollback the transaction" END STRINGTABLE diff --git a/include/Symbols.h b/include/Symbols.h index 146f1a8..4a5d237 100644 --- a/include/Symbols.h +++ b/include/Symbols.h @@ -68,6 +68,8 @@ #define IDC_CHK_DROPFUNCTIONS 1101 #define IDC_CHK_DROPTRIGGERS 1102 #define IDC_OBJECTFILTER 1103 +#define IDC_REGEXFILTER 1104 +#define IDC_REGEXFILTERTEXT 1105 #define IDC_ABORT 1211 #define IDC_AVGROWLEN 2003 diff --git a/include/Version.h b/include/Version.h index 9b4c136..3d6ba2d 100644 --- a/include/Version.h +++ b/include/Version.h @@ -1,5 +1,5 @@ #define MAJOR_VERSION_INT 12 -#define MINOR_VERSION_INT 3 -#define UPDATE_VERSION_INT 3 +#define MINOR_VERSION_INT 4 +#define UPDATE_VERSION_INT 2 #define RELEASE_VERSION_INT 0 #define EXTRAINFO "" diff --git a/include/resource.h b/include/resource.h index a1f7565..d06c697 100644 --- a/include/resource.h +++ b/include/resource.h @@ -197,14 +197,15 @@ #define IDI_SCHEMADESIGNER 802 #define IDD_CREATEDB 802 #define IDD_MYSQL_ERROR 803 +#define IDD_REGISTERSPLASH 804 #define IDI_PKEY 810 #define IDI_CLOSETABLE 812 #define IDI_SDTABLEVIEW 813 #define IDI_EXPORTASIMG 815 #define IDI_SDPRINT 816 -#define IDI_COMMIT 817 -#define IDI_ROLLBACK 818 -#define IDI_START_TRANSACTION 819 +#define IDI_COMMIT 817 +#define IDI_ROLLBACK 818 +#define IDI_START_TRANSACTION 819 #define IDI_ADDTABLES 820 #define IDI_ALTERDB 821 #define IDI_PREVIOUS 824 @@ -217,9 +218,9 @@ #define IDI_EVENT 838 #define IDI_REFRESHCANVAS 839 #define IDR_TABLESMENU 840 -#define IDI_COMMIT_16 841 -#define IDI_ROLLBACK_16 842 -#define IDI_START_TRANSACTION_16 843 +#define IDI_COMMIT_16 841 +#define IDI_ROLLBACK_16 842 +#define IDI_START_TRANSACTION_16 843 #define IDI_SDZOOMIN 845 #define IDI_SDZOOMOUT 846 #define IDI_ALTEREVENT 847 @@ -485,7 +486,7 @@ #define IDC_ENABLEUPGRADE 1064 #define IDD_GETSQLYOGULTIMATE 1064 #define IDD_OBCOLOR 1065 -#define IDC_TRANSACTION 1067 +#define IDC_TRANSACTION 1067 #define IDC_EXPORTFILENAME 1081 #define IDC_PROGRESS 1082 #define IDC_CHK_USEDBNAME 1083 @@ -773,7 +774,6 @@ #define IDC_TIMEOUTOPT 1526 #define IDC_TIMEOUTEDIT 1527 #define IDC_COMPRESSHELP 1533 -#define IDC_READONLY 10289 #define IDC_TIMEOUTHELP 1534 #define IDC_TIMESEC 1535 #define IDC_SHOWWARNING 1536 @@ -955,8 +955,8 @@ #define IDC_SELCHECK 1708 #define IDC_CH 1708 #define IDC_PROMPTTRANSACTION 1708 -#define IDC_PROMPTCLOSETRANSACTION 1710 #define IDC_OPENSEL 1709 +#define IDC_PROMPTCLOSETRANSACTION 1710 #define IDC_PROGRESS2 1712 #define IDC_RESTORE_PROGRESS 1712 #define IDC_CONNECTION_NAME 1713 @@ -970,6 +970,18 @@ #define IDC_SAVEPOINTEDIT 1755 #define IDC_SAVEPOINTRELEASE_COMBO 1756 #define IDC_ROLLBACKTO_COMBO 1757 +#define IDM_VERIFY 1801 +#define IDM_NEXT 1802 +#define IDM_RESEND 1803 +#define IDM_BACK 1804 +#define IDC_LITE 1805 +#define IDC_IMAGELINK 1806 +#define IDC_TRIALEMAIL 1807 +#define IDC_PASSCODE 1808 +#define IDC_TITLE 1809 +#define IDC_TRIALNOTESTATIC 1810 +#define IDC_TITLE2 1811 +#define IDC_TRIALSTATIC 1812 #define IDC_INITCOMMANDHELP 2644 #define IDC_COMBOCUSTOM 2645 #define ID_IMPORT_FROMXML 2655 @@ -992,6 +1004,7 @@ #define IDS_TITLE5 10245 #define IDS_SUBTITLE5 10246 #define IDC_DLGCONNECT_STOREPASSWORD 10247 +#define IDC_READONLY 10289 #define ID_LF_1 39100 #define ID_LF_2 39101 #define ID_LF_3 39102 @@ -1609,6 +1622,7 @@ #define ID_SAVEPOINT_CREATESAVEPOINT 41821 #define ID_SAVEPOINT_RELEASESAVEPOINT 41822 #define ID_Menu 41823 +#define ID_DATABASE_REBUILDTAGS 41756 #define IDC_INITCOMMAND 44114 #define IDC_EDITINITCOMMAND 44115 #define IDC_INVISIBLE 44116 @@ -1643,7 +1657,7 @@ #ifndef APSTUDIO_READONLY_SYMBOLS #define _APS_NO_MFC 1 #define _APS_NEXT_RESOURCE_VALUE 1018 -#define _APS_NEXT_COMMAND_VALUE 41825 +#define _APS_NEXT_COMMAND_VALUE 41826 #define _APS_NEXT_CONTROL_VALUE 1716 #define _APS_NEXT_SYMED_VALUE 101 #endif diff --git a/src/ConnectionBase.cpp b/src/ConnectionBase.cpp index b88d8dc..a29e931 100644 --- a/src/ConnectionBase.cpp +++ b/src/ConnectionBase.cpp @@ -2084,7 +2084,7 @@ ConnectionBase::EnableToolButtonsAndCombo(HWND hwndtool, HWND hwndsecondtool, HW ID_FORMATCURRENTQUERY, IDC_DIFFTOOL, ID_QUERYBUILDER, ID_SCHEMADESIGNER, IDM_TOOL_ADDUSER, ID_STARTTRANSACTION_WITHNOMODIFIER, - ID_COMMIT_WITHNOMODIFIER, ID_ROLLBACK_TRANSACTION + ID_COMMIT_WITHNOMODIFIER, ID_ROLLBACK_TRANSACTION }; /* Enable/Disable all the toolbuttons */ diff --git a/src/ConnectionCommunity.cpp b/src/ConnectionCommunity.cpp index a6f6e7e..d0c7c0f 100644 --- a/src/ConnectionCommunity.cpp +++ b/src/ConnectionCommunity.cpp @@ -1072,7 +1072,8 @@ ConnectionCommunity::CreateIconList(HWND hwndmain, wyUInt32 *numicons) ID_ROLLBACK_TOSAVEPOINT, ID_ROLLBACK_TRANSACTION, ID_ROLLBACK_ANDCHAIN, ID_ROLLBACK_RELEASE, ID_ROLLBACK_ANDNOCHAIN, ID_ROLLBACK_NORELEASE, - ID_SAVEPOINT_CREATESAVEPOINT, ID_SAVEPOINT_RELEASESAVEPOINT + ID_SAVEPOINT_CREATESAVEPOINT, ID_SAVEPOINT_RELEASESAVEPOINT/*, + ID_DATABASE_REBUILDTAGS*/ @@ -1385,11 +1386,22 @@ ConnectionCommunity::CheckRegistration(HWND hwnd, void *main) HKEY key; DWORD dwdisposition; +#if IS_FROM_WINDOWS_STORE == 1 + CRegInfoCommunity creg; + wyInt32 ret; +#endif + //ShowDialog(hwnd); // create the registry. VERIFY((RegCreateKeyEx(HKEY_CURRENT_USER, TEXT(REGKEY), 0, NULL, REG_OPTION_NON_VOLATILE, KEY_READ | KEY_WRITE, NULL, &key, &dwdisposition))== ERROR_SUCCESS); - + +#if IS_FROM_WINDOWS_STORE == 1 + ret = creg.Show(hwnd, 0); + if(ret == 2) + return wyFalse; +#endif + return wyTrue; } diff --git a/src/DataView.cpp b/src/DataView.cpp index f31401a..ee9138a 100644 --- a/src/DataView.cpp +++ b/src/DataView.cpp @@ -967,6 +967,9 @@ DataView::IsColumnVirtual(wyInt32 col) wyString query,db, table,column; MYSQL_RES *fieldres = NULL; + if(! IsMySQL576Maria52(m_wnd->m_tunnel, &m_wnd->m_mysql)) + return 0; + if(m_data->m_colvirtual) { if(m_data->m_colvirtual[col]!=-1) diff --git a/src/ExportAsSQL.cpp b/src/ExportAsSQL.cpp index 2612c1f..9ab63e2 100644 --- a/src/ExportAsSQL.cpp +++ b/src/ExportAsSQL.cpp @@ -390,12 +390,12 @@ MySQLDump::SetHexBlob(wyBool val) return; } -void -MySQLDump::SetFlushSlave(wyBool val) -{ - m_firstslave = val; - return; -} +//void +//MySQLDump::SetFlushSlave(wyBool val) +//{ +// m_firstslave = val; +// return; +//} void MySQLDump::SetLockTable(wyBool val) @@ -1530,8 +1530,8 @@ MySQLDump::DumpTrigger(wyString * buffer, const wyChar * db, const wyChar * trig sja_mysql_free_result(m_tunnel, res); sja_mysql_free_result(m_tunnel, res1); - if(m_flushmaster == wyTrue) - OnFlushMaster(); +/* if(m_flushmaster == wyTrue) + OnFlushMaster();*/ if( m_individualtablefiles == wyTrue) { @@ -1998,10 +1998,19 @@ MySQLDump::StartDump() return wyFalse; } + //Write to file , if data is there in buffer if(WriteBufferToFile(&buffer, wyTrue) == wyFalse) return wyFalse; + if(m_flushmaster == wyTrue) + { + if(OnFlushMaster() == wyFalse) + { + return wyFalse; + } + } + return wyTrue; } @@ -2354,8 +2363,9 @@ MySQLDump::DumpTableAndViewTableStructure(wyString * buffer, const wyChar *db) m_tunnel->SetDB(db); #endif - if(m_firstslave == wyTrue || m_flushmaster == wyTrue) - DumpDatabaseOnMasterSlave(); +// if(m_firstslave == wyTrue || m_flushmaster == wyTrue) +/* if(m_flushmaster == wyTrue) + DumpDatabaseOnMasterSlave();*/ ChangeContextDatabase(db); @@ -2501,9 +2511,7 @@ MySQLDump::DumpDatabase(wyString * buffer, const wyChar *db, wyInt32 *fileerr) m_tunnel->SetDB(db); #endif - if(m_firstslave == wyTrue || m_flushmaster == wyTrue) - DumpDatabaseOnMasterSlave(); - +// if(m_firstslave == wyTrue || m_flushmaster == wyTrue) CHECKSTOP() @@ -3136,9 +3144,9 @@ MySQLDump::DumpTable(wyString * buffer, const wyChar *db, const wyChar *table, w if(m_autocommit == wyTrue && (m_iscommit == wyTrue)) buffer->AddSprintf("%sCOMMIT;%s", m_strnewline.GetString(), m_strnewline.GetString()); - if(m_flushmaster == wyTrue) - if(OnFlushMaster() == wyFalse) - return wyFalse; + //if(m_flushmaster == wyTrue) + // if(OnFlushMaster() == wyFalse) + // return wyFalse; if( m_individualtablefiles == wyTrue ) { @@ -3176,16 +3184,32 @@ MySQLDump::OnFlushMaster() { wyString query; MYSQL_RES *res; - if(IsMySQL5600(m_tunnel, &m_mysql) == wyTrue) - query.SetAs("RESET MASTER"); - else - query.SetAs("FLUSH MASTER"); - + MYSQL_ROW row; + wyString str; + wyInt32 index_filename; + query.SetAs("SHOW MASTER STATUS"); res = SjaExecuteAndGetResult(m_tunnel, &m_mysql, query); + + if(!res && sja_mysql_affected_rows(m_tunnel, m_mysql) == -1) + return OnError(); + if(res->row_count <=0 ) + return wyTrue; + + row= mysql_fetch_row(res); + index_filename = GetFieldIndex( m_tunnel, res, "File"); + str.SetAs(row[index_filename]); + mysql_free_result(res); + query.Clear(); + query.AddSprintf("PURGE BINARY LOGS TO '%s",str.GetString()); + query.Add("'"); + + res= SjaExecuteAndGetResult(m_tunnel, &m_mysql, query); if(!res && sja_mysql_affected_rows(m_tunnel, m_mysql) == -1) return OnError(); + mysql_free_result(res); + return wyTrue; } @@ -3392,8 +3416,8 @@ MySQLDump::DumpProcedure(wyString * buffer, const wyChar *db, const wyChar *proc buffer->AddSprintf("%sDELIMITER ;%s", m_strnewline.GetString(), m_strnewline.GetString()); - if(m_flushmaster == wyTrue) - OnFlushMaster(); +/* if(m_flushmaster == wyTrue) + OnFlushMaster();*/ if( m_individualtablefiles == wyTrue ) { @@ -3482,8 +3506,8 @@ MySQLDump::DumpEvent(wyString * buffer, const wyChar * db, const wyChar * event, sja_mysql_free_result(m_tunnel, res); - if(m_flushmaster == wyTrue) - OnFlushMaster(); +/* if(m_flushmaster == wyTrue) + OnFlushMaster();*/ if( m_individualtablefiles == wyTrue ) { @@ -3548,8 +3572,8 @@ MySQLDump::DumpFunction(wyString * buffer, const wyChar *db, const wyChar *funct buffer->AddSprintf("%sDELIMITER ;%s", m_strnewline.GetString(), m_strnewline.GetString()); - if(m_flushmaster == wyTrue) - OnFlushMaster(); + //if(m_flushmaster == wyTrue) + // OnFlushMaster(); if( m_individualtablefiles == wyTrue ) { @@ -4554,7 +4578,6 @@ MySQLDump::WriteBufferToFile(wyString * buffer, wyBool isforce) //Flushing buffer for next write buffer->Clear(); } - return wyTrue; } diff --git a/src/FrameWindow.cpp b/src/FrameWindow.cpp index 55473cb..cb764fa 100644 --- a/src/FrameWindow.cpp +++ b/src/FrameWindow.cpp @@ -931,6 +931,18 @@ FrameWindow::MoveToInitPos(HWND hwnd) wyInt32 virtx, virty; wyInt32 diffht, diffwd; wyInt32 xprim, yprim; + static const char* (CDECL *pwine_get_version)(void); + HMODULE hntdll; + + hntdll = GetModuleHandle(L"ntdll.dll"); + if (hntdll) + { + if(GetProcAddress(hntdll, "wine_get_version")) + { + m_showwindowstyle = SW_NORMAL; + return wyFalse; + } + } if(SearchFilePath(L"sqlyog", L".ini", MAX_PATH, directory, &lpfileport) == wyFalse) { @@ -1049,7 +1061,6 @@ FrameWindow::MoveToInitPos(HWND hwnd) MoveWindow(hwnd, rc.left, rc.top, rc.right-rc.left, rc.bottom-rc.top, FALSE); - lstyle = wyIni::IniGetInt(SECTION_NAME, "Maximize", 0, dirstr.GetString()); if(lstyle == 1) @@ -1736,6 +1747,7 @@ FrameWindow::CreateToolBarWindow() wyUInt32 daysleft = TRIAL_DAYS_LEFT; static const char * (CDECL *pwine_get_version)(void); HMODULE hntdll; + //Make sure destroy all toolbar resources during the chage of icon size DestroyToolBarResources(); @@ -3410,7 +3422,7 @@ pGlobals->m_pcmainwin->m_closealltrans = 1; case ID_OBJECT_CLEARTABLE: if(hwndactive ) pcquerywnd->m_pcqueryobject->EmptyTable(pcquerywnd->m_tunnel, &pcquerywnd->m_mysql); - break; + break; case ACCEL_COPYTABLE: case ID_OBJECT_COPYTABLE: @@ -3556,6 +3568,11 @@ pGlobals->m_pcmainwin->m_closealltrans = 1; if(hwndactive) pcquerywnd->m_pcqueryobject->CreateSchema(); break; + //case ID_DATABASE_REBUILDTAGS: vgladcode + // if(hwndactive) + // m_connection->OnWmCommand(hwndactive, pcquerywnd, wParam); + // return wyTrue; vgladcode + case IDM_WINDOW_TILE: SendMessage(pGlobals->m_hwndclient, WM_MDITILE, 0, 0); @@ -4975,7 +4992,7 @@ FrameWindow::OnActiveConn() ID_OBJECTS_RENAMEVIEW, ID_OBJECTS_RENAMETRIGGER, ID_TOOLS_FLUSH, IDC_DIFFTOOL, IDM_CREATEDATABASE,ID_OBJECT_TRUNCATEDATABASE, ID_DB_TABLE_MAKER, ID_TABLE_MAKER, IDM_ALTERDATABASE,ID_OPEN_COPYDATABASE, - ID_OBJECT_DROPDATABASE, ID_OBJECT_EMPTYDATABASE, ID_OBJECT_CREATESCHEMA, + ID_OBJECT_DROPDATABASE, ID_OBJECT_EMPTYDATABASE, ID_OBJECT_CREATESCHEMA,/*ID_DATABASE_REBUILDTAGS, vgladcode*/ ID_OBJECT_TABLEEDITOR, ID_OBJECT_COPYTABLE, ID_IMPORT_FROMCSV,ID_IMPORT_FROMXML, ID_OBJECT_RENAMETABLE, ID_OBJECT_CLEARTABLE, ID_OBJECT_DROPTABLE, ID_OBJECT_REORDER, ID_OBJECT_CHANGETABLETYPE_ISAM, @@ -7985,7 +8002,7 @@ FrameWindow::OnCreateDatabase(HWND hwndactive, MDIWindow *wnd) wyWChar *dbname; wyInt32 ret; #ifndef COMMUNITY - if(GetActiveWin()->m_conninfo.m_isreadonly == wyTrue) + if(GetActiveWin() && GetActiveWin()->m_conninfo.m_isreadonly == wyTrue) { return; } diff --git a/src/GUIHelper.cpp b/src/GUIHelper.cpp index 1fafff9..cfe2efa 100644 --- a/src/GUIHelper.cpp +++ b/src/GUIHelper.cpp @@ -1209,7 +1209,7 @@ EnableDBItems(HMENU hmenu) { wyInt32 image, size, advsize, count, itemcount, state; wyInt32 nid[] = {ID_DB_TABLE_MAKER,IDM_ALTERDATABASE, ID_OPEN_COPYDATABASE, ID_OBJECT_TRUNCATEDATABASE, - ID_OBJECT_DROPDATABASE, ID_OBJECT_EMPTYDATABASE, ID_OBJECT_CREATESCHEMA }; + ID_OBJECT_DROPDATABASE, ID_OBJECT_EMPTYDATABASE, ID_OBJECT_CREATESCHEMA/*, ID_DATABASE_REBUILDTAGS vgladcode*/}; wyInt32 advnid[] = { ID_DB_CREATEVIEW, ID_DB_CREATESTOREDPROCEDURE, ID_DB_CREATEFUNCTION , ID_DB_CREATETRIGGER}; MDIWindow *pcquerywnd; @@ -1239,6 +1239,8 @@ EnableDBItems(HMENU hmenu) for(count = 0; count < advsize; count++) EnableMenuItem(hmenu, advnid[count], state | MF_BYCOMMAND); + + //first disable create event menu EnableMenuItem(hmenu, ID_DB_CREATEEVENT, MF_GRAYED| MF_BYCOMMAND); @@ -1249,6 +1251,8 @@ EnableDBItems(HMENU hmenu) EnableMenuItem(hmenu, ID_IMPORT_EXTERNAL_DATA, MF_GRAYED| MF_BYCOMMAND); EnableMenuItem(hmenu, IDM_CREATEDATABASE, MF_GRAYED| MF_BYCOMMAND); EnableMenuItem(hmenu, ID_OBJECT_CREATESCHEMA, MF_ENABLED| MF_BYCOMMAND); + /* EnableMenuItem(hmenu, ID_DATABASE_REBUILDTAGS, MF_ENABLED| MF_BYCOMMAND); vgladcode*/ + //EnableMenuItem(hmenu, ID_OPEN_COPYDATABASE, MF_GRAYED| MF_BYCOMMAND); return wyTrue; } @@ -1265,6 +1269,9 @@ EnableDBItems(HMENU hmenu) for(count = 0; count < size; count++) EnableMenuItem(hmenu, nid[count], state | MF_BYCOMMAND); + //if(pGlobals->m_isautocomplete == wyFalse) vgladcode + //EnableMenuItem(hmenu, ID_DATABASE_REBUILDTAGS, MF_GRAYED| MF_BYCOMMAND); + if(! IsMySQL41(pcquerywnd->m_tunnel, &pcquerywnd->m_mysql )) EnableMenuItem(hmenu, IDM_ALTERDATABASE, MF_GRAYED); @@ -2272,7 +2279,16 @@ ChangeMenuItemOnPref(HMENU hmenu, wyInt32 menuindex) pGlobals->m_menuallquery = wcsdup(_(L"Execute &All Queries\tCtrl+F5")); } SetMenuOnPreferenceChange(hmenu, pGlobals->m_menuallquery, ACCEL_EXECUTEALL); - } + } + + //if(pGlobals->m_isautocomplete == wyFalse) + //{ + //VERIFY(EnableMenuItem(hmenu, ID_DATABASE_REBUILDTAGS, MF_GRAYED | MF_BYCOMMAND) != -1); + //} + //else + //{ + // + //} } //setting menu item information diff --git a/src/MDIWindow.cpp b/src/MDIWindow.cpp index 687979a..770183c 100644 --- a/src/MDIWindow.cpp +++ b/src/MDIWindow.cpp @@ -1716,7 +1716,7 @@ void MDIWindow::EnableToolOnNoQuery() { wyInt32 image, size, count; - wyInt32 nid[] = {ID_OPEN_COPYDATABASE, ID_OBJECT_CREATESCHEMA, ID_EXPORT_AS, + wyInt32 nid[] = {ID_OPEN_COPYDATABASE, ID_OBJECT_CREATESCHEMA/*, vgladcode ID_DATABASE_REBUILDTAGS*/, ID_EXPORT_AS, ID_OBJECT_COPYTABLE, ID_OBJECT_INSERTUPDATE, ID_OBJECT_TABLEEDITOR, ID_OBJECT_MAINMANINDEX, ACCEL_MANREL }; wyInt32 nidd[] = {ID_EXPORT_AS, ID_OBJECT_COPYTABLE, ID_OBJECT_INSERTUPDATE, diff --git a/src/MySQLVersionHelper.cpp b/src/MySQLVersionHelper.cpp index 7b79dab..3090a9e 100644 --- a/src/MySQLVersionHelper.cpp +++ b/src/MySQLVersionHelper.cpp @@ -507,6 +507,20 @@ wyBool IsMySQL578(Tunnel * tunnel, PMYSQL mysql) else return wyFalse; } + +// Mysql 5.7.6 and MariaDb 5.2 for virtual column support +wyBool IsMySQL576Maria52(Tunnel * tunnel, PMYSQL mysql) +{ + long me = mysql_get_server_version(*mysql); + const char *dbString = mysql_get_server_info(*mysql); + + if((me >= 50706 && !strstr(dbString, "MariaDB") ) || (me >= 50200 && strstr(dbString, "MariaDB") )) + return wyTrue; + else + return wyFalse; +} + + /* wyBool IsClusterDb(Tunnel * tunnel, PMYSQL mysql) { diff --git a/src/ObjectBrowser.cpp b/src/ObjectBrowser.cpp index 1c67c22..4076202 100644 --- a/src/ObjectBrowser.cpp +++ b/src/ObjectBrowser.cpp @@ -23,6 +23,11 @@ #include "FrameWindowHelper.h" #include "MySQLVersionHelper.h" #include "ExportMultiFormat.h" + +#ifndef COMMUNITY +#include "pcre.h" +#endif + //#include "IndexManager.h" #include "ExportMultiFormat.h" #include "OtherDialogs.h" @@ -95,6 +100,10 @@ CQueryObject::CQueryObject(HWND hwndparent, wyChar *filterdb) m_isnoderefresh = wyFalse; + #ifndef COMMUNITY + m_isRegexChecked = wyFalse; + #endif + m_hfont = NULL; m_hwndFilter = NULL; @@ -150,16 +159,21 @@ CQueryObject::CreateObjectBrowser(HWND hwndparent) //wyUInt32 exstyles = WS_EX_STATICEDGE; wyUInt32 styles = WS_VISIBLE | WS_CHILD | TVS_HASBUTTONS | TVS_SHOWSELALWAYS | TVS_EDITLABELS |TVS_FULLROWSELECT/*| TVS_TRACKSELECT*/; HWND hwndobject, hwndFilter, hwndStaticParent = NULL, hwndSt = NULL; + #ifndef COMMUNITY + HWND hwndRegex; + HWND hwndRegexText; + #endif + COLORREF backcolor, forecolor; /*HICON hicon; TOOLINFO tf; */ SendMessage(hwndparent, WM_SETREDRAW, 0, FALSE); - VERIFY(hwndStaticParent = CreateWindowEx(0, WC_STATIC, L"", WS_VISIBLE | WS_CHILD | WS_CLIPCHILDREN, + VERIFY(hwndStaticParent = CreateWindowEx(0, WC_STATIC, L"", WS_VISIBLE | WS_CHILD | WS_CLIPCHILDREN , 2, 2, 16, 16, hwndparent, (HMENU)-1, pGlobals->m_pcmainwin->GetHinstance(), this)); - - VERIFY(hwndobject = CreateWindowEx(0 , WC_TREEVIEW, NULL, styles, 5, 30, 150, 150, + + VERIFY(hwndobject = CreateWindowEx(0 , WC_TREEVIEW, NULL, styles, 5, 30, 150, 150, hwndparent,(HMENU)IDC_OBJECTTREE, pGlobals->m_pcmainwin->GetHinstance(), this)); m_hwnd = hwndobject; @@ -183,12 +197,27 @@ CQueryObject::CreateObjectBrowser(HWND hwndparent) VERIFY(hwndSt = CreateWindowEx(0, WC_STATIC, _(L"Filter Databases"), WS_VISIBLE | WS_CHILD | SS_ENDELLIPSIS, 2, 2, 16,16, hwndStaticParent, (HMENU)-1, pGlobals->m_pcmainwin->GetHinstance(), this)); m_hwndStMsg = hwndSt; - - VERIFY(hwndFilter = CreateWindowEx(WS_EX_CLIENTEDGE, WC_EDIT, NULL, WS_VISIBLE | WS_CHILD | ES_LEFT | WS_TABSTOP | ES_AUTOHSCROLL, 16, 2, 150, 30, + VERIFY(hwndFilter = CreateWindowEx(WS_EX_CLIENTEDGE, WC_EDIT, NULL, WS_VISIBLE | WS_CHILD | ES_LEFT | WS_TABSTOP | ES_AUTOHSCROLL, 16, 2, 150, 30, hwndStaticParent,(HMENU)IDC_OBJECTFILTER, pGlobals->m_pcmainwin->GetHinstance(), this)); +#ifndef COMMUNITY + VERIFY(hwndRegex = CreateWindowEx(0, WC_BUTTON, NULL, WS_VISIBLE | WS_CHILD | BS_CHECKBOX | WS_TABSTOP, 16, 30, 20, 28, + hwndStaticParent,(HMENU)IDC_REGEXFILTER, pGlobals->m_pcmainwin->GetHinstance(), this)); + VERIFY(hwndRegexText= CreateWindowEx(0, WC_STATIC, _(L"Search As Regex"), WS_VISIBLE | WS_CHILD | SS_ENDELLIPSIS | SS_NOTIFY, 16, 30, 120, 28, + hwndStaticParent, (HMENU)(IDC_REGEXFILTERTEXT), pGlobals->m_pcmainwin->GetHinstance(), this)); + //CheckDlgButton(hwndRegex, 1, BST_CHECKED); +#endif + + SetWindowPos(hwndobject, hwndFilter, 0, 0, 0, 0, SWP_NOMOVE|SWP_NOSIZE); SetWindowPos(hwndFilter, hwndStaticParent, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE); + + #ifndef COMMUNITY + SetWindowPos(hwndobject, hwndRegex, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE); + SetWindowPos(hwndobject, hwndRegexText, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE); + m_hwndRegex = hwndRegex; + m_hwndRegexText= hwndRegexText; + #endif //ShowWindow(hwndFilter, SW_HIDE); @@ -196,13 +225,15 @@ CQueryObject::CreateObjectBrowser(HWND hwndparent) m_hwndFilter = hwndFilter; m_hwndStParent = hwndStaticParent; + + SendMessage(m_hwndFilter, EM_LIMITTEXT, 64, NULL); SetWindowLongPtr(m_hwndStParent, GWLP_USERDATA, (LONG_PTR)this); m_stWndProc = (WNDPROC)SetWindowLongPtr(m_hwndStParent, GWLP_WNDPROC, (LONG_PTR) CQueryObject::StCtrlProc); SetWindowLongPtr(m_hwndFilter, GWLP_USERDATA, (LONG_PTR)this); - m_FilterProc = (WNDPROC)SetWindowLongPtr(m_hwndFilter, GWLP_WNDPROC, (LONG_PTR) CQueryObject::FilterProc); + m_FilterProc = (WNDPROC)SetWindowLongPtr(m_hwndFilter, GWLP_WNDPROC, (LONG_PTR) CQueryObject::FilterProc); //..Setting font SetFont(); @@ -277,6 +308,10 @@ CQueryObject::FilterProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) HWND curHwnd = NULL; HDC hdc = NULL; + #ifndef COMMUNITY + wyWChar str1[70]; + wyWChar strTemp[70]; + #endif VERIFY(wnd = GetActiveWin()); @@ -321,7 +356,7 @@ CQueryObject::FilterProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) if(PtInRect(&rectWnd, pt)) { - if(pcqueryobject->HandleOnEscapeOBFilter()) + if(pcqueryobject->HandleOnEscapeOBFilter()) { SetFocus(pcqueryobject->m_hwndFilter); } @@ -417,6 +452,20 @@ CQueryObject::FilterProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) switch(wParam) { case VK_RETURN: + #ifndef COMMUNITY + if(pcqueryobject->m_isRegexChecked==wyTrue) + { + + //GetWindowText(pcqueryobject->m_hwndFilter, strTemp, 65); + //pcqueryobject->HandleOnEscapeOBFilter(); + pcqueryobject->HandleOBFilter(L"", wyFalse); + //SetWindowText(pcqueryobject->m_hwndFilter,strTemp); + //CEdit* e = (CEdit*)GetDlgItem(); + //SetFocus(pcqueryobject->m_hwndFilter); + pcqueryobject->HandleOBFilter(); + break; + } + #endif if(pcqueryobject->m_isSelValid) { pcqueryobject->HandleOBFilter(); @@ -494,10 +543,12 @@ CQueryObject::FilterProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) { SetFocus(pcqueryobject->m_hwndFilter); } + pcqueryobject->PaintFilterWindow(pcqueryobject->m_hwndFilter); break; - case VK_DELETE: + case VK_DELETE: case VK_BACK: GetWindowText(pcqueryobject->m_hwndFilter, str, 64); + SendMessage(pcqueryobject->m_hwndFilter, EM_GETSEL, (WPARAM)&start,(LPARAM)&end); if(wcslen(str) && wcslen(str) == (end-start)) { @@ -557,9 +608,22 @@ void CALLBACK CQueryObject::OBFilterTimerProc(HWND hwnd, UINT message, UINT_PTR id, DWORD time) { CQueryObject *pcqueryobject = (CQueryObject*)GetWindowLongPtr(hwnd, GWLP_USERDATA); - KillTimer(hwnd, id); - +#ifndef COMMUNITY + wyWChar strTemp[10]; + if(pcqueryobject->m_isRegexChecked==wyTrue) + { + GetWindowText(pcqueryobject->m_hwndFilter, strTemp, 10); + if(!strTemp[0] ) + { + pcqueryobject->HandleOnEscapeOBFilter(); + pcqueryobject->HandleOBFilter(); + return; + } + else + return; + } +#endif if(!(pcqueryobject->m_isSelValid)) pcqueryobject->HandleOBFilter(); } @@ -573,6 +637,9 @@ CQueryObject::StCtrlProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) /*HBRUSH hbr = NULL;*/ MDIWindow *wnd = NULL; wyWChar str[70]; +#ifndef COMMUNITY + wyWChar strTemp[70]; +#endif /*HTREEITEM hti = NULL, htiSel = NULL;*/ memset(str, 0, sizeof(str)); @@ -588,17 +655,52 @@ CQueryObject::StCtrlProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) switch(HIWORD(wParam)) { case EN_UPDATE: - if(wnd->m_executing == wyFalse && !(pcqueryobject->m_isSelValid)) + if(wnd->m_executing == wyFalse && !(pcqueryobject->m_isSelValid)) { SetTimer(hwnd, OBFILTERTIMER, 200, CQueryObject::OBFilterTimerProc); - } + } +#ifndef COMMUNITY + pcqueryobject->PaintFilterWindow(pcqueryobject->m_hwndFilter); + SetCursor(LoadCursor(NULL, IDC_ARROW)); +#endif break; } break; - } - break; +#ifndef COMMUNITY + case IDC_REGEXFILTER: + switch(HIWORD(wParam)) + { + case BN_CLICKED: + BOOL checked = IsDlgButtonChecked(pcqueryobject->m_hwndStParent, IDC_REGEXFILTER) ; + /*BOOL checked = SendMessage((HWND)lParam, BM_GETCHECK, 0, 0);*/ + SetFocus(pcqueryobject->m_hwndFilter); + if (checked) + { + pcqueryobject->m_isRegexChecked=wyFalse; + CheckDlgButton(pcqueryobject->m_hwndStParent, IDC_REGEXFILTER, BST_UNCHECKED); + pcqueryobject->HandleOnEscapeOBFilter(); + + } + else + { + + pcqueryobject->m_isRegexChecked=wyTrue; + CheckDlgButton(pcqueryobject->m_hwndStParent, IDC_REGEXFILTER, BST_CHECKED); + //GetWindowText(pcqueryobject->m_hwndFilter, strTemp, 65); + //pcqueryobject->HandleOnEscapeOBFilter(); + pcqueryobject->HandleOBFilter(L"", wyFalse); + //SetWindowText(pcqueryobject->m_hwndFilter,strTemp); + pcqueryobject->HandleOBFilter(); + } + break; + } + break; +#endif + } + break; + case WM_CTLCOLORSTATIC: - if((HWND)lParam == pcqueryobject->m_hwndStMsg/* || (HWND)lParam == pcqueryobject->m_hwndStClear*/) + if((HWND)lParam == pcqueryobject->m_hwndStMsg /*|| (HWND)lParam == pcqueryobject->m_hwndStClear*/) { hdc = (HDC)wParam; SetBkMode(hdc, TRANSPARENT); @@ -606,13 +708,27 @@ CQueryObject::StCtrlProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) SetDCBrushColor(hdc, TreeView_GetBkColor(pcqueryobject->m_hwnd)); return (wyInt32)GetStockBrush(DC_BRUSH); } +#ifndef COMMUNITY + if((HWND)lParam == pcqueryobject->m_hwndRegexText) + { + hdc = (HDC)wParam; + SetBkMode(hdc, TRANSPARENT); + SetTextColor(hdc, TreeView_GetTextColor(pcqueryobject->m_hwnd)); + SetDCBrushColor(hdc, TreeView_GetBkColor(pcqueryobject->m_hwnd)); + return (wyInt32)GetStockBrush(DC_BRUSH); + } +#endif + break; + } return CallWindowProc(pcqueryobject->m_stWndProc, pcqueryobject->m_hwndStParent, message, wParam, lParam); } + + wyBool CQueryObject::SetFont() { @@ -671,6 +787,11 @@ CQueryObject::SetFont() SendMessage(m_hwnd, WM_SETFONT,(WPARAM)m_hfont, TRUE); SendMessage(m_hwndStMsg, WM_SETFONT, (WPARAM)m_hfont, TRUE); SendMessage(m_hwndFilter, WM_SETFONT, (WPARAM)m_hfont, TRUE); +#ifndef COMMUNITY + SendMessage(m_hwndRegex,WM_SETFONT,(WPARAM)m_hfont,TRUE); + SendMessage(m_hwndRegexText,WM_SETFONT,(WPARAM)m_hfont, TRUE); +#endif + //SetWindowFont(m_hwnd, m_hfont, TRUE); UpdateWindow(m_hwnd); UpdateWindow(m_hwndFilter); @@ -892,6 +1013,9 @@ CQueryObject::WndProc(HWND hwnd, UINT message, WPARAM wparam, LPARAM lparam) { SetFocus(pcqueryobject->m_hwnd); } +#ifndef COMMUNITY + pcqueryobject->PaintFilterWindow(pcqueryobject->m_hwndFilter); +#endif break; case VK_INSERT: pcqueryobject->ProcessInsert(); @@ -902,7 +1026,9 @@ CQueryObject::WndProc(HWND hwnd, UINT message, WPARAM wparam, LPARAM lparam) wyInt32 ret; ret = GetKeyState(VK_SHIFT); if(ret & 0x8000) + { pcqueryobject->ProcessDelete(wyTrue); + } else pcqueryobject->ProcessDelete(wyFalse); } @@ -988,6 +1114,7 @@ CQueryObject::Resize(wyBool isannouncements, wyBool isstart) RECT rcmain, rcvsplitter; wyInt32 ret; wyInt32 hpos, vpos, width, height, widthEditFilter, htmlh; +// wyInt32 widthRegexFilter; if(isannouncements && wnd->m_isanncreate == wyFalse) pcqueryvsplitter->Resize(wyTrue); @@ -1000,25 +1127,54 @@ CQueryObject::Resize(wyBool isannouncements, wyBool isstart) vpos = (m_height + 10) > 22 ? m_height + 10: 22; width = rcvsplitter.left-2; widthEditFilter = (width - 26) > 0 ? (width - 26) : 0; + + //widthRegexFilter= width < 200 ? width : (width-250); + //if(widthRegexFilter<=220) + //widthRegexFilter=150; + +#ifndef COMMUNITY + height = rcmain.bottom - (2 * vpos)-vpos-9; +#else height = rcmain.bottom - (2 * vpos) - 10; - htmlh = (wyInt32)(0.3 * height); +#endif + htmlh = (wyInt32)((0.3 * height)); htmlh+=2; - +#ifndef COMMUNITY + MoveWindow(m_hwndStParent, 2, 2, width, vpos * 3 + 7, TRUE); + MoveWindow(m_hwndStMsg, 6, 4, width, vpos - 5, TRUE); + //MoveWindow(m_hwndStMsg, 6, 4, width - 28, vpos - 5, TRUE); + MoveWindow(m_hwndFilter, 2, vpos, widthEditFilter+22, vpos - 2, TRUE); + //MoveWindow(m_hwndRegex, 2, (vpos*2)+5, widthEditFilter-1, vpos-2, TRUE ); + MoveWindow(m_hwndRegex, 2, (vpos*2)+1, 20, vpos+1, TRUE ); + MoveWindow(m_hwndRegexText,24,(vpos*2)+1+5, widthEditFilter-22, vpos-2, TRUE); +#else MoveWindow(m_hwndStParent, 2, 2, width, vpos * 2 + 6, TRUE); MoveWindow(m_hwndStMsg, 6, 4, width - 28, vpos - 5, TRUE); - - MoveWindow(m_hwndFilter, 2, vpos, widthEditFilter + 22, vpos - 2, TRUE); + MoveWindow(m_hwndFilter, 2, vpos, widthEditFilter + 22, vpos - 2, TRUE); +#endif if(!isannouncements) +#ifndef COMMUNITY + VERIFY(ret = MoveWindow(m_hwnd, hpos, (vpos * 3) + 7, width, height, TRUE)); +#else VERIFY(ret = MoveWindow(m_hwnd, hpos, (vpos * 2) + 8, width, height, TRUE)); +#endif else +#ifndef COMMUNITY + VERIFY(ret = MoveWindow(m_hwnd, hpos, (vpos * 3) + 10, width, height - htmlh, TRUE)); +#else VERIFY(ret = MoveWindow(m_hwnd, hpos, (vpos * 2) + 8, width, height - htmlh, TRUE)); - +#endif + +#ifndef COMMUNITY + InvalidateRect(m_hwndRegex, NULL, TRUE); + InvalidateRect(m_hwndRegexText, NULL, TRUE); +#endif InvalidateRect(m_hwndStMsg, NULL, TRUE); + InvalidateRect(m_hwndFilter, NULL, TRUE); InvalidateRect(m_hwnd, NULL, TRUE); - InvalidateRect(m_hwndFilter, NULL, TRUE); - + _ASSERT(ret != 0); } @@ -3186,7 +3342,7 @@ CQueryObject::OnSelChanged(HTREEITEM hitem, LPNMTREEVIEW pnmtv) { HTREEITEM hitemtemp, hroot, hparent; wyInt32 image, size, nodecount; - wyInt32 nid[] = { ID_OPEN_COPYDATABASE, ID_OBJECT_CREATESCHEMA, ID_EXPORT_AS, ID_OBJECT_COPYTABLE, ID_OBJECT_INSERTUPDATE, ID_OBJECT_TABLEEDITOR, ID_OBJECT_MAINMANINDEX, ACCEL_MANREL }; + wyInt32 nid[] = { ID_OPEN_COPYDATABASE, /*ID_DATABASE_REBUILDTAGS, vgladcode*/ ID_OBJECT_CREATESCHEMA, ID_EXPORT_AS, ID_OBJECT_COPYTABLE, ID_OBJECT_INSERTUPDATE, ID_OBJECT_TABLEEDITOR, ID_OBJECT_MAINMANINDEX, ACCEL_MANREL }; wyInt32 nidd[] = { ID_EXPORT_AS, ID_OBJECT_COPYTABLE, ID_OBJECT_INSERTUPDATE, ID_OBJECT_TABLEEDITOR, ID_OBJECT_MAINMANINDEX, ACCEL_MANREL, ID_OBJECT_COPYTABLE}; wyInt32 viewdata[] = {ID_OBJECT_VIEWDATA, ID_TABLE_OPENINNEWTAB}; MDIWindow *wnd = GetActiveWin(); @@ -7673,6 +7829,8 @@ CQueryObject::OnWmCommand(WPARAM wparam) InvalidateRect(m_hwndStParent, NULL, TRUE); InvalidateRect(m_hwndStMsg, NULL, TRUE); + InvalidateRect(m_hwndRegexText, NULL, TRUE); + InvalidateRect(m_hwndRegex, NULL, TRUE); /* InvalidateRect(m_hwndStClear, NULL, TRUE);*/ } break; @@ -7938,6 +8096,7 @@ CQueryObject::SelectTableEngineMenuItem(MDIWindow *wnd, HMENU hmenuhandle, wyInt CheckMenuItem(hsubmenu, index, MF_BYPOSITION | MF_UNCHECKED); } } + wyBool CQueryObject::OpenTable() { @@ -8010,9 +8169,13 @@ CQueryObject::HandleOBFilter(wyWChar *text, wyBool isAutoCmplt) HTREEITEM hti = NULL; wyWChar str[70], str1[70]; wyWChar *temp = NULL; - + //isAutoCmplt=wyFalse; ::memset(str, 0, sizeof(str)); ::memset(str1, 0, sizeof(str1)); +#ifndef COMMUNITY + if(m_isRegexChecked==wyTrue) + isAutoCmplt=wyFalse; +#endif if(text) { @@ -8067,9 +8230,16 @@ CQueryObject::HandleOBFilter(wyWChar *text, wyBool isAutoCmplt) TreeView_SetItem(m_hwnd, &tvi); wcscpy(str1, m_prevString.GetAsWideChar()); - _wcslwr_s(str1, 65); - _wcslwr_s(str, 65); - +#ifndef COMMUNITY + if( m_isRegexChecked != wyTrue ) + { + _wcslwr_s(str1, 65); + _wcslwr_s(str, 65); + } +#else + _wcslwr_s(str1, 65); + _wcslwr_s(str, 65); +#endif temp = wcsstr(str1, str); if(temp == str1) { @@ -8124,6 +8294,11 @@ CQueryObject::FilterTreeView(wyWChar str[]) HTREEITEM nexthti = NULL; HTREEITEM hti; TVITEM tvi; +#ifndef COMMUNITY + pcre* pregex; + const wyChar *str11; + wyInt32 offset,ovector[12]; +#endif wyWChar objName[200], *temp = NULL, stri[200]; OBDltElementParam *lparamValue = NULL; wyElem *tempDlt = NULL; @@ -8141,7 +8316,13 @@ CQueryObject::FilterTreeView(wyWChar str[]) lparamValue = (OBDltElementParam *)tvi.lParam; wcscpy(lparamValue->m_filterText, m_strOrig); hti = TreeView_GetChild(m_hwnd, hti); - +#ifndef COMMUNITY + wyString ttt; + ttt.SetAs(str); + //ttt.SetAs("(?c)T+"); /*PCRE_CASELESS*//*PCRE_NO_AUTO_CAPTURE*/PCRE_MULTILINE +if(m_isRegexChecked) +pregex = pcre_compile(ttt.GetString(),PCRE_NO_AUTO_CAPTURE,&str11,&offset,NULL); +#endif while(hti) { tvi.hItem = hti; @@ -8153,26 +8334,50 @@ CQueryObject::FilterTreeView(wyWChar str[]) wcscpy(stri, tvi.pszText); _wcslwr_s(stri, 200); - temp = wcsstr(stri, str); - - if(!temp) - { - nexthti = TreeView_GetNextSibling(m_hwnd, hti); - tempDlt = new DltElement(tvi); - lparamValue->m_deleteList.Insert(tempDlt); - OnFilterDeleteItem(hti, tempDlt); - TreeView_DeleteItem(m_hwnd, hti); - hti = nexthti; - } - else - { - if(temp == stri && (wcscmp(tvi.pszText, m_matchString.GetAsWideChar()) < 0 || !m_matchString.GetLength())) - { - m_matchString.SetAs(tvi.pszText); - } - - hti = TreeView_GetNextSibling(m_hwnd, hti); - } + temp = wcsstr(stri, str); +#ifndef COMMUNITY + wyString tt; + tt.SetAs(stri); + if(m_isRegexChecked) + { + int check=pcre_exec(pregex, NULL, tt.GetString(), tt.GetLength(), offset, PCRE_NO_UTF8_CHECK, ovector, sizeof(ovector) / sizeof(wyInt32)); + if(check!=1) + { + nexthti = TreeView_GetNextSibling(m_hwnd, hti); + tempDlt = new DltElement(tvi); + lparamValue->m_deleteList.Insert(tempDlt); + OnFilterDeleteItem(hti, tempDlt); + TreeView_DeleteItem(m_hwnd, hti); + hti = nexthti; + } + else + { + m_matchString.SetAs(tvi.pszText); + hti = TreeView_GetNextSibling(m_hwnd, hti); + } + } + else +#endif + { + if(!temp) + { + nexthti = TreeView_GetNextSibling(m_hwnd, hti); + tempDlt = new DltElement(tvi); + lparamValue->m_deleteList.Insert(tempDlt); + OnFilterDeleteItem(hti, tempDlt); + TreeView_DeleteItem(m_hwnd, hti); + hti = nexthti; + } + else + { + if(temp == stri && (wcscmp(tvi.pszText, m_matchString.GetAsWideChar()) < 0 || !m_matchString.GetLength())) + { + m_matchString.SetAs(tvi.pszText); + } + hti = TreeView_GetNextSibling(m_hwnd, hti); + } + + } } } diff --git a/src/OtherDialogs.cpp b/src/OtherDialogs.cpp index 9f3944b..b5a93f3 100644 --- a/src/OtherDialogs.cpp +++ b/src/OtherDialogs.cpp @@ -2517,7 +2517,7 @@ CCopyTable::GetSelectStmt(wyString &select, wyString &query_for_virtuality,wyWCh query.Sprintf("Show create table `%s`.`%s`",m_db.GetString(), m_table.GetString()); myres1 = ExecuteAndGetResult(GetActiveWin(), m_tunnel, m_mysql, query); - if(!myres) + if(!myres1) { ShowMySQLError(m_hwnd, m_tunnel, m_mysql, query.GetString()); return wyFalse; diff --git a/src/TabTable.cpp b/src/TabTable.cpp index 2d2c375..d599586 100644 --- a/src/TabTable.cpp +++ b/src/TabTable.cpp @@ -116,10 +116,10 @@ TabTable::Refresh() wyInt32 diffdb = 0, difftable = 0; if(!m_data || - (m_pmdi->m_pcqueryobject->IsSelectionOnTable() == wyTrue && - ((diffdb = m_data->m_db.Compare(m_pmdi->m_pcqueryobject->m_seldatabase)) || + (m_pmdi->m_pcqueryobject->IsSelectionOnTable() == wyTrue && + ((diffdb = m_data->m_db.Compare(m_pmdi->m_pcqueryobject->m_seldatabase)) || (difftable = m_data->m_table.Compare(m_pmdi->m_pcqueryobject->m_seltable)))) || - IsRefreshTableData() == wyTrue) + IsRefreshTableData() == wyTrue) { if(m_data) {