Skip to content

Commit

Permalink
SQLyog 13.2.1 GA
Browse files Browse the repository at this point in the history
  • Loading branch information
sandhyawy committed Nov 3, 2023
1 parent c3dd825 commit 756d02b
Show file tree
Hide file tree
Showing 15 changed files with 133 additions and 71 deletions.
2 changes: 1 addition & 1 deletion include/AppInfo.h
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@

#define SQLITE_APPVERSION_MAJOR "10"
#define SQLITE_APPVERSION_MINOR "5"
#define COMPANY_COPYRIGHT "(c) 2001-2022 Webyog Inc."
#define COMPANY_COPYRIGHT "(c) 2001-2023 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)
Expand Down
6 changes: 6 additions & 0 deletions include/ExportAsSQL.h
Original file line number Diff line number Diff line change
Expand Up @@ -269,6 +269,12 @@ class MySQLDump
*/
wyBool DumpDatabaseOnUtf8();

/// Dumps database with setting the utf8mb4 option
/**
@returns wyTrue
*/
wyBool DumpDatabaseOnUtf8mb4();

/// Changes the current database
/**
@param db : IN Database name to change to
Expand Down
2 changes: 1 addition & 1 deletion include/Version.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#define MAJOR_VERSION_INT 13
#define MINOR_VERSION_INT 2
#define UPDATE_VERSION_INT 0
#define UPDATE_VERSION_INT 1
#define RELEASE_VERSION_INT 0
#define EXTRAINFO ""
Binary file modified lib/Keywords.db
Binary file not shown.
47 changes: 14 additions & 33 deletions src/CommonHelper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ extern FILE *logfilehandle;
static wyChar table64[]=
"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";

static CryptoPP::byte AESKey[16] = { };//provide any Key
static CryptoPP::byte AESKey[16] = {}; //Provide any Key
static CryptoPP::byte AESiv[16] = {}; //Provide any IV

Tunnel *
Expand Down Expand Up @@ -1149,42 +1149,22 @@ wyBool GetCheckConstraintValue(wyChar * currentrow, wyString * expression)
{
return wyFalse;
}
wyChar * find = "CHECK", *findcomment = "COMMENT";
wyChar * find = "CHECK ";
wyBool found = wyFalse;
wyChar *ptr = strstr(currentrow, find);
wyChar *ptrc = strstr(currentrow, findcomment);
wyString s1, s2,s3;
s1.SetAs(currentrow);
s2.SetAs("");
s3.SetAs("COMMENT");
wyInt32 index=0;
if (ptr) {
if (ptrc) {
index = ptr - currentrow + 5;
s2.SetAs(s1.Substr(index, 7));
while (s2.CompareI(s3)!=0)//(currentrow[index + 2] != 'C' && currentrow[index + 3] != 'O' && currentrow[index + 4] != 'M')
{
expression->AddSprintf("%c", currentrow[index]);
index++;
s2.SetAs(s1.Substr(index, 7));
}
found = wyTrue;
}
else
{
index = ptr - currentrow + 5;
index = ptr - currentrow + 6; //length of "CHECK "

while (wyTrue)
{
if ((currentrow[index] == ',' && currentrow[index + 2] == ' ')|| (currentrow[index] == '\0' ))
break;
while (wyTrue)
{
if ((currentrow[index] == ',' && currentrow[index + 2] == ' ')|| (currentrow[index] == '\0' ))
break;

expression->AddSprintf("%c", currentrow[index]);
index++;
}
found = wyTrue;
expression->AddSprintf("%c", currentrow[index]);
index++;
}

found = wyTrue;
}

return found;
Expand All @@ -1193,13 +1173,13 @@ wyBool GetCheckConstraintValue(wyChar * currentrow, wyString * expression)

wyBool GettablelevelCheckConstraintValue(wyChar * currentrow, wyString * expression)
{
wyChar * find = "CHECK";
wyChar * find = "CHECK ";
wyBool found = wyFalse;/*, withcomment = wyFalse, withoutcomment = wyFalse;*/
wyChar *ptr = strstr(currentrow, find);
wyInt32 index=0;
if (ptr) {
found = wyTrue;
index =( ptr - currentrow) + 5;
index =( ptr - currentrow) + 6; //length of "CHECK "
while (currentrow[index] != '\0')
{
/*if (currentrow[index] == '\0' && currentrow[index + 2] == ' ')
Expand Down Expand Up @@ -4264,8 +4244,8 @@ InitConnectionDetails(ConnectionInfo *conn)
conn->m_rgbconn = RGB(255, 255, 255);
conn->m_rgbfgconn = RGB(0, 0, 0);
#endif

conn->m_no_ca = wyFalse;

return;
}

Expand Down Expand Up @@ -4810,4 +4790,5 @@ GetConnectionId(Tunnel *tunnel, MYSQL *mysql)
sja_mysql_free_result(tunnel, myres);

return idstr.GetAsInt32();

}
15 changes: 15 additions & 0 deletions src/ConnectionBase.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -908,6 +908,11 @@ ConnectionBase::ChangeConnName(HWND hdlg)
hwndc = (HWND)SendMessage(hwndcombo, CCBM_GETCOMBOHWND, NULL, NULL);

VERIFY ((cursel = SendMessage(hwndcombo, CB_GETCURSEL, 0, 0))!= CB_ERR);

if (cursel == -1) {
cursel = SendMessage(hwndcombo, CB_GETCOUNT, cursel, 0) - 1;
}

VERIFY ((SendMessage(hwndc, CB_GETLBTEXT, cursel,(LPARAM)pconn.m_connname)));
VERIFY((count = SendMessage(hwndcombo, CB_GETITEMDATA, cursel, 0)));

Expand Down Expand Up @@ -1583,6 +1588,9 @@ ConnectionBase::GetInitialDetails(HWND hdlg)
dirstr.SetAs(directory);

count = SendMessage(hwndcombo, CB_GETCURSEL, 0, 0);
if (count == -1) {
count = SendMessage(hwndcombo, CB_GETCOUNT, count, 0) - 1;
}
VERIFY(count != CB_ERR);
count = SendMessage(hwndcombo, CB_GETITEMDATA, count, 0);
conn.Sprintf("Connection %u", count);
Expand Down Expand Up @@ -1799,6 +1807,9 @@ ConnectionBase::GetOtherValues(HWND hdlg, ConnectionInfo *coninfo)

// now get the title.
index = SendMessage(hcb,CB_GETCURSEL,0,0);
if (index == -1) {
index = SendMessage(hcb, CB_GETCOUNT, index, 0) - 1;
}

SendMessage(hwndCombo,CB_GETLBTEXT, index, (LPARAM)title);
SendMessage(GetDlgItem(hdlg, IDC_DLGCONNECT_DATABASE), WM_GETTEXT,(WPARAM)SIZE_512 - 1,(LPARAM)db);
Expand Down Expand Up @@ -2908,6 +2919,10 @@ ConnectionBase::GetConnectionName(HWND hdlg, wyString *connnamestr, const wyChar

VERIFY((index = SendMessage(hcb, CB_GETCURSEL, 0, 0))!= CB_ERR);

if (index == -1) {
index = SendMessage(hcb, CB_GETCOUNT, index, 0) - 1;
}

txtlen = (SendMessage(hcb, CB_GETLBTEXTLEN, index, 0));

conname = AllocateBuffWChar(txtlen + 1);
Expand Down
8 changes: 7 additions & 1 deletion src/ConnectionCommunity.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1231,6 +1231,9 @@ ConnectionCommunity::CreateSourceInstance(CopyDatabase *copydb)

VERIFY(!(copydb->m_newsrctunnel->mysql_options(tempmysql, MYSQL_INIT_COMMAND, "/*40030 SET net_write_timeout=3600 */")));

if(copydb->m_srcinfo->m_initcommand.FindI("utf8mb4") >=0)
VERIFY(!(copydb->m_newsrctunnel->mysql_options(tempmysql, MYSQL_INIT_COMMAND, copydb->m_srcinfo->m_initcommand.GetString())));

SetMySQLOptions(copydb->m_srcinfo, copydb->m_newsrctunnel, &tempmysql, wyTrue);

newsrcmysql = copydb->m_newsrctunnel->mysql_real_connect(tempmysql,
Expand Down Expand Up @@ -1269,7 +1272,10 @@ ConnectionCommunity::CreateTargetInstance(CopyDatabase *copydb)
copydb->m_newtargettunnel = CreateTunnel((wyBool)copydb->m_targettunnel->IsTunnel());

VERIFY(tempmysql = copydb->m_newtargettunnel->mysql_init((MYSQL*)0));


if (copydb->m_tgtinfo->m_initcommand.FindI("utf8mb4") >= 0)
VERIFY(!(copydb->m_newtargettunnel->mysql_options(tempmysql, MYSQL_INIT_COMMAND, copydb->m_tgtinfo->m_initcommand.GetString())));

SetMySQLOptions(copydb->m_tgtinfo, copydb->m_newtargettunnel, &tempmysql);

newtargetmysql = copydb->m_newtargettunnel->mysql_real_connect(tempmysql,
Expand Down
59 changes: 36 additions & 23 deletions src/CopyDatabase.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1582,7 +1582,8 @@ CopyDatabase::InitExportData(HWND hwndtree)
else
m_isremdefiner = wyFalse;
InitTargetServer();
SetNamesToUTF8();

SetNamesToUTF8();

return wyTrue;
}
Expand Down Expand Up @@ -2612,54 +2613,66 @@ CopyDatabase::RevertTargetServer()
void
CopyDatabase::SetNamesToUTF8()
{
wyString query;
MYSQL_RES *res;
wyString query;
MYSQL_RES *res;

if(IsMySQL41(m_newsrctunnel, &m_newsrcmysql)&& IsMySQL41(m_newtargettunnel, &m_newtargetmysql))
wyString srcUtf8CharType = "utf8";
wyString trgtUtf8CharType = "utf8";

if (m_tgtinfo->m_initcommand.FindI("utf8mb4") >= 0)
{
trgtUtf8CharType = "utf8mb4";
}

if(m_srcinfo->m_initcommand.FindI("utf8mb4") >= 0)
{
if(m_newsrctunnel->IsTunnel())
m_newsrctunnel->SetCharset("utf8");
srcUtf8CharType = "utf8mb4";
}

if (IsMySQL41(m_newsrctunnel, &m_newsrcmysql) && IsMySQL41(m_newtargettunnel, &m_newtargetmysql))
{
if (m_newsrctunnel->IsTunnel())
m_newsrctunnel->SetCharset(srcUtf8CharType.GetString());
else
{
query.Sprintf("SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT");
query.Sprintf("SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT");
res = SjaExecuteAndGetResult(m_newsrctunnel, &m_newsrcmysql, query);
if(res)
if (res)
m_newsrctunnel->mysql_free_result(res);

query.Sprintf("SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS");
query.Sprintf("SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS");
res = SjaExecuteAndGetResult(m_newsrctunnel, &m_newsrcmysql, query);
if(res)
if (res)
m_newsrctunnel->mysql_free_result(res);

query.Sprintf("SET NAMES utf8");
query.Sprintf("SET NAMES %s", srcUtf8CharType.GetString());
res = SjaExecuteAndGetResult(m_newsrctunnel, &m_newsrcmysql, query);
if(res)
if (res)
m_newsrctunnel->mysql_free_result(res);
}

if(m_newtargettunnel->IsTunnel())
m_newtargettunnel->SetCharset("utf8");
if (m_newtargettunnel->IsTunnel())
m_newtargettunnel->SetCharset(trgtUtf8CharType.GetString());
else
{

query.Sprintf("SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT");
query.Sprintf("SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT");
res = SjaExecuteAndGetResult(m_newtargettunnel, &m_newtargetmysql, query);
if(res)
if (res)
m_newtargettunnel->mysql_free_result(res);

query.Sprintf("SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS");
query.Sprintf("SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS");
res = SjaExecuteAndGetResult(m_newtargettunnel, &m_newtargetmysql, query);
if(res)
if (res)
m_newtargettunnel->mysql_free_result(res);

query.Sprintf("SET NAMES utf8");
query.Sprintf("SET NAMES %s", trgtUtf8CharType.GetString());
res = SjaExecuteAndGetResult(m_newtargettunnel, &m_newtargetmysql, query);
if(res)
if (res)
m_newtargettunnel->mysql_free_result(res);
}
}
}

return;
return;
}

void
Expand Down
26 changes: 26 additions & 0 deletions src/ExportAsSQL.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2497,6 +2497,10 @@ MySQLDump::DumpDatabase(wyString * buffer, const wyChar *db, wyInt32 *fileerr)
if(DumpDatabaseOnUtf8() == wyFalse)
return wyFalse;

if (m_charset.CompareI("utf8mb4") == 0)
if (DumpDatabaseOnUtf8mb4() == wyFalse)
return wyFalse;

if(m_singletransaction == wyTrue)
OnSingleTransaction();

Expand Down Expand Up @@ -2581,6 +2585,28 @@ MySQLDump::DumpDatabaseOnUtf8()
return wyTrue;
}

wyBool
MySQLDump::DumpDatabaseOnUtf8mb4()
{
MYSQL_RES *res;
wyString query;

query.SetAs("SET NAMES UTF8MB4");

res = SjaExecuteAndGetResult(m_tunnel, &m_mysql, query);

#ifdef _WIN32

m_tunnel->SetCharset("utf8mb4");

#endif

if (res)
sja_mysql_free_result(m_tunnel, res);

return wyTrue;
}

wyBool
MySQLDump::ChangeContextDatabase(const wyChar *db)
{
Expand Down
12 changes: 9 additions & 3 deletions src/ExportBatch.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1490,6 +1490,7 @@ ExportBatch::SetOtherValues(MySQLDump *dump)
wyString filename;
wyString charset, query;
wyBool ischunkinsert,isprifixtimestamp=wyFalse;
MDIWindow *wnd = GetActiveWin();

dump->SetDatabase(m_db.GetString());
dump->SetAllTables(m_alltables);
Expand All @@ -1516,9 +1517,14 @@ ExportBatch::SetOtherValues(MySQLDump *dump)
dump->SetChunkLimit(chunklimit);
}
}

if(IsMySQL41(m_tunnel, m_mysql))
dump->SetCharSet("utf8");

if (wnd->m_conninfo.m_initcommand.FindI("utf8mb4") >= 0)
dump->SetCharSet("utf8mb4");
else if(IsMySQL41(m_tunnel, m_mysql))
{
dump->SetCharSet("utf8");
}

else
{
if(GetServerDefaultCharset(m_tunnel, *m_mysql, charset, query) == wyFalse)
Expand Down
6 changes: 5 additions & 1 deletion src/ExportImportConnectionDetails.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1369,7 +1369,11 @@ wyBool ExportImportConnection::LoadDataToLV(HWND hwnd)

cono=atoi(tempconsecname+10);
if(connnamestr.Compare("") == 0)
return wyFalse;
{
++i;
tempconsecname = strtok(NULL, seps);
continue;
}
AddRowsToListViewControl(m_hwndLV, cono, connnamestr.GetAsWideChar(), connhostnamestr.GetAsWideChar(), connusernamestr.GetAsWideChar(), connportstr.GetAsWideChar(),isSSH, isSSL, isHTTP);
++i;
tempconsecname = strtok(NULL, seps);
Expand Down
4 changes: 4 additions & 0 deletions src/GUIHelper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1859,6 +1859,10 @@ WriteConnDetails(HWND hdlg)

VERIFY((index = SendMessage(hcb, CB_GETCURSEL, 0, 0))!= CB_ERR);

if (index == -1) {
index = SendMessage(hcb, CB_GETCOUNT, index, 0) - 1;
}

txtlen = (SendMessage(hcb, CB_GETLBTEXTLEN, index, 0));

conname = AllocateBuffWChar(txtlen + 1);
Expand Down
6 changes: 3 additions & 3 deletions src/MySQLVersionHelper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -517,10 +517,10 @@ void GetVersionInfoforAutoComplete(MYSQL *mysql, wyString &VersionS)
char *dbString = mysql_get_server_info(mysql);
if(strstr(dbString, "MariaDB")) ///if its mariadb,check if the version is above 10.2
{
if(me >= 100200)
if(me >= 100200 && me < 100300)
me = 50713;///if mariadb version is > 10.2 it supports JSON, hence include functions till mysql version 5.7.13
else
me = 50066;///if mariadb version is < 10.2, include functions only for previous versons of mysql.
else if(me < 100200)
me = 50300;///if mariadb version is < 10.2, include functions only for previous versons of mysql.
}

VersionS.Sprintf("%ld", me);
Expand Down
3 changes: 3 additions & 0 deletions src/TabFields.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1989,6 +1989,9 @@ TabFields::GetDefaultValue(wyString& query, FieldStructWrapper* cwrapobj)
{
query.Add("'' ");
}
else if (datatype.Compare("varchar") == 0 && ((defval.FindI("UUID()") != -1) || (defval.FindI("SYS_GUID()") != -1))) {
query.AddSprintf("%s ", defval.GetString());
}
else
{
if(defval.GetCharAt(0) == '`' && defval.GetCharAt(defval.GetLength() - 1) == '`'
Expand Down
Loading

0 comments on commit 756d02b

Please sign in to comment.