From 3b036247490bb9a98384e45f24f4b1aa7cbbb12c Mon Sep 17 00:00:00 2001 From: vijay singh Date: Wed, 1 Mar 2017 22:04:17 +0530 Subject: [PATCH] SQLyog 12.4.1 GA --- include/ExportAsSQL.h | 12 ++++++ include/FrameWindowHelper.h | 6 +-- include/SQLyog.rc | 23 +++++------ include/resource.h | 1 + src/CalendarCtrl.cpp | 77 ++++++++++++++++++++++++++++++------- src/EditorProcs.cpp | 18 +++++++-- src/EditorQuery.cpp | 20 ++++++++-- src/ExportAsSQL.cpp | 72 +++++++++++++++++++++++++++++++++- src/ExportBatch.cpp | 14 ++++++- src/FrameWindow.cpp | 40 ++++++++++++++----- src/FrameWindowHelper.cpp | 24 +++++++++++- src/GUIHelper.cpp | 6 ++- src/MDIWindow.cpp | 14 +++++++ src/OtherDialogs.cpp | 7 ++-- src/UpgradeCheck.cpp | 4 ++ 15 files changed, 283 insertions(+), 55 deletions(-) diff --git a/include/ExportAsSQL.h b/include/ExportAsSQL.h index d6aad4c..abd3244 100644 --- a/include/ExportAsSQL.h +++ b/include/ExportAsSQL.h @@ -126,6 +126,7 @@ typedef struct __schdextra_options wyBool m_flushslave; wyBool m_autocommit; wyBool m_locktablewrite; + wyBool m_hextoblob; wyBool m_singletransaction; //single transaction wyBool m_struconly; wyBool m_completeinsert; @@ -486,6 +487,9 @@ class MySQLDump /// Flag to set fk_checks = 0 and 1 wyBool m_setfkchecks; + /// Flag to set hex to blob conversion to 0 or 1 + wyBool m_sethexblob; + ///Flag to set all databases wyBool m_alldb; @@ -956,6 +960,14 @@ class MySQLDump */ void SetFKChecks (wyBool flag); + /// Sets the hex to blob in export dialog + /** + @param flag : IN set hex to blob ? + @returns void + */ + + void SetHexBlob (wyBool flag); + /// Enables or disables the file append mode /** @param val : IN Enabled or disabled ? diff --git a/include/FrameWindowHelper.h b/include/FrameWindowHelper.h index 24e9490..1d9a2d0 100644 --- a/include/FrameWindowHelper.h +++ b/include/FrameWindowHelper.h @@ -396,9 +396,9 @@ All Files(*.*)\0*.*\0" #define DEFAULT_NO_TABLE _("(Read Only)") #define DEFAULT_NO_TABLEW _(L"(Read Only)") #define DEFAULT_READONLY_RESULT _(L"Read-only result") -#define BUYLABEL "Buy SQLyog" +#define BUYLABEL "click here" #if IS_FROM_WINDOWS_STORE == 1 -#define BUYURL "https://www.webyog.com/product/sqlyogpricing/?utm_source=sqlyogapp&utm_medium=referral&utm_campaign=windowsstore" +#define BUYURL "https://www.webyog.com/product/sqlyog/?utm_source=sqlyogapp&utm_medium=referral&utm_campaign=windowsstore" #else #define BUYURL "http://www.webyog.com/product/sqlyogpricing" #endif @@ -414,7 +414,7 @@ All Files(*.*)\0*.*\0" #define SUPPORTURL "https://www.webyog.com/customer?ref=sqlyog" #if IS_FROM_WINDOWS_STORE == 1 -#define BUYENT "https://www.webyog.com/product/sqlyogpricing/?utm_source=sqlyogapp&utm_medium=referral&utm_campaign=windowsstore" +#define BUYENT "https://www.webyog.com/product/sqlyog/?utm_source=sqlyogapp&utm_medium=referral&utm_campaign=windowsstore" #else #define BUYENT "http://www.webyog.com/product/sqlyogpricing" #endif diff --git a/include/SQLyog.rc b/include/SQLyog.rc index 9dfa208..04224fc 100644 --- a/include/SQLyog.rc +++ b/include/SQLyog.rc @@ -972,7 +972,7 @@ BEGIN CONTROL 662,IDC_STATIC,"Static",SS_BITMAP | SS_CENTERIMAGE,7,9,100,220 END -IDD_EXPORTDATA DIALOGEX 150, 50, 391, 339 +IDD_EXPORTDATA DIALOGEX 150, 50, 391, 378 STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | DS_CENTER | WS_POPUP | WS_CAPTION | WS_SYSMENU CAPTION " SQL Dump" FONT 8, "MS Shell Dlg", 0, 0, 0x1 @@ -982,7 +982,7 @@ BEGIN LTEXT "Database na&me",IDC_TEXT2,6,34,51,8 COMBOBOX IDC_EXPORT_DBCOMBO,6,47,128,137,CBS_DROPDOWNLIST | CBS_SORT | WS_VSCROLL | WS_GROUP | WS_TABSTOP LTEXT "&Object(s)",IDC_TEXT4,6,62,54,8 - CONTROL "",IDC_EXPORTTREE,"SysTreeView32",TVS_HASBUTTONS | TVS_HASLINES | TVS_LINESATROOT | TVS_CHECKBOXES | WS_BORDER | WS_HSCROLL | WS_GROUP | WS_TABSTOP,6,72,172,212 + CONTROL "",IDC_EXPORTTREE,"SysTreeView32",TVS_HASBUTTONS | TVS_HASLINES | TVS_LINESATROOT | TVS_CHECKBOXES | WS_BORDER | WS_HSCROLL | WS_GROUP | WS_TABSTOP,6,74,172,234 GROUPBOX "",IDC_GROUP1,142,2,243,26 CONTROL "Str&ucture only",IDC_CHK_STRUCTURE,"Button",BS_AUTORADIOBUTTON | WS_TABSTOP,153,12,57,11 CONTROL "&Data only",IDC_CHK_DATAONLY,"Button",BS_AUTORADIOBUTTON | WS_TABSTOP,232,12,43,11 @@ -994,7 +994,7 @@ BEGIN CONTROL "Loc&k tables for read",IDC_CHK_LOCKFORREAD,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,202,79,97,12 CONTROL "Flush lo&gs before dump",IDC_CHK_FLUSHLOGS,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,202,91,87,12 CONTROL "&Single transaction",IDC_SINGLE_TRANSACTION,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,202,103,104,12 - GROUPBOX "Options written to file",IDC_GROUP3,183,121,199,119 + GROUPBOX "Options written to file",IDC_GROUP3,183,118,199,139 CONTROL "Include ""USE d&atabase"" statement",IDC_CHK_USEDBNAME, "Button",BS_AUTOCHECKBOX | WS_TABSTOP,202,132,124,11 CONTROL "Include ""&CREATE database"" statement",IDC_CHK_CREATEDB, @@ -1009,15 +1009,16 @@ BEGIN CONTROL "Ignore DEFINER",IDC_CHK_DEFINER,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,202,216,105,11 CONTROL "Include version information in backup file",IDC_CHK_VERSION, "Button",BS_AUTOCHECKBOX | WS_TABSTOP,202,228,168,11 - GROUPBOX "Advance options",IDC_GROUP4,186,242,199,43 - CONTROL "Prefix with Timestamp",IDC_TIMESTAMP_PREFIX,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,202,250,87,12 - CONTROL "File per object",IDC_FILE_TABLE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,202,263,104,12 - CONTROL "",IDC_PROGRESS,"msctls_progress32",WS_BORDER,6,293,379,14,WS_EX_TRANSPARENT + GROUPBOX "Advance options",IDC_GROUP4,184,263,199,41 + CONTROL "Prefix with Timestamp",IDC_TIMESTAMP_PREFIX,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,202,274,87,12 + CONTROL "File per object",IDC_FILE_TABLE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,202,288,104,12 + CONTROL "",IDC_PROGRESS,"msctls_progress32",WS_BORDER,6,323,379,14,WS_EX_TRANSPARENT LTEXT "",IDC_MESSAGE2,6,307,249,18 - DEFPUSHBUTTON "&Export",IDOK,280,311,50,15 - PUSHBUTTON "C&lose",IDCANCEL,335,311,50,15 - PUSHBUTTON "Do&ne",IDDONE,335,311,50,15,NOT WS_VISIBLE | WS_DISABLED + DEFPUSHBUTTON "&Export",IDOK,280,345,50,15 + PUSHBUTTON "C&lose",IDCANCEL,335,345,50,15 + PUSHBUTTON "Do&ne",IDDONE,335,346,50,15,NOT WS_VISIBLE | WS_DISABLED LTEXT "Grip",IDC_EXPDAT_GRIP,215,310,14,8 + CONTROL "Convert BLOB to HEX",IDC_CHK_HEXBLOB,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,202,240,168,11 END IDD_ABOUTDIALOG DIALOGEX 125, 125, 334, 107 @@ -2490,7 +2491,7 @@ BEGIN IDD_EXPORTDATA, DIALOG BEGIN - BOTTOMMARGIN, 280 + BOTTOMMARGIN, 319 END IDD_ABOUTDIALOG, DIALOG diff --git a/include/resource.h b/include/resource.h index 6f2d3ec..a1f7565 100644 --- a/include/resource.h +++ b/include/resource.h @@ -507,6 +507,7 @@ #define IDC_CHK_VERSION 1096 #define IDC_ONEROW 1097 #define IDC_NULLREPLACEBY 1098 +#define IDC_CHK_HEXBLOB 1098 #define IDC_OBFONT 1099 #define IDC_NULLCHAR 1099 #define IDC_COMBO 1101 diff --git a/src/CalendarCtrl.cpp b/src/CalendarCtrl.cpp index 6195d62..596d8bf 100644 --- a/src/CalendarCtrl.cpp +++ b/src/CalendarCtrl.cpp @@ -241,6 +241,7 @@ wyInt32 CALLBACK CalendarCtrl::CalendarProc(HWND hwnd, UINT message, WPARAM wPar case WM_LBUTTONDOWN: SendMessage(pcc->m_hwnd, WM_NEXTDLGCTL, (WPARAM)GetDlgItem(pcc->m_hwnd,IDC_DATETIMEPICKER1), TRUE); SetFocus(GetDlgItem(pcc->m_hwnd,IDC_DATETIMEPICKER1)); + EnableWindow(GetDlgItem(pcc->m_hwnd,IDOK), TRUE); break; } return pcc->m_calproc(hwnd,message,wParam,lParam); @@ -294,37 +295,77 @@ CalendarCtrl::ConvertCtrlValues() void CalendarCtrl::InitCalendarValues() { + wyInt32 iszerodateflag=0; wyString temp,temp2; m_row = CustomGrid_GetCurSelRow(m_hwndparent); m_col = CustomGrid_GetCurSelCol(m_hwndparent); wyChar tempchar[5]= ""; - - - if(m_orgdata.Substr(0,4)==NULL) - strcpy(tempchar,"0"); + wyString year,month,day; + wyChar * tempstr = NULL; + +// Year Section + tempstr = m_orgdata.Substr(0,4); + if(tempstr !=NULL) + { + year.SetAs(tempstr); + if(year.CompareI("0000")==0) + { + strcpy(tempchar,"1970"); + iszerodateflag=-1; + } + else + strcpy(tempchar,year.GetString()); + } else - strcpy(tempchar,m_orgdata.Substr(0,4)); + { + strcpy(tempchar,"0"); + } temp.Add(tempchar); m_datetime.wYear=temp.GetAsUInt32(); temp.Clear(); - - - if(m_orgdata.Substr(5,2)==NULL) - strcpy(tempchar,"0"); + +// Month Section + tempstr = m_orgdata.Substr(5,2); + if(tempstr !=NULL) + { + month.SetAs(tempstr); + if(month.CompareI("00")==0) + { + strcpy(tempchar,"01"); + iszerodateflag=-1; + } + else + strcpy(tempchar,month.GetString()); + } else - strcpy(tempchar,m_orgdata.Substr(5,2)); + { + strcpy(tempchar,"0"); + } temp.Add(tempchar); m_datetime.wMonth=temp.GetAsUInt32(); temp.Clear(); +// Date Section - if(m_orgdata.Substr(8,2)==NULL) - strcpy(tempchar,"0"); + tempstr = m_orgdata.Substr(8,2); + if(tempstr !=NULL) + { + day.SetAs(tempstr); + if(day.CompareI("00")==0) + { + strcpy(tempchar,"01"); + iszerodateflag=-1; + } + else + strcpy(tempchar,day.GetString()); + } else - strcpy(tempchar,m_orgdata.Substr(8,2)); + { + strcpy(tempchar,"0"); + } temp.Add(tempchar); m_datetime.wDay=temp.GetAsUInt32(); temp.Clear(); - + if(m_orgdata.Substr(11,2)==NULL) strcpy(tempchar,"0"); @@ -354,6 +395,13 @@ CalendarCtrl::InitCalendarValues() m_datetime.wMilliseconds=0; + + /* to check if the user has entered a date containg year as zero or month as zero or day as zero*/ + + if(iszerodateflag==-1){ + EnableWindow(GetDlgItem(m_hwnd, IDOK), FALSE); + } + MonthCal_SetCurSel(GetDlgItem(m_hwnd,IDC_MONTHCALENDAR1), &m_datetime); if(!m_isDate) { @@ -524,6 +572,7 @@ CalendarCtrl::OnClickNow() wyString temp; SYSTEMTIME seltime; GetLocalTime(&seltime); + EnableWindow(GetDlgItem(m_hwnd, IDOK), TRUE); MonthCal_SetCurSel(GetDlgItem(m_hwnd,IDC_MONTHCALENDAR1), &seltime); DateTime_SetFormat(GetDlgItem(m_hwnd,IDC_DATETIMEPICKER1), L"HH:mm:ss"); DateTime_SetSystemtime(GetDlgItem(m_hwnd,IDC_DATETIMEPICKER1),GDT_VALID, &seltime); diff --git a/src/EditorProcs.cpp b/src/EditorProcs.cpp index b19c398..38962db 100644 --- a/src/EditorProcs.cpp +++ b/src/EditorProcs.cpp @@ -151,12 +151,22 @@ EditorProcs::ExecuteAllQuery(wyInt32 * stop) GetCompleteText(query); wyChar *tmp = AllocateBuff(query.GetLength() + 1); strcpy(tmp,query.GetString()); - wyChar *tmp1 = AllocateBuff(query.GetLength() * 2 + 1); - AddCRToLF(tmp, tmp1); + wyString temp; + /* + All stored procedures created via workbench will contain /n as new line character between BEGIN and END which will + disturb the formatting when altered via SQLyog hence changing all \n to \r\n and then changing \r\r back to \r + Previously this was done via function AddCRToLF/ChangeCRtoLF + */ + temp.SetAs(tmp); + temp.FindAndReplace("\n","\r\n"); + temp.FindAndReplace("\r\r","\r"); + //wyChar *tmp1 = AllocateBuff(query.GetLength() * 2 + 1); + //AddCRToLF(tmp, tmp1); //ChangeCRToLF(tmp); - query.SetAs(tmp1); + //query.SetAs(tmp1); + query.SetAs(temp.GetString()); free(tmp); - free(tmp1); + //free(tmp1); /* set the flag to executing */ wnd->SetExecuting(wyTrue); *stop = 0; diff --git a/src/EditorQuery.cpp b/src/EditorQuery.cpp index 292080a..357deff 100644 --- a/src/EditorQuery.cpp +++ b/src/EditorQuery.cpp @@ -83,7 +83,8 @@ EditorQuery::ExecuteAllQuery(wyInt32 *stop) wyString query; wyChar *tmp; wyBool selquery = wyFalse; - + wyString temp; + MDIWindow *wnd; HWND hwnd; TabMgmt *ptabmgmt = NULL; @@ -131,9 +132,20 @@ EditorQuery::ExecuteAllQuery(wyInt32 *stop) SendMessage(m_hwnd, SCI_GETSELTEXT, 0, (LPARAM)tmp); } // Commented Because to Solve an Extra '\n' appending bug in http://www.webyog.com/forums//index.php?showtopic=3556 - ChangeCRToLF(tmp); - query.SetAs(tmp); - free(tmp); + // ChangeCRToLF(tmp); + //query.SetAs(tmp); + + temp.SetAs(tmp); + /* + All stored procedures created via workbench will contain /n as new line character between BEGIN and END which will + disturb the formatting when altered via SQLyog hence changing all \n to \r\n and then changing \r\r back to \r + Previously this was done via function AddCRTOLF in editorproc which disturbed the schema when executed via query editor instead of + EditorProc + */ + temp.FindAndReplace("\n","\r\n"); + temp.FindAndReplace("\r\r","\r"); + query.SetAs(temp.GetString()); + free(tmp); /* set the flag to executing */ wnd->SetExecuting(wyTrue); diff --git a/src/ExportAsSQL.cpp b/src/ExportAsSQL.cpp index 34e5668..2612c1f 100644 --- a/src/ExportAsSQL.cpp +++ b/src/ExportAsSQL.cpp @@ -382,6 +382,14 @@ MySQLDump::SetFKChecks(wyBool val) return; } + +void +MySQLDump::SetHexBlob(wyBool val) +{ + m_sethexblob = val; + return; +} + void MySQLDump::SetFlushSlave(wyBool val) { @@ -3763,7 +3771,11 @@ MySQLDump::PrintFieldValue(wyString * buffer, MYSQL_RES *res, MYSQL_ROW row, wyI wyInt32 *lengths; wyInt32 to, count, firstcol =0; MYSQL_FIELD *field; - + int isBlob, i, len; + wyString blob_temp; + wyString hex_tmp; + wyString hex_data; + wyUInt32 hex_datalen; lengths = (wyInt32 *)sja_mysql_fetch_lengths(m_tunnel, res); for(count = 0; count < fcount; count++) @@ -3784,7 +3796,56 @@ MySQLDump::PrintFieldValue(wyString * buffer, MYSQL_RES *res, MYSQL_ROW row, wyI else if(!IS_NUM_FIELD(field)) { - + if(m_tunnel->IsTunnel()) + isBlob= (field->type == MYSQL_TYPE_BIT || + field->type == MYSQL_TYPE_STRING || + field->type == MYSQL_TYPE_VAR_STRING || + field->type == MYSQL_TYPE_VARCHAR || + field->type == MYSQL_TYPE_BLOB || + field->type == MYSQL_TYPE_LONG_BLOB || + field->type == MYSQL_TYPE_MEDIUM_BLOB || + field->type == MYSQL_TYPE_TINY_BLOB) ? 1 : 0; + else + isBlob= (field->charsetnr == 63 && + (field->type == MYSQL_TYPE_BIT || + field->type == MYSQL_TYPE_STRING || + field->type == MYSQL_TYPE_VAR_STRING || + field->type == MYSQL_TYPE_VARCHAR || + field->type == MYSQL_TYPE_BLOB || + field->type == MYSQL_TYPE_LONG_BLOB || + field->type == MYSQL_TYPE_MEDIUM_BLOB || + field->type == MYSQL_TYPE_TINY_BLOB)) ? 1 : 0; + + if(m_sethexblob && isBlob) + { + hex_datalen=lengths[count]+1; + hex_data.SetAs(row[count]); + if(hex_datalen==1) + { + buffer->AddSprintf("''"); + firstcol++; + continue; + } + len=hex_data.GetLength(); + blob_temp.SetAs(hex_data.GetString()); + buffer->AddSprintf("0x"); + hex_tmp.SetAs(""); + for (i = 0; i < len; i++) + { + if((i+3) < len && blob_temp.GetCharAt(i) == '\\' && blob_temp.GetCharAt(i+1)=='r' && blob_temp.GetCharAt(i+2)=='\\' && blob_temp.GetCharAt(i+3) == 'n') + { + hex_tmp.Add("0D0A"); + i += 3; + } + else + { + hex_tmp.AddSprintf("%02x",blob_temp.GetCharAt(i)); + } + } + buffer->AddSprintf(hex_tmp.GetString()); + firstcol ++; + continue; + } /*check wether the fieild value is a string if it is string make it quoted */ @@ -4457,7 +4518,14 @@ wyBool MySQLDump::WriteBufferToFile(wyString * buffer, wyBool isforce) { wyInt32 ret; + /* + buffer->FindAndReplace("\r\n","\n"); added to solve community issue 2128 + 0xOD is additionally attached at every end of lines. + Reason : fprintf handles \n as \r\n when working in windows and simply as \n when in UNIX + hence \r\n will change to \r\r\n + */ + buffer->FindAndReplace("\r\n","\n"); //If buffer size is more than 8K or dumping end has reached , write data to file if((isforce == wyTrue && buffer->GetLength()) || buffer->GetLength() >= SIZE_8K) { diff --git a/src/ExportBatch.cpp b/src/ExportBatch.cpp index a250755..ba8afc1 100644 --- a/src/ExportBatch.cpp +++ b/src/ExportBatch.cpp @@ -385,7 +385,9 @@ ExportBatch::EnableDisableOptions(wyInt32 id) EnableWindow(GetDlgItem(m_hwnd, IDC_CHK_CREATEDB), FALSE); EnableWindow(GetDlgItem(m_hwnd, IDC_CHK_DROPOBJECT), FALSE); EnableWindow(GetDlgItem(m_hwnd, IDC_CHK_DEFINER), FALSE); + EnableWindow(GetDlgItem(m_hwnd, IDC_CHK_HEXBLOB), TRUE); EnableWindow(GetDlgItem(m_hwnd, IDC_BULKINSERT), TRUE); + //If Bulk Insert is Checked then enable "One Row Per line option" if(BST_CHECKED == SendMessage(GetDlgItem(m_hwnd, IDC_BULKINSERT), BM_GETCHECK, 0, 0)) EnableWindow(GetDlgItem(m_hwnd, IDC_ONEROW), TRUE); @@ -413,6 +415,7 @@ ExportBatch::EnableDisableOptions(wyInt32 id) EnableWindow(GetDlgItem(m_hwnd, IDC_CHK_CREATEDB), TRUE); EnableWindow(GetDlgItem(m_hwnd, IDC_CHK_DROPOBJECT), TRUE); EnableWindow(GetDlgItem(m_hwnd, IDC_CHK_DEFINER), TRUE); + EnableWindow(GetDlgItem(m_hwnd, IDC_CHK_HEXBLOB), FALSE); } else @@ -446,6 +449,7 @@ ExportBatch::EnableDisableOptions(wyInt32 id) EnableWindow(GetDlgItem(m_hwnd, IDC_CHK_DROPOBJECT), TRUE); EnableWindow(GetDlgItem(m_hwnd, IDC_CHK_LOCKAROUNDINSERT), TRUE); EnableWindow(GetDlgItem(m_hwnd, IDC_CHK_DEFINER), TRUE); + EnableWindow(GetDlgItem(m_hwnd, IDC_CHK_HEXBLOB), TRUE); } } break; @@ -814,7 +818,7 @@ ExportBatch::HandleDlgPersistance(HWND hwnd) m_p->Add(hwnd, IDC_ONEROW, "OneRowPerline", "1", CHECKBOX); m_p->Add(hwnd, IDC_SINGLE_TRANSACTION, "SingleTransaction", "0", CHECKBOX); m_p->Add(hwnd, IDC_CHK_VERSION, "Version", "1", CHECKBOX); - + m_p->Add(hwnd, IDC_CHK_HEXBLOB, "Hexblob", "0", CHECKBOX); return; } @@ -1597,6 +1601,11 @@ ExportBatch::SetOtherValues(MySQLDump *dump) dump->SetDefiner(wyTrue); else dump->SetDefiner(wyFalse); + + if(BST_CHECKED == SendMessage(GetDlgItem(m_hwnd, IDC_CHK_HEXBLOB), BM_GETCHECK, 0, 0)) + dump->SetHexBlob(wyTrue); + else + dump->SetHexBlob(wyFalse); if(BST_CHECKED == SendMessage(GetDlgItem(m_hwnd, IDC_ONEROW), BM_GETCHECK, 0, 0)) dump->SetOneRowPerLine(wyTrue); @@ -1637,7 +1646,7 @@ ExportBatch::EnableDlgWindows(bool state) IDC_CHK_USEDBNAME, IDC_CHK_DROPTABLE, IDC_CHK_CREATEDB, IDC_CHK_LOCKFORREAD, IDC_CHK_FLUSHLOGS, IDC_CHK_LOCKAROUNDINSERT, IDC_SETUNIQUE, IDC_BULKINSERT,IDC_ONEROW,IDC_SINGLE_TRANSACTION, IDCANCEL, IDC_CHK_DROPPROCEDURES, IDC_CHK_DROPVIEWS, - IDC_CHK_DROPFUNCTIONS, IDC_CHK_DROPTRIGGERS, IDC_CHK_DEFINER, IDC_CHK_VERSION, IDC_TIMESTAMP_PREFIX, IDC_FILE_TABLE + IDC_CHK_DROPFUNCTIONS, IDC_CHK_DROPTRIGGERS, IDC_CHK_DEFINER, IDC_CHK_VERSION, IDC_CHK_HEXBLOB,IDC_TIMESTAMP_PREFIX, IDC_FILE_TABLE }; wyInt32 i, count; @@ -1991,6 +2000,7 @@ ExportBatch::GetCtrlRects() IDC_CHK_DROPOBJECT, 0, 0, IDC_CHK_DEFINER, 0, 0, IDC_CHK_VERSION, 0, 0, + IDC_CHK_HEXBLOB, 0, 0, IDC_GROUP4, 0, 0, IDC_TIMESTAMP_PREFIX, 0, 0, IDC_FILE_TABLE, 0, 0, diff --git a/src/FrameWindow.cpp b/src/FrameWindow.cpp index 68414a6..55473cb 100644 --- a/src/FrameWindow.cpp +++ b/src/FrameWindow.cpp @@ -1402,7 +1402,7 @@ FrameWindow::WndProc(HWND hwnd, UINT message, WPARAM wparam, LPARAM lparam) { PostMessage(pcmainwin->m_hwndrestorestatus, UM_CLOSE_RESTORE_STATUS, 0, 0); KillTimer(hwnd, CONRESTORE_TIMER); - if(pGlobals->m_pcquerywnd !=NULL) + if(pGlobals->m_pcquerywnd !=NULL && pGlobals->m_pcquerywnd->m_pcqueryobject!=NULL) { if(pGlobals->m_database.GetLength()) { @@ -1933,7 +1933,11 @@ FrameWindow::ToolbarWndProc(HWND hwnd, UINT message, WPARAM wparam, LPARAM lpara prevbk = SetBkMode(lpdis->hDC, TRANSPARENT); prevobj = SelectObject(lpdis->hDC, pGlobals->m_pcmainwin->m_trialbuyfont); SetTextColor(lpdis->hDC, RGB(255, 255, 255)); +#if IS_FROM_WINDOWS_STORE == 1 + prevcolor = DrawText(lpdis->hDC, _(L"Visit Us"), -1, &lpdis->rcItem, DT_CENTER | DT_SINGLELINE | DT_VCENTER ); +#else prevcolor = DrawText(lpdis->hDC, _(L"BUY"), -1, &lpdis->rcItem, DT_CENTER | DT_SINGLELINE | DT_VCENTER ); +#endif SelectObject(lpdis->hDC, prevobj); SetBkMode(lpdis->hDC, prevbk); SetTextColor(lpdis->hDC, prevcolor); @@ -2080,9 +2084,14 @@ FrameWindow::CreateTrialBuy(HWND hwndtool) RECT rcmain; GetClientRect((HWND)GetHwnd(), &rcmain); wyUInt32 style = WS_CHILD | WS_VISIBLE | WS_CLIPSIBLINGS | BS_TEXT | BS_CENTER | BS_OWNERDRAW ; - + +#if IS_FROM_WINDOWS_STORE == 1 + VERIFY(hwndtrialbuy = CreateWindowEx(0, WC_BUTTON, TEXT("Visit Us"), style, rcmain.right-84, 2, 64, 26, + m_hwndsecondtool,(HMENU)IDC_TRIALBUY,(HINSTANCE)GetHinstance(), NULL)); +#else VERIFY(hwndtrialbuy = CreateWindowEx(0, WC_BUTTON, TEXT("BUY"), style, rcmain.right-84, 2, 64, 26, m_hwndsecondtool,(HMENU)IDC_TRIALBUY,(HINSTANCE)GetHinstance(), NULL)); +#endif return hwndtrialbuy; } @@ -3229,12 +3238,6 @@ pGlobals->m_pcmainwin->m_closealltrans = 1; case ACCEL_FLUSH: case ID_TOOLS_FLUSH: -#ifndef COMMUNITY - if(pcquerywnd->m_conninfo.m_isreadonly == wyTrue) - { - break; - } -#endif if(hwndactive) pcquerywnd->ShowFlushDlg(); break; @@ -9017,6 +9020,11 @@ FrameWindow::CreateConnDialog(wyBool readsession) GetSystemTime(&systime); currntday = upg.HandleSetDayFormat(systime.wDay, systime.wMonth, systime.wYear); currentdate.Sprintf("%lu", currntday); + +#if IS_FROM_WINDOWS_STORE == 1 + lastchkdday = 0; +#endif + if(currntday > lastchkdday && currntday - lastchkdday >= 1) //if(TRUE) { @@ -9428,6 +9436,9 @@ FrameWindow::OnCreateObjectWmHelp(HWND hwnd, wyChar *object) void FrameWindow::CheckForUpgrade(wyBool isexplict) { +#if IS_FROM_WINDOWS_STORE == 1 + return; +#endif UpgradeCheck *upgradeexplicit = NULL; if(isexplict == wyTrue) @@ -11482,7 +11493,13 @@ Htmlannouncementsproc(void *arg) productid.SetAs("Trial"); GetTimeDifference(&daysleft); #endif - + +// showing the announcements only if installation passed over 7 days +#if IS_FROM_WINDOWS_STORE == 1 + if(daysleft >= 7) + goto cleanup; +#endif + productid.EscapeURL(); //Major and minor version num appmajorversion.SetAs(MAJOR_VERSION); @@ -11512,6 +11529,11 @@ Htmlannouncementsproc(void *arg) if(daysleft > 0 && daysleft <= 7) url.AddSprintf("&trialends=1"); //no of days left + +#if IS_FROM_WINDOWS_STORE == 1 + url.AddSprintf("&FromWindowsStore=1"); +#endif + http.SetUrl(url.GetAsWideChar()); http.SetContentType(L"text/xml"); diff --git a/src/FrameWindowHelper.cpp b/src/FrameWindowHelper.cpp index 7e836f6..93692af 100644 --- a/src/FrameWindowHelper.cpp +++ b/src/FrameWindowHelper.cpp @@ -1739,6 +1739,24 @@ ReadOnlyQueryAllow(wyString *str) if(str->FindI("Transaction") == 6) ret = wyTrue; } + else if(str->FindI("Unlock") == 0) + { + str->SetAs(RemoveExtraSpaces(str->GetString())); + if(str->FindI("Tables") == 7) + ret = wyFalse; + else + ret=wyTrue; + + } + + else if(str->FindI("flush") == 0) + { + str->SetAs(RemoveExtraSpaces(str->GetString())); + if(str->FindI("tables with read lock")==6 || str->FindI("NO_WRITE_TO_BINLOG TABLES WITH READ LOCK") == 6) + ret=wyFalse; + else + ret = wyTrue; + } else if(str->FindI("commit") == 0) { ret = wyTrue; @@ -3668,12 +3686,14 @@ AddXMLToBuffer(wyString * buffer, const wyChar * text, wyBool crlf) break; default: - if(crlf == wyTrue && *text == '\r' && *(text+1)== '\n') + if(*text == '\r' && *(text+1)== '\n') { + if(crlf == wyTrue) buffer->Add("
"); - //fixed a bug, export as html was truncating data //text += 2; + else + buffer->Add(" "); text ++; } else diff --git a/src/GUIHelper.cpp b/src/GUIHelper.cpp index 975dbcb..1fafff9 100644 --- a/src/GUIHelper.cpp +++ b/src/GUIHelper.cpp @@ -1194,7 +1194,7 @@ EnableToolItems(HMENU hmenu) #ifndef COMMUNITY if(pcquerywnd->m_conninfo.m_isreadonly == wyTrue) { - EnableMenuItem(hmenu, ID_TOOLS_FLUSH, MF_GRAYED | MF_BYCOMMAND); + EnableMenuItem(hmenu, ID_TOOLS_FLUSH, MF_BYCOMMAND); EnableMenuItem(hmenu, ID_IMEX_TEXTFILE2, MF_GRAYED | MF_BYCOMMAND); } #endif @@ -1377,6 +1377,10 @@ EnableTableItems(HMENU hmenu) { EnableMenuItem(hmenu, ID_IMPORT_EXTERNAL_DATA, MF_GRAYED | MF_BYCOMMAND); } + else + { + EnableMenuItem(hmenu, ID_IMPORT_EXTERNAL_DATA, MF_BYCOMMAND); + } #endif /*Adding Table engines to Table menu. diff --git a/src/MDIWindow.cpp b/src/MDIWindow.cpp index e852710..687979a 100644 --- a/src/MDIWindow.cpp +++ b/src/MDIWindow.cpp @@ -3458,6 +3458,11 @@ MDIWindow::EnableDisableFlushOptions(HWND hwnd, wyInt32 state) EnableWindow(GetDlgItem(hwnd, IDOK), TRUE); else uncheckcount++; + if(GetActiveWin()->m_conninfo.m_isreadonly == wyTrue && id[counter] == IDC_FL_TABLESREAD) + { + EnableWindow(GetDlgItem(hwnd, id[counter]), wyFalse); + continue; + } EnableWindow(GetDlgItem(hwnd, id[counter]), state); } @@ -3537,6 +3542,15 @@ MDIWindow::AddFlushPersistence(HWND hwnd) m_p_flush->Add(hwnd, IDC_FLUSH_ALL, "FlushAll", "0", CHECKBOX); m_p_flush->Add(hwnd, IDC_FL_BINLOG, "FlushBinLog", "0", CHECKBOX); + + #ifndef COMMUNITY + if(GetActiveWin() && GetActiveWin()->m_conninfo.m_isreadonly == wyTrue) + { + EnableWindow(GetDlgItem(hwnd, IDC_FL_TABLESREAD), wyFalse); + } +#endif + + /* if all is selected then we need to disable everything */ ret = SendMessage(GetDlgItem(hwnd, IDC_FLUSH_ALL), BM_GETCHECK, 0, 0); diff --git a/src/OtherDialogs.cpp b/src/OtherDialogs.cpp index 89b717b..9f3944b 100644 --- a/src/OtherDialogs.cpp +++ b/src/OtherDialogs.cpp @@ -3289,9 +3289,10 @@ TableDiag::DiagAnalyze() itemcount = ListView_GetItemCount(m_hwndlisttables); /* whether to issue write to bin log option */ - binlog = SendMessage(GetDlgItem(m_hwnd, IDC_DIAG_OPTIMIZELOCAL), BM_GETCHECK, 0, 0); - - query.Sprintf("analyze %s table ", (BST_CHECKED==binlog)?("NO_WRITE_TO_BINLOG"):("")); + binlog = SendMessage(GetDlgItem(m_hwnd, IDC_DIAG_ANALYZELOCAL), BM_GETCHECK, 0, 0); + + query.Sprintf("analyze %s table ", (BST_CHECKED==binlog)?("LOCAL"):("NO_WRITE_TO_BINLOG")); + GetDBName(dbname); for(count = 0; count < itemcount; count++) diff --git a/src/UpgradeCheck.cpp b/src/UpgradeCheck.cpp index 00a4e52..c204ae8 100644 --- a/src/UpgradeCheck.cpp +++ b/src/UpgradeCheck.cpp @@ -94,6 +94,7 @@ UpgradeCheck::HandleUpgradeCheck(wyBool isexplict) m_ischecked = wyFalse; m_isupgradeexplicit = isexplict; + //For explicit check for upgrade if(isexplict == wyTrue) @@ -206,6 +207,9 @@ UpgradeCheck::HandleHttpRequest(LPVOID param) if(!upgrd) return 1; +#if IS_FROM_WINDOWS_STORE == 1 + return 1; +#endif //Gets the product id(Ent, Commmunity or Trial) #ifdef COMMUNITY upgrd->m_productid.SetAs("SQLyog Community");