Skip to content

Commit

Permalink
SQLyog 12.3.2
Browse files Browse the repository at this point in the history
  • Loading branch information
wyaadarsh committed Nov 16, 2016
1 parent 0a39ff0 commit 16126c5
Show file tree
Hide file tree
Showing 7 changed files with 75 additions and 7 deletions.
1 change: 1 addition & 0 deletions include/FrameWindowHelper.h
Original file line number Diff line number Diff line change
Expand Up @@ -758,6 +758,7 @@ const wyChar *LeftPadText(const wyChar *text);
wyBool ChangeContextDB(Tunnel * tunnel, PMYSQL mysql, const wyChar *query, wyBool changeincombo = wyTrue);
#ifndef COMMUNITY
wyBool ChangeTransactionState(MDIWindow *wnd, const wyChar *query);
wyBool CheckTransactionStart(MDIWindow *wnd, const wyChar *query);
#endif
/// Gets the database name from the query.
/**
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 12
#define MINOR_VERSION_INT 3
#define UPDATE_VERSION_INT 1
#define UPDATE_VERSION_INT 2
#define RELEASE_VERSION_INT 0
#define EXTRAINFO ""
2 changes: 1 addition & 1 deletion src/DataView.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -979,7 +979,7 @@ DataView::IsColumnVirtual(wyInt32 col)
//get the db and table name
if(GetDBName(db, col) == wyTrue && GetTableName(table, col) == wyTrue && GetColumnName(column, col) == wyTrue)
{
query.Sprintf("show full fields from `%s`.`%s` WHERE FIELD=\"%s\" AND (Extra LIKE \"%%VIRTUAL%%\" OR Extra LIKE \"%%STORED%%\" OR Extra LIKE \"%%PERSISTENT%%\")", db.GetString(), table.GetString(),column.GetString());
query.Sprintf("show full fields from `%s`.`%s` WHERE FIELD='%s' AND (Extra LIKE '%%VIRTUAL%%' OR Extra LIKE '%%STORED%%' OR Extra LIKE '%%PERSISTENT%%')", db.GetString(), table.GetString(),column.GetString());
fieldres = SjaExecuteAndGetResult(m_wnd->m_tunnel,&m_wnd->m_mysql,query);

if(fieldres)
Expand Down
6 changes: 3 additions & 3 deletions src/FrameWindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2665,8 +2665,10 @@ FrameWindow::OnWmCommand(WPARAM wParam)
case ID_WITHCONSISTENTSNAPSHOT_READWRITE:
case ID_STARTTRANSACTION_READONLY:
case ID_STARTTRANSACTION_READWRITE:
if(pcquerywnd->m_tunnel->IsTunnel() == false)
ptransaction->HandleStartTransaction(LOWORD(wParam), pcquerywnd->m_tunnel, &pcquerywnd->m_mysql);

else
ptransaction->OnTunnelMessage(GetActiveWindow());
break;

case ID_COMMIT_WITHNOMODIFIER:
Expand All @@ -2676,7 +2678,6 @@ FrameWindow::OnWmCommand(WPARAM wParam)
case ID_COMMIT_NORELEASE:
VERIFY(hmenu = GetMenu(m_hwndmain));
ptransaction->HandleCommit(LOWORD(wParam), hmenu, pcquerywnd->m_tunnel, &pcquerywnd->m_mysql);

break;

case ID_ROLLBACK_TRANSACTION:
Expand All @@ -2686,7 +2687,6 @@ FrameWindow::OnWmCommand(WPARAM wParam)
case ID_ROLLBACK_NORELEASE:
VERIFY(hmenu = GetMenu(m_hwndmain));
ptransaction->HandleRollback(LOWORD(wParam), hmenu, pcquerywnd->m_tunnel, &pcquerywnd->m_mysql);

break;

case ID_SAVEPOINT_CREATESAVEPOINT:
Expand Down
54 changes: 54 additions & 0 deletions src/FrameWindowHelper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1617,6 +1617,60 @@ ChangeTransactionState(MDIWindow *wnd, const wyChar *query)
}
return wyTrue;
}
wyBool
CheckTransactionStart(MDIWindow *wnd, const wyChar *query)
{
SQLFormatter formatter;
wyString queryStr, newquery;

queryStr.SetAs(query);
formatter.GetQueryWtOutComments(&queryStr, &newquery);
newquery.RTrim();
newquery.LTrim();

if(newquery.GetLength() != -1 && (newquery.FindI("START") == 0 || newquery.FindI("BEGIN") == 0 || newquery.FindI("COMMIT") == 0 || newquery.FindI("ROLLBACK") == 0))
{
newquery.SetAs(wnd->m_ptransaction->RemoveExtraSpaces(newquery.GetString()));

if(newquery.FindI("START") != -1 )
{
if(newquery.FindI("TRANSACTION") == 6)
{
wnd->m_ptransaction->OnTunnelMessage(wnd->m_hwnd);
return wyTrue;
}
}
else if(newquery.FindI("COMMIT") == 0 && newquery.GetLength() > 7)
{
wyString tempquery = newquery.Substr(7, newquery.GetLength() - 7);
newquery.SetAs(wnd->m_ptransaction->RemoveExtraSpaces(tempquery.GetString()));
if(newquery.FindI("AND CHAIN") == 0)
{
wnd->m_ptransaction->OnTunnelMessage(wnd->m_hwnd);
return wyTrue;
}
}
else if(newquery.FindI("ROLLBACK") == 0 && newquery.GetLength() > 9)
{
wyString tempquery = newquery.Substr(9, newquery.GetLength() - 9);
newquery.SetAs(wnd->m_ptransaction->RemoveExtraSpaces(tempquery.GetString()));
if(newquery.FindI("AND CHAIN") == 0)
{
wnd->m_ptransaction->OnTunnelMessage(wnd->m_hwnd);
return wyTrue;
}
}
else if(newquery.FindI("BEGIN") != -1)
{
if(wnd->m_ptransaction->HandleBegin(newquery.GetString()))
{
wnd->m_ptransaction->OnTunnelMessage(wnd->m_hwnd);
return wyTrue;
}
}
}
return wyFalse;
}
#endif
wyBool
ChangeContextDB(Tunnel * tunnel, PMYSQL mysql, const wyChar *query, wyBool changeincombo)
Expand Down
7 changes: 5 additions & 2 deletions src/MDIWindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -249,18 +249,20 @@ MDIWindow::Create(wyBool iscon_res, ConnectionInfo* conninfo)
m_keepaliveinterval = 0;
}
#ifndef COMMUNITY
if(pGlobals->m_entlicense.CompareI("Professional") != 0)
if(pGlobals->m_entlicense.CompareI("Professional") != 0 && m_tunnel->IsTunnel() == false)
{
wyString query, resstr;
MYSQL_RES* myres;
MYSQL_ROW row;
MDIWindow* wnd;
wnd = GetActiveWin();

query.Sprintf("SHOW GLOBAL VARIABLES WHERE variable_name = \"AUTOCOMMIT\"");
query.Sprintf("SHOW VARIABLES like 'AUTOCOMMIT'");
myres = ExecuteAndGetResult(wnd, m_tunnel, &m_mysql, query);
if(!myres && m_tunnel->mysql_affected_rows(m_mysql) == -1)
{
wnd->m_ptransaction->m_autocommit = wyTrue;
return wyTrue;
}
row = m_tunnel->mysql_fetch_row(myres);
if(!row)
Expand All @@ -280,6 +282,7 @@ MDIWindow::Create(wyBool iscon_res, ConnectionInfo* conninfo)
}
else if(resstr.CompareI("OFF") == 0)
{
wnd->m_ptransaction->CallOnStart();
wnd->m_ptransaction->m_autocommit = wyFalse;
}
}
Expand Down
10 changes: 10 additions & 0 deletions src/QueryThread.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -198,6 +198,15 @@ HelperExecuteQuery(QUERYTHREADPARAMS * param, const wyChar* query,wyBool ismulti

querytemp.SetAs(query);

#ifndef COMMUNITY
if(pGlobals->m_entlicense.CompareI("Professional") != 0 && param->tunnel->IsTunnel() == wyTrue)
{
wyBool start_t = CheckTransactionStart(param->wnd, query);
if(start_t == wyTrue)
return IN_TRANSACTION;
}
#endif

//if(param->m_highlimitvalue != -1 && param->m_lowlimitvalue != -1)
if(param->m_islimitpresent == wyFalse)
isselectrange = wyTrue;
Expand Down Expand Up @@ -327,6 +336,7 @@ HelperExecuteQuery(QUERYTHREADPARAMS * param, const wyChar* query,wyBool ismulti
#ifndef COMMUNITY
if(pGlobals->m_entlicense.CompareI("Professional") != 0)
{
if(param->tunnel->IsTunnel() == false)
ChangeTransactionState(param->wnd, query);
}
#endif
Expand Down

0 comments on commit 16126c5

Please sign in to comment.